Compact contact editor UI tweaks
* Move delete ActionBar icon option back into the overflow
* Move the "More fields" option back to left alignment and
give it accent color
* Make unfocused fields 25% black
* Layout/padding tweaks
- Remove the 0 bottom padding on names so that all fields
have the same spacing between each other
- Use the min edit height on the "More fields" row
so that the spacing is the same as the other fields.
Bug 19729447
Change-Id: Ia11c74c1b65f96f937d6e51ed143f5f088b41561
diff --git a/res/drawable-hdpi/ic_delete_white_24dp.png b/res/drawable-hdpi/ic_delete_white_24dp.png
deleted file mode 100644
index 4a9f769..0000000
--- a/res/drawable-hdpi/ic_delete_white_24dp.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_delete_white_24dp.png b/res/drawable-mdpi/ic_delete_white_24dp.png
deleted file mode 100644
index e2f5f35..0000000
--- a/res/drawable-mdpi/ic_delete_white_24dp.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_delete_white_24dp.png b/res/drawable-xhdpi/ic_delete_white_24dp.png
deleted file mode 100644
index 388b5b0..0000000
--- a/res/drawable-xhdpi/ic_delete_white_24dp.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_delete_white_24dp.png b/res/drawable-xxhdpi/ic_delete_white_24dp.png
deleted file mode 100644
index 3fcdfdb..0000000
--- a/res/drawable-xxhdpi/ic_delete_white_24dp.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_delete_white_24dp.png b/res/drawable-xxxhdpi/ic_delete_white_24dp.png
deleted file mode 100644
index 8d322aa..0000000
--- a/res/drawable-xxxhdpi/ic_delete_white_24dp.png
+++ /dev/null
Binary files differ
diff --git a/res/layout-land/compact_contact_editor_fragment.xml b/res/layout-land/compact_contact_editor_fragment.xml
index ffc8f4f..2363091 100644
--- a/res/layout-land/compact_contact_editor_fragment.xml
+++ b/res/layout-land/compact_contact_editor_fragment.xml
@@ -24,21 +24,7 @@
android:orientation="horizontal"
android:visibility="invisible">
- <com.android.contacts.editor.CompactPhotoEditorView
- android:id="@+id/photo_editor"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center_horizontal"
- android:orientation="vertical">
-
- <com.android.contacts.widget.QuickContactImageView
- android:id="@+id/photo"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clickable="true"
- android:scaleType="centerCrop"/>
-
- </com.android.contacts.editor.CompactPhotoEditorView>
+ <include layout="@layout/compact_photo_editor_view" />
<ScrollView
android:layout_width="match_parent"
diff --git a/res/layout/compact_contact_editor_fields.xml b/res/layout/compact_contact_editor_fields.xml
index 723c952..f59c5be 100644
--- a/res/layout/compact_contact_editor_fields.xml
+++ b/res/layout/compact_contact_editor_fields.xml
@@ -60,28 +60,20 @@
android:layout_height="wrap_content"
android:orientation="vertical">
- <View
- android:layout_width="match_parent"
- android:layout_height="@dimen/divider_line_height"
- android:background="@color/divider_line_color_light"/>
-
+ <!-- See the comment for EditKindIconStyle in styles.xml, we use (16 + 24 + 32) dp of
+ padding (start margin + icon width + end margin) for this to line up with the start
+ of the edit fields. -->
<TextView
+ android:background="?android:attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingEnd="@dimen/expanding_entry_card_item_image_spacing"
+ android:minHeight="@dimen/editor_min_line_item_height"
+ android:paddingStart="72dp"
android:gravity="center_vertical"
- android:paddingBottom="@dimen/expanding_entry_card_button_padding_vertical"
- android:paddingTop="@dimen/expanding_entry_card_button_padding_vertical"
android:text="@string/compact_editor_more_fields"
- android:textAlignment="viewEnd"
- android:textColor="@color/expanding_entry_card_button_text_color"
+ android:textColor="?android:attr/colorAccent"
android:textSize="@dimen/expanding_entry_card_title_text_size"/>
- <View
- android:layout_width="match_parent"
- android:layout_height="@dimen/divider_line_height"
- android:background="@color/divider_line_color_light"/>
-
</LinearLayout>
</merge>
\ No newline at end of file
diff --git a/res/layout/compact_contact_editor_fragment.xml b/res/layout/compact_contact_editor_fragment.xml
index d38184b..a6cda4c 100644
--- a/res/layout/compact_contact_editor_fragment.xml
+++ b/res/layout/compact_contact_editor_fragment.xml
@@ -29,21 +29,7 @@
android:orientation="vertical"
android:visibility="invisible">
- <com.android.contacts.editor.CompactPhotoEditorView
- android:id="@+id/photo_editor"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center_horizontal"
- android:orientation="vertical">
-
- <com.android.contacts.widget.QuickContactImageView
- android:id="@+id/photo"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clickable="true"
- android:scaleType="centerCrop"/>
-
- </com.android.contacts.editor.CompactPhotoEditorView>
+ <include layout="@layout/compact_photo_editor_view" />
<include layout="@layout/compact_contact_editor_fields" />
diff --git a/res/layout/compact_photo_editor_view.xml b/res/layout/compact_photo_editor_view.xml
new file mode 100644
index 0000000..670b24e
--- /dev/null
+++ b/res/layout/compact_photo_editor_view.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.CompactPhotoEditorView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/photo_editor"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_horizontal">
+
+ <com.android.contacts.widget.QuickContactImageView
+ android:id="@+id/photo"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop"/>
+
+</com.android.contacts.editor.CompactPhotoEditorView>
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index cb658b3..a537a95 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -62,6 +62,6 @@
<!-- 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>
+ <!-- Color of disabled text and unfocused hint text inside the contact editor. 25% black. -->
+ <color name="editor_disabled_text_color">#40000000</color>
</resources>
diff --git a/src/com/android/contacts/editor/CompactContactEditorFragment.java b/src/com/android/contacts/editor/CompactContactEditorFragment.java
index 121fc88..e31e063 100644
--- a/src/com/android/contacts/editor/CompactContactEditorFragment.java
+++ b/src/com/android/contacts/editor/CompactContactEditorFragment.java
@@ -116,10 +116,6 @@
mPhotoMode = photoMode;
}
- public void setPhotoMode(int photoMode) {
- mPhotoMode = photoMode;
- }
-
@Override
public void onClick(View view) {
PhotoSourceDialogFragment.show(CompactContactEditorFragment.this, mPhotoMode);
diff --git a/src/com/android/contacts/editor/CompactPhotoEditorView.java b/src/com/android/contacts/editor/CompactPhotoEditorView.java
index ef05651..3481a33 100644
--- a/src/com/android/contacts/editor/CompactPhotoEditorView.java
+++ b/src/com/android/contacts/editor/CompactPhotoEditorView.java
@@ -72,14 +72,16 @@
public CompactPhotoEditorView(Context context, AttributeSet attrs) {
super(context, attrs);
-
- final TypedValue landscapePhotoRatio = new TypedValue();
- getResources().getValue(R.dimen.quickcontact_landscape_photo_ratio, landscapePhotoRatio,
- /* resolveRefs =*/ true);
- mLandscapePhotoRatio = landscapePhotoRatio.getFloat();
+ mLandscapePhotoRatio = getTypedFloat(R.dimen.quickcontact_landscape_photo_ratio);
mIsTwoPanel = getResources().getBoolean(R.bool.quickcontact_two_panel);
}
+ private float getTypedFloat(int resourceId) {
+ final TypedValue typedValue = new TypedValue();
+ getResources().getValue(resourceId, typedValue, /* resolveRefs =*/ true);
+ return typedValue.getFloat();
+ }
+
@Override
protected void onFinishInflate() {
super.onFinishInflate();
@@ -137,7 +139,6 @@
SchedulingUtils.doOnPreDraw(this, /* drawNextFrame =*/ false, new Runnable() {
@Override
public void run() {
-
final int photoHeight, photoWidth;
if (mIsTwoPanel) {
// Make the photo slightly more narrow than it is tall
@@ -145,8 +146,8 @@
photoWidth = (int) (photoHeight * mLandscapePhotoRatio);
} else {
// Make the photo a square
- photoHeight = getWidth();
- photoWidth = photoHeight;
+ photoWidth = getWidth();
+ photoHeight = photoWidth;
}
final ViewGroup.LayoutParams layoutParams = getLayoutParams();
layoutParams.height = photoHeight;
diff --git a/src/com/android/contacts/editor/ContactEditorBaseFragment.java b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
index 075aca3..618772f 100644
--- a/src/com/android/contacts/editor/ContactEditorBaseFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
@@ -728,8 +728,6 @@
final MenuItem sendToVoiceMailMenu = menu.findItem(R.id.menu_send_to_voicemail);
final MenuItem ringToneMenu = menu.findItem(R.id.menu_set_ringtone);
final MenuItem deleteMenu = menu.findItem(R.id.menu_delete);
- deleteMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
- deleteMenu.setIcon(R.drawable.ic_delete_white_24dp);
// Set visibility of menus
doneMenu.setVisible(false);
diff --git a/src/com/android/contacts/editor/PhoneticNameEditorView.java b/src/com/android/contacts/editor/PhoneticNameEditorView.java
index e645687..420575c 100644
--- a/src/com/android/contacts/editor/PhoneticNameEditorView.java
+++ b/src/com/android/contacts/editor/PhoneticNameEditorView.java
@@ -151,12 +151,4 @@
return !TextUtils.isEmpty(family) || !TextUtils.isEmpty(middle)
|| !TextUtils.isEmpty(given);
}
-
- /** {@inheritDoc} */
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- // Remove padding below this view.
- setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), 0);
- }
}
diff --git a/src/com/android/contacts/editor/StructuredNameEditorView.java b/src/com/android/contacts/editor/StructuredNameEditorView.java
index 82d6324..0f98f53 100644
--- a/src/com/android/contacts/editor/StructuredNameEditorView.java
+++ b/src/com/android/contacts/editor/StructuredNameEditorView.java
@@ -287,12 +287,4 @@
return 0;
}
}
-
- /** {@inheritDoc} */
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- // Remove padding below this view.
- setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), 0);
- }
}