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

Commit 9fb57751 authored by Walter Jang's avatar Walter Jang Committed by Android Git Automerger
Browse files

am 9fd44162: am 09e790ac: Merge "Only use one hint color on contact editors" into mnc-dev

* commit '9fd44162':
  Only use one hint color on contact editors
parents 3412e978 9fd44162
Loading
Loading
Loading
Loading
+0 −47
Original line number Diff line number Diff line
@@ -269,10 +269,6 @@ public class ContactEditorFragment extends ContactEditorBaseFragment implements
                        if (activity.isFinishing()) {
                            return;
                        }
                        if (request == EditorListener.EDITOR_FOCUS_CHANGED) {
                            adjustNameFieldsHintDarkness(rawContactEditor);
                            return;
                        }
                        if (!isEditingUserProfile()) {
                            if (request == EditorListener.FIELD_CHANGED) {
                                if (!nameValuesDelta.isSuperPrimary()) {
@@ -294,23 +290,6 @@ public class ContactEditorFragment extends ContactEditorBaseFragment implements
                    public void onDeleteRequested(Editor removedEditor) {
                    }
                };
                final EditorListener otherNamesListener = new EditorListener() {

                    @Override
                    public void onRequest(int request) {
                        // Make sure the activity is running
                        if (activity.isFinishing()) {
                            return;
                        }
                        if (request == EditorListener.EDITOR_FOCUS_CHANGED) {
                            adjustNameFieldsHintDarkness(rawContactEditor);
                        }
                    }

                    @Override
                    public void onDeleteRequested(Editor removedEditor) {
                    }
                };

                final StructuredNameEditorView nameEditor = rawContactEditor.getNameEditor();
                if (mRequestFocus) {
@@ -322,22 +301,13 @@ public class ContactEditorFragment extends ContactEditorBaseFragment implements
                    nameEditor.setDisplayName(mDefaultDisplayName);
                }

                final TextFieldsEditorView phoneticNameEditor =
                        rawContactEditor.getPhoneticNameEditor();
                phoneticNameEditor.setEditorListener(otherNamesListener);
                rawContactEditor.setAutoAddToDefaultGroup(mAutoAddToDefaultGroup);

                final TextFieldsEditorView nickNameEditor =
                        rawContactEditor.getNickNameEditor();
                nickNameEditor.setEditorListener(otherNamesListener);

                if (isAggregationSuggestionRawContactId(rawContactId)) {
                    acquireAggregationSuggestions(activity,
                            rawContactEditor.getNameEditor().getRawContactId(),
                            rawContactEditor.getNameEditor().getValues());
                }

                adjustNameFieldsHintDarkness(rawContactEditor);
            }
        }

@@ -426,23 +396,6 @@ public class ContactEditorFragment extends ContactEditorBaseFragment implements
        return null;
    }

    /**
     * Adjust how dark the hint text should be on all the names' text fields.
     *
     * @param rawContactEditor editor to update
     */
    private void adjustNameFieldsHintDarkness(RawContactEditorView rawContactEditor) {
        // Check whether fields contain focus by calling findFocus() instead of hasFocus().
        // The hasFocus() value is not necessarily up to date.
        final boolean nameFieldsAreNotFocused
                = rawContactEditor.getNameEditor().findFocus() == null
                && rawContactEditor.getPhoneticNameEditor().findFocus() == null
                && rawContactEditor.getNickNameEditor().findFocus() == null;
        rawContactEditor.getNameEditor().setHintColorDark(!nameFieldsAreNotFocused);
        rawContactEditor.getPhoneticNameEditor().setHintColorDark(!nameFieldsAreNotFocused);
        rawContactEditor.getNickNameEditor().setHintColorDark(!nameFieldsAreNotFocused);
    }

    /**
     * Update the values in {@link #mExpandedEditors}.
     */
+0 −4
Original line number Diff line number Diff line
@@ -577,14 +577,12 @@ public abstract class LabeledEditorView extends LinearLayout implements Editor,
        private boolean mHasCustomSelection;
        private int mTextColorHintUnfocused;
        private int mTextColorDark;
        private int mTextColorSecondary;

        public EditTypeAdapter(Context context) {
            super(context, 0);
            mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            mTextColorHintUnfocused = context.getResources().getColor(
                    R.color.editor_disabled_text_color);
            mTextColorSecondary = context.getResources().getColor(R.color.secondary_text_color);
            mTextColorDark = context.getResources().getColor(R.color.primary_text_color);


@@ -617,8 +615,6 @@ public abstract class LabeledEditorView extends LinearLayout implements Editor,
            // color.
            if (!LabeledEditorView.this.isEmpty()) {
                view.setTextColor(mTextColorDark);
            } else if (LabeledEditorView.this.hasFocus()) {
                view.setTextColor(mTextColorSecondary);
            } else {
                view.setTextColor(mTextColorHintUnfocused);
            }
+3 −22
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ public class TextFieldsEditorView extends LabeledEditorView {
    private boolean mHasShortAndLongForms;
    private int mMinFieldHeight;
    private int mPreviousViewHeight;
    private int mHintTextColor;
    private int mHintTextColorUnfocused;

    public TextFieldsEditorView(Context context) {
@@ -85,7 +84,6 @@ public class TextFieldsEditorView extends LabeledEditorView {
        mMinFieldHeight = getContext().getResources().getDimensionPixelSize(
                R.dimen.editor_min_line_item_height);
        mFields = (ViewGroup) findViewById(R.id.editors);
        mHintTextColor = getResources().getColor(R.color.secondary_text_color);
        mHintTextColorUnfocused = getResources().getColor(R.color.editor_disabled_text_color);
        mExpansionView = (ImageView) findViewById(R.id.expansion_view);
        mExpansionViewContainer = findViewById(R.id.expansion_view_container);
@@ -151,13 +149,12 @@ public class TextFieldsEditorView extends LabeledEditorView {
    private OnFocusChangeListener mTextFocusChangeListener = new OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            // Check whether this field contains focus by calling findFocus() instead of
            // hasFocus(). The hasFocus() value is not necessarily up to date.
            final boolean foundFocus = TextFieldsEditorView.this.findFocus() != null;
            setHintColorDark(foundFocus);
            if (getEditorListener() != null) {
                getEditorListener().onRequest(EditorListener.EDITOR_FOCUS_CHANGED);
            }
            // Check whether this field contains focus by calling findFocus() instead of
            // hasFocus(). The hasFocus() value is not necessarily up to date.
            final boolean foundFocus = TextFieldsEditorView.this.findFocus() != null;
            if (foundFocus && !isTypeVisible()) {
                // We just got focus and the types are not visible
                showType();
@@ -170,22 +167,6 @@ public class TextFieldsEditorView extends LabeledEditorView {
        }
    };

    /**
     * Set the hint color. If {@param isHintDark} is TRUE, then the hint color is set to a
     * a darker color.
     */
    public void setHintColorDark(boolean isHintDark) {
        if (mFieldEditTexts != null) {
            for (EditText text : mFieldEditTexts) {
                if (isHintDark) {
                    text.setHintTextColor(mHintTextColor);
                } else {
                    text.setHintTextColor(mHintTextColorUnfocused);
                }
            }
        }
    }

    /**
     * Creates or removes the type/label button. Doesn't do anything if already correctly configured
     */