diff --git a/app/src/main/java/eu/faircode/email/AdapterFolder.java b/app/src/main/java/eu/faircode/email/AdapterFolder.java index cd546e60af..9d053c18d1 100644 --- a/app/src/main/java/eu/faircode/email/AdapterFolder.java +++ b/app/src/main/java/eu/faircode/email/AdapterFolder.java @@ -233,6 +233,7 @@ public class AdapterFolder extends RecyclerView.Adapter 0 ? Typeface.BOLD : Typeface.NORMAL); + holder.tvName.setTextColor(Helper.resolveColor(context, folder.unseen > 0 ? R.attr.colorUnread : android.R.attr.textColorSecondary)); holder.tvAfter.setText(Integer.toString(folder.after)); holder.tvAfter.setVisibility(folder.synchronize ? View.VISIBLE : View.INVISIBLE); diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 07802de8c3..ebbc5c6a04 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -245,14 +245,19 @@ public class AdapterMessage extends RecyclerView.Adapter 0 ? View.VISIBLE : View.GONE); + boolean unseen = (message.thread == null ? message.unseen > 0 : !message.seen); + int visibility = (unseen ? Typeface.BOLD : Typeface.NORMAL); holder.tvFrom.setTypeface(null, visibility); holder.tvTime.setTypeface(null, visibility); - holder.ivAttachments.setVisibility(message.attachments > 0 ? View.VISIBLE : View.GONE); holder.tvSubject.setTypeface(null, visibility); holder.tvCount.setTypeface(null, visibility); + holder.tvFrom.setTextColor(Helper.resolveColor(context, unseen ? R.attr.colorUnread : android.R.attr.textColorSecondary)); + holder.tvTime.setTextColor(Helper.resolveColor(context, unseen ? R.attr.colorUnread : android.R.attr.textColorSecondary)); + holder.wire(); } } diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index b86679847d..b3ad4854f1 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -20,11 +20,10 @@ package eu.faircode.email; */ import android.content.Context; -import android.content.res.Resources; +import android.content.res.TypedArray; import android.os.Build; import android.text.TextUtils; import android.util.Log; -import android.util.TypedValue; import java.io.BufferedReader; import java.io.IOException; @@ -34,10 +33,11 @@ public class Helper { static final String TAG = BuildConfig.APPLICATION_ID; static int resolveColor(Context context, int attr) { - TypedValue typedValue = new TypedValue(); - Resources.Theme theme = context.getTheme(); - theme.resolveAttribute(attr, typedValue, true); - return typedValue.data; + int[] attrs = new int[]{attr}; + TypedArray a = context.getTheme().obtainStyledAttributes(attrs); + int color = a.getColor(0, 0xFF0000); + a.recycle(); + return color; } static String localizeFolderName(Context context, String name) { diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f5d4223b49..0b40115071 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -6,11 +6,13 @@ #fff + #000 #ffaaaaaa #99000000 #111 #eee + #fff #ff878787 #997f7f7f #fff diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index b5f56a4898..6d42bb2b24 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,4 +1,5 @@ + @@ -11,6 +12,7 @@ @color/colorPrimaryDark @color/colorAccent + @color/lightColorUnread @color/lightColorSeparator @color/lightColorDrawerScrim @color/lightColorDrawerText @@ -24,6 +26,7 @@ @color/colorPrimaryDark @color/colorAccent + @color/darkColorUnread @color/darkColorSeparator @color/darkColorDrawerScrim @color/darkColorDrawerText