Darker text color for light theme (2)

This commit is contained in:
M66B 2019-10-07 13:07:26 +02:00
parent fc59806bb5
commit bb9f7f228e
11 changed files with 37 additions and 23 deletions

View File

@ -24,6 +24,7 @@ import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
@ -47,6 +48,7 @@ import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.ListUpdateCallback;
import androidx.recyclerview.widget.RecyclerView;
@ -310,7 +312,9 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
this.owner = parentFragment.getViewLifecycleOwner();
this.inflater = LayoutInflater.from(context);
this.colorUnread = Helper.resolveColor(context, R.attr.colorUnread);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", false);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnreadHighlight : android.R.attr.textColorPrimary);
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.DTF = Helper.getDateTimeInstance(context, DateFormat.SHORT, DateFormat.SHORT);

View File

@ -717,11 +717,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
boolean highlight_unread = prefs.getBoolean("highlight_unread", false);
if (highlight_unread)
this.colorUnread = Helper.resolveColor(context, R.attr.colorUnread);
else
this.colorUnread = this.textColorPrimary;
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnreadHighlight : android.R.attr.textColorPrimary);
setHasStableIds(true);

View File

@ -182,6 +182,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private int textColorPrimary;
private int textColorSecondary;
private int colorUnread;
private int colorRead;
private int colorSeparator;
private boolean hasWebView;
@ -721,10 +722,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvSubject.setTypeface(typeface);
tvCount.setTypeface(typeface);
int colorUnseen = (message.unseen > 0 ? colorUnread : textColorSecondary);
int colorUnseen = (message.unseen > 0 ? colorUnread : colorRead);
tvFrom.setTextColor(colorUnseen);
tvSize.setTextColor(colorUnseen);
tvTime.setTextColor(colorUnseen);
tvSubject.setTextColor(colorRead);
// Account color
vwColor.setBackgroundColor(message.accountColor == null || !ActivityBilling.isPro(context)
@ -1415,7 +1417,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
tvBody.setMinHeight(height);
tvBody.setTextColor(contrast ? textColorPrimary : textColorSecondary);
tvBody.setTextColor(contrast ? colorUnread : colorRead);
tvBody.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT);
tvBody.setVisibility(View.VISIBLE);
@ -3528,10 +3530,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", false);
if (highlight_unread)
this.colorUnread = Helper.resolveColor(context, R.attr.colorUnread);
else
this.colorUnread = this.textColorPrimary;
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnreadHighlight : R.attr.colorUnread);
this.colorRead = Helper.resolveColor(context, R.attr.colorRead);
this.colorSeparator = Helper.resolveColor(context, R.attr.colorSeparator);
@ -3995,7 +3995,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (filter_duplicates && message != null && message.duplicate) {
holder.tvFolder.setText(context.getString(R.string.title_duplicate_in, message.getFolderName(context)));
holder.tvFolder.setTypeface(message.unseen > 0 ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
holder.tvFolder.setTextColor(message.unseen > 0 ? colorUnread : textColorSecondary);
holder.tvFolder.setTextColor(message.unseen > 0 ? colorUnread : colorRead);
holder.tvFolder.setAlpha(Helper.LOW_LIGHT);
return;
}

View File

@ -134,7 +134,7 @@ public class AdapterNavAccount extends RecyclerView.Adapter<AdapterNavAccount.Vi
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", false);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnread : android.R.attr.textColorPrimary);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnreadHighlight : android.R.attr.textColorPrimary);
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.DTF = Helper.getTimeInstance(context, SimpleDateFormat.SHORT);

View File

@ -157,7 +157,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", false);
this.debug = prefs.getBoolean("debug", false);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnread : android.R.attr.textColorPrimary);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnreadHighlight : android.R.attr.textColorPrimary);
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
this.DTF = Helper.getTimeInstance(context, SimpleDateFormat.SHORT);

View File

@ -127,7 +127,7 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", false);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnread : android.R.attr.textColorPrimary);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnreadHighlight : android.R.attr.textColorPrimary);
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
setHasStableIds(true);

View File

@ -123,7 +123,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean highlight_unread = prefs.getBoolean("highlight_unread", false);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnread : android.R.attr.textColorPrimary);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnreadHighlight : android.R.attr.textColorPrimary);
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
}

View File

@ -81,7 +81,6 @@
android:maxLines="1"
android:text="123 KB"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorUnread"
app:layout_constraintBottom_toBottomOf="@+id/tvFrom"
app:layout_constraintEnd_toStartOf="@+id/tvTime"
app:layout_constraintTop_toBottomOf="@id/paddingTop" />

View File

@ -78,7 +78,6 @@
android:maxLines="1"
android:text="123 KB"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorUnread"
app:layout_constraintBottom_toBottomOf="@+id/tvFrom"
app:layout_constraintEnd_toStartOf="@+id/tvTime"
app:layout_constraintTop_toBottomOf="@id/paddingTop" />

View File

@ -10,6 +10,14 @@
<color name="colorError">#ff0000</color>
<color name="colorReadLight">#b3000000</color>
<color name="colorUnreadLight">#ff000000</color>
<!-- White 38% secondary_text_material_dark -->
<color name="colorReadDark">#b3ffffff</color>
<!-- White 87% primary_text_default_material_dark -->
<color name="colorUnreadDark">#ffffffff</color>
<!-- Light blue 900 -->
<color name="darkPrimary">#01579b</color>
<color name="darkPrimaryDark">#002f6c</color>

View File

@ -1,6 +1,8 @@
<resources>
<attr name="themeName" format="string" />
<attr name="colorRead" format="reference" />
<attr name="colorUnread" format="reference" />
<attr name="colorUnreadHighlight" format="reference" />
<attr name="colorSeparator" format="reference" />
<attr name="colorWarning" format="reference" />
<attr name="colorDrawerScrim" format="reference" />
@ -24,7 +26,10 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorUnread">@color/colorAccentDark</item>
<item name="colorRead">@color/colorReadLight</item>
<item name="colorUnread">@color/colorUnreadLight</item>
<item name="colorUnreadHighlight">@color/colorAccentDark</item>
<item name="colorSeparator">@color/lightColorSeparator</item>
<item name="colorWarning">@color/lightColorWarning</item>
@ -66,7 +71,10 @@
<item name="colorPrimaryDark">@color/darkPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorUnread">@color/colorAccent</item>
<item name="colorRead">@color/colorReadDark</item>
<item name="colorUnread">@color/colorUnreadDark</item>
<item name="colorUnreadHighlight">@color/colorAccent</item>
<item name="colorSeparator">@color/darkColorSeparator</item>
<item name="colorWarning">@color/darkColorWarning</item>
@ -112,7 +120,7 @@
<item name="colorPrimaryDark">@color/greyPrimaryDark</item>
<item name="colorAccent">@color/greyAccent</item>
<item name="colorUnread">@color/greyAccentDark</item>
<item name="colorUnreadHighlight">@color/greyAccentDark</item>
<item name="colorFabBackground">@color/greyAccent</item>
@ -125,7 +133,7 @@
<item name="colorPrimaryDark">@color/greyPrimaryDark</item>
<item name="colorAccent">@color/greyAccent</item>
<item name="colorUnread">@color/greyAccent</item>
<item name="colorUnreadHighlight">@color/greyAccent</item>
<item name="colorSeparator">@color/greyPrimary</item>
<item name="colorActionBackground">@color/greyPrimary</item>