Rename actionBarTint to colorOnPrimary

pull/935/head
Alex Baker 6 years ago
parent d627cb1d5a
commit 31483a0aba

@ -45,12 +45,12 @@ public class ActionUtils {
TextView title = contextView.findViewById(R.id.action_bar_title); TextView title = contextView.findViewById(R.id.action_bar_title);
if (title != null) { if (title != null) {
title.setTextColor(themeColor.getActionBarTint()); title.setTextColor(themeColor.getColorOnPrimary());
} }
ImageView closeButton = contextView.findViewById(R.id.action_mode_close_button); ImageView closeButton = contextView.findViewById(R.id.action_mode_close_button);
if (closeButton != null) { if (closeButton != null) {
closeButton.setColorFilter(themeColor.getActionBarTint()); closeButton.setColorFilter(themeColor.getColorOnPrimary());
} }
} }

@ -68,8 +68,7 @@ public class ThemeCache {
colorNames[i], colorNames[i],
i, i,
resolveAttribute(theme, R.attr.colorPrimary), resolveAttribute(theme, R.attr.colorPrimary),
resolveAttribute(theme, R.attr.colorPrimaryVariant), resolveAttribute(theme, R.attr.colorPrimaryVariant)));
resolveAttribute(theme, R.attr.colorOnPrimary)));
} }
String[] accentNames = resources.getStringArray(R.array.accents); String[] accentNames = resources.getStringArray(R.array.accents);
for (int i = 0; i < ThemeAccent.ACCENTS.length; i++) { for (int i = 0; i < ThemeAccent.ACCENTS.length; i++) {
@ -87,13 +86,7 @@ public class ThemeCache {
getColor(context, i == 0 ? R.color.black_54 : R.color.white_70))); getColor(context, i == 0 ? R.color.black_54 : R.color.white_70)));
} }
untaggedColor = untaggedColor =
new ThemeColor( new ThemeColor(context, null, 19, getColor(context, R.color.tag_color_none_background), 0);
context,
null,
19,
getColor(context, R.color.tag_color_none_background),
0,
getColor(context, R.color.black_87));
} }
private static int resolveAttribute(Resources.Theme theme, int attribute) { private static int resolveAttribute(Resources.Theme theme, int attribute) {

@ -110,7 +110,7 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
}; };
private final String name; private final String name;
private final int index; private final int index;
private final int actionBarTint; private final int colorOnPrimary;
private final int style; private final int style;
private final int colorPrimary; private final int colorPrimary;
private final int colorPrimaryVariant; private final int colorPrimaryVariant;
@ -121,24 +121,22 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
String name, String name,
int index, int index,
int colorPrimary, int colorPrimary,
int colorPrimaryVariant, int colorPrimaryVariant) {
int actionBarTint) {
this.name = name; this.name = name;
this.index = index; this.index = index;
this.actionBarTint = actionBarTint;
this.style = COLORS[index]; this.style = COLORS[index];
this.colorPrimary = colorPrimary; this.colorPrimary = colorPrimary;
this.colorPrimaryVariant = colorPrimaryVariant; this.colorPrimaryVariant = colorPrimaryVariant;
double contrast = int whiteText = context.getResources().getColor(R.color.white_100);
ColorUtils.calculateContrast( double contrast = ColorUtils.calculateContrast(whiteText, colorPrimary);
context.getResources().getColor(R.color.white_100), colorPrimary);
this.isDark = contrast < 3; this.isDark = contrast < 3;
colorOnPrimary = isDark ? context.getResources().getColor(R.color.black_87) : whiteText;
} }
private ThemeColor(Parcel source) { private ThemeColor(Parcel source) {
name = source.readString(); name = source.readString();
index = source.readInt(); index = source.readInt();
actionBarTint = source.readInt(); colorOnPrimary = source.readInt();
style = source.readInt(); style = source.readInt();
colorPrimary = source.readInt(); colorPrimary = source.readInt();
colorPrimaryVariant = source.readInt(); colorPrimaryVariant = source.readInt();
@ -251,13 +249,13 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
return colorPrimary; return colorPrimary;
} }
public int getActionBarTint() { public int getColorOnPrimary() {
return actionBarTint; return colorOnPrimary;
} }
public void apply(Toolbar toolbar) { public void apply(Toolbar toolbar) {
toolbar.setBackgroundColor(getPrimaryColor()); toolbar.setBackgroundColor(getPrimaryColor());
MenuColorizer.colorToolbar(toolbar, actionBarTint); MenuColorizer.colorToolbar(toolbar, colorOnPrimary);
} }
@Override @Override
@ -269,7 +267,7 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name); dest.writeString(name);
dest.writeInt(index); dest.writeInt(index);
dest.writeInt(actionBarTint); dest.writeInt(colorOnPrimary);
dest.writeInt(style); dest.writeInt(style);
dest.writeInt(colorPrimary); dest.writeInt(colorPrimary);
dest.writeInt(colorPrimaryVariant); dest.writeInt(colorPrimaryVariant);

@ -197,8 +197,8 @@ public class ChipProvider {
ThemeColor color = getColor(theme); ThemeColor color = getColor(theme);
chip.setText(name); chip.setText(name);
chip.setCloseIconTint( chip.setCloseIconTint(
new ColorStateList(new int[][] {new int[] {}}, new int[] {color.getActionBarTint()})); new ColorStateList(new int[][] {new int[] {}}, new int[] {color.getColorOnPrimary()}));
chip.setTextColor(color.getActionBarTint()); chip.setTextColor(color.getColorOnPrimary());
chip.getChipDrawable().setAlpha(iconAlpha); chip.getChipDrawable().setAlpha(iconAlpha);
chip.setChipBackgroundColor( chip.setChipBackgroundColor(
new ColorStateList( new ColorStateList(

@ -84,9 +84,9 @@ public class TasksWidget extends InjectingAppWidgetProvider {
remoteViews.setViewVisibility(R.id.widget_header, View.VISIBLE); remoteViews.setViewVisibility(R.id.widget_header, View.VISIBLE);
remoteViews.setViewVisibility( remoteViews.setViewVisibility(
R.id.widget_reconfigure, widgetPreferences.showSettings() ? View.VISIBLE : View.GONE); R.id.widget_reconfigure, widgetPreferences.showSettings() ? View.VISIBLE : View.GONE);
remoteViews.setInt(R.id.widget_title, "setTextColor", color.getActionBarTint()); remoteViews.setInt(R.id.widget_title, "setTextColor", color.getColorOnPrimary());
remoteViews.setInt(R.id.widget_button, "setColorFilter", color.getActionBarTint()); remoteViews.setInt(R.id.widget_button, "setColorFilter", color.getColorOnPrimary());
remoteViews.setInt(R.id.widget_reconfigure, "setColorFilter", color.getActionBarTint()); remoteViews.setInt(R.id.widget_reconfigure, "setColorFilter", color.getColorOnPrimary());
} else { } else {
remoteViews.setViewVisibility(R.id.widget_header, View.GONE); remoteViews.setViewVisibility(R.id.widget_header, View.GONE);
} }

Loading…
Cancel
Save