Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5af2a2e9 authored by Walter Jang's avatar Walter Jang Committed by Android (Google) Code Review
Browse files

Merge "Constrain group names to 40 chars on the editor"

parents 756d36f7 f1bb74d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+4 −1
Original line number Diff line number Diff line
@@ -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>
+5 −1
Original line number Diff line number Diff line
@@ -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);
+3 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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());