UX changes for compact editor
am: b0550f0265

Change-Id: I512dc58e00bebfe92f60deb516485efc3386deef
diff --git a/res/layout/editor_save_button.xml b/res/layout/editor_save_button.xml
new file mode 100644
index 0000000..024ddcb
--- /dev/null
+++ b/res/layout/editor_save_button.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<Button xmlns:android="http://schemas.android.com/apk/res/android"
+    style="?android:attr/buttonBarButtonStyle"
+    android:id="@+id/editor_menu_save_button"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:text="@string/menu_save"
+    android:textColor="@color/action_bar_button_text_color"
+    android:textSize="14sp">
+</Button>
diff --git a/res/menu/edit_contact.xml b/res/menu/edit_contact.xml
index 256edb6..9bf067f 100644
--- a/res/menu/edit_contact.xml
+++ b/res/menu/edit_contact.xml
@@ -18,7 +18,7 @@
     <item
         android:id="@+id/menu_save"
         android:showAsAction="always"
-        android:icon="@drawable/ic_done_wht_24dp"
+        android:actionLayout="@layout/editor_save_button"
         android:title="@string/menu_save" />
 
     <item
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 132064c..73764e7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -663,7 +663,7 @@
     <string name="toast_text_copied">Text copied</string>
 
     <!-- Contents of the alert dialog when the user hits the Cancel button in the editor [CHAR LIMIT=128] -->
-    <string name="cancel_confirmation_dialog_message">Discard your changes and quit editing?</string>
+    <string name="cancel_confirmation_dialog_message">Discard changes?</string>
 
     <!-- Positive button text for the cancel editing confirmation dialog.
       Pushing this button indicates that the user wishes to discard the changes they have already
@@ -673,7 +673,7 @@
     <!-- Negative button text for the cancel editing confirmation dialog.
       Pushing this button indicates that the user wishes to continue editing
       and return to the editor [CHAR LIMIT=30] -->
-    <string name="cancel_confirmation_dialog_keep_editing_button">Keep editing</string>
+    <string name="cancel_confirmation_dialog_keep_editing_button">Cancel</string>
 
     <!-- Description of a call log entry, made of a call type and a date -->
     <string name="call_type_and_date">
diff --git a/src/com/android/contacts/activities/ContactEditorBaseActivity.java b/src/com/android/contacts/activities/ContactEditorBaseActivity.java
index 97095f0..c4abd58 100644
--- a/src/com/android/contacts/activities/ContactEditorBaseActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorBaseActivity.java
@@ -231,6 +231,7 @@
             actionBar.setTitle(getResources().getString(mActionBarTitleResId));
             actionBar.setDisplayShowHomeEnabled(true);
             actionBar.setDisplayHomeAsUpEnabled(true);
+            actionBar.setHomeAsUpIndicator(R.drawable.ic_close_dk);
         }
     }
 
diff --git a/src/com/android/contacts/editor/ContactEditorBaseFragment.java b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
index c1e5af8..d149f16 100644
--- a/src/com/android/contacts/editor/ContactEditorBaseFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
@@ -788,6 +788,15 @@
 
         // Save menu is invisible when there's only one read only contact in the editor.
         saveMenu.setVisible(!mRawContactDisplayAloneIsReadOnly);
+        if (saveMenu.isVisible()) {
+            // Since we're using a custom action layout we have to manually hook up the handler.
+            saveMenu.getActionView().setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    onOptionsItemSelected(saveMenu);
+                }
+            });
+        }
 
         if (mRawContactIdToDisplayAlone != -1 || mIsUserProfile) {
             sendToVoiceMailMenu.setVisible(false);