Merge "tablet visual tweaks. more caret." into jb-ub-mail-ur9
diff --git a/res/drawable-hdpi/ic_carrot_holo.9.png b/res/drawable-hdpi/ic_carrot_holo.9.png
new file mode 100644
index 0000000..d7d6502
--- /dev/null
+++ b/res/drawable-hdpi/ic_carrot_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/list_activated_holo.9.png b/res/drawable-hdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..2d03486
--- /dev/null
+++ b/res/drawable-hdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/list_checked_holo.9.png b/res/drawable-hdpi/list_checked_holo.9.png
new file mode 100644
index 0000000..705f97c
--- /dev/null
+++ b/res/drawable-hdpi/list_checked_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_carrot_holo.9.png b/res/drawable-mdpi/ic_carrot_holo.9.png
new file mode 100644
index 0000000..372fe9f
--- /dev/null
+++ b/res/drawable-mdpi/ic_carrot_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_activated_holo.9.png b/res/drawable-mdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..c253d94
--- /dev/null
+++ b/res/drawable-mdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_checked_holo.9.png b/res/drawable-mdpi/list_checked_holo.9.png
new file mode 100644
index 0000000..63c7a63
--- /dev/null
+++ b/res/drawable-mdpi/list_checked_holo.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_carrot_holo.9.png b/res/drawable-xhdpi/ic_carrot_holo.9.png
new file mode 100644
index 0000000..2c5f03a
--- /dev/null
+++ b/res/drawable-xhdpi/ic_carrot_holo.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/list_activated_holo.9.png b/res/drawable-xhdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..c67e675
--- /dev/null
+++ b/res/drawable-xhdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/list_checked_holo.9.png b/res/drawable-xhdpi/list_checked_holo.9.png
new file mode 100644
index 0000000..455bf2a
--- /dev/null
+++ b/res/drawable-xhdpi/list_checked_holo.9.png
Binary files differ
diff --git a/res/drawable/conversation_read_selector.xml b/res/drawable/conversation_read_selector.xml
index bd32b81..cfd1c45 100644
--- a/res/drawable/conversation_read_selector.xml
+++ b/res/drawable/conversation_read_selector.xml
@@ -17,11 +17,11 @@
 -->
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_pressed="true"
-          android:drawable="@color/checked_item_background_color" />
+          android:drawable="@drawable/list_checked_holo" />
     <item android:state_selected="true"
-          android:drawable="@color/checked_item_background_color" />
+          android:drawable="@drawable/list_checked_holo" />
     <item android:state_activated="true"
-          android:drawable="@color/activated_item_background_color" />
+          android:drawable="@drawable/list_activated_holo" />
     <item android:state_focused="true"
           android:drawable="@drawable/list_focused_holo" />
     <item android:drawable="@drawable/list_read_holo" />
diff --git a/res/drawable/conversation_unread_selector.xml b/res/drawable/conversation_unread_selector.xml
index 138feeb..176af6a 100644
--- a/res/drawable/conversation_unread_selector.xml
+++ b/res/drawable/conversation_unread_selector.xml
@@ -17,11 +17,11 @@
 -->
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_pressed="true"
-          android:drawable="@color/checked_item_background_color" />
+          android:drawable="@drawable/list_checked_holo" />
     <item android:state_selected="true"
-          android:drawable="@color/checked_item_background_color" />
+          android:drawable="@drawable/list_checked_holo" />
     <item android:state_activated="true"
-          android:drawable="@color/activated_item_background_color" />
+          android:drawable="@drawable/list_activated_holo" />
     <item android:state_focused="true"
           android:drawable="@drawable/list_focused_holo" />
     <item android:drawable="@drawable/list_unread_holo" />
diff --git a/res/drawable/list_edge_tablet.xml b/res/drawable/list_edge_tablet.xml
new file mode 100644
index 0000000..d6aae76
--- /dev/null
+++ b/res/drawable/list_edge_tablet.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2013 Google Inc.
+     Licensed to 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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <size
+        android:width="1dp" />
+    <solid
+        android:color="@color/light_gray" />
+</shape>
diff --git a/res/layout/conversation_item_view_normal.xml b/res/layout/conversation_item_view_normal.xml
index 449ee81..350afd7 100644
--- a/res/layout/conversation_item_view_normal.xml
+++ b/res/layout/conversation_item_view_normal.xml
@@ -145,6 +145,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_alignParentRight="true"
+                    android:layout_marginTop="-6dp"
                     android:src="@drawable/ic_star_off" />
 
                 <!-- we assume the star asset is less than 48dp wide -->
diff --git a/res/layout/conversation_item_view_normal_spacious.xml b/res/layout/conversation_item_view_normal_spacious.xml
index ec5f369..b8bb2af 100644
--- a/res/layout/conversation_item_view_normal_spacious.xml
+++ b/res/layout/conversation_item_view_normal_spacious.xml
@@ -145,6 +145,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_alignParentRight="true"
+                    android:layout_marginTop="-6dp"
                     android:src="@drawable/ic_star_off" />
 
                 <!-- we assume the star asset is less than 48dp wide -->
diff --git a/res/layout/conversation_list.xml b/res/layout/conversation_list.xml
index f5bd8ab..071696e 100644
--- a/res/layout/conversation_list.xml
+++ b/res/layout/conversation_list.xml
@@ -49,14 +49,6 @@
             android:fadingEdge="none"
             android:layout_alignParentTop="true"/>
 
-        <View
-            android:id="@+id/list_pane_edge"
-            android:layout_width="1dp"
-            android:layout_height="match_parent"
-            android:layout_gravity="right"
-            android:visibility="gone"
-            android:background="@color/light_gray" />
-
         <ProgressBar
             android:id="@+id/sync_trigger"
             android:layout_width="match_parent"
