From ed693fc01a6250c25cdf6cc5986b6bbcd1be41ff Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Thu, 6 Sep 2012 15:46:58 -0700 Subject: [PATCH] Hide the unread message count in the actionbar when doing an explicit search. --- src/com/fsck/k9/activity/MessageList.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 2f8e8348c..2321ebea8 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -526,11 +526,13 @@ public class MessageList extends K9ListActivity implements OnItemClickListener, } else { mActionBarSubTitle.setText(operation); } - // query result display } else if (mQueryString != null) { + // query result display. This may be for a search folder as opposed to a user-initiated search. if (mTitle != null) { + // This was a search folder; the search folder has overridden our title. mActionBarTitle.setText(mTitle); } else { + // This is a search result; set it to the default search result line. mActionBarTitle.setText(getString(R.string.search_results)); } } @@ -539,8 +541,14 @@ public class MessageList extends K9ListActivity implements OnItemClickListener, if (mUnreadMessageCount == 0) { mActionBarUnread.setVisibility(View.GONE); } else { - mActionBarUnread.setText(Integer.toString(mUnreadMessageCount)); - mActionBarUnread.setVisibility(View.VISIBLE); + if (mQueryString != null && mTitle == null) { + // This is a search result. The unread message count is easily confused + // with total number of messages in the search result, so let's hide it. + mActionBarUnread.setVisibility(View.GONE); + } else { + mActionBarUnread.setText(Integer.toString(mUnreadMessageCount)); + mActionBarUnread.setVisibility(View.VISIBLE); + } } }