Added beige switch to theme selection dialog

pull/215/head
M66B 6 months ago
parent 6995526dd6
commit 921773eaa0

@ -54,6 +54,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
private TextView tvYou; private TextView tvYou;
private RadioGroup rgThemeOptions; private RadioGroup rgThemeOptions;
private TextView tvSystem; private TextView tvSystem;
private SwitchCompat swBeige;
private SwitchCompat swBlack; private SwitchCompat swBlack;
private SwitchCompat swHtmlLight; private SwitchCompat swHtmlLight;
private SwitchCompat swComposerLight; private SwitchCompat swComposerLight;
@ -97,6 +98,8 @@ public class FragmentDialogTheme extends FragmentDialogBase {
final Context context = getContext(); final Context context = getContext();
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String theme = prefs.getString("theme", "blue_orange_system"); String theme = prefs.getString("theme", "blue_orange_system");
boolean cards = prefs.getBoolean("cards", true);
boolean beige = prefs.getBoolean("beige", true);
boolean default_light = prefs.getBoolean("default_light", false); boolean default_light = prefs.getBoolean("default_light", false);
boolean composer_light = prefs.getBoolean("composer_light", false); boolean composer_light = prefs.getBoolean("composer_light", false);
boolean debug = prefs.getBoolean("debug", false); boolean debug = prefs.getBoolean("debug", false);
@ -109,6 +112,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
swReverse = dview.findViewById(R.id.swReverse); swReverse = dview.findViewById(R.id.swReverse);
rgThemeOptions = dview.findViewById(R.id.rgThemeOptions); rgThemeOptions = dview.findViewById(R.id.rgThemeOptions);
tvSystem = dview.findViewById(R.id.tvSystem); tvSystem = dview.findViewById(R.id.tvSystem);
swBeige = dview.findViewById(R.id.swBeige);
swBlack = dview.findViewById(R.id.swBlack); swBlack = dview.findViewById(R.id.swBlack);
swHtmlLight = dview.findViewById(R.id.swHtmlLight); swHtmlLight = dview.findViewById(R.id.swHtmlLight);
swComposerLight = dview.findViewById(R.id.swComposerLight); swComposerLight = dview.findViewById(R.id.swComposerLight);
@ -173,6 +177,8 @@ public class FragmentDialogTheme extends FragmentDialogBase {
else else
rgThemeOptions.check(R.id.rbThemeLight); rgThemeOptions.check(R.id.rbThemeLight);
swBeige.setChecked(beige);
swBeige.setVisibility(cards ? View.VISIBLE : View.GONE);
swBlack.setChecked(black); swBlack.setChecked(black);
swHtmlLight.setChecked(default_light); swHtmlLight.setChecked(default_light);
swComposerLight.setChecked(composer_light); swComposerLight.setChecked(composer_light);
@ -304,6 +310,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
boolean reverse = (swReverse.isEnabled() && swReverse.isChecked()); boolean reverse = (swReverse.isEnabled() && swReverse.isChecked());
boolean dark = (rgThemeOptions.isEnabled() && optionId == R.id.rbThemeDark); boolean dark = (rgThemeOptions.isEnabled() && optionId == R.id.rbThemeDark);
boolean system = (rgThemeOptions.isEnabled() && optionId == R.id.rbThemeSystem); boolean system = (rgThemeOptions.isEnabled() && optionId == R.id.rbThemeSystem);
boolean beige = swBeige.isChecked();
boolean black = (swBlack.isEnabled() && swBlack.isChecked()); boolean black = (swBlack.isEnabled() && swBlack.isChecked());
SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor editor = prefs.edit();
@ -379,6 +386,8 @@ public class FragmentDialogTheme extends FragmentDialogBase {
(black ? "_black" : dark ? "_dark" : "_light")).apply(); (black ? "_black" : dark ? "_dark" : "_light")).apply();
} }
editor.putBoolean("beige", beige);
editor.putBoolean("default_light", swHtmlLight.isChecked()); editor.putBoolean("default_light", swHtmlLight.isChecked());
editor.putBoolean("composer_light", swComposerLight.isChecked()); editor.putBoolean("composer_light", swComposerLight.isChecked());

@ -366,6 +366,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rgThemeOptions" /> app:layout_constraintTop_toBottomOf="@id/rgThemeOptions" />
<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/tvSystem" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBlack" android:id="@+id/swBlack"
android:layout_width="0dp" android:layout_width="0dp"
@ -374,7 +384,7 @@
android:text="@string/title_setup_theme_black_background" android:text="@string/title_setup_theme_black_background"
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/tvSystem" /> app:layout_constraintTop_toBottomOf="@id/swBeige" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtmlLight" android:id="@+id/swHtmlLight"

@ -434,6 +434,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rgThemeOptions" /> app:layout_constraintTop_toBottomOf="@id/rgThemeOptions" />
<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/tvSystem" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBlack" android:id="@+id/swBlack"
android:layout_width="0dp" android:layout_width="0dp"
@ -442,7 +452,7 @@
android:text="@string/title_setup_theme_black_background" android:text="@string/title_setup_theme_black_background"
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/tvSystem" /> app:layout_constraintTop_toBottomOf="@id/swBeige" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtmlLight" android:id="@+id/swHtmlLight"

@ -183,6 +183,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rgThemeOptions" /> app:layout_constraintTop_toBottomOf="@id/rgThemeOptions" />
<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/tvSystem" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBlack" android:id="@+id/swBlack"
android:layout_width="0dp" android:layout_width="0dp"
@ -191,7 +201,7 @@
android:text="@string/title_setup_theme_black_background" android:text="@string/title_setup_theme_black_background"
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/tvSystem" /> app:layout_constraintTop_toBottomOf="@id/swBeige" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtmlLight" android:id="@+id/swHtmlLight"

Loading…
Cancel
Save