diff --git a/src/com/android/mail/browse/ConversationItemView.java b/src/com/android/mail/browse/ConversationItemView.java
index 4039d91..01ed1ba 100644
--- a/src/com/android/mail/browse/ConversationItemView.java
+++ b/src/com/android/mail/browse/ConversationItemView.java
@@ -113,6 +113,8 @@
     private static Bitmap STATE_FORWARDED;
     private static Bitmap STATE_REPLIED_AND_FORWARDED;
     private static Bitmap STATE_CALENDAR_INVITE;
+    private static Bitmap VISIBLE_CONVERSATION_CARET;
+    private static Drawable RIGHT_EDGE_TABLET;
 
     private static String sSendersSplitToken;
     private static String sElidedPaddingToken;
@@ -361,6 +363,10 @@
                     BitmapFactory.decodeResource(res, R.drawable.ic_badge_reply_forward_holo_light);
             STATE_CALENDAR_INVITE =
                     BitmapFactory.decodeResource(res, R.drawable.ic_badge_invite_holo_light);
+            VISIBLE_CONVERSATION_CARET = BitmapFactory.decodeResource(res,
+                    R.drawable.ic_carrot_holo);
+
+            RIGHT_EDGE_TABLET = res.getDrawable(R.drawable.list_edge_tablet);
 
             // Initialize colors.
             sActivatedTextColor = res.getColor(R.color.senders_text_color_read);
@@ -1165,8 +1171,18 @@
             canvas.restore();
         }
 
+        // right-side edge effect when in tablet conversation mode
+        if (mTabletDevice && ViewMode.isConversationMode(mConfig.getViewMode())) {
+            RIGHT_EDGE_TABLET.setBounds(getWidth() - RIGHT_EDGE_TABLET.getIntrinsicWidth(), 0,
+                    getWidth(), getHeight());
+            RIGHT_EDGE_TABLET.draw(canvas);
+        }
+
         if (isActivated()) {
-            // TODO: draw caret on the right, centered vertically
+            // draw caret on the right, centered vertically
+            final int x = getWidth() - VISIBLE_CONVERSATION_CARET.getWidth();
+            final int y = (getHeight() - VISIBLE_CONVERSATION_CARET.getHeight()) / 2;
+            canvas.drawBitmap(VISIBLE_CONVERSATION_CARET, x, y, null);
         }
     }
 
@@ -1210,13 +1226,13 @@
         final int background;
         if (isUnread) {
             if (mSelected) {
-                background = R.color.checked_item_background_color;
+                background = R.drawable.list_checked_holo;
             } else {
                 background = R.drawable.conversation_unread_selector;
             }
         } else {
             if (mSelected) {
-                background = R.color.checked_item_background_color;
+                background = R.drawable.list_checked_holo;
             } else {
                 background = R.drawable.conversation_read_selector;
             }
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java
index 19d007d..9a6b22d 100644
--- a/src/com/android/mail/ui/ConversationListFragment.java
+++ b/src/com/android/mail/ui/ConversationListFragment.java
@@ -108,8 +108,6 @@
 
     private View mSearchStatusView;
 
-    private View mListEdge;
-
     /**
      * Current Account being viewed
      */
@@ -399,8 +397,6 @@
         mListView.enableSwipe(mAccount.supportsCapability(AccountCapabilities.UNDO));
         mListView.setSwipedListener(this);
 
-        mListEdge = rootView.findViewById(R.id.list_pane_edge);
-
         if (savedState != null && savedState.containsKey(LIST_STATE_KEY)) {
             mListView.onRestoreInstanceState(savedState.getParcelable(LIST_STATE_KEY));
         }
@@ -424,17 +420,7 @@
         if (!mTabletDevice) {
             return;
         }
-        final int currentSelected = mListView.getCheckedItemPosition();
-        mListView.clearChoices();
-        // We use the activated state to show the blue highlight on tablet. Clearing the choices
-        // removes the checked state, but doesn't do anything to the activated state.  We must
-        // manually clear that.
-        if (currentSelected != ListView.INVALID_POSITION) {
-            final View v = mListView.getChildAt(currentSelected);
-            if (v != null) {
-                v.setActivated(false);
-            }
-        }
+        clearChoicesAndActivated();
         setChoiceMode(ListView.CHOICE_MODE_NONE);
     }
 
@@ -584,14 +570,10 @@
 
     @Override
     public void onViewModeChanged(int newMode) {
-        // Change the divider based on view mode.
         if (mTabletDevice) {
-            if (ViewMode.isConversationMode(newMode)) {
-                mListEdge.setVisibility(View.VISIBLE);
-            } else if (ViewMode.isListMode(newMode)) {
-                mListEdge.setVisibility(View.GONE);
+            if (ViewMode.isListMode(newMode)) {
                 // There are no selected conversations when in conversation list mode.
-                mListView.clearChoices();
+                clearChoicesAndActivated();
             }
         }
         if (mFooterView != null) {
@@ -599,6 +581,20 @@
         }
     }
 
+    private void clearChoicesAndActivated() {
+        final int currentSelected = mListView.getCheckedItemPosition();
+        mListView.clearChoices();
+        // We use the activated state to show the blue highlight on tablet. Clearing the choices
+        // removes the checked state, but doesn't do anything to the activated state.  We must
+        // manually clear that.
+        if (currentSelected != ListView.INVALID_POSITION) {
+            final View v = mListView.getChildAt(currentSelected);
+            if (v != null) {
+                v.setActivated(false);
+            }
+        }
+    }
+
     /**
      * Handles a request to show a new conversation list, either from a search
      * query or for viewing a folder. This will initiate a data load, and hence