Loading res/layout/group_name_edit_dialog.xml +1 −1 Original line number Diff line number Diff line Loading @@ -33,5 +33,5 @@ android:hint="@string/group_name_dialog_hint" android:inputType="textCapWords|textNoSuggestions" android:singleLine="true" android:maxLength="40"/> android:maxLength="@integer/group_name_max_length"/> </LinearLayout> No newline at end of file res/values/integers.xml +4 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,10 @@ <!-- Number of lines the QuickContact title can have --> <integer name="quickcontact_title_lines">1</integer> <!-- Max suggestions limit showing in quick contact suggestion card [CHAR LIMIT=30]--> <!-- Max suggestions limit showing in quick contact suggestion card --> <integer name="quickcontact_suggestions_limit">10</integer> <!-- The maximum allowed group name length --> <integer name="group_name_max_length">40</integer> </resources> src/com/android/contacts/group/GroupNameEditDialogFragment.java +5 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,11 @@ public final class GroupNameEditDialogFragment extends DialogFragment { mGroupNameEditText = (EditText) alertDialog.findViewById(android.R.id.text1); if (!TextUtils.isEmpty(mGroupName)) { mGroupNameEditText.setText(mGroupName); mGroupNameEditText.setSelection(mGroupName.length()); // Guard against already created group names that are longer than the max final int maxLength = getResources().getInteger( R.integer.group_name_max_length); mGroupNameEditText.setSelection( mGroupName.length() > maxLength ? maxLength : mGroupName.length()); } final Button createButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); Loading src/com/android/contacts/interactions/GroupNameDialogFragment.java +3 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnShowListener; import android.os.Bundle; import android.text.Editable; import android.text.InputFilter; import android.text.TextUtils; import android.text.TextWatcher; import android.view.LayoutInflater; Loading @@ -46,6 +47,8 @@ public abstract class GroupNameDialogFragment extends DialogFragment { final LayoutInflater layoutInflater = LayoutInflater.from(builder.getContext()); final View view = layoutInflater.inflate(R.layout.group_name_dialog, null); final EditText editText = (EditText) view.findViewById(R.id.group_label); final int maxLength = getResources().getInteger(R.integer.group_name_max_length); editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(maxLength) }); initializeGroupLabelEditText(editText); builder.setTitle(getTitleResourceId()); Loading Loading
res/layout/group_name_edit_dialog.xml +1 −1 Original line number Diff line number Diff line Loading @@ -33,5 +33,5 @@ android:hint="@string/group_name_dialog_hint" android:inputType="textCapWords|textNoSuggestions" android:singleLine="true" android:maxLength="40"/> android:maxLength="@integer/group_name_max_length"/> </LinearLayout> No newline at end of file
res/values/integers.xml +4 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,10 @@ <!-- Number of lines the QuickContact title can have --> <integer name="quickcontact_title_lines">1</integer> <!-- Max suggestions limit showing in quick contact suggestion card [CHAR LIMIT=30]--> <!-- Max suggestions limit showing in quick contact suggestion card --> <integer name="quickcontact_suggestions_limit">10</integer> <!-- The maximum allowed group name length --> <integer name="group_name_max_length">40</integer> </resources>
src/com/android/contacts/group/GroupNameEditDialogFragment.java +5 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,11 @@ public final class GroupNameEditDialogFragment extends DialogFragment { mGroupNameEditText = (EditText) alertDialog.findViewById(android.R.id.text1); if (!TextUtils.isEmpty(mGroupName)) { mGroupNameEditText.setText(mGroupName); mGroupNameEditText.setSelection(mGroupName.length()); // Guard against already created group names that are longer than the max final int maxLength = getResources().getInteger( R.integer.group_name_max_length); mGroupNameEditText.setSelection( mGroupName.length() > maxLength ? maxLength : mGroupName.length()); } final Button createButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); Loading
src/com/android/contacts/interactions/GroupNameDialogFragment.java +3 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnShowListener; import android.os.Bundle; import android.text.Editable; import android.text.InputFilter; import android.text.TextUtils; import android.text.TextWatcher; import android.view.LayoutInflater; Loading @@ -46,6 +47,8 @@ public abstract class GroupNameDialogFragment extends DialogFragment { final LayoutInflater layoutInflater = LayoutInflater.from(builder.getContext()); final View view = layoutInflater.inflate(R.layout.group_name_dialog, null); final EditText editText = (EditText) view.findViewById(R.id.group_label); final int maxLength = getResources().getInteger(R.integer.group_name_max_length); editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(maxLength) }); initializeGroupLabelEditText(editText); builder.setTitle(getTitleResourceId()); Loading