summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Lemieux <jplemieux@google.com>2014-07-01 18:01:31 -0700
committerJames Lemieux <jplemieux@google.com>2014-07-02 16:28:01 -0700
commit928308d6b10d353493492ad05e0227f960ddaa7e (patch)
tree31a9f3d5ab922674df2eeed18a2fad4212307251
parent679a2bab428e75697c4453105ad4f535aac3285f (diff)
downloadandroid_packages_apps_UnifiedEmail-928308d6b10d353493492ad05e0227f960ddaa7e.tar.gz
android_packages_apps_UnifiedEmail-928308d6b10d353493492ad05e0227f960ddaa7e.tar.bz2
android_packages_apps_UnifiedEmail-928308d6b10d353493492ad05e0227f960ddaa7e.zip
Implement general layout and colors for Thread List items.
This includes: - separating the subject and snippet lines - RTL support - new layout sizing (common to phone and tablet) - new font sizing - new colors - mirroring these changes in the widget version of Thread List Change-Id: I92fda7ca9936a8d7f96bc5f584a7a11e0e0fe72e
-rw-r--r--res/drawable-hdpi/list_read_holo.9.pngbin220 -> 212 bytes
-rw-r--r--res/drawable-mdpi/list_read_holo.9.pngbin183 -> 181 bytes
-rw-r--r--res/drawable-xhdpi/list_read_holo.9.pngbin239 -> 232 bytes
-rw-r--r--res/drawable-xxhdpi/list_read_holo.9.pngbin1157 -> 1153 bytes
-rw-r--r--res/layout/conversation_item_view.xml (renamed from res/layout/conversation_item_view_normal.xml)77
-rw-r--r--res/layout/conversation_item_view_normal_spacious.xml192
-rw-r--r--res/layout/conversation_item_view_wide.xml199
-rw-r--r--res/layout/conversation_message_upper_header.xml8
-rw-r--r--res/layout/widget.xml2
-rw-r--r--res/layout/widget_conversation_list_item.xml35
-rw-r--r--res/values-ldrtl/styles-ldrtl.xml19
-rw-r--r--res/values-sw600dp/dimen.xml2
-rw-r--r--res/values/colors.xml9
-rw-r--r--res/values/dimen.xml9
-rw-r--r--res/values/strings.xml6
-rw-r--r--res/values/styles.xml27
-rw-r--r--src/com/android/mail/browse/ConversationItemView.java177
-rw-r--r--src/com/android/mail/browse/ConversationItemViewCoordinates.java92
-rw-r--r--src/com/android/mail/browse/MessageHeaderView.java9
-rw-r--r--src/com/android/mail/providers/Conversation.java28
-rw-r--r--src/com/android/mail/utils/ViewUtils.java10
-rw-r--r--src/com/android/mail/widget/WidgetConversationListItemViewBuilder.java57
-rw-r--r--src/com/android/mail/widget/WidgetService.java4
23 files changed, 272 insertions, 690 deletions
diff --git a/res/drawable-hdpi/list_read_holo.9.png b/res/drawable-hdpi/list_read_holo.9.png
index a04c062f1..47e3a8b2d 100644
--- a/res/drawable-hdpi/list_read_holo.9.png
+++ b/res/drawable-hdpi/list_read_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_read_holo.9.png b/res/drawable-mdpi/list_read_holo.9.png
index fc9bb9dab..5865b73ab 100644
--- a/res/drawable-mdpi/list_read_holo.9.png
+++ b/res/drawable-mdpi/list_read_holo.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/list_read_holo.9.png b/res/drawable-xhdpi/list_read_holo.9.png
index 0f14404c3..ff8cd6d17 100644
--- a/res/drawable-xhdpi/list_read_holo.9.png
+++ b/res/drawable-xhdpi/list_read_holo.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/list_read_holo.9.png b/res/drawable-xxhdpi/list_read_holo.9.png
index c4f471523..20cfb22a3 100644
--- a/res/drawable-xxhdpi/list_read_holo.9.png
+++ b/res/drawable-xxhdpi/list_read_holo.9.png
Binary files differ
diff --git a/res/layout/conversation_item_view_normal.xml b/res/layout/conversation_item_view.xml
index afd8df0e7..582929675 100644
--- a/res/layout/conversation_item_view_normal.xml
+++ b/res/layout/conversation_item_view.xml
@@ -25,7 +25,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingBottom="1dp"
+ android:minHeight="88dp"
android:orientation="vertical">
<LinearLayout
@@ -38,10 +38,9 @@
<View
android:id="@+id/contact_image"
- android:layout_width="48dp"
- android:layout_height="48dp"
- android:layout_marginTop="12dp"
- android:layout_marginBottom="12dp"
+ android:layout_width="@dimen/contact_image_width"
+ android:layout_height="@dimen/contact_image_height"
+ android:layout_marginTop="@dimen/conv_list_padding"
style="@style/ConversationListContactImageStyle" />
<LinearLayout
@@ -70,7 +69,7 @@
android:id="@+id/reply_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
+ android:layout_marginTop="@dimen/conv_list_padding"
android:src="@drawable/ic_badge_reply_holo_light"
style="@style/ConversationListReplyStateStyle" />
@@ -79,7 +78,7 @@
android:id="@+id/personal_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="11dp"
+ android:layout_marginTop="@dimen/conv_list_padding"
android:src="@drawable/ic_email_caret_single"
style="@style/ConversationListPersonalIndicatorStyle" />
@@ -89,8 +88,8 @@
android:id="@+id/senders"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="12dp"
- android:textSize="18sp"
+ android:layout_marginTop="@dimen/conv_list_padding"
+ android:textSize="16sp"
android:lines="1"
android:includeFontPadding="false"
android:text="@string/long_string"
@@ -100,63 +99,75 @@
android:id="@+id/info_icon"
android:layout_width="14dp"
android:layout_height="14dp"
- android:layout_marginTop="10dp"
+ android:layout_marginTop="@dimen/conv_list_padding"
style="@style/ConversationListInfoIconStyle" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="12dp"
+ android:layout_marginTop="@dimen/conv_list_padding"
+ android:layout_alignBaseline="@id/senders"
android:textSize="12sp"
android:lines="1"
android:includeFontPadding="false"
android:text="@string/long_string"
style="@style/ConversationListDateStyle" />
- <!-- top margin should be 12dp, but the asset has 8dp built-in padding -->
- <!-- left padding should be 8dp, but the asset has 2dp built-in padding -->
<ImageView
android:id="@+id/paperclip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="4dp"
+ android:layout_marginTop="17dp"
android:src="@drawable/ic_attach_file_20dp"
style="@style/ConversationListPaperclipStyle" />
<!-- for Email -->
<View android:id="@+id/color_block"
- android:layout_width="@dimen/color_block_width"
- android:layout_height="@dimen/color_block_height"
- style="@style/ConversationListColorBlockStyle" />
+ android:layout_width="@dimen/color_block_width"
+ android:layout_height="@dimen/color_block_height"
+ style="@style/ConversationListColorBlockStyle" />
</RelativeLayout>
- <LinearLayout
+ <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="12dp"
- android:orientation="horizontal" >
+ android:layout_marginBottom="@dimen/conv_list_padding">
+
+ <ImageView
+ android:id="@+id/star"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingBottom="3dp"
+ android:src="@drawable/ic_star_outline_20dp"
+ style="@style/ConversationListStarStyle"/>
<TextView
- android:id="@id/subject"
+ android:id="@+id/subject"
android:layout_width="0dip"
android:layout_height="wrap_content"
- android:layout_weight="1"
- android:lines="2"
- android:textSize="13sp"
+ android:layout_marginTop="2dp"
+ android:background="@color/mail_app_blue"
android:includeFontPadding="false"
- android:text="@string/long_string" />
+ android:lines="1"
+ android:text="@string/long_string"
+ android:textSize="14sp"
+ style="@style/ConversationListSubjectStyle"/>
- <ImageView
- android:id="@+id/star"
- android:layout_width="wrap_content"
+ <TextView
+ android:id="@+id/snippet"
+ android:layout_width="0dip"
android:layout_height="wrap_content"
- android:layout_marginTop="-1dp"
- android:src="@drawable/ic_star_outline_20dp"
- style="@style/ConversationListStarStyle" />
+ android:layout_marginTop="2dp"
+ android:background="@color/dark_gray_text_color"
+ android:includeFontPadding="false"
+ android:lines="1"
+ android:text="@string/long_string"
+ android:textSize="14sp"
+ style="@style/ConversationListSnippetStyle"/>
- </LinearLayout>
+ </RelativeLayout>
</LinearLayout>
@@ -185,6 +196,6 @@
android:text="@string/long_string"
android:textSize="11sp"
android:lines="1"
- android:minHeight="16dp" />
+ android:minHeight="@dimen/conv_list_padding" />
</LinearLayout>
diff --git a/res/layout/conversation_item_view_normal_spacious.xml b/res/layout/conversation_item_view_normal_spacious.xml
deleted file mode 100644
index b37eda0e3..000000000
--- a/res/layout/conversation_item_view_normal_spacious.xml
+++ /dev/null
@@ -1,192 +0,0 @@
-<?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.
--->
-
-<!-- This layout is used as a template to create custom view CanvasConversationHeaderView
- in normal mode. To be able to get the correct measurements, every source field should
- be populated with data here. E.g:
- - Text View should set text to a random long string (android:text="@string/long_string")
- - Image View should set source to a specific asset -->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingBottom="1dp"
- android:orientation="vertical">
-
- <LinearLayout
- android:id="@+id/conversation_item_frame"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- style="@style/ConversationListSpaciousStyle" >
-
- <View
- android:id="@+id/contact_image"
- android:layout_width="48dp"
- android:layout_height="48dp"
- android:layout_marginTop="16dp"
- android:layout_marginBottom="16dp"
- style="@style/ConversationListSpaciousContactImageStyle" />
-
- <LinearLayout
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical">
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <!-- these views overlap horizontally, that's okay. -->
- <!-- we are only interested in the left edge of senders and the right edge -->
- <!-- of the date. -->
- <!-- sendersWidth, clipX, and dateX are dynamically determined later. -->
-
- <FrameLayout
- android:id="@+id/senders_decoration"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
-
- <!-- for Email -->
- <!-- top margin should be 16dp, but the asset has 2dp built-in padding -->
- <ImageView
- android:id="@+id/reply_state"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="14dp"
- android:src="@drawable/ic_badge_reply_holo_light"
- style="@style/ConversationListReplyStateStyle" />
-
- <!-- for Gmail -->
- <ImageView
- android:id="@+id/personal_indicator"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="15dp"
- android:src="@drawable/ic_email_caret_single"
- style="@style/ConversationListPersonalIndicatorStyle" />
-
- </FrameLayout>
-
- <TextView
- android:id="@+id/senders"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:textSize="18sp"
- android:lines="1"
- android:includeFontPadding="false"
- android:text="@string/long_string"
- style="@style/ConversationListSendersStyle" />
-
- <ImageView
- android:id="@+id/info_icon"
- android:layout_width="14dp"
- android:layout_height="14dp"
- android:layout_marginTop="14dp"
- style="@style/ConversationListInfoIconStyle" />
-
- <TextView
- android:id="@+id/date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:textSize="12sp"
- android:lines="1"
- android:includeFontPadding="false"
- android:text="@string/long_string"
- style="@style/ConversationListDateStyle" />
-
- <!-- top margin should be 16dp, but the asset has 8dp built-in padding -->
- <!-- left padding should be 8dp, but the asset has 2dp built-in padding -->
- <ImageView
- android:id="@+id/paperclip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:src="@drawable/ic_attach_file_20dp"
- style="@style/ConversationListPaperclipStyle" />
-
- <!-- for Email -->
- <View android:id="@+id/color_block"
- android:layout_width="@dimen/color_block_width"
- android:layout_height="@dimen/color_block_height"
- style="@style/ConversationListColorBlockStyle" />
-
- </RelativeLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
- android:orientation="horizontal" >
-
- <TextView
- android:id="@+id/subject"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:lines="2"
- android:textSize="13sp"
- android:includeFontPadding="false"
- android:text="@string/long_string" />
-
- <ImageView
- android:id="@+id/star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="-1dp"
- android:src="@drawable/ic_star_outline_20dp"
- style="@style/ConversationListSpaciousStarStyle"/>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
- <!-- There are 16dp bottom margins here for when there are no labels -->
-
- <include
- layout="@layout/conversation_attachment_previews"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/attachment_preview_margin_top_spacious"/>
-
- <!-- Margin between attachment previews and folders. 16dp bottom margins match above -->
- <View
- android:id="@+id/attachment_previews_bottom_margin"
- android:layout_width="0dp"
- android:layout_height="@dimen/attachment_preview_margin_bottom"
- android:layout_marginBottom="16dp"
- android:visibility="gone" />
-
- <!-- Labels should be ~5dp below the subject *baseline*, so we cancel out part of the 16dp bottom margin -->
- <TextView
- android:id="@+id/folders"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="-14dp"
- android:fontFamily="sans-serif-light"
- android:includeFontPadding="false"
- android:text="@string/long_string"
- android:textSize="11sp"
- android:lines="1"
- android:minHeight="16dp" />
-
-</LinearLayout>
diff --git a/res/layout/conversation_item_view_wide.xml b/res/layout/conversation_item_view_wide.xml
deleted file mode 100644
index 5560e9fe7..000000000
--- a/res/layout/conversation_item_view_wide.xml
+++ /dev/null
@@ -1,199 +0,0 @@
-<?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.
--->
-
-<!-- This layout is used as a template to create custom view CanvasConversationHeaderView
- in normal mode. To be able to get the correct measurements, every source field should
- be populated with data here. E.g:
- - Text View should set text to a random long string (android:text="@string/long_string")
- - Image View should set source to a specific asset -->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingBottom="1dp"
- android:orientation="vertical">
-
- <FrameLayout
- android:id="@+id/conversation_item_frame"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- style="@style/ConversationListWideStyle" >
-
- <!-- minHeight here is to ensure more consistent item heights across gadget choices -->
- <!-- and between 'normal' vs. 'wide' layouts (which is important during 2-pane -->
- <!-- transitions) -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:minHeight="66dp"
- android:gravity="center_vertical">
-
- <View
- android:id="@+id/contact_image"
- android:layout_width="46dp"
- android:layout_height="46dp"
- android:layout_marginTop="10dp"
- android:layout_marginBottom="10dp"
- style="@style/ConversationListWideContactImageStyle" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:layout_marginBottom="10dp"
- android:baselineAligned="false"
- android:gravity="top"
- android:orientation="horizontal">
-
- <!-- for Email -->
- <!-- cancel out the asset's 2dp built-in padding -->
- <ImageView
- android:id="@+id/reply_state"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="-2dp"
- android:src="@drawable/ic_badge_reply_holo_light"
- style="@style/ConversationListReplyStateStyle" />
-
- <LinearLayout
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical" >
- <TextView
- android:id="@+id/senders"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18sp"
- android:lines="1"
- android:includeFontPadding="false"
- android:text="@string/long_string" />
- <TextView
- android:id="@+id/badge"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:lines="1"
- android:includeFontPadding="false"
- android:text="@string/long_string" />
- </LinearLayout>
-
- <FrameLayout
- android:layout_width="54dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical">
-
- <!-- for Gmail -->
- <ImageView
- android:id="@+id/personal_indicator"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/ic_email_caret_single"
- style="@style/ConversationListWidePersonalIndicatorStyle" />
-
- </FrameLayout>
-
- <TextView
- android:id="@+id/subject"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="2"
- android:lines="2"
- android:textSize="14sp"
- android:includeFontPadding="false"
- android:text="@string/long_string" />
-
- <!-- cancel out the asset's 8dp built-in top padding -->
- <!-- left padding should be 8dp, but the asset has 2dp built-in padding -->
- <ImageView
- android:id="@+id/paperclip"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="-8dp"
- android:src="@drawable/ic_attach_file_20dp"
- style="@style/ConversationListWidePaperclipStyle" />
-
- <!-- The date should never appear truncated. -->
- <TextView
- android:id="@+id/date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="12sp"
- android:lines="1"
- android:includeFontPadding="false"
- android:text="@string/date"
- style="@style/ConversationListWideDateStyle" />
-
- <ImageView
- android:id="@+id/info_icon"
- android:layout_width="14dp"
- android:layout_height="14dp"
- android:layout_marginTop="-3dp"
- style="@style/ConversationListWideInfoIconStyle" />
-
- <!-- align to bottom of subject text -->
- <ImageView
- android:id="@+id/star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="2dp"
- android:src="@drawable/ic_star_outline_20dp"
- style="@style/ConversationListWideStarStyle"/>
-
- </LinearLayout>
-
- </LinearLayout>
-
- <!-- for Email -->
- <!-- aligned to be above the date (32dp(star asset) + 32dp(star left margin) = 64dp) -->
- <View android:id="@+id/color_block"
- android:layout_width="@dimen/color_block_width"
- android:layout_height="@dimen/color_block_height"
- style="@style/ConversationListWideColorBlockStyle" />
-
- </FrameLayout>
- <!-- There are 10dp bottom margins here for when there are no folders -->
-
- <include
- layout="@layout/conversation_attachment_previews"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/attachment_preview_margin_top_wide"/>
-
- <!-- Margin between attachment previews and folders. 10dp bottom margins match above -->
- <View
- android:id="@+id/attachment_previews_bottom_margin"
- android:layout_width="0dp"
- android:layout_height="@dimen/attachment_preview_margin_bottom_wide"
- android:layout_marginBottom="10dp"
- android:visibility="gone" />
-
- <!-- Folders should be 0dp below the subject, so we cancel out the 10dp bottom margin above -->
- <TextView
- android:id="@+id/folders"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="-10dp"
- android:fontFamily="sans-serif-light"
- android:includeFontPadding="false"
- android:text="@string/long_string"
- android:textSize="12sp"
- android:lines="1"
- android:minHeight="16dp" />
-
-</LinearLayout>
diff --git a/res/layout/conversation_message_upper_header.xml b/res/layout/conversation_message_upper_header.xml
index 44b61356a..a57b8188d 100644
--- a/res/layout/conversation_message_upper_header.xml
+++ b/res/layout/conversation_message_upper_header.xml
@@ -23,8 +23,8 @@
<com.android.mail.browse.MessageHeaderContactBadge
android:id="@+id/photo"
- android:layout_width="@dimen/message_header_contact_photo_width"
- android:layout_height="@dimen/message_header_contact_photo_height"
+ android:layout_width="@dimen/contact_image_width"
+ android:layout_height="@dimen/contact_image_height"
android:layout_marginTop="@dimen/message_header_contact_photo_margin"
android:layout_marginBottom="@dimen/message_header_contact_photo_margin"
android:background="?android:attr/selectableItemBackground"
@@ -42,8 +42,8 @@
<!-- draft should match photo in dimensions -->
<ImageView
android:id="@+id/draft"
- android:layout_width="@dimen/message_header_contact_photo_width"
- android:layout_height="@dimen/message_header_contact_photo_height"
+ android:layout_width="@dimen/contact_image_width"
+ android:layout_height="@dimen/contact_image_height"
android:layout_marginTop="@dimen/message_header_contact_photo_margin"
android:layout_marginBottom="@dimen/message_header_contact_photo_margin"
android:visibility="gone"
diff --git a/res/layout/widget.xml b/res/layout/widget.xml
index 425eae166..678a90ac4 100644
--- a/res/layout/widget.xml
+++ b/res/layout/widget.xml
@@ -28,7 +28,7 @@
<LinearLayout
android:id="@+id/widget_header"
android:layout_width="match_parent"
- android:layout_height="48dp"
+ android:layout_height="48sp"
android:orientation="horizontal"
android:paddingLeft="8dip"
android:paddingRight="8dip"
diff --git a/res/layout/widget_conversation_list_item.xml b/res/layout/widget_conversation_list_item.xml
index 891db59a2..8d6cbb239 100644
--- a/res/layout/widget_conversation_list_item.xml
+++ b/res/layout/widget_conversation_list_item.xml
@@ -44,27 +44,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
+ android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp"
android:gravity="top"
android:orientation="horizontal" >
<TextView
android:id="@+id/widget_senders"
- android:layout_width="0dip"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="end"
android:textSize="@dimen/senders_font_size"
- android:textColor="#58585b"
android:includeFontPadding="false"
style="@style/WidgetSendersStyle" />
- <!-- Use negative margins to align attachment icon with text -->
<ImageView
android:id="@+id/widget_attachment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="-4sp"/>
+ android:layout_marginTop="4sp"
+ style="@style/WidgetAttachStyle"/>
<TextView
android:id="@+id/widget_date"
android:layout_width="wrap_content"
@@ -76,30 +75,40 @@
android:id="@+id/widget_subject"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:maxLines="2"
+ android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp"
+ android:maxLines="1"
android:includeFontPadding="false" />
+
+ <TextView
+ android:id="@+id/widget_snippet"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp"
+ android:includeFontPadding="false"
+ android:maxLines="1"/>
+
<LinearLayout
android:id="@+id/labels"
android:layout_width="wrap_content"
- android:layout_height="0dip"
+ android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="right|end"
android:gravity="bottom" >
<ImageView
android:id="@+id/widget_folder_0"
- android:layout_width="32dip"
+ android:layout_width="32dp"
android:layout_height="6sp"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/widget_folder_1"
- android:layout_width="32dip"
+ android:layout_width="32dp"
android:layout_height="6sp"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/widget_folder_2"
- android:layout_width="32dip"
+ android:layout_width="32dp"
android:layout_height="6sp"
android:scaleType="fitXY" />
</LinearLayout>
diff --git a/res/values-ldrtl/styles-ldrtl.xml b/res/values-ldrtl/styles-ldrtl.xml
index 0196f29e8..818730e4e 100644
--- a/res/values-ldrtl/styles-ldrtl.xml
+++ b/res/values-ldrtl/styles-ldrtl.xml
@@ -244,6 +244,10 @@
<item name="android:paddingEnd">@dimen/widget_senders_padding_end</item>
</style>
+ <style name="WidgetAttachStyle">
+ <item name="android:paddingEnd">@dimen/widget_attachment_padding_end</item>
+ </style>
+
<style name="SearchStatusStyle">
<item name="android:paddingStart">@dimen/search_results_padding</item>
</style>
@@ -291,8 +295,21 @@
<item name="android:layout_alignParentEnd">true</item>
</style>
+ <style name="ConversationListSubjectStyle">
+ <item name="android:layout_alignParentTop">true</item>
+ <item name="android:layout_alignParentStart">true</item>
+ <item name="android:layout_toStartOf">@id/star</item>
+ </style>
+
+ <style name="ConversationListSnippetStyle">
+ <item name="android:layout_below">@id/subject</item>
+ <item name="android:layout_alignParentStart">true</item>
+ <item name="android:layout_toStartOf">@id/star</item>
+ </style>
+
<style name="ConversationListStarStyle">
- <item name="android:layout_marginEnd">@dimen/conv_list_star_padding_end</item>
+ <item name="android:layout_alignParentBottom">true</item>
+ <item name="android:layout_alignParentEnd">true</item>
</style>
<style name="AttachmentPreviewOverflowStyle">
diff --git a/res/values-sw600dp/dimen.xml b/res/values-sw600dp/dimen.xml
index e8724e78a..855e5e6bc 100644
--- a/res/values-sw600dp/dimen.xml
+++ b/res/values-sw600dp/dimen.xml
@@ -22,8 +22,6 @@
<dimen name="conversation_header_padding_side">24dp</dimen>
<dimen name="conversation_page_gutter">0dip</dimen>
<dimen name="message_header_inner_side_padding">16dp</dimen>
- <dimen name="message_header_contact_photo_width">64dp</dimen>
- <dimen name="message_header_contact_photo_height">64dp</dimen>
<dimen name="message_header_action_button_width">56dp</dimen>
<dimen name="message_header_action_button_height">56dp</dimen>
<dimen name="message_details_header_padding_start_expanded">104dip</dimen>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 99e2c64ed..7bcf3bb5c 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -22,12 +22,9 @@
<!-- if you want to make something blue, please try to use THIS blue -->
<color name="mail_app_blue">@android:color/holo_blue_light</color>
<!-- Conversation List Item Colors -->
- <color name="subject_text_color_unread">@color/dark_gray_text_color</color>
- <color name="snippet_text_color_unread">#777777</color>
- <color name="senders_text_color_unread">@color/dark_gray_text_color</color>
- <color name="subject_text_color_read">@color/subject_text_color_unread</color>
- <color name="snippet_text_color_read">@color/snippet_text_color_unread</color>
- <color name="senders_text_color_read">@color/senders_text_color_unread</color>
+ <color name="senders_text_color">#212121</color>
+ <color name="subject_text_color">#212121</color>
+ <color name="snippet_text_color">#757575</color>
<color name="date_text_color_unread">#4285F4</color>
<color name="date_text_color_read">#757575</color>
<color name="message_info_text_color">@color/gray_text_color</color>
diff --git a/res/values/dimen.xml b/res/values/dimen.xml
index 394c8cfbe..5378d8222 100644
--- a/res/values/dimen.xml
+++ b/res/values/dimen.xml
@@ -62,8 +62,8 @@
<dimen name="super_collapsed_height">30sp</dimen>
<dimen name="super_collapsed_text_size">14sp</dimen>
<dimen name="notification_view_height">36dip</dimen>
- <dimen name="message_header_contact_photo_width">40dp</dimen>
- <dimen name="message_header_contact_photo_height">40dp</dimen>
+ <dimen name="contact_image_width">40dp</dimen>
+ <dimen name="contact_image_height">40dp</dimen>
<dimen name="message_header_contact_photo_margin">16dp</dimen>
<dimen name="message_header_inner_side_padding">16dp</dimen>
<dimen name="attachment_toast_yoffset">-100dip</dimen>
@@ -100,7 +100,6 @@
<dimen name="tile_divider_width">1dp</dimen>
<dimen name="attachment_preview_height_tall">124dip</dimen>
- <dimen name="attachment_preview_height_tall_wide">168dip</dimen>
<dimen name="attachment_preview_height_short">28dip</dimen>
<!-- Margin of 8dp with 12dp cancelled out -->
<dimen name="attachment_preview_margin_top">-4dip</dimen>
@@ -156,6 +155,7 @@
<dimen name="compose_recipient_heading_margin_end">4dip</dimen>
<dimen name="widget_senders_padding_end">16dip</dimen>
+ <dimen name="widget_attachment_padding_end">8dp</dimen>
<dimen name="search_results_padding">8dip</dimen>
@@ -163,14 +163,13 @@
<dimen name="conv_list_padding">16dip</dimen>
<dimen name="conv_list_card_border_padding">8dip</dimen>
<dimen name="conv_list_no_border_padding">0dip</dimen>
- <dimen name="conv_list_contact_image_padding_end">12dip</dimen>
+ <dimen name="conv_list_contact_image_padding_end">16dp</dimen>
<dimen name="conv_list_reply_state_padding_end">8dip</dimen>
<dimen name="conv_list_personal_indicator_padding_start">-2dip</dimen>
<dimen name="conv_list_personal_indicator_padding_end">2dip</dimen>
<dimen name="conv_list_info_icon_padding_start">4dip</dimen>
<dimen name="conv_list_date_padding_start">8dip</dimen>
<dimen name="conv_list_paperclip_padding_start">6dip</dimen>
- <dimen name="conv_list_star_padding_end">-9dip</dimen>
<dimen name="conv_list_wide_padding_start">20dip</dimen>
<dimen name="conv_list_wide_padding_end">32dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index bd19b07df..b1a5abf47 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -306,10 +306,8 @@
<!-- Formatting string. If the subject contains the tag of a mailing-list (text surrounded with
return the subject with that tag ellipsized, e.g. "[android-gmail-team] Hello" -> "[andr...] Hello" [CHAR LIMIT=100] -->
<string name="filtered_tag"> [<xliff:g id="tag">%1$s</xliff:g>]<xliff:g id="subject">%2$s</xliff:g></string>
- <!-- Displayed in conversation list item in the form of "subject - snippet" [CHAR LIMIT=5] -->
- <string name="subject_and_snippet"><xliff:g>%s</xliff:g> \u2014 <xliff:g>%s</xliff:g></string>
- <!-- Displayed in conversation list item in the form of "badge subject - snippet" [CHAR LIMIT=7] -->
- <string name="badge_subject_and_snippet"><xliff:g>%1$s</xliff:g> <xliff:g>%2$s</xliff:g> \u2014 <xliff:g>%3$s</xliff:g></string>
+ <!-- Displayed in conversation list item in the form of "badge subject" [CHAR LIMIT=7] -->
+ <string name="badge_and_subject"><xliff:g>%1$s</xliff:g> <xliff:g>%2$s</xliff:g></string>
<!-- Displayed in browse list item when the list item is a draft message instead of showing the subject [CHAR LIMIT=100] -->
<plurals name="draft">
<!-- Title of the screen when there is exactly one draft -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index cca2ad727..7e07d2608 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -477,21 +477,21 @@
</style>
<style name="SubjectAppearanceUnreadStyle">
- <item name="android:textColor">@color/subject_text_color_unread</item>
+ <item name="android:textColor">@color/subject_text_color</item>
<item name="android:textStyle">bold</item>
</style>
<style name="SubjectAppearanceReadStyle">
- <item name="android:textColor">@color/subject_text_color_read</item>
+ <item name="android:textColor">@color/subject_text_color</item>
</style>
<style name="SendersUnreadTextAppearance">
- <item name="android:textColor">@color/senders_text_color_unread</item>
+ <item name="android:textColor">@color/senders_text_color</item>
<item name="android:textStyle">bold</item>
</style>
<style name="SendersReadTextAppearance">
- <item name="android:textColor">@color/senders_text_color_read</item>
+ <item name="android:textColor">@color/senders_text_color</item>
</style>
<style name="NotificationSendersUnreadTextAppearance">
@@ -793,6 +793,10 @@
<item name="android:paddingRight">@dimen/widget_senders_padding_end</item>
</style>
+ <style name="WidgetAttachStyle">
+ <item name="android:paddingRight">@dimen/widget_attachment_padding_end</item>
+ </style>
+
<style name="SearchStatusStyle">
<item name="android:paddingLeft">@dimen/search_results_padding</item>
</style>
@@ -840,8 +844,21 @@
<item name="android:layout_alignParentRight">true</item>
</style>
+ <style name="ConversationListSubjectStyle">
+ <item name="android:layout_alignParentTop">true</item>
+ <item name="android:layout_alignParentLeft">true</item>
+ <item name="android:layout_toLeftOf">@id/star</item>
+ </style>
+
+ <style name="ConversationListSnippetStyle">
+ <item name="android:layout_below">@id/subject</item>
+ <item name="android:layout_alignParentLeft">true</item>
+ <item name="android:layout_toLeftOf">@id/star</item>
+ </style>
+
<style name="ConversationListStarStyle">
- <item name="android:layout_marginRight">@dimen/conv_list_star_padding_end</item>
+ <item name="android:layout_alignParentBottom">true</item>
+ <item name="android:layout_alignParentRight">true</item>
</style>
<style name="AttachmentPreviewOverflowStyle">
diff --git a/src/com/android/mail/browse/ConversationItemView.java b/src/com/android/mail/browse/ConversationItemView.java
index 56872153e..849174ff8 100644
--- a/src/com/android/mail/browse/ConversationItemView.java
+++ b/src/com/android/mail/browse/ConversationItemView.java
@@ -39,7 +39,7 @@ import android.graphics.Shader;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
-import android.support.v4.text.BidiFormatter;
+import android.support.v4.text.TextUtilsCompat;
import android.support.v4.view.ViewCompat;
import android.text.Layout.Alignment;
import android.text.Spannable;
@@ -102,6 +102,7 @@ import com.google.common.annotations.VisibleForTesting;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
public class ConversationItemView extends View
implements SwipeableItemView, ToggleableItem, InvalidateCallback, OnScrollListener,
@@ -141,8 +142,7 @@ public class ConversationItemView extends View
private static String sElidedPaddingToken;
// Static colors.
- private static int sSendersTextColorRead;
- private static int sSendersTextColorUnread;
+ private static int sSendersTextColor;
private static int sDateTextColorRead;
private static int sDateTextColorUnread;
private static int sStarTouchSlop;
@@ -202,9 +202,9 @@ public class ConversationItemView extends View
private float mAnimatedHeightFraction = 1.0f;
private final String mAccount;
private ControllableActivity mActivity;
- private final TextView mSubjectTextView;
private final TextView mSendersTextView;
- private final TextView mBadgeTextView;
+ private final TextView mSubjectTextView;
+ private final TextView mSnippetTextView;
private int mGadgetMode;
private boolean mAttachmentPreviewsEnabled;
private boolean mParallaxSpeedAlternative;
@@ -215,8 +215,7 @@ public class ConversationItemView extends View
private static TextAppearanceSpan sSubjectTextReadSpan;
private static TextAppearanceSpan sBadgeTextSpan;
private static BackgroundColorSpan sBadgeBackgroundSpan;
- private static ForegroundColorSpan sSnippetTextUnreadSpan;
- private static ForegroundColorSpan sSnippetTextReadSpan;
+ private static ForegroundColorSpan sSnippetTextSpan;
private static int sScrollSlop;
private static CharacterStyle sActivatedTextSpan;
@@ -399,15 +398,22 @@ public class ConversationItemView extends View
getItemViewResources(mContext);
+ final int layoutDir = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault());
+
mSendersTextView = new TextView(mContext);
mSendersTextView.setIncludeFontPadding(false);
mSubjectTextView = new TextView(mContext);
mSubjectTextView.setEllipsize(TextUtils.TruncateAt.END);
mSubjectTextView.setIncludeFontPadding(false);
+ ViewCompat.setLayoutDirection(mSubjectTextView, layoutDir);
+ ViewUtils.setTextAlignment(mSubjectTextView, View.TEXT_ALIGNMENT_VIEW_START);
- mBadgeTextView = new TextView(mContext);
- mBadgeTextView.setIncludeFontPadding(false);
+ mSnippetTextView = new TextView(mContext);
+ mSnippetTextView.setEllipsize(TextUtils.TruncateAt.END);
+ mSnippetTextView.setIncludeFontPadding(false);
+ ViewCompat.setLayoutDirection(mSnippetTextView, layoutDir);
+ ViewUtils.setTextAlignment(mSnippetTextView, View.TEXT_ALIGNMENT_VIEW_START);
mAttachmentsView = new AttachmentGridDrawable(res, PLACEHOLDER, PROGRESS_BAR);
mAttachmentsView.setCallback(this);
@@ -459,9 +465,8 @@ public class ConversationItemView extends View
// Initialize colors.
sActivatedTextSpan = CharacterStyle.wrap(new ForegroundColorSpan(
- res.getColor(R.color.senders_text_color_read)));
- sSendersTextColorRead = res.getColor(R.color.senders_text_color_read);
- sSendersTextColorUnread = res.getColor(R.color.senders_text_color_unread);
+ res.getColor(R.color.senders_text_color)));
+ sSendersTextColor = res.getColor(R.color.senders_text_color);
sSubjectTextUnreadSpan = new TextAppearanceSpan(context,
R.style.SubjectAppearanceUnreadStyle);
sBadgeTextSpan = new TextAppearanceSpan(context, R.style.BadgeTextStyle);
@@ -469,10 +474,7 @@ public class ConversationItemView extends View
res.getColor(R.color.badge_background_color));
sSubjectTextReadSpan = new TextAppearanceSpan(
context, R.style.SubjectAppearanceReadStyle);
- sSnippetTextUnreadSpan =
- new ForegroundColorSpan(res.getColor(R.color.snippet_text_color_unread));
- sSnippetTextReadSpan =
- new ForegroundColorSpan(res.getColor(R.color.snippet_text_color_read));
+ sSnippetTextSpan = new ForegroundColorSpan(res.getColor(R.color.snippet_text_color));
sDateTextColorRead = res.getColor(R.color.date_text_color_read);
sDateTextColorUnread = res.getColor(R.color.date_text_color_unread);
sStarTouchSlop = res.getDimensionPixelSize(R.dimen.star_touch_slop);
@@ -777,7 +779,7 @@ public class ConversationItemView extends View
Utils.traceBeginSection("subject");
createSubject(mHeader.unread);
- createBadge();
+ createSnippet();
if (!mHeader.isLayoutValid()) {
setContentDescription();
@@ -1060,17 +1062,10 @@ public class ConversationItemView extends View
}
private void createSubject(final boolean isUnread) {
- // Need to check if we're in wide mode because the badge
- // does not get added if we're in wide mode.
- final BidiFormatter bidiFormatter = mAdapter.getBidiFormatter();
- final String badgeText = mCoordinates.isWideMode() || mHeader.badgeText == null ? "" :
- bidiFormatter.unicodeWrap(mHeader.badgeText);
- final String subject = bidiFormatter.unicodeWrap(
- filterTag(getContext(), mHeader.conversation.subject));
- final String snippet = bidiFormatter.unicodeWrap(mHeader.conversation.getSnippet());
+ final String badgeText = mHeader.badgeText == null ? "" : mHeader.badgeText;
+ final String subject = filterTag(getContext(), mHeader.conversation.subject);
final Spannable displayedStringBuilder = new SpannableString(
- Conversation.getSubjectAndSnippetForDisplay(
- mContext, badgeText, subject, snippet));
+ Conversation.getSubjectForDisplay(mContext, badgeText, subject));
// since spans affect text metrics, add spans to the string before measure/layout or fancy
// ellipsizing
@@ -1084,14 +1079,6 @@ public class ConversationItemView extends View
isUnread ? sSubjectTextUnreadSpan : sSubjectTextReadSpan),
badgeTextLength, subjectTextLength, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
- if (!TextUtils.isEmpty(snippet)) {
- final int startOffset = subjectTextLength;
- // Start after the end of the subject text; since the subject may be
- // "" or null, this could start at the 0th character in the subjectText string
- displayedStringBuilder.setSpan(ForegroundColorSpan.wrap(
- isUnread ? sSnippetTextUnreadSpan : sSnippetTextReadSpan), startOffset,
- displayedStringBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- }
if (isActivated() && showActivatedText()) {
displayedStringBuilder.setSpan(sActivatedTextSpan, badgeTextLength,
displayedStringBuilder.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
@@ -1107,23 +1094,25 @@ public class ConversationItemView extends View
mSubjectTextView.setText(displayedStringBuilder);
}
- private void createBadge() {
- // Do not create badge if in wide mode or badge text is empty.
- final String badgeText = mHeader.badgeText;
- if (!mCoordinates.isWideMode() || TextUtils.isEmpty(badgeText)) {
- return;
- }
+ private void createSnippet() {
+ final String snippet = mHeader.conversation.getSnippet();
+ final Spannable displayedStringBuilder = new SpannableString(snippet);
- final Spannable displayedBadgeString = new SpannableString(badgeText);
- formatBadgeText(displayedBadgeString, badgeText);
+ if (!TextUtils.isEmpty(snippet)) {
+ // Start after the end of the subject text; since the subject may be
+ // "" or null, this could start at the 0th character in the subjectText string
+ displayedStringBuilder.setSpan(ForegroundColorSpan.wrap(sSnippetTextSpan), 0,
+ displayedStringBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
- final int badgeWidth = mCoordinates.badgeWidth;
- final int badgeHeight = mCoordinates.badgeHeight;
- mBadgeTextView.setLayoutParams(new ViewGroup.LayoutParams(badgeWidth, badgeHeight));
- mBadgeTextView.setMaxLines(mCoordinates.badgeLineCount);
- layoutViewExactly(mBadgeTextView, badgeWidth, badgeHeight);
+ final int snippetWidth = mCoordinates.snippetWidth;
+ final int snippetHeight = mCoordinates.snippetHeight;
+ mSnippetTextView.setLayoutParams(new ViewGroup.LayoutParams(snippetWidth, snippetHeight));
+ mSnippetTextView.setMaxLines(mCoordinates.snippetLineCount);
+ mSnippetTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mCoordinates.snippetFontSize);
+ layoutViewExactly(mSnippetTextView, snippetWidth, snippetHeight);
- mBadgeTextView.setText(displayedBadgeString);
+ mSnippetTextView.setText(displayedStringBuilder);
}
private int formatBadgeText(Spannable displayedStringBuilder, String badgeText) {
@@ -1202,36 +1191,29 @@ public class ConversationItemView extends View
mPaperclipX = (isRtl) ? mDateX + mDateWidth + mCoordinates.datePaddingStart :
mDateX - ATTACHMENT.getWidth() - mCoordinates.datePaddingStart;
- if (mCoordinates.isWideMode()) {
- // In wide mode, the end of the senders should align with
- // the start of the subject and is based on a max width.
- mSendersWidth = mCoordinates.sendersWidth;
- mSendersX = mCoordinates.sendersX;
+ // In normal mode, the senders x and width is based
+ // on where the date/attachment icon start.
+ final int dateAttachmentStart;
+ // Have this end near the paperclip or date, not the folders.
+ if (mHeader.paperclip != null) {
+ // If there is a paperclip, the date/attachment start is at the start
+ // of the paperclip minus the paperclip padding.
+ // In RTL, it is at the end of the paperclip plus the paperclip padding.
+ dateAttachmentStart = (isRtl) ?
+ mPaperclipX + ATTACHMENT.getWidth() + mCoordinates.paperclipPaddingStart
+ : mPaperclipX - mCoordinates.paperclipPaddingStart;
} else {
- // In normal mode, the senders x and width is based
- // on where the date/attachment icon start.
- final int dateAttachmentStart;
- // Have this end near the paperclip or date, not the folders.
- if (mHeader.paperclip != null) {
- // If there is a paperclip, the date/attachment start is at the start
- // of the paperclip minus the paperclip padding.
- // In RTL, it is at the end of the paperclip plus the paperclip padding.
- dateAttachmentStart = (isRtl) ?
- mPaperclipX + ATTACHMENT.getWidth() + mCoordinates.paperclipPaddingStart
- : mPaperclipX - mCoordinates.paperclipPaddingStart;
- } else {
- // If no paperclip, just use the start of the date minus the date padding start.
- // In RTL mode, this is just the paperclipX.
- dateAttachmentStart = (isRtl) ?
- mPaperclipX : mDateX - mCoordinates.datePaddingStart;
- }
- // Senders width is the dateAttachmentStart - sendersX.
- // In RTL, it is sendersWidth + sendersX - dateAttachmentStart.
- mSendersWidth = (isRtl) ?
- mCoordinates.sendersWidth + mCoordinates.sendersX - dateAttachmentStart
- : dateAttachmentStart - mCoordinates.sendersX;
- mSendersX = (isRtl) ? dateAttachmentStart : mCoordinates.sendersX;
- }
+ // If no paperclip, just use the start of the date minus the date padding start.
+ // In RTL mode, this is just the paperclipX.
+ dateAttachmentStart = (isRtl) ?
+ mPaperclipX : mDateX - mCoordinates.datePaddingStart;
+ }
+ // Senders width is the dateAttachmentStart - sendersX.
+ // In RTL, it is sendersWidth + sendersX - dateAttachmentStart.
+ mSendersWidth = (isRtl) ?
+ mCoordinates.sendersWidth + mCoordinates.sendersX - dateAttachmentStart
+ : dateAttachmentStart - mCoordinates.sendersX;
+ mSendersX = (isRtl) ? dateAttachmentStart : mCoordinates.sendersX;
// Second pass to layout each fragment.
sPaint.setTextSize(mCoordinates.sendersFontSize);
@@ -1422,7 +1404,7 @@ public class ConversationItemView extends View
if (mHeader.sendersDisplayLayout != null) {
sPaint.setTextSize(mCoordinates.sendersFontSize);
sPaint.setTypeface(SendersView.getTypeface(isUnread));
- sPaint.setColor(isUnread ? sSendersTextColorUnread : sSendersTextColorRead);
+ sPaint.setColor(sSendersTextColor);
canvas.translate(mSendersX, mCoordinates.sendersY
+ mHeader.sendersDisplayLayout.getTopPadding());
mHeader.sendersDisplayLayout.draw(canvas);
@@ -1438,11 +1420,9 @@ public class ConversationItemView extends View
drawSubject(canvas);
canvas.restore();
- if (mCoordinates.isWideMode()) {
- canvas.save();
- drawBadge(canvas);
- canvas.restore();
- }
+ canvas.save();
+ drawSnippet(canvas);
+ canvas.restore();
// Folders.
if (mConfig.areFoldersVisible()) {
@@ -1489,8 +1469,7 @@ public class ConversationItemView extends View
sPaint.setTextSize(mCoordinates.dateFontSize);
sPaint.setTypeface(Typeface.DEFAULT);
sPaint.setColor(isUnread ? sDateTextColorUnread : sDateTextColorRead);
- drawText(canvas, mHeader.dateText, mDateX, mCoordinates.dateYBaseline,
- sPaint);
+ drawText(canvas, mHeader.dateText, mDateX, mCoordinates.dateYBaseline, sPaint);
// Paper clip icon.
if (mHeader.paperclip != null) {
@@ -1577,9 +1556,9 @@ public class ConversationItemView extends View
mSubjectTextView.draw(canvas);
}
- private void drawBadge(Canvas canvas) {
- canvas.translate(mCoordinates.badgeLeft, mCoordinates.badgeTop);
- mBadgeTextView.draw(canvas);
+ private void drawSnippet(Canvas canvas) {
+ canvas.translate(mCoordinates.snippetX, mCoordinates.snippetY);
+ mSnippetTextView.draw(canvas);
}
private void drawSenders(Canvas canvas) {
@@ -1736,20 +1715,11 @@ public class ConversationItemView extends View
}
if (mStarEnabled) {
- if (mCoordinates.isWideMode()) {
- // Just check that we're to start of the star's touch area
- if (isTouchInStarTargetX(isRtl, x)) {
- return false;
- }
- } else {
- // We're on a single pane device with the more condensed layout
+ // We allow touches all the way to the right edge, so no x check is necessary
- // We allow touches all the way to the right edge, so no x check is necessary
-
- // We need to be above the star's touch area, which ends at the top of the subject
- // text
- return y < mCoordinates.subjectY;
- }
+ // We need to be above the star's touch area, which ends at the top of the subject
+ // text
+ return y < mCoordinates.subjectY;
}
// With no star below the info icon, we allow touches anywhere from the top edge to the
@@ -1758,8 +1728,7 @@ public class ConversationItemView extends View
}
private boolean isTouchInStar(float x, float y) {
- if (mHeader.infoIcon != null
- && !mCoordinates.isWideMode()) {
+ if (mHeader.infoIcon != null) {
// We have an info icon, and it's above the star
// We allow touches everywhere below the top of the subject text
if (y < mCoordinates.subjectY) {
diff --git a/src/com/android/mail/browse/ConversationItemViewCoordinates.java b/src/com/android/mail/browse/ConversationItemViewCoordinates.java
index a35539a65..5a1624ac2 100644
--- a/src/com/android/mail/browse/ConversationItemViewCoordinates.java
+++ b/src/com/android/mail/browse/ConversationItemViewCoordinates.java
@@ -48,6 +48,8 @@ import com.google.common.base.Objects;
* @author phamm
*/
public class ConversationItemViewCoordinates {
+ private static final int SINGLE_LINE = 1;
+
// Modes
static final int MODE_COUNT = 2;
static final int WIDE_MODE = 0;
@@ -224,13 +226,6 @@ public class ConversationItemViewCoordinates {
final int sendersLineCount;
final float sendersFontSize;
- // Badge. optional.
- final int badgeLeft;
- final int badgeTop;
- final int badgeWidth;
- final int badgeHeight;
- final int badgeLineCount;
-
// Subject.
final int subjectX;
final int subjectY;
@@ -239,6 +234,14 @@ public class ConversationItemViewCoordinates {
final int subjectLineCount;
final float subjectFontSize;
+ // Snippet.
+ final int snippetX;
+ final int snippetY;
+ final int snippetWidth;
+ final int snippetHeight;
+ final int snippetLineCount;
+ final float snippetFontSize;
+
// Folders.
final int foldersLeft;
final int foldersRight;
@@ -331,16 +334,7 @@ public class ConversationItemViewCoordinates {
mMode = calculateMode(res, config);
- final int layoutId;
- if (isWideMode()) {
- layoutId = R.layout.conversation_item_view_wide;
- } else {
- if (config.getWidth() >= mMinListWidthIsSpacious) {
- layoutId = R.layout.conversation_item_view_normal_spacious;
- } else {
- layoutId = R.layout.conversation_item_view_normal;
- }
- }
+ final int layoutId = R.layout.conversation_item_view;
ViewGroup view = (ViewGroup) cache.getView(layoutId);
if (view == null) {
@@ -350,7 +344,7 @@ public class ConversationItemViewCoordinates {
// Show/hide optional views before measure/layout call
- final View attachmentPreviews = view.findViewById(R.id.attachment_previews);;
+ final View attachmentPreviews = view.findViewById(R.id.attachment_previews);
if (config.getAttachmentPreviewMode() != ATTACHMENT_PREVIEW_NONE) {
final LayoutParams params = attachmentPreviews.getLayoutParams();
attachmentPreviews.setVisibility(View.VISIBLE);
@@ -430,43 +424,33 @@ public class ConversationItemViewCoordinates {
sendersY = getY(senders) + sendersTopAdjust;
sendersWidth = senders.getWidth();
sendersHeight = senders.getHeight();
- sendersLineCount = getLineCount(senders);
+ sendersLineCount = SINGLE_LINE;
sendersFontSize = senders.getTextSize();
- final TextView badge = (TextView) view.findViewById(R.id.badge);
- if (badge != null) {
- badgeLeft = getX(badge);
- badgeTop = getY(badge);
- badgeWidth = senders.getWidth();
- badgeHeight = senders.getHeight();
- badgeLineCount = getLineCount(senders);
- } else {
- badgeLeft = badgeTop = badgeWidth = badgeHeight = badgeLineCount = 0;
- }
-
final TextView subject = (TextView) view.findViewById(R.id.subject);
final int subjectTopAdjust = getLatinTopAdjustment(subject);
subjectX = getX(subject);
- if (isWideMode()) {
- subjectY = getY(subject) + subjectTopAdjust;
- } else {
- subjectY = getY(subject) + sendersTopAdjust;
- }
+ subjectY = getY(subject) + sendersTopAdjust;
subjectWidth = subject.getWidth();
subjectHeight = subject.getHeight();
- subjectLineCount = getLineCount(subject);
+ subjectLineCount = SINGLE_LINE;
subjectFontSize = subject.getTextSize();
+ final TextView snippet = (TextView) view.findViewById(R.id.snippet);
+ final int snippetTopAdjust = getLatinTopAdjustment(snippet);
+ snippetX = getX(snippet);
+ snippetY = getY(snippet) + snippetTopAdjust;
+ snippetWidth = snippet.getWidth();
+ snippetHeight = snippet.getHeight();
+ snippetLineCount = SINGLE_LINE;
+ snippetFontSize = snippet.getTextSize();
+
if (config.areFoldersVisible()) {
// vertically align folders min left edge with subject
final boolean isRtl = ViewUtils.isViewRtl(view);
- foldersLeft = (isRtl) ? 0 : subjectX;
- foldersRight = (isRtl) ? subjectX + subjectWidth : getX(folders) + folders.getWidth();
- if (isWideMode()) {
- foldersY = getY(folders);
- } else {
- foldersY = getY(folders) + sendersTopAdjust;
- }
+ foldersLeft = (isRtl) ? 0 : snippetX;
+ foldersRight = (isRtl) ? snippetX + snippetWidth : getX(folders) + folders.getWidth();
+ foldersY = getY(folders) + sendersTopAdjust;
foldersHeight = folders.getHeight();
foldersTypeface = folders.getTypeface();
foldersTextBottomPadding = res
@@ -568,7 +552,7 @@ public class ConversationItemViewCoordinates {
progressBarHeight = 0;
}
- height = view.getHeight() + (isWideMode() ? 0 : sendersTopAdjust);
+ height = view.getHeight() + sendersTopAdjust;
Utils.traceEndSection();
}
@@ -592,10 +576,6 @@ public class ConversationItemViewCoordinates {
return mMode;
}
- public boolean isWideMode() {
- return mMode == WIDE_MODE;
- }
-
/**
* Returns a negative corrective value that you can apply to a TextView's vertical dimensions
* that will nudge the first line of text upwards such that uppercase Latin characters are
@@ -631,9 +611,7 @@ public class ConversationItemViewCoordinates {
final Resources res = context.getResources();
switch (attachmentPreviewMode) {
case ATTACHMENT_PREVIEW_UNREAD:
- return (int) (isWideMode()
- ? res.getDimension(R.dimen.attachment_preview_height_tall_wide)
- : res.getDimension(R.dimen.attachment_preview_height_tall));
+ return (int) res.getDimension(R.dimen.attachment_preview_height_tall);
case ATTACHMENT_PREVIEW_READ:
return (int) res.getDimension(R.dimen.attachment_preview_height_short);
default:
@@ -666,18 +644,6 @@ public class ConversationItemViewCoordinates {
}
/**
- * Returns the number of lines of this text view. Delegates to built-in TextView logic on JB+.
- */
- @SuppressLint("NewApi")
- private static int getLineCount(TextView textView) {
- if (Utils.isRunningJellybeanOrLater()) {
- return textView.getMaxLines();
- } else {
- return Math.round(((float) textView.getHeight()) / textView.getLineHeight());
- }
- }
-
- /**
* Returns the length (maximum of characters) of subject in this mode.
*/
public static int getSendersLength(Context context, int mode, boolean hasAttachments) {
diff --git a/src/com/android/mail/browse/MessageHeaderView.java b/src/com/android/mail/browse/MessageHeaderView.java
index 552d89fb7..323750086 100644
--- a/src/com/android/mail/browse/MessageHeaderView.java
+++ b/src/com/android/mail/browse/MessageHeaderView.java
@@ -241,12 +241,9 @@ public class MessageHeaderView extends SnapHeader implements OnClickListener,
mMyName = context.getString(R.string.me_object_pronoun);
final Resources res = getResources();
- mContactPhotoWidth = res.getDimensionPixelSize(
- R.dimen.message_header_contact_photo_width);
- mContactPhotoHeight = res.getDimensionPixelSize(
- R.dimen.message_header_contact_photo_height);
- mTitleContainerMarginEnd = res.getDimensionPixelSize(
- R.dimen.conversation_view_margin_side);
+ mContactPhotoWidth = res.getDimensionPixelSize(R.dimen.contact_image_width);
+ mContactPhotoHeight = res.getDimensionPixelSize(R.dimen.contact_image_height);
+ mTitleContainerMarginEnd = res.getDimensionPixelSize(R.dimen.conversation_view_margin_side);
}
@Override
diff --git a/src/com/android/mail/providers/Conversation.java b/src/com/android/mail/providers/Conversation.java
index ef92bc49a..3b10a19fb 100644
--- a/src/com/android/mail/providers/Conversation.java
+++ b/src/com/android/mail/providers/Conversation.java
@@ -179,8 +179,7 @@ public class Conversation implements Parcelable {
private transient boolean viewed;
- private static String sSubjectAndSnippet;
- private static String sBadgeSubjectAndSnippet;
+ private static String sBadgeAndSubject;
// Constituents of convFlags below
// Flag indicating that the item has been deleted, but will continue being
@@ -871,29 +870,20 @@ public class Conversation implements Parcelable {
}
/**
- * Get the properly formatted subject and snippet string for display a
- * conversation.
+ * Get the properly formatted badge and subject string for displaying a conversation.
*/
- public static String getSubjectAndSnippetForDisplay(Context context,
- String badgeText, String filteredSubject, String snippet) {
- if (TextUtils.isEmpty(filteredSubject) && TextUtils.isEmpty(snippet)) {
+ public static String getSubjectForDisplay(Context context, String badgeText,
+ String filteredSubject) {
+ if (TextUtils.isEmpty(filteredSubject)) {
return "";
- } else if (TextUtils.isEmpty(filteredSubject)) {
- return snippet;
- } else if (TextUtils.isEmpty(snippet)) {
- return filteredSubject;
} else if (!TextUtils.isEmpty(badgeText)) {
- if (sBadgeSubjectAndSnippet == null) {
- sBadgeSubjectAndSnippet = context.getString(R.string.badge_subject_and_snippet);
+ if (sBadgeAndSubject == null) {
+ sBadgeAndSubject = context.getString(R.string.badge_and_subject);
}
- return String.format(sBadgeSubjectAndSnippet, badgeText, filteredSubject, snippet);
+ return String.format(sBadgeAndSubject, badgeText, filteredSubject);
}
- if (sSubjectAndSnippet == null) {
- sSubjectAndSnippet = context.getString(R.string.subject_and_snippet);
- }
-
- return String.format(sSubjectAndSnippet, filteredSubject, snippet);
+ return filteredSubject;
}
/**
diff --git a/src/com/android/mail/utils/ViewUtils.java b/src/com/android/mail/utils/ViewUtils.java
index 6f1aaed9a..ce2bc6281 100644
--- a/src/com/android/mail/utils/ViewUtils.java
+++ b/src/com/android/mail/utils/ViewUtils.java
@@ -49,4 +49,14 @@ public class ViewUtils {
public static int getPaddingEnd(View view) {
return Utils.isRunningJBMR1OrLater() ? view.getPaddingEnd() : view.getPaddingRight();
}
+
+ /**
+ * Sets the text alignment of the view. Prior to API 17, will no-op.
+ */
+ @SuppressLint("NewApi")
+ public static void setTextAlignment(View view, int textAlignment) {
+ if (Utils.isRunningJBMR1OrLater()) {
+ view.setTextAlignment(textAlignment);
+ }
+ }
}
diff --git a/src/com/android/mail/widget/WidgetConversationListItemViewBuilder.java b/src/com/android/mail/widget/WidgetConversationListItemViewBuilder.java
index 03af955e0..ea7c347b2 100644
--- a/src/com/android/mail/widget/WidgetConversationListItemViewBuilder.java
+++ b/src/com/android/mail/widget/WidgetConversationListItemViewBuilder.java
@@ -38,21 +38,15 @@ import com.android.mail.ui.FolderDisplayer;
import com.android.mail.utils.FolderUri;
public class WidgetConversationListItemViewBuilder {
- // Static font sizes
- private static int DATE_FONT_SIZE;
- private static int SUBJECT_FONT_SIZE;
-
// Static colors
- private static int SUBJECT_TEXT_COLOR_READ;
- private static int SUBJECT_TEXT_COLOR_UNREAD;
+ private static int SUBJECT_TEXT_COLOR;
+ private static int SNIPPET_TEXT_COLOR;
private static int DATE_TEXT_COLOR_READ;
private static int DATE_TEXT_COLOR_UNREAD;
// Static bitmap
private static Bitmap ATTACHMENT;
- private final Context mContext;
-
private WidgetFolderDisplayer mFolderDisplayer;
/**
@@ -117,16 +111,11 @@ public class WidgetConversationListItemViewBuilder {
* Get font sizes and bitmaps from Resources
*/
public WidgetConversationListItemViewBuilder(Context context) {
- mContext = context;
- Resources res = context.getResources();
-
- // Initialize font sizes
- DATE_FONT_SIZE = res.getDimensionPixelSize(R.dimen.widget_date_font_size);
- SUBJECT_FONT_SIZE = res.getDimensionPixelSize(R.dimen.widget_subject_font_size);
+ final Resources res = context.getResources();
// Initialize colors
- SUBJECT_TEXT_COLOR_READ = res.getColor(R.color.subject_text_color_read);
- SUBJECT_TEXT_COLOR_UNREAD = res.getColor(R.color.subject_text_color_unread);
+ SUBJECT_TEXT_COLOR = res.getColor(R.color.subject_text_color);
+ SNIPPET_TEXT_COLOR = res.getColor(R.color.snippet_text_color);
DATE_TEXT_COLOR_READ = res.getColor(R.color.date_text_color_read);
DATE_TEXT_COLOR_UNREAD = res.getColor(R.color.date_text_color_unread);
@@ -151,34 +140,39 @@ public class WidgetConversationListItemViewBuilder {
/*
* Return the full View
*/
- public RemoteViews getStyledView(final CharSequence date, final Conversation conversation,
- final FolderUri folderUri, final int ignoreFolderType,
+ public RemoteViews getStyledView(final Context context, final CharSequence date,
+ final Conversation conversation, final FolderUri folderUri, final int ignoreFolderType,
final SpannableStringBuilder senders, final String subject) {
final boolean isUnread = !conversation.read;
final String snippet = conversation.getSnippet();
final boolean hasAttachments = conversation.hasAttachments;
+ final Resources res = context.getResources();
+ final int dateFontSize = res.getDimensionPixelSize(R.dimen.widget_date_font_size);
+ final int subjectFontSize = res.getDimensionPixelSize(R.dimen.widget_subject_font_size);
// Add style to date
final int dateColor = isUnread ? DATE_TEXT_COLOR_UNREAD : DATE_TEXT_COLOR_READ;
- final CharSequence styledDate = addStyle(date, DATE_FONT_SIZE, dateColor);
+ final CharSequence styledDate = addStyle(date, dateFontSize, dateColor);
// Add style to subject
- final int subjectColor = isUnread ? SUBJECT_TEXT_COLOR_UNREAD : SUBJECT_TEXT_COLOR_READ;
final BidiFormatter bidiFormatter = BidiFormatter.getInstance();
final String filteredSubject =
TextUtils.isEmpty(subject) ? "" : bidiFormatter.unicodeWrap(subject);
- final SpannableStringBuilder subjectAndSnippet = new SpannableStringBuilder(
- Conversation.getSubjectAndSnippetForDisplay(
- mContext, null /* badgeText */, filteredSubject,
- bidiFormatter.unicodeWrap(snippet)));
+ final SpannableStringBuilder subjectBuilder = new SpannableStringBuilder(
+ Conversation.getSubjectForDisplay(context, null /* badgeText */, filteredSubject));
if (isUnread) {
- subjectAndSnippet.setSpan(new StyleSpan(Typeface.BOLD), 0, filteredSubject.length(),
+ subjectBuilder.setSpan(new StyleSpan(Typeface.BOLD), 0, filteredSubject.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
- subjectAndSnippet.setSpan(new ForegroundColorSpan(subjectColor), 0, subjectAndSnippet
- .length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- final CharSequence styledSubject = addStyle(subjectAndSnippet, SUBJECT_FONT_SIZE, 0);
+ subjectBuilder.setSpan(new ForegroundColorSpan(SUBJECT_TEXT_COLOR), 0,
+ subjectBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ final CharSequence styledSubject = addStyle(subjectBuilder, subjectFontSize, 0);
+
+ final SpannableStringBuilder snippetBuilder = new SpannableStringBuilder(snippet);
+ snippetBuilder.setSpan(new ForegroundColorSpan(SNIPPET_TEXT_COLOR), 0,
+ snippetBuilder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ final CharSequence styledSnippet = addStyle(snippetBuilder, subjectFontSize, 0);
// Paper clip for attachment
Bitmap paperclipBitmap = null;
@@ -188,10 +182,11 @@ public class WidgetConversationListItemViewBuilder {
// Inflate and fill out the remote view
final RemoteViews remoteViews = new RemoteViews(
- mContext.getPackageName(), R.layout.widget_conversation_list_item);
+ context.getPackageName(), R.layout.widget_conversation_list_item);
remoteViews.setTextViewText(R.id.widget_senders, senders);
remoteViews.setTextViewText(R.id.widget_date, styledDate);
remoteViews.setTextViewText(R.id.widget_subject, styledSubject);
+ remoteViews.setTextViewText(R.id.widget_snippet, styledSnippet);
if (paperclipBitmap != null) {
remoteViews.setViewVisibility(R.id.widget_attachment, View.VISIBLE);
remoteViews.setImageViewBitmap(R.id.widget_attachment, paperclipBitmap);
@@ -205,8 +200,8 @@ public class WidgetConversationListItemViewBuilder {
remoteViews.setViewVisibility(R.id.widget_unread_background, View.GONE);
remoteViews.setViewVisibility(R.id.widget_read_background, View.VISIBLE);
}
- if (mContext.getResources().getBoolean(R.bool.display_folder_colors_in_widget)) {
- mFolderDisplayer = new WidgetFolderDisplayer(mContext);
+ if (context.getResources().getBoolean(R.bool.display_folder_colors_in_widget)) {
+ mFolderDisplayer = new WidgetFolderDisplayer(context);
mFolderDisplayer.loadConversationFolders(conversation, folderUri, ignoreFolderType);
mFolderDisplayer.displayFolders(remoteViews);
}
diff --git a/src/com/android/mail/widget/WidgetService.java b/src/com/android/mail/widget/WidgetService.java
index f5eda01b4..c33a09fe2 100644
--- a/src/com/android/mail/widget/WidgetService.java
+++ b/src/com/android/mail/widget/WidgetService.java
@@ -431,8 +431,8 @@ public class WidgetService extends RemoteViewsService {
}
// Load up our remote view.
- RemoteViews remoteViews = mWidgetConversationListItemViewBuilder.getStyledView(date,
- conversation, new FolderUri(mFolderUri), ignoreFolderType,
+ RemoteViews remoteViews = mWidgetConversationListItemViewBuilder.getStyledView(
+ mContext, date, conversation, new FolderUri(mFolderUri), ignoreFolderType,
senderBuilder,
ConversationItemView.filterTag(mContext, conversation.subject));