Black or white theme

pull/194/merge
M66B 4 years ago
parent 5cabf7ed85
commit 155ad63801

@ -42,15 +42,16 @@ public class FragmentDialogTheme extends FragmentDialogBase {
private void eval() { private void eval() {
int checkedId = rgTheme.getCheckedRadioButtonId(); int checkedId = rgTheme.getCheckedRadioButtonId();
boolean grey = (checkedId == R.id.rbThemeGrey); boolean grey = (checkedId == R.id.rbThemeGrey);
boolean bw = (checkedId == R.id.rbThemeBlackOrWhite);
boolean solarized = (checkedId == R.id.rbThemeSolarized); boolean solarized = (checkedId == R.id.rbThemeSolarized);
boolean you = (checkedId == R.id.rbThemeYou); boolean you = (checkedId == R.id.rbThemeYou);
boolean colored = (grey || solarized || you || boolean colored = (grey || bw || solarized || you ||
checkedId == R.id.rbThemeBlueOrange || checkedId == R.id.rbThemeBlueOrange ||
checkedId == R.id.rbThemeRedGreen || checkedId == R.id.rbThemeRedGreen ||
checkedId == R.id.rbThemeYellowPurple); checkedId == R.id.rbThemeYellowPurple);
int optionId = rgThemeOptions.getCheckedRadioButtonId(); int optionId = rgThemeOptions.getCheckedRadioButtonId();
swReverse.setEnabled(colored && !grey && !solarized); swReverse.setEnabled(colored && !grey && !bw && !solarized);
rgThemeOptions.setEnabled(colored); rgThemeOptions.setEnabled(colored);
for (int i = 0; i < rgThemeOptions.getChildCount(); i++) for (int i = 0; i < rgThemeOptions.getChildCount(); i++)
@ -58,7 +59,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
tvSystem.setEnabled(colored && optionId == R.id.rbThemeSystem); tvSystem.setEnabled(colored && optionId == R.id.rbThemeSystem);
swBlack.setEnabled(colored && !grey && !solarized && optionId != R.id.rbThemeLight); swBlack.setEnabled(colored && !grey && !bw && !solarized && optionId != R.id.rbThemeLight);
swHtmlLight.setEnabled(!colored || optionId != R.id.rbThemeLight); swHtmlLight.setEnabled(!colored || optionId != R.id.rbThemeLight);
swComposerLight.setEnabled(!colored || optionId != R.id.rbThemeLight); swComposerLight.setEnabled(!colored || optionId != R.id.rbThemeLight);
@ -134,7 +135,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
theme.startsWith("orange_blue") || theme.startsWith("orange_blue") ||
theme.startsWith("purple_yellow") || theme.startsWith("purple_yellow") ||
theme.startsWith("green_red")); theme.startsWith("green_red"));
boolean dark = theme.endsWith("dark"); boolean dark = (theme.endsWith("dark") || theme.equals("black"));
boolean system = (theme.endsWith("system") || theme.endsWith("system_black")); boolean system = (theme.endsWith("system") || theme.endsWith("system_black"));
boolean black = (!"black".equals(theme) && theme.endsWith("black")); boolean black = (!"black".equals(theme) && theme.endsWith("black"));
@ -206,10 +207,9 @@ public class FragmentDialogTheme extends FragmentDialogBase {
break; break;
case "black": case "black":
rgTheme.check(R.id.rbThemeBlack);
break;
case "white": case "white":
rgTheme.check(R.id.rbThemeWhite); case "bw_system":
rgTheme.check(R.id.rbThemeBlackOrWhite);
break; break;
case "black_and_white": case "black_and_white":
rgTheme.check(R.id.rbThemeBlackAndWhite); rgTheme.check(R.id.rbThemeBlackAndWhite);
@ -307,10 +307,11 @@ public class FragmentDialogTheme extends FragmentDialogBase {
else else
editor.putString("theme", editor.putString("theme",
"solarized" + (dark ? "_dark" : "_light")).apply(); "solarized" + (dark ? "_dark" : "_light")).apply();
} else if (checkedRadioButtonId == R.id.rbThemeBlack) { } else if (checkedRadioButtonId == R.id.rbThemeBlackOrWhite) {
editor.putString("theme", "black").apply(); if (system)
} else if (checkedRadioButtonId == R.id.rbThemeWhite) { editor.putString("theme", "bw_system").apply();
editor.putString("theme", "white").apply(); else
editor.putString("theme", (dark ? "black" : "white")).apply();
} else if (checkedRadioButtonId == R.id.rbThemeBlackAndWhite) { } else if (checkedRadioButtonId == R.id.rbThemeBlackAndWhite) {
editor.putString("theme", "black_and_white").apply(); editor.putString("theme", "black_and_white").apply();
} else if (checkedRadioButtonId == R.id.rbThemeYou) { } else if (checkedRadioButtonId == R.id.rbThemeYou) {
@ -513,6 +514,9 @@ public class FragmentDialogTheme extends FragmentDialogBase {
case "solarized_system": case "solarized_system":
return (night return (night
? R.style.AppThemeSolarizedDark : R.style.AppThemeSolarizedLight); ? R.style.AppThemeSolarizedDark : R.style.AppThemeSolarizedLight);
case "bw_system":
return (night
? R.style.AppThemeBlack : R.style.AppThemeWhite);
case "you_light": case "you_light":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)

@ -74,19 +74,11 @@
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton <RadioButton
android:id="@+id/rbThemeBlack" android:id="@+id/rbThemeBlackOrWhite"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="6dp" android:padding="6dp"
android:text="@string/title_setup_theme_black" android:text="@string/title_setup_theme_black_or_white"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/title_setup_theme_white"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton <RadioButton

@ -74,19 +74,11 @@
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton <RadioButton
android:id="@+id/rbThemeBlack" android:id="@+id/rbThemeBlackOrWhite"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="6dp" android:padding="6dp"
android:text="@string/title_setup_theme_black" android:text="@string/title_setup_theme_black_or_white"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/title_setup_theme_white"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton <RadioButton

@ -146,6 +146,7 @@
<color name="lightSolarizedActionBackground">#93a1a1</color><!-- Base1 --> <color name="lightSolarizedActionBackground">#93a1a1</color><!-- Base1 -->
<!-- default: #323232 --> <!-- default: #323232 -->
<!-- https://issuetracker.google.com/issues/37120757 -->
<color name="design_snackbar_background_color" tools:override="true">#222</color> <color name="design_snackbar_background_color" tools:override="true">#222</color>
<color name="white">#ffffffff</color> <color name="white">#ffffffff</color>

@ -292,6 +292,7 @@
<string name="title_setup_theme_solarized" translatable="false">Solarized</string> <string name="title_setup_theme_solarized" translatable="false">Solarized</string>
<string name="title_setup_theme_black">Black</string> <string name="title_setup_theme_black">Black</string>
<string name="title_setup_theme_white">White</string> <string name="title_setup_theme_white">White</string>
<string name="title_setup_theme_black_or_white">Black or white</string>
<string name="title_setup_theme_black_and_white">Black and white</string> <string name="title_setup_theme_black_and_white">Black and white</string>
<string name="title_setup_theme_you" translatable="false">Material You</string> <string name="title_setup_theme_you" translatable="false">Material You</string>

@ -410,29 +410,28 @@
<item name="colorDrawerBackground">@color/black</item> <item name="colorDrawerBackground">@color/black</item>
</style> </style>
<style name="AppThemeWhite" parent="AppThemeBaseLight"> <style name="AppThemeWhite" parent="AppThemeBlueOrangeLight">
<item name="colorPrimary">@color/greyPrimary</item> <item name="colorPrimary">@color/blackPrimary</item>
<item name="colorPrimaryDark">@color/greyPrimaryDark</item> <item name="colorPrimaryDark">@color/blackPrimaryDark</item>
<item name="colorAccent">@color/greyPrimary</item> <item name="colorAccent">@color/blackAccent</item>
<item name="colorUnreadHighlight">@color/greyPrimaryDark</item>
<item name="colorEncrypt">@color/colorEncryptDark</item>
<item name="colorDrawerBackground">@color/white</item>
<item name="colorFabBackground">@color/greyPrimary</item>
<item name="colorInfoForeground">@color/white</item> <item name="colorInfoForeground">@color/white</item>
<item name="colorInfoBackground">@color/greyPrimary</item> <item name="colorInfoBackground">@color/blackPrimary</item>
<item name="actionBarTheme">@style/WhiteActionBar</item> <item name="actionBarTheme">@style/WhiteActionBar</item>
<item name="snackbarStyle">@style/WhiteSnackBar</item>
</style> </style>
<style name="WhiteActionBar" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="WhiteActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:background">@color/white</item> <item name="android:background">@color/white</item>
<item name="android:titleTextStyle">@style/ActionBarTitle</item> <item name="android:titleTextStyle">@style/ActionBarTitle</item>
<item name="android:textColor">@color/black</item> <!-- snackbar text color -->
<item name="android:textColor">@color/blackPrimaryDark</item>
</style>
<style name="WhiteSnackBar" parent="Widget.Design.Snackbar">
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
</style> </style>
<style name="AppThemeBlackAndWhite" parent="AppThemeBaseDark"> <style name="AppThemeBlackAndWhite" parent="AppThemeBaseDark">

Loading…
Cancel
Save