Merge "Show total message count for Outbox/Sent"
This commit is contained in:
commit
ffee97985c
@ -105,28 +105,30 @@ import android.widget.TextView;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set count
|
// Set count
|
||||||
final int count = cursor.getInt((type == Mailbox.TYPE_DRAFTS || type == Mailbox.TYPE_TRASH)
|
boolean useTotalCount = false;
|
||||||
? COLUMN_MESSAGE_COUNT : COLUMN_UNREAD_COUNT);
|
switch (type) {
|
||||||
|
case Mailbox.TYPE_DRAFTS:
|
||||||
|
case Mailbox.TYPE_OUTBOX:
|
||||||
|
case Mailbox.TYPE_SENT:
|
||||||
|
case Mailbox.TYPE_TRASH:
|
||||||
|
useTotalCount = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
final int count = cursor.getInt(useTotalCount ? COLUMN_MESSAGE_COUNT : COLUMN_UNREAD_COUNT);
|
||||||
final TextView unreadCountView = (TextView) view.findViewById(R.id.new_message_count);
|
final TextView unreadCountView = (TextView) view.findViewById(R.id.new_message_count);
|
||||||
final TextView allCountView = (TextView) view.findViewById(R.id.all_message_count);
|
final TextView allCountView = (TextView) view.findViewById(R.id.all_message_count);
|
||||||
|
|
||||||
// If the unread count is zero, not to show countView.
|
// If the unread count is zero, not to show countView.
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
nameView.setTypeface(Typeface.DEFAULT_BOLD);
|
nameView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
switch (type) {
|
if (useTotalCount) {
|
||||||
case Mailbox.TYPE_DRAFTS:
|
unreadCountView.setVisibility(View.GONE);
|
||||||
case Mailbox.TYPE_OUTBOX:
|
allCountView.setVisibility(View.VISIBLE);
|
||||||
case Mailbox.TYPE_SENT:
|
allCountView.setText(Integer.toString(count));
|
||||||
case Mailbox.TYPE_TRASH:
|
} else {
|
||||||
unreadCountView.setVisibility(View.GONE);
|
allCountView.setVisibility(View.GONE);
|
||||||
allCountView.setVisibility(View.VISIBLE);
|
unreadCountView.setVisibility(View.VISIBLE);
|
||||||
allCountView.setText(Integer.toString(count));
|
unreadCountView.setText(Integer.toString(count));
|
||||||
break;
|
|
||||||
default:
|
|
||||||
allCountView.setVisibility(View.GONE);
|
|
||||||
unreadCountView.setVisibility(View.VISIBLE);
|
|
||||||
unreadCountView.setText(Integer.toString(count));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nameView.setTypeface(Typeface.DEFAULT);
|
nameView.setTypeface(Typeface.DEFAULT);
|
||||||
|
Loading…
Reference in New Issue
Block a user