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

Commit d690dff2 authored by Brian Attwell's avatar Brian Attwell
Browse files

Change text colors to reflect their state

The editor's text color suffered from two conflicting
problems
1) It didn't all pass GAR
2) The difference between hint text and regular text
 is too subtle to differentiate at a glance

Changes
1) Once a LabeledEditorView is non-empty, the text color of
 the spinner should no longer be the hint text color
2) Once an editor field is focused, all fields in the same
 EditKindSection get a slightly darker color. Since the various
 name editors, don't actually belong to a EditKindSection
 extra work needed to be done for them.
3) Drop down lists use non hint colors

Read only editor continues to use the darker hint color.
There is no need to strongly distinquish hint colors from
non hint colors in the read only editor.

Bug: 18004959
Change-Id: Ia6b16ab882b2fcb9113c2ac880e741f62115a1f9
parent 75f2c438
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2014 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<com.android.contacts.editor.TextFieldsEditorView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="@dimen/editor_min_line_item_height"
    android:layout_marginStart="@dimen/editor_kind_icon_total_width"
    android:layout_marginEnd="@dimen/editor_delete_button_width">

    <!-- This isn't used in the nickname field. It is only included so that
        TextFieldsEditorView's base classes don't need extra null checks. -->
    <include
        android:id="@+id/spinner"
        layout="@layout/edit_spinner"
        android:visibility="gone" />

    <include
        android:id="@+id/editors"
        layout="@layout/edit_field_list" />

    <!-- This isn't used in the nickname field. It is only included so that
        TextFieldsEditorView doesn't need extra null checks. -->
    <include
        android:id="@+id/delete_button_container"
        layout="@layout/edit_delete_button"
        android:visibility="gone" />

</com.android.contacts.editor.TextFieldsEditorView>
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@

        <include
            android:id="@+id/edit_nick_name"
            layout="@layout/item_kind_section" />
            layout="@layout/nick_name_editor_view" />

        <include
            android:id="@+id/edit_photo"
+3 −0
Original line number Diff line number Diff line
@@ -57,4 +57,7 @@

    <!-- Color of the mime-type icons inside the editor. 50% black. -->
    <color name="editor_icon_color">#7f7f7f</color>

    <!-- Color of disabled text and unfocused hint text inside the contact editor. -->
    <color name="editor_disabled_text_color">#989898</color>
</resources>
+25 −0
Original line number Diff line number Diff line
@@ -892,6 +892,8 @@ public class ContactEditorFragment extends Fragment implements
                        }
                        if (request == EditorListener.FIELD_CHANGED && !isEditingUserProfile()) {
                            acquireAggregationSuggestions(activity, rawContactEditor);
                        } else if (request == EditorListener.EDITOR_FOCUS_CHANGED) {
                            adjustNameFieldsHintDarkness(rawContactEditor);
                        }
                    }

@@ -915,9 +917,15 @@ public class ContactEditorFragment extends Fragment implements
                phoneticNameEditor.setEditorListener(listener);
                rawContactEditor.setAutoAddToDefaultGroup(mAutoAddToDefaultGroup);

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

                if (rawContactId == mAggregationSuggestionsRawContactId) {
                    acquireAggregationSuggestions(activity, rawContactEditor);
                }

                adjustNameFieldsHintDarkness(rawContactEditor);
            }
        }

@@ -936,6 +944,23 @@ public class ContactEditorFragment extends Fragment implements
        updatedExpandedEditorsMap();
    }

    /**
     * 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}.
     */
+3 −0
Original line number Diff line number Diff line
@@ -49,6 +49,9 @@ public interface Editor {
        // The editor has switched between different representations of the same
        // data, e.g. from full name to structured name
        public static final int EDITOR_FORM_CHANGED = 5;

        // Focus has changed inside the editor.
        public static final int EDITOR_FOCUS_CHANGED = 6;
    }

    /**
Loading