Loading res/layout/nick_name_editor_view.xml 0 → 100644 +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> res/layout/raw_contact_editor_view.xml +1 −1 Original line number Diff line number Diff line Loading @@ -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" Loading res/values/colors.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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> src/com/android/contacts/editor/ContactEditorFragment.java +25 −0 Original line number Diff line number Diff line Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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}. */ Loading src/com/android/contacts/editor/Editor.java +3 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
res/layout/nick_name_editor_view.xml 0 → 100644 +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>
res/layout/raw_contact_editor_view.xml +1 −1 Original line number Diff line number Diff line Loading @@ -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" Loading
res/values/colors.xml +3 −0 Original line number Diff line number Diff line Loading @@ -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>
src/com/android/contacts/editor/ContactEditorFragment.java +25 −0 Original line number Diff line number Diff line Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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}. */ Loading
src/com/android/contacts/editor/Editor.java +3 −0 Original line number Diff line number Diff line Loading @@ -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