Rename actionBarTint to colorOnPrimary

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

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

@ -68,8 +68,7 @@ public class ThemeCache {
colorNames[i],
i,
resolveAttribute(theme, R.attr.colorPrimary),
resolveAttribute(theme, R.attr.colorPrimaryVariant),
resolveAttribute(theme, R.attr.colorOnPrimary)));
resolveAttribute(theme, R.attr.colorPrimaryVariant)));
}
String[] accentNames = resources.getStringArray(R.array.accents);
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)));
}
untaggedColor =
new ThemeColor(
context,
null,
19,
getColor(context, R.color.tag_color_none_background),
0,
getColor(context, R.color.black_87));
new ThemeColor(context, null, 19, getColor(context, R.color.tag_color_none_background), 0);
}
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 int index;
private final int actionBarTint;
private final int colorOnPrimary;
private final int style;
private final int colorPrimary;
private final int colorPrimaryVariant;
@ -121,24 +121,22 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
String name,
int index,
int colorPrimary,
int colorPrimaryVariant,
int actionBarTint) {
int colorPrimaryVariant) {
this.name = name;
this.index = index;
this.actionBarTint = actionBarTint;
this.style = COLORS[index];
this.colorPrimary = colorPrimary;
this.colorPrimaryVariant = colorPrimaryVariant;
double contrast =
ColorUtils.calculateContrast(
context.getResources().getColor(R.color.white_100), colorPrimary);
int whiteText = context.getResources().getColor(R.color.white_100);
double contrast = ColorUtils.calculateContrast(whiteText, colorPrimary);
this.isDark = contrast < 3;
colorOnPrimary = isDark ? context.getResources().getColor(R.color.black_87) : whiteText;
}
private ThemeColor(Parcel source) {
name = source.readString();
index = source.readInt();
actionBarTint = source.readInt();
colorOnPrimary = source.readInt();
style = source.readInt();
colorPrimary = source.readInt();
colorPrimaryVariant = source.readInt();
@ -251,13 +249,13 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
return colorPrimary;
}
public int getActionBarTint() {
return actionBarTint;
public int getColorOnPrimary() {
return colorOnPrimary;
}
public void apply(Toolbar toolbar) {
toolbar.setBackgroundColor(getPrimaryColor());
MenuColorizer.colorToolbar(toolbar, actionBarTint);
MenuColorizer.colorToolbar(toolbar, colorOnPrimary);
}
@Override
@ -269,7 +267,7 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeInt(index);
dest.writeInt(actionBarTint);
dest.writeInt(colorOnPrimary);
dest.writeInt(style);
dest.writeInt(colorPrimary);
dest.writeInt(colorPrimaryVariant);

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

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

Loading…
Cancel
Save