Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

Commit

Permalink
Added auto suggest and multi line input to text entry
Browse files Browse the repository at this point in the history
Fixes #76
  • Loading branch information
inghamn committed Oct 9, 2014
1 parent 95194b4 commit 3c58bd0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
3 changes: 1 addition & 2 deletions open311-android/res/layout/attribute_entry_string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
android:id="@+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textCapSentences">
android:ems="10">
<requestFocus />
</EditText>
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,23 @@ private View loadAttributeEntryView() {
LayoutInflater inflater = getLayoutInflater();

if (mDatatype.equals(Open311.STRING) || mDatatype.equals(Open311.NUMBER) || mDatatype.equals(Open311.TEXT)) {
View v = inflater.inflate(R.layout.attribute_entry_string, null);
EditText input = (EditText) v.findViewById(R.id.input);
EditText input = (EditText) inflater.inflate(R.layout.attribute_entry_string, null);

if (mDatatype.equals(Open311.NUMBER)) {
input.setInputType(InputType.TYPE_CLASS_NUMBER);
}
if (mDatatype.equals(Open311.TEXT)) {
input.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
input.setInputType(
InputType.TYPE_CLASS_TEXT
|InputType.TYPE_TEXT_FLAG_MULTI_LINE
|InputType.TYPE_TEXT_FLAG_AUTO_CORRECT
|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES
|InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE
);
input.setMaxLines(6);
input.setHorizontallyScrolling(false);
}
return v;
return input;
}
else if (mDatatype.equals(Open311.SINGLEVALUELIST) || mDatatype.equals(Open311.MULTIVALUELIST)) {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,35 @@ protected void onCreate(Bundle savedInstanceState) {
mInput.setText(i.getStringExtra(VALUE));

if (mKey.equals(Open311.DESCRIPTION)) {
mInput.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
mInput.setInputType(
InputType.TYPE_CLASS_TEXT
|InputType.TYPE_TEXT_FLAG_MULTI_LINE
|InputType.TYPE_TEXT_FLAG_AUTO_CORRECT
|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES
|InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE
);
mInput.setMaxLines(6);
mInput.setHorizontallyScrolling(false);
}
if (mKey.equals(Open311.FIRST_NAME) || mKey.equals(Open311.LAST_NAME)) {
mInput.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
else if (mKey.equals(Open311.FIRST_NAME) || mKey.equals(Open311.LAST_NAME)) {
mInput.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
}
if (mKey.equals(Open311.EMAIL)) {
mInput.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
else if (mKey.equals(Open311.EMAIL)) {
mInput.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
}
if (mKey.equals(Open311.PHONE)) {
else if (mKey.equals(Open311.PHONE)) {
mInput.setInputType(InputType.TYPE_CLASS_PHONE);

}
else {
mInput.setInputType(
InputType.TYPE_CLASS_TEXT
|InputType.TYPE_TEXT_FLAG_MULTI_LINE
|InputType.TYPE_TEXT_FLAG_AUTO_CORRECT
|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES
|InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE
);
mInput.setMaxLines(6);
mInput.setHorizontallyScrolling(false);
}

mLayout.addView(mInput);
Expand Down

0 comments on commit 3c58bd0

Please sign in to comment.