Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fade the read messages in message list.

Improves usability, mainly of the dark theme because marking the unread
messages using just the bold typeface is not enough visible there.
  • Loading branch information...
commit 070b27cbba5d3bb1f9e426fcd8c464d065d350da 1 parent 3fa8081
Jan Holesovsky authored

Showing 1 changed file with 7 additions and 2 deletions. Show diff stats Hide diff stats

  1. +7 2 src/com/fsck/k9/activity/MessageList.java
9 src/com/fsck/k9/activity/MessageList.java
@@ -12,6 +12,7 @@
12 12 import android.app.Dialog;
13 13 import android.content.Context;
14 14 import android.content.Intent;
  15 +import android.content.res.ColorStateList;
15 16 import android.graphics.Color;
16 17 import android.graphics.Typeface;
17 18 import android.graphics.drawable.Drawable;
@@ -2300,6 +2301,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
2300 2301 */
2301 2302 private void bindView(final int position, final View view, final MessageViewHolder holder,
2302 2303 final MessageInfoHolder message) {
  2304 + ColorStateList read_or_unread_color = holder.subject.getTextColors().withAlpha(message.read ? 127 : 255);
  2305 + holder.subject.setTextColor(read_or_unread_color);
2303 2306 holder.subject.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);
2304 2307
2305 2308 // XXX TODO there has to be some way to walk our view hierarchy and get this
@@ -2319,7 +2322,7 @@ private void bindView(final int position, final View view, final MessageViewHold
2319 2322
2320 2323 holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().generateColorChip().drawable());
2321 2324 holder.chip.getBackground().setAlpha(message.read ? 127 : 255);
2322   - view.getBackground().setAlpha(message.downloaded ? 0 : 127);
  2325 + view.getBackground().setAlpha(message.downloaded ? 0 : 32);
2323 2326
2324 2327 if ((message.message.getSubject() == null) || message.message.getSubject().equals("")) {
2325 2328 holder.subject.setText(getText(R.string.general_no_subject));
@@ -2340,6 +2343,7 @@ private void bindView(final int position, final View view, final MessageViewHold
2340 2343 holder.preview.setText(new SpannableStringBuilder(recipientSigil(message))
2341 2344 .append(message.sender).append(" ").append(message.message.getPreview()),
2342 2345 TextView.BufferType.SPANNABLE);
  2346 + holder.preview.setTextColor(read_or_unread_color);
2343 2347 Spannable str = (Spannable)holder.preview.getText();
2344 2348
2345 2349 // Create a span section for the sender, and assign the correct font size and weight.
@@ -2359,11 +2363,12 @@ private void bindView(final int position, final View view, final MessageViewHold
2359 2363 Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
2360 2364 } else {
2361 2365 holder.from.setText(new SpannableStringBuilder(recipientSigil(message)).append(message.sender));
2362   -
  2366 + holder.from.setTextColor(read_or_unread_color);
2363 2367 holder.from.setTypeface(null, senderTypeface);
2364 2368 }
2365 2369
2366 2370 holder.date.setText(message.getDate(mMessageHelper));
  2371 + holder.date.setTextColor(read_or_unread_color);
2367 2372 holder.subject.setCompoundDrawablesWithIntrinsicBounds(
2368 2373 message.answered ? mAnsweredIcon : null, // left
2369 2374 null, // top

0 comments on commit 070b27c

Please sign in to comment.
Something went wrong with that request. Please try again.