Create black theme

This commit is contained in:
Phillip Hsu 2016-09-27 03:24:58 -07:00
parent b9d6fdd0a7
commit 26215d3641
5 changed files with 29 additions and 3 deletions

View File

@ -41,12 +41,14 @@ public abstract class BaseActivity extends AppCompatActivity {
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
// ========================================================================================
// TOneverDO: Set theme after setContentView()
// Since the default theme is light, we only need to check against the dark theme.
String themeDark = getString(R.string.theme_dark);
final String themeDark = getString(R.string.theme_dark);
final String themeBlack = getString(R.string.theme_black);
String theme = PreferenceManager.getDefaultSharedPreferences(this).getString(
getString(R.string.key_theme), null);
if (themeDark.equals(theme)) {
setTheme(R.style.AppTheme_Dark);
} else if (themeBlack.equals(theme)) {
setTheme(R.style.AppTheme_Black);
}
// ========================================================================================
setContentView(layoutResId());

View File

@ -27,5 +27,9 @@
<item name="android:colorAccent">@color/colorAccentInverse</item>
<item name="android:background">@color/alert_dialog_background_color_inverse</item>
</style>
<style name="AlertDialogStyle.Black">
<item name="android:colorAccent">@color/colorAccentBlack</item>
<item name="android:background">@color/alert_dialog_background_color_black</item>
</style>
</resources>

View File

@ -11,9 +11,12 @@
<color name="colorAccentInverse">#FF5252</color>
<color name="colorPrimaryFallbackInverse">#303030</color>
<color name="colorAccentBlack">#FF5252</color>
<color name="card_background_color">#1fffffff</color> <!--12% white, not from MD spec-->
<color name="card_background_color_inverse">#0fffffff</color> <!--6% white, not from MD spec-->
<color name="alert_dialog_background_color">@color/colorPrimaryFallback</color>
<color name="alert_dialog_background_color_inverse">@color/colorPrimaryFallbackInverse</color>
<color name="alert_dialog_background_color_black">#111111</color>
</resources>

View File

@ -8,9 +8,11 @@
<string name="theme_light">Light</string>
<string name="theme_dark">Dark</string>
<string name="theme_black">Black</string>
<string-array name="array_theme">
<item>@string/theme_light</item>
<item>@string/theme_dark</item>
<item>@string/theme_black</item>
</string-array>
<string name="key_last_tab">last_tab</string>

View File

@ -34,12 +34,24 @@
<item name="android:windowBackground">@color/colorPrimaryInverse</item>
</style>
<style name="BaseAppTheme.Black">
<item name="colorPrimary">@android:color/black</item>
<item name="colorPrimaryDark">@android:color/black</item>
<item name="colorAccent">@color/colorAccentBlack</item>
<item name="cardBackgroundColor">@color/card_background_color_inverse</item>
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle.Black</item>
<item name="android:windowBackground">@android:color/black</item>
</style>
<style name="AppTheme" parent="BaseAppTheme.Light">
</style>
<style name="AppTheme.Dark" parent="BaseAppTheme.Dark">
</style>
<style name="AppTheme.Black" parent="BaseAppTheme.Black">
</style>
<style name="NumberButton">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
@ -138,11 +150,14 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="android:background">@color/alert_dialog_background_color</item>
</style>
<style name="AppCompatAlertDialogStyle.Dark">
<item name="colorAccent">@color/colorAccentInverse</item>
<item name="android:background">@color/alert_dialog_background_color_inverse</item>
</style>
<style name="AppCompatAlertDialogStyle.Black">
<item name="colorAccent">@color/colorAccentBlack</item>
<item name="android:background">@color/alert_dialog_background_color_black</item>
</style>
<style name="BottomSheetDialogTheme" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/ModalStyle</item>