diff --git a/app/src/main/java/org/isoron/uhabits/activities/BaseScreen.java b/app/src/main/java/org/isoron/uhabits/activities/BaseScreen.java index 64f9ffe0a..b8140c0aa 100644 --- a/app/src/main/java/org/isoron/uhabits/activities/BaseScreen.java +++ b/app/src/main/java/org/isoron/uhabits/activities/BaseScreen.java @@ -37,6 +37,9 @@ import org.isoron.uhabits.utils.*; import java.io.*; +import static android.os.Build.VERSION.*; +import static android.os.Build.VERSION_CODES.*; + /** * Base class for all screens in the application. *
@@ -95,6 +98,22 @@ public class BaseScreen } } + @Deprecated + public static int getDefaultActionBarColor(Context context) + { + if (SDK_INT < LOLLIPOP) + { + return context + .getResources() + .getColor(R.color.grey_900, context.getTheme()); + } + else + { + StyledResources res = new StyledResources(context); + return res.getColor(R.attr.colorPrimary); + } + } + /** * Notifies the screen that its contents should be updated. */ diff --git a/app/src/main/java/org/isoron/uhabits/activities/settings/SettingsActivity.java b/app/src/main/java/org/isoron/uhabits/activities/settings/SettingsActivity.java index de1120278..914e7e714 100644 --- a/app/src/main/java/org/isoron/uhabits/activities/settings/SettingsActivity.java +++ b/app/src/main/java/org/isoron/uhabits/activities/settings/SettingsActivity.java @@ -35,9 +35,17 @@ public class SettingsActivity extends BaseActivity { super.onCreate(savedInstanceState); setContentView(R.layout.settings_activity); + setupActionBarColor(); + } + private void setupActionBarColor() + { StyledResources res = new StyledResources(this); - int color = res.getColor(R.attr.aboutScreenColor); + int color = BaseScreen.getDefaultActionBarColor(this); + + if (res.getBoolean(R.attr.useHabitColorAsPrimary)) + color = res.getColor(R.attr.aboutScreenColor); + BaseScreen.setupActionBarColor(this, color); } }