Added beige switch to theme selector

master
M66B 2 weeks ago
parent d640083e96
commit b5aac31be8

@ -55,6 +55,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
private RadioGroup rgThemeOptions; private RadioGroup rgThemeOptions;
private TextView tvSystem; private TextView tvSystem;
private SwitchCompat swBlack; private SwitchCompat swBlack;
private SwitchCompat swBeige;
private SwitchCompat swHtmlLight; private SwitchCompat swHtmlLight;
private SwitchCompat swComposerLight; private SwitchCompat swComposerLight;
private Button btnMore; private Button btnMore;
@ -62,6 +63,9 @@ public class FragmentDialogTheme extends FragmentDialogBase {
private Group grpDebug; private Group grpDebug;
private void eval() { private void eval() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean cards = prefs.getBoolean("cards", true);
int checkedId = rgTheme.getCheckedRadioButtonId(); int checkedId = rgTheme.getCheckedRadioButtonId();
boolean grey = (checkedId == R.id.rbThemeGrey); boolean grey = (checkedId == R.id.rbThemeGrey);
boolean solarized = (checkedId == R.id.rbThemeSolarized); boolean solarized = (checkedId == R.id.rbThemeSolarized);
@ -84,6 +88,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
tvSystem.setEnabled(colored && optionId == R.id.rbThemeSystem); tvSystem.setEnabled(colored && optionId == R.id.rbThemeSystem);
swBlack.setEnabled(colored && !grey && !bw && !solarized && optionId != R.id.rbThemeLight); swBlack.setEnabled(colored && !grey && !bw && !solarized && optionId != R.id.rbThemeLight);
swBeige.setEnabled(cards && optionId != R.id.rbThemeDark);
swHtmlLight.setEnabled(colored ? optionId != R.id.rbThemeLight : !blank); swHtmlLight.setEnabled(colored ? optionId != R.id.rbThemeLight : !blank);
swComposerLight.setEnabled(colored ? optionId != R.id.rbThemeLight : !blank); swComposerLight.setEnabled(colored ? optionId != R.id.rbThemeLight : !blank);
@ -111,6 +116,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
rgThemeOptions = dview.findViewById(R.id.rgThemeOptions); rgThemeOptions = dview.findViewById(R.id.rgThemeOptions);
tvSystem = dview.findViewById(R.id.tvSystem); tvSystem = dview.findViewById(R.id.tvSystem);
swBlack = dview.findViewById(R.id.swBlack); swBlack = dview.findViewById(R.id.swBlack);
swBeige = dview.findViewById(R.id.swBeige);
swHtmlLight = dview.findViewById(R.id.swHtmlLight); swHtmlLight = dview.findViewById(R.id.swHtmlLight);
swComposerLight = dview.findViewById(R.id.swComposerLight); swComposerLight = dview.findViewById(R.id.swComposerLight);
btnMore = dview.findViewById(R.id.btnMore); btnMore = dview.findViewById(R.id.btnMore);
@ -156,6 +162,13 @@ public class FragmentDialogTheme extends FragmentDialogBase {
} }
}); });
swBeige.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
eval();
}
});
boolean reversed = boolean reversed =
(theme.contains("reversed") || (theme.contains("reversed") ||
theme.startsWith("orange_blue") || theme.startsWith("orange_blue") ||
@ -164,6 +177,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
boolean dark = (theme.endsWith("dark") || theme.equals("black")); 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"));
boolean beige = prefs.getBoolean("beige", true);
swReverse.setChecked(reversed); swReverse.setChecked(reversed);
@ -175,6 +189,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
rgThemeOptions.check(R.id.rbThemeLight); rgThemeOptions.check(R.id.rbThemeLight);
swBlack.setChecked(black); swBlack.setChecked(black);
swBeige.setChecked(beige);
swHtmlLight.setChecked(default_light); swHtmlLight.setChecked(default_light);
swComposerLight.setChecked(composer_light); swComposerLight.setChecked(composer_light);
@ -380,6 +395,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
(black ? "_black" : dark ? "_dark" : "_light")).apply(); (black ? "_black" : dark ? "_dark" : "_light")).apply();
} }
editor.putBoolean("beige", swBeige.isChecked());
editor.putBoolean("default_light", swHtmlLight.isChecked()); editor.putBoolean("default_light", swHtmlLight.isChecked());
editor.putBoolean("composer_light", swComposerLight.isChecked()); editor.putBoolean("composer_light", swComposerLight.isChecked());

@ -376,6 +376,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSystem" /> app:layout_constraintTop_toBottomOf="@id/tvSystem" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBeige"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_cards_beige"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBlack" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtmlLight" android:id="@+id/swHtmlLight"
android:layout_width="0dp" android:layout_width="0dp"
@ -384,7 +394,7 @@
android:text="@string/title_setup_theme_html_light" android:text="@string/title_setup_theme_html_light"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBlack" /> app:layout_constraintTop_toBottomOf="@id/swBeige" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swComposerLight" android:id="@+id/swComposerLight"

@ -444,6 +444,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSystem" /> app:layout_constraintTop_toBottomOf="@id/tvSystem" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBeige"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_cards_beige"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBlack" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtmlLight" android:id="@+id/swHtmlLight"
android:layout_width="0dp" android:layout_width="0dp"
@ -452,7 +462,7 @@
android:text="@string/title_setup_theme_html_light" android:text="@string/title_setup_theme_html_light"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBlack" /> app:layout_constraintTop_toBottomOf="@id/swBeige" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swComposerLight" android:id="@+id/swComposerLight"

@ -193,6 +193,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSystem" /> app:layout_constraintTop_toBottomOf="@id/tvSystem" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBeige"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_cards_beige"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBlack" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtmlLight" android:id="@+id/swHtmlLight"
android:layout_width="0dp" android:layout_width="0dp"
@ -201,7 +211,7 @@
android:text="@string/title_setup_theme_html_light" android:text="@string/title_setup_theme_html_light"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBlack" /> app:layout_constraintTop_toBottomOf="@id/swBeige" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swComposerLight" android:id="@+id/swComposerLight"

Loading…
Cancel
Save