Switch colorPrimaryDark with colorPrimaryVariant

pull/848/head
Alex Baker 5 years ago
parent 7bab3b87d0
commit 309377ee31

@ -67,7 +67,7 @@ public class ThemeCache {
colorNames[i],
i,
resolveAttribute(theme, R.attr.colorPrimary),
resolveAttribute(theme, R.attr.colorPrimaryDark),
resolveAttribute(theme, R.attr.colorPrimaryVariant),
resolveAttribute(theme, R.attr.actionBarPrimaryText),
resolveBoolean(theme, R.attr.dark_status_bar)));
}

@ -109,14 +109,14 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
private final int actionBarTint;
private final int style;
private final int colorPrimary;
private final int colorPrimaryDark;
private final int colorPrimaryVariant;
private final boolean isDark;
public ThemeColor(
String name,
int index,
int colorPrimary,
int colorPrimaryDark,
int colorPrimaryVariant,
int actionBarTint,
boolean isDark) {
this.name = name;
@ -124,7 +124,7 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
this.actionBarTint = actionBarTint;
this.style = COLORS[index];
this.colorPrimary = colorPrimary;
this.colorPrimaryDark = colorPrimaryDark;
this.colorPrimaryVariant = colorPrimaryVariant;
this.isDark = isDark;
}
@ -134,7 +134,7 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
actionBarTint = source.readInt();
style = source.readInt();
colorPrimary = source.readInt();
colorPrimaryDark = source.readInt();
colorPrimaryVariant = source.readInt();
isDark = source.readInt() == 1;
}
@ -148,13 +148,13 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
public void setStatusBarColor(Activity activity) {
if (atLeastLollipop()) {
activity.getWindow().setStatusBarColor(getColorPrimaryDark());
activity.getWindow().setStatusBarColor(getColorPrimaryVariant());
}
}
public void applyToStatusBar(DrawerLayout drawerLayout) {
if (atLeastLollipop()) {
drawerLayout.setStatusBarBackgroundColor(getColorPrimaryDark());
drawerLayout.setStatusBarBackgroundColor(getColorPrimaryVariant());
}
if (atLeastMarshmallow()) {
int systemUiVisibility = applyLightStatusBarFlag(drawerLayout.getSystemUiVisibility());
@ -242,8 +242,8 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
return actionBarTint;
}
private int getColorPrimaryDark() {
return colorPrimaryDark;
private int getColorPrimaryVariant() {
return colorPrimaryVariant;
}
public void apply(Toolbar toolbar) {
@ -263,7 +263,7 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
dest.writeInt(actionBarTint);
dest.writeInt(style);
dest.writeInt(colorPrimary);
dest.writeInt(colorPrimaryDark);
dest.writeInt(colorPrimaryVariant);
dest.writeInt(isDark ? 1 : 0);
}
}

@ -21,7 +21,7 @@
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:statusBarScrim="?attr/colorPrimaryDark"
app:statusBarScrim="?attr/colorPrimaryVariant"
app:titleEnabled="false">
<androidx.constraintlayout.widget.ConstraintLayout

@ -3,7 +3,7 @@
<style name="Amber" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/amber_500</item>
<item name="colorPrimaryDark">@color/amber_700</item>
<item name="colorPrimaryVariant">@color/amber_700</item>
</style>
<style name="AmberAccent" parent="BlackTint">

@ -3,7 +3,7 @@
<style name="Blue" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/blue_500</item>
<item name="colorPrimaryDark">@color/blue_700</item>
<item name="colorPrimaryVariant">@color/blue_700</item>
</style>
<style name="BlueAccent" parent="WhiteTint">

@ -3,7 +3,7 @@
<style name="BlueGrey" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/blue_grey_500</item>
<item name="colorPrimaryDark">@color/blue_grey_700</item>
<item name="colorPrimaryVariant">@color/blue_grey_700</item>
</style>
<style name="BlueGreyAccent" parent="WhiteTint">

@ -3,7 +3,7 @@
<style name="Brown" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/brown_500</item>
<item name="colorPrimaryDark">@color/brown_700</item>
<item name="colorPrimaryVariant">@color/brown_700</item>
</style>
</resources>

@ -3,7 +3,7 @@
<style name="Cyan" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/cyan_500</item>
<item name="colorPrimaryDark">@color/cyan_700</item>
<item name="colorPrimaryVariant">@color/cyan_700</item>
</style>
<style name="CyanAccent" parent="BlackTint">

@ -3,7 +3,7 @@
<style name="DarkGrey" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/grey_900</item>
<item name="colorPrimaryDark">@color/grey_statusbar</item>
<item name="colorPrimaryVariant">@color/grey_statusbar</item>
</style>
</resources>

@ -3,7 +3,7 @@
<style name="DeepOrange" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/deep_orange_500</item>
<item name="colorPrimaryDark">@color/deep_orange_700</item>
<item name="colorPrimaryVariant">@color/deep_orange_700</item>
</style>
<style name="DeepOrangeAccent" parent="WhiteTint">

@ -3,7 +3,7 @@
<style name="DeepPurple" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/deep_purple_500</item>
<item name="colorPrimaryDark">@color/deep_purple_700</item>
<item name="colorPrimaryVariant">@color/deep_purple_700</item>
</style>
<style name="DeepPurpleAccent" parent="WhiteTint">

@ -3,7 +3,7 @@
<style name="Green" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/green_500</item>
<item name="colorPrimaryDark">@color/green_700</item>
<item name="colorPrimaryVariant">@color/green_700</item>
</style>
<style name="GreenAccent" parent="BlackTint">

@ -3,7 +3,7 @@
<style name="Grey" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/grey_500</item>
<item name="colorPrimaryDark">@color/grey_700</item>
<item name="colorPrimaryVariant">@color/grey_700</item>
</style>
</resources>

@ -3,7 +3,7 @@
<style name="Indigo" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/indigo_500</item>
<item name="colorPrimaryDark">@color/indigo_700</item>
<item name="colorPrimaryVariant">@color/indigo_700</item>
</style>
<style name="IndigoAccent" parent="WhiteTint">

@ -3,7 +3,7 @@
<style name="LightBlue" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/light_blue_500</item>
<item name="colorPrimaryDark">@color/light_blue_700</item>
<item name="colorPrimaryVariant">@color/light_blue_700</item>
</style>
<style name="LightBlueAccent" parent="BlackTint">

@ -3,7 +3,7 @@
<style name="LightGreen" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/light_green_500</item>
<item name="colorPrimaryDark">@color/light_green_700</item>
<item name="colorPrimaryVariant">@color/light_green_700</item>
</style>
<style name="LightGreenAccent" parent="BlackTint">

@ -3,7 +3,7 @@
<style name="Lime" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/lime_500</item>
<item name="colorPrimaryDark">@color/lime_700</item>
<item name="colorPrimaryVariant">@color/lime_700</item>
</style>
<style name="LimeAccent" parent="BlackTint">

@ -3,7 +3,7 @@
<style name="Orange" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/orange_500</item>
<item name="colorPrimaryDark">@color/orange_700</item>
<item name="colorPrimaryVariant">@color/orange_700</item>
</style>
<style name="OrangeAccent" parent="BlackTint">

@ -3,7 +3,7 @@
<style name="Pink" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/pink_500</item>
<item name="colorPrimaryDark">@color/pink_700</item>
<item name="colorPrimaryVariant">@color/pink_700</item>
</style>
<style name="PinkAccent" parent="WhiteTint">

@ -3,7 +3,7 @@
<style name="Purple" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryDark">@color/purple_700</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
</style>
<style name="PurpleAccent" parent="WhiteTint">

@ -3,7 +3,7 @@
<style name="Red" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/red_500</item>
<item name="colorPrimaryDark">@color/red_700</item>
<item name="colorPrimaryVariant">@color/red_700</item>
</style>
<style name="RedAccent" parent="WhiteTint">

@ -3,7 +3,7 @@
<style name="Teal" parent="WhiteToolbarTheme">
<item name="colorPrimary">@color/teal_500</item>
<item name="colorPrimaryDark">@color/teal_700</item>
<item name="colorPrimaryVariant">@color/teal_700</item>
</style>
<style name="TealAccent" parent="BlackTint">

@ -3,7 +3,7 @@
<style name="White" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/white_100</item>
<item name="colorPrimaryDark">@color/white_100</item>
<item name="colorPrimaryVariant">@color/white_100</item>
</style>
</resources>

@ -3,7 +3,7 @@
<style name="Yellow" parent="BlackToolbarTheme">
<item name="colorPrimary">@color/yellow_500</item>
<item name="colorPrimaryDark">@color/yellow_700</item>
<item name="colorPrimaryVariant">@color/yellow_700</item>
</style>
<style name="YellowAccent" parent="BlackTint">

Loading…
Cancel
Save