Black or white theme

This commit is contained in:
M66B 2022-02-20 08:13:12 +01:00
parent 5cabf7ed85
commit 155ad63801
6 changed files with 34 additions and 45 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -292,6 +292,7 @@
<string name="title_setup_theme_solarized" translatable="false">Solarized</string>
<string name="title_setup_theme_black">Black</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_you" translatable="false">Material You</string>

View File

@ -410,29 +410,28 @@
<item name="colorDrawerBackground">@color/black</item>
</style>
<style name="AppThemeWhite" parent="AppThemeBaseLight">
<item name="colorPrimary">@color/greyPrimary</item>
<item name="colorPrimaryDark">@color/greyPrimaryDark</item>
<item name="colorAccent">@color/greyPrimary</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>
<style name="AppThemeWhite" parent="AppThemeBlueOrangeLight">
<item name="colorPrimary">@color/blackPrimary</item>
<item name="colorPrimaryDark">@color/blackPrimaryDark</item>
<item name="colorAccent">@color/blackAccent</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="snackbarStyle">@style/WhiteSnackBar</item>
</style>
<style name="WhiteActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:background">@color/white</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 name="AppThemeBlackAndWhite" parent="AppThemeBaseDark">