|
|
@ -16,6 +16,7 @@ import androidx.annotation.RequiresApi;
|
|
|
|
import androidx.appcompat.widget.Toolbar;
|
|
|
|
import androidx.appcompat.widget.Toolbar;
|
|
|
|
import androidx.core.graphics.ColorUtils;
|
|
|
|
import androidx.core.graphics.ColorUtils;
|
|
|
|
import androidx.drawerlayout.widget.DrawerLayout;
|
|
|
|
import androidx.drawerlayout.widget.DrawerLayout;
|
|
|
|
|
|
|
|
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
|
|
|
import org.tasks.R;
|
|
|
|
import org.tasks.R;
|
|
|
|
import org.tasks.dialogs.ColorPickerDialog;
|
|
|
|
import org.tasks.dialogs.ColorPickerDialog;
|
|
|
|
import org.tasks.ui.MenuColorizer;
|
|
|
|
import org.tasks.ui.MenuColorizer;
|
|
|
@ -154,13 +155,13 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
|
|
|
|
|
|
|
|
|
|
|
|
public void setStatusBarColor(Activity activity) {
|
|
|
|
public void setStatusBarColor(Activity activity) {
|
|
|
|
if (atLeastLollipop()) {
|
|
|
|
if (atLeastLollipop()) {
|
|
|
|
activity.getWindow().setStatusBarColor(getColorPrimaryVariant());
|
|
|
|
activity.getWindow().setStatusBarColor(colorPrimaryVariant);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void applyToStatusBar(DrawerLayout drawerLayout) {
|
|
|
|
public void setStatusBarColor(DrawerLayout drawerLayout) {
|
|
|
|
if (atLeastLollipop()) {
|
|
|
|
if (atLeastLollipop()) {
|
|
|
|
drawerLayout.setStatusBarBackgroundColor(getColorPrimaryVariant());
|
|
|
|
drawerLayout.setStatusBarBackgroundColor(colorPrimaryVariant);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (atLeastMarshmallow()) {
|
|
|
|
if (atLeastMarshmallow()) {
|
|
|
|
int systemUiVisibility = applyLightStatusBarFlag(drawerLayout.getSystemUiVisibility());
|
|
|
|
int systemUiVisibility = applyLightStatusBarFlag(drawerLayout.getSystemUiVisibility());
|
|
|
@ -168,6 +169,11 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setStatusBarColor(CollapsingToolbarLayout layout) {
|
|
|
|
|
|
|
|
layout.setContentScrimColor(colorPrimary);
|
|
|
|
|
|
|
|
layout.setStatusBarScrimColor(colorPrimaryVariant);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void applyToStatusBarIcons(Activity activity) {
|
|
|
|
public void applyToStatusBarIcons(Activity activity) {
|
|
|
|
if (atLeastMarshmallow()) {
|
|
|
|
if (atLeastMarshmallow()) {
|
|
|
|
View decorView = activity.getWindow().getDecorView();
|
|
|
|
View decorView = activity.getWindow().getDecorView();
|
|
|
@ -249,10 +255,6 @@ public class ThemeColor implements ColorPickerDialog.Pickable {
|
|
|
|
return actionBarTint;
|
|
|
|
return actionBarTint;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private int getColorPrimaryVariant() {
|
|
|
|
|
|
|
|
return colorPrimaryVariant;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void apply(Toolbar toolbar) {
|
|
|
|
public void apply(Toolbar toolbar) {
|
|
|
|
toolbar.setBackgroundColor(getPrimaryColor());
|
|
|
|
toolbar.setBackgroundColor(getPrimaryColor());
|
|
|
|
MenuColorizer.colorToolbar(toolbar, actionBarTint);
|
|
|
|
MenuColorizer.colorToolbar(toolbar, actionBarTint);
|
|
|
|