Use blue pressed background state

Change-Id: I10dd655aeb2bfb38ff9b309576b317e6aeef25c8
diff --git a/res/drawable-hdpi/ic_menu_add_field_normal_holo_light.png b/res/drawable-hdpi/ic_menu_add_field_holo_light.png
similarity index 100%
rename from res/drawable-hdpi/ic_menu_add_field_normal_holo_light.png
rename to res/drawable-hdpi/ic_menu_add_field_holo_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_add_field_pressed_holo_light.png b/res/drawable-hdpi/ic_menu_add_field_pressed_holo_light.png
deleted file mode 100644
index 14d1df4..0000000
--- a/res/drawable-hdpi/ic_menu_add_field_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_expander_maximized_normal_holo_light.png b/res/drawable-hdpi/ic_menu_expander_maximized_holo_light.png
similarity index 100%
rename from res/drawable-hdpi/ic_menu_expander_maximized_normal_holo_light.png
rename to res/drawable-hdpi/ic_menu_expander_maximized_holo_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_expander_maximized_pressed_holo_light.png b/res/drawable-hdpi/ic_menu_expander_maximized_pressed_holo_light.png
deleted file mode 100644
index bff50ab..0000000
--- a/res/drawable-hdpi/ic_menu_expander_maximized_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_expander_minimized_normal_holo_light.png b/res/drawable-hdpi/ic_menu_expander_minimized_holo_light.png
similarity index 100%
rename from res/drawable-hdpi/ic_menu_expander_minimized_normal_holo_light.png
rename to res/drawable-hdpi/ic_menu_expander_minimized_holo_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_expander_minimized_pressed_holo_light.png b/res/drawable-hdpi/ic_menu_expander_minimized_pressed_holo_light.png
deleted file mode 100644
index afdb9df..0000000
--- a/res/drawable-hdpi/ic_menu_expander_minimized_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_remove_field_normal_holo_light.png b/res/drawable-hdpi/ic_menu_remove_field_holo_light.png
similarity index 100%
rename from res/drawable-hdpi/ic_menu_remove_field_normal_holo_light.png
rename to res/drawable-hdpi/ic_menu_remove_field_holo_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_remove_field_pressed_holo_light.png b/res/drawable-hdpi/ic_menu_remove_field_pressed_holo_light.png
deleted file mode 100644
index 7cfdfe9..0000000
--- a/res/drawable-hdpi/ic_menu_remove_field_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_field_normal_holo_light.png b/res/drawable-mdpi/ic_menu_add_field_holo_light.png
similarity index 100%
rename from res/drawable-mdpi/ic_menu_add_field_normal_holo_light.png
rename to res/drawable-mdpi/ic_menu_add_field_holo_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_field_pressed_holo_light.png b/res/drawable-mdpi/ic_menu_add_field_pressed_holo_light.png
deleted file mode 100644
index a340e41..0000000
--- a/res/drawable-mdpi/ic_menu_add_field_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_expander_maximized_normal_holo_light.png b/res/drawable-mdpi/ic_menu_expander_maximized_holo_light.png
similarity index 100%
rename from res/drawable-mdpi/ic_menu_expander_maximized_normal_holo_light.png
rename to res/drawable-mdpi/ic_menu_expander_maximized_holo_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_expander_maximized_pressed_holo_light.png b/res/drawable-mdpi/ic_menu_expander_maximized_pressed_holo_light.png
deleted file mode 100644
index cb64494..0000000
--- a/res/drawable-mdpi/ic_menu_expander_maximized_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_expander_minimized_normal_holo_light.png b/res/drawable-mdpi/ic_menu_expander_minimized_holo_light.png
similarity index 100%
rename from res/drawable-mdpi/ic_menu_expander_minimized_normal_holo_light.png
rename to res/drawable-mdpi/ic_menu_expander_minimized_holo_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_expander_minimized_pressed_holo_light.png b/res/drawable-mdpi/ic_menu_expander_minimized_pressed_holo_light.png
deleted file mode 100644
index 6a6776a..0000000
--- a/res/drawable-mdpi/ic_menu_expander_minimized_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_remove_field_normal_holo_light.png b/res/drawable-mdpi/ic_menu_remove_field_holo_light.png
similarity index 100%
rename from res/drawable-mdpi/ic_menu_remove_field_normal_holo_light.png
rename to res/drawable-mdpi/ic_menu_remove_field_holo_light.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_remove_field_pressed_holo_light.png b/res/drawable-mdpi/ic_menu_remove_field_pressed_holo_light.png
deleted file mode 100644
index 10835fe..0000000
--- a/res/drawable-mdpi/ic_menu_remove_field_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/ic_menu_add_field_holo_light.xml b/res/drawable/ic_menu_add_field_holo_light.xml
deleted file mode 100644
index c75c262..0000000
--- a/res/drawable/ic_menu_add_field_holo_light.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <!-- TODO: Properly specify focused states once we have assets -->
-    <item android:state_window_focused="false" android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_add_field_normal_holo_light" />
-    <item android:state_pressed="true" 
-        android:drawable="@drawable/ic_menu_add_field_pressed_holo_light" />
-    <item android:state_focused="true" android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_add_field_normal_holo_light" />
-    <item android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_add_field_normal_holo_light" />
-</selector>
diff --git a/res/drawable/ic_menu_expander_maximized_holo_light.xml b/res/drawable/ic_menu_expander_maximized_holo_light.xml
deleted file mode 100644
index 43b2fe6..0000000
--- a/res/drawable/ic_menu_expander_maximized_holo_light.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <!-- TODO: Properly specify focused states once we have assets -->
-    <item android:state_window_focused="false" android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_expander_maximized_normal_holo_light" />
-    <item android:state_pressed="true" 
-        android:drawable="@drawable/ic_menu_expander_maximized_pressed_holo_light" />
-    <item android:state_focused="true" android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_expander_maximized_normal_holo_light" />
-    <item android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_expander_maximized_normal_holo_light" />
-</selector>
diff --git a/res/drawable/ic_menu_expander_minimized_holo_light.xml b/res/drawable/ic_menu_expander_minimized_holo_light.xml
deleted file mode 100644
index 59597d1..0000000
--- a/res/drawable/ic_menu_expander_minimized_holo_light.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <!-- TODO: Properly specify focused states once we have assets -->
-    <item android:state_window_focused="false" android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_expander_minimized_normal_holo_light" />
-    <item android:state_pressed="true" 
-        android:drawable="@drawable/ic_menu_expander_minimized_pressed_holo_light" />
-    <item android:state_focused="true" android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_expander_minimized_normal_holo_light" />
-    <item android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_expander_minimized_normal_holo_light" />
-</selector>
diff --git a/res/drawable/ic_menu_remove_field_holo_light.xml b/res/drawable/ic_menu_remove_field_holo_light.xml
deleted file mode 100644
index 85f6dac..0000000
--- a/res/drawable/ic_menu_remove_field_holo_light.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <!-- TODO: Properly specify focused states once we have assets -->
-    <item android:state_window_focused="false" android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_remove_field_normal_holo_light" />
-    <item android:state_pressed="true" 
-        android:drawable="@drawable/ic_menu_remove_field_pressed_holo_light" />
-    <item android:state_focused="true" android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_remove_field_normal_holo_light" />
-    <item android:state_enabled="true"
-        android:drawable="@drawable/ic_menu_remove_field_normal_holo_light" />
-</selector>
diff --git a/res/layout-xlarge/item_kind_section.xml b/res/layout-xlarge/item_kind_section.xml
index 6c6c9e7..ac6245c 100644
--- a/res/layout-xlarge/item_kind_section.xml
+++ b/res/layout-xlarge/item_kind_section.xml
@@ -48,7 +48,7 @@
         android:paddingRight="@dimen/editor_round_button_padding_right"
         android:paddingTop="@dimen/editor_round_button_padding_top"
         android:paddingBottom="@dimen/editor_round_button_padding_bottom"
-        android:background="@null"
+        android:background="?android:attr/selectableItemBackground"
         android:src="@drawable/ic_menu_add_field_holo_light"
         android:contentDescription="@string/description_plus_button" />
 </com.android.contacts.views.editor.KindSectionView>
diff --git a/res/layout/item_kind_section.xml b/res/layout/item_kind_section.xml
index 9262cb2..80cf34d 100644
--- a/res/layout/item_kind_section.xml
+++ b/res/layout/item_kind_section.xml
@@ -58,7 +58,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:duplicateParentState="true"
-            android:background="@null"
+            android:background="?android:attr/selectableItemBackground"
             android:src="@drawable/ic_menu_add_field_holo_light"
             android:paddingLeft="@dimen/editor_round_button_padding_left"
             android:paddingRight="@dimen/editor_round_button_padding_right"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index fc0056c..29241ae 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -36,10 +36,9 @@
     <dimen name="aizy_preview_width">80dip</dimen>
     <dimen name="aizy_preview_height">80dip</dimen>
 
-    <!-- Padding of the rounded plus/minus buttons in the editor (the minus button is created
-    in code) -->
-    <dimen name="editor_round_button_padding_left">5dip</dimen>
-    <dimen name="editor_round_button_padding_right">5dip</dimen>
+    <!-- Padding of the rounded plus/minus/expand/collapse buttons in the editor  -->
+    <dimen name="editor_round_button_padding_left">10dip</dimen>
+    <dimen name="editor_round_button_padding_right">10dip</dimen>
     <dimen name="editor_round_button_padding_top">10dip</dimen>
     <dimen name="editor_round_button_padding_bottom">10dip</dimen>
 
diff --git a/src/com/android/contacts/activities/ContactBrowserActivity.java b/src/com/android/contacts/activities/ContactBrowserActivity.java
index 228389d..e970688 100644
--- a/src/com/android/contacts/activities/ContactBrowserActivity.java
+++ b/src/com/android/contacts/activities/ContactBrowserActivity.java
@@ -36,6 +36,7 @@
 import com.android.contacts.preference.ContactsPreferenceActivity;
 import com.android.contacts.util.AccountsListAdapter;
 import com.android.contacts.util.DialogManager;
+import com.android.contacts.util.ThemeUtils;
 import com.android.contacts.views.ContactSaveService;
 import com.android.contacts.views.detail.ContactDetailFragment;
 import com.android.contacts.widget.ContextMenuAdapter;
@@ -219,6 +220,8 @@
             // TODO: request may ask for FREQUENT - set the filter accordingly
             mAddContactImageView = new ImageView(this);
             mAddContactImageView.setImageResource(R.drawable.ic_menu_add_contact_holo_light);
+            mAddContactImageView.setBackgroundResource(
+                    ThemeUtils.getSelectableItemBackground(getTheme()));
             mAddContactImageView.setContentDescription(getString(R.string.menu_newContact));
             mAddContactImageView.setOnClickListener(new OnClickListener() {
                 @Override
diff --git a/src/com/android/contacts/util/ThemeUtils.java b/src/com/android/contacts/util/ThemeUtils.java
new file mode 100644
index 0000000..f2d84dd
--- /dev/null
+++ b/src/com/android/contacts/util/ThemeUtils.java
@@ -0,0 +1,25 @@
+package com.android.contacts.util;
+
+import android.content.res.Resources.Theme;
+import android.util.TypedValue;
+
+/**
+ * Provides static functions to more easily resolve attributes of the current theme
+ */
+public class ThemeUtils {
+    /**
+     * Resolves the given attribute id of the theme to a ressource id
+     */
+    public static int getAttribute(Theme theme, int attrId) {
+        final TypedValue outValue = new TypedValue();
+        theme.resolveAttribute(attrId, outValue, true);
+        return outValue.resourceId;
+    }
+
+    /**
+     * Returns the ressource id of the background used for buttons to show pressed and focused state
+     */
+    public static int getSelectableItemBackground(Theme theme) {
+        return getAttribute(theme, android.R.attr.selectableItemBackground);
+    }
+}
diff --git a/src/com/android/contacts/views/editor/KindSectionView.java b/src/com/android/contacts/views/editor/KindSectionView.java
index da6fbe0..814ce8c 100644
--- a/src/com/android/contacts/views/editor/KindSectionView.java
+++ b/src/com/android/contacts/views/editor/KindSectionView.java
@@ -24,6 +24,7 @@
 import com.android.contacts.views.editor.Editor.EditorListener;
 
 import android.content.Context;
+import android.os.Handler;
 import android.provider.ContactsContract.Data;
 import android.text.TextUtils;
 import android.util.AttributeSet;
@@ -70,8 +71,15 @@
 
         mAddPlusButton = (ImageButton) findViewById(R.id.kind_plus);
         mAddPlusButton.setOnClickListener(new OnClickListener() {
+            @Override
             public void onClick(View v) {
-                addItem();
+                // defer action so that the pressed state of the button is visible shortly
+                new Handler().post(new Runnable() {
+                    @Override
+                    public void run() {
+                        addItem();
+                    }
+                });
             }
         });
 
@@ -79,12 +87,14 @@
     }
 
     /** {@inheritDoc} */
+    @Override
     public void onDeleted(Editor editor) {
         updateAddEnabled();
         updateVisible();
     }
 
     /** {@inheritDoc} */
+    @Override
     public void onRequest(int request) {
         // Ignore requests
     }
diff --git a/src/com/android/contacts/views/editor/LabeledEditorView.java b/src/com/android/contacts/views/editor/LabeledEditorView.java
index ce236b2..1cedef7 100644
--- a/src/com/android/contacts/views/editor/LabeledEditorView.java
+++ b/src/com/android/contacts/views/editor/LabeledEditorView.java
@@ -24,6 +24,7 @@
 import com.android.contacts.model.EntityDelta.ValuesDelta;
 import com.android.contacts.model.EntityModifier;
 import com.android.contacts.util.DialogManager;
+import com.android.contacts.util.ThemeUtils;
 import com.android.contacts.util.DialogManager.DialogShowingView;
 
 import android.app.AlertDialog;
@@ -33,6 +34,7 @@
 import android.content.Entity;
 import android.content.res.Resources;
 import android.os.Bundle;
+import android.os.Handler;
 import android.util.AttributeSet;
 import android.view.Gravity;
 import android.view.Menu;
@@ -160,7 +162,8 @@
         if (shouldExist && mDelete == null) {
             mDelete = new ImageButton(mContext);
             mDelete.setImageResource(R.drawable.ic_menu_remove_field_holo_light);
-            mDelete.setBackgroundDrawable(null);
+            mDelete.setBackgroundResource(
+                    ThemeUtils.getSelectableItemBackground(mContext.getTheme()));
             final Resources resources = mContext.getResources();
             mDelete.setPadding(
                     resources.getDimensionPixelOffset(R.dimen.editor_round_button_padding_left),
@@ -174,15 +177,21 @@
             mDelete.setOnClickListener(new OnClickListener() {
                 @Override
                 public void onClick(View v) {
-                    // Keep around in model, but mark as deleted
-                    mEntry.markDeleted();
+                    // defer removal of this button so that the pressed state is visible shortly
+                    new Handler().post(new Runnable() {
+                        @Override
+                        public void run() {
+                            // Keep around in model, but mark as deleted
+                            mEntry.markDeleted();
 
-                    ((ViewGroup) getParent()).removeView(LabeledEditorView.this);
+                            ((ViewGroup) getParent()).removeView(LabeledEditorView.this);
 
-                    if (mListener != null) {
-                        // Notify listener when present
-                        mListener.onDeleted(LabeledEditorView.this);
-                    }
+                            if (mListener != null) {
+                                // Notify listener when present
+                                mListener.onDeleted(LabeledEditorView.this);
+                            }
+                        }
+                    });
                 }
             });
             addView(mDelete);
diff --git a/src/com/android/contacts/views/editor/TextFieldsEditorView.java b/src/com/android/contacts/views/editor/TextFieldsEditorView.java
index bac33f1..daade45 100644
--- a/src/com/android/contacts/views/editor/TextFieldsEditorView.java
+++ b/src/com/android/contacts/views/editor/TextFieldsEditorView.java
@@ -22,11 +22,13 @@
 import com.android.contacts.model.BaseAccountType.EditField;
 import com.android.contacts.model.EntityDelta;
 import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.android.contacts.util.ThemeUtils;
 
 import android.content.Context;
 import android.content.Entity;
 import android.content.res.Resources;
 import android.graphics.Rect;
+import android.os.Handler;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.telephony.PhoneNumberFormattingTextWatcher;
@@ -135,7 +137,8 @@
         if (shouldExist) {
             if (mMoreOrLess == null) {
                 mMoreOrLess = new ImageButton(mContext);
-                mMoreOrLess.setBackgroundDrawable(null);
+                mMoreOrLess.setBackgroundResource(
+                        ThemeUtils.getSelectableItemBackground(mContext.getTheme()));
                 final Resources resources = mContext.getResources();
                 mMoreOrLess.setPadding(
                         resources.getDimensionPixelOffset(