From bd9b2ff2b31b8db24471f74d35b4f6c220a1d2e3 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Wed, 5 Jan 2011 10:47:08 -0800 Subject: [PATCH] Add final backgrounds to message list items Bug: 3137994 Change-Id: Ife96b23815999290fc1d263ca6d8f4cedaef1b20 --- res/drawable/message_list_read_selector.xml | 23 +++++++++++++++++++ res/drawable/message_list_unread_selector.xml | 23 +++++++++++++++++++ .../message_list_wide_read_selector.xml | 21 +++++++++++++++++ .../message_list_wide_unread_selector.xml | 21 +++++++++++++++++ .../email/activity/MessageListItem.java | 23 +++++++++++++++++++ 5 files changed, 111 insertions(+) create mode 100644 res/drawable/message_list_read_selector.xml create mode 100644 res/drawable/message_list_unread_selector.xml create mode 100644 res/drawable/message_list_wide_read_selector.xml create mode 100644 res/drawable/message_list_wide_unread_selector.xml diff --git a/res/drawable/message_list_read_selector.xml b/res/drawable/message_list_read_selector.xml new file mode 100644 index 000000000..caa006680 --- /dev/null +++ b/res/drawable/message_list_read_selector.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/res/drawable/message_list_unread_selector.xml b/res/drawable/message_list_unread_selector.xml new file mode 100644 index 000000000..7f2081efe --- /dev/null +++ b/res/drawable/message_list_unread_selector.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/res/drawable/message_list_wide_read_selector.xml b/res/drawable/message_list_wide_read_selector.xml new file mode 100644 index 000000000..39bcab28e --- /dev/null +++ b/res/drawable/message_list_wide_read_selector.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/res/drawable/message_list_wide_unread_selector.xml b/res/drawable/message_list_wide_unread_selector.xml new file mode 100644 index 000000000..f27bd0c5d --- /dev/null +++ b/res/drawable/message_list_wide_unread_selector.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/src/com/android/email/activity/MessageListItem.java b/src/com/android/email/activity/MessageListItem.java index 7c4314fc3..6011c2ef3 100644 --- a/src/com/android/email/activity/MessageListItem.java +++ b/src/com/android/email/activity/MessageListItem.java @@ -27,6 +27,7 @@ import android.graphics.Paint; import android.graphics.Paint.Align; import android.graphics.Paint.FontMetricsInt; import android.graphics.Typeface; +import android.graphics.drawable.Drawable; import android.text.Layout.Alignment; import android.text.Spannable; import android.text.SpannableString; @@ -136,6 +137,10 @@ public class MessageListItem extends View { private static int sColorTipHeight; private static int sColorTipRightMarginOnNarrow; private static int sColorTipRightMarginOnWide; + private static Drawable sReadSelector; + private static Drawable sUnreadSelector; + private static Drawable sWideReadSelector; + private static Drawable sWideUnreadSelector; public int mSnippetLineCount = NEEDS_LAYOUT; private final CharSequence[] mSnippetLines = new CharSequence[MAX_SUBJECT_SNIPPET_LINES]; @@ -205,6 +210,10 @@ public class MessageListItem extends View { BitmapFactory.decodeResource(r, R.drawable.btn_check_off_normal_holo_light); sSelectedIconOn = BitmapFactory.decodeResource(r, R.drawable.btn_check_on_normal_holo_light); + sReadSelector = r.getDrawable(R.drawable.message_list_read_selector); + sUnreadSelector = r.getDrawable(R.drawable.message_list_unread_selector); + sWideReadSelector = r.getDrawable(R.drawable.message_list_wide_read_selector); + sWideUnreadSelector = r.getDrawable(R.drawable.message_list_wide_unread_selector); sFavoriteIconWidth = sFavoriteIconOff.getWidth(); sInit = true; @@ -226,6 +235,20 @@ public class MessageListItem extends View { } private void calculateDrawingData() { + if (mRead) { + if (mMode == MODE_WIDE) { + setBackgroundDrawable(sWideReadSelector); + } else { + setBackgroundDrawable(sReadSelector); + } + } else { + if (mMode == MODE_WIDE) { + setBackgroundDrawable(sWideUnreadSelector); + } else { + setBackgroundDrawable(sUnreadSelector); + } + } + SpannableStringBuilder ssb = new SpannableStringBuilder(); boolean hasSubject = false; if (!TextUtils.isEmpty(mSubject)) {