Merge "Remove duplicate Contacts/tests res-common resources" into ub-contactsdialer-g-dev
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index e78c355..b896406 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -604,7 +604,7 @@
         }
 
         if (mSelectionMode) {
-            final int cabStatusBarColor =ContextCompat.getColor(
+            final int cabStatusBarColor = ContextCompat.getColor(
                     mActivity, R.color.contextual_selection_bar_status_bar_color);
             runStatusBarAnimation(/* colorTo */ cabStatusBarColor);
         } else {
diff --git a/src/com/android/contacts/common/list/ContactListItemView.java b/src/com/android/contacts/common/list/ContactListItemView.java
index bb28858..1dc99ef 100644
--- a/src/com/android/contacts/common/list/ContactListItemView.java
+++ b/src/com/android/contacts/common/list/ContactListItemView.java
@@ -674,11 +674,13 @@
                         photoTop,
                         rightBound,
                         photoTop + mDeleteImageButtonSize);
+                rightBound -= mDeleteImageButtonSize;
             } else {
                 mDeleteImageButton.layout(leftBound,
                         photoTop,
                         leftBound + mDeleteImageButtonSize,
                         photoTop + mDeleteImageButtonSize);
+                leftBound += mDeleteImageButtonSize;
             }
         }
 
diff --git a/src/com/android/contacts/editor/LabeledEditorView.java b/src/com/android/contacts/editor/LabeledEditorView.java
index 61c1061..947f35e 100644
--- a/src/com/android/contacts/editor/LabeledEditorView.java
+++ b/src/com/android/contacts/editor/LabeledEditorView.java
@@ -37,6 +37,7 @@
 import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.ArrayAdapter;
 import android.widget.Button;
+import android.widget.CheckedTextView;
 import android.widget.EditText;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -44,10 +45,10 @@
 import android.widget.TextView;
 
 import com.android.contacts.R;
-import com.android.contacts.common.model.RawContactDelta;
 import com.android.contacts.common.ContactsUtils;
-import com.android.contacts.common.model.ValuesDelta;
+import com.android.contacts.common.model.RawContactDelta;
 import com.android.contacts.common.model.RawContactModifier;
+import com.android.contacts.common.model.ValuesDelta;
 import com.android.contacts.common.model.account.AccountType.EditType;
 import com.android.contacts.common.model.dataitem.DataKind;
 import com.android.contacts.util.DialogManager;
@@ -86,6 +87,7 @@
     private DialogManager mDialogManager = null;
     private EditorListener mListener;
     protected int mMinLineItemHeight;
+    private int mSelectedLabelIndex;
 
     /**
      * A marker in the spinner adapter of the currently selected custom type.
@@ -292,6 +294,7 @@
      */
     public void rebuildLabel() {
         mEditTypeAdapter = new EditTypeAdapter(getContext());
+        mEditTypeAdapter.setSelectedIndex(mSelectedLabelIndex);
         mLabel.setAdapter(mEditTypeAdapter);
         if (mEditTypeAdapter.hasCustomSelection()) {
             mLabel.setSelection(mEditTypeAdapter.getPosition(CUSTOM_SELECTION));
@@ -518,6 +521,7 @@
             // User picked type, and we're sure it's ok to actually write the entry.
             mType = selected;
             mEntry.put(mKind.typeColumn, mType.rawValue);
+            mSelectedLabelIndex = position;
             rebuildLabel();
             requestFocusForFirstEditField();
             onLabelRebuilt();
@@ -563,6 +567,7 @@
         private boolean mHasCustomSelection;
         private int mTextColorHintUnfocused;
         private int mTextColorDark;
+        private int mSelectedIndex;
 
         public EditTypeAdapter(Context context) {
             super(context, 0);
@@ -609,8 +614,11 @@
 
         @Override
         public View getDropDownView(int position, View convertView, ViewGroup parent) {
-            return createViewFromResource(
+            final CheckedTextView dropDownView = (CheckedTextView) createViewFromResource(
                     position, convertView, parent, android.R.layout.simple_spinner_dropdown_item);
+            dropDownView.setBackground(getContext().getDrawable(R.drawable.drawer_item_background));
+            dropDownView.setChecked(position == mSelectedIndex);
+            return dropDownView;
         }
 
         private TextView createViewFromResource(int position, View convertView, ViewGroup parent,
@@ -636,5 +644,9 @@
             textView.setText(text);
             return textView;
         }
+
+        public void setSelectedIndex(int selectedIndex) {
+            mSelectedIndex = selectedIndex;
+        }
     }
 }