Added option for default light original view

This commit is contained in:
M66B 2021-09-21 14:58:54 +02:00
parent c52968bd48
commit 8ce323d844
7 changed files with 37 additions and 5 deletions

View File

@ -4,6 +4,10 @@
### [Yaverlandia](https://en.wikipedia.org/wiki/Yaverlandia) ### [Yaverlandia](https://en.wikipedia.org/wiki/Yaverlandia)
### Next version
* Added theme option for default light original message view
### 1.1731 ### 1.1731
* Fixed invalid error reports * Fixed invalid error reports

View File

@ -4,6 +4,10 @@
### [Yaverlandia](https://en.wikipedia.org/wiki/Yaverlandia) ### [Yaverlandia](https://en.wikipedia.org/wiki/Yaverlandia)
### Next version
* Added theme option for default light original message view
### 1.1731 ### 1.1731
* Fixed invalid error reports * Fixed invalid error reports

View File

@ -2268,6 +2268,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
properties.setValue("full", message.id, true); properties.setValue("full", message.id, true);
properties.setValue("full_asked", message.id, true); properties.setValue("full_asked", message.id, true);
} }
boolean default_light = prefs.getBoolean("default_light", false);
properties.setValue("force_light", message.id, default_light);
} }
private void bindBody(TupleMessageEx message, final boolean scroll) { private void bindBody(TupleMessageEx message, final boolean scroll) {

View File

@ -24,6 +24,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
private SwitchCompat swReverse; private SwitchCompat swReverse;
private RadioGroup rgThemeOptions; private RadioGroup rgThemeOptions;
private SwitchCompat swBlack; private SwitchCompat swBlack;
private SwitchCompat swHtmlLight;
private TextView tvSystem; private TextView tvSystem;
private TextView tvMore; private TextView tvMore;
@ -45,6 +46,8 @@ public class FragmentDialogTheme extends FragmentDialogBase {
swBlack.setEnabled(colored && !grey && !solarized && optionId != R.id.rbThemeLight); swBlack.setEnabled(colored && !grey && !solarized && optionId != R.id.rbThemeLight);
swHtmlLight.setEnabled(!colored || optionId != R.id.rbThemeLight);
tvSystem.setEnabled(colored && optionId == R.id.rbThemeSystem); tvSystem.setEnabled(colored && optionId == R.id.rbThemeSystem);
} }
@ -56,6 +59,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);
swBlack = dview.findViewById(R.id.swBlack); swBlack = dview.findViewById(R.id.swBlack);
swHtmlLight = dview.findViewById(R.id.swHtmlLight);
tvSystem = dview.findViewById(R.id.tvSystem); tvSystem = dview.findViewById(R.id.tvSystem);
tvMore = dview.findViewById(R.id.tvMore); tvMore = dview.findViewById(R.id.tvMore);
@ -109,6 +113,9 @@ public class FragmentDialogTheme extends FragmentDialogBase {
swBlack.setChecked(black); swBlack.setChecked(black);
boolean default_light = prefs.getBoolean("default_light", false);
swHtmlLight.setChecked(default_light);
switch (theme) { switch (theme) {
case "light": case "light":
case "dark": case "dark":
@ -244,6 +251,8 @@ public class FragmentDialogTheme extends FragmentDialogBase {
editor.putString("theme", "black_and_white").apply(); editor.putString("theme", "black_and_white").apply();
} }
editor.putBoolean("default_light", swHtmlLight.isChecked());
editor.apply(); editor.apply();
} }
}) })

View File

@ -144,7 +144,8 @@ public class FragmentOptions extends FragmentBase {
"language_detection", "language_detection",
"quick_filter", "quick_scroll", "quick_filter", "quick_scroll",
"experiments", "debug", "experiments", "debug",
"biometrics" "biometrics",
"default_light"
}; };
@Override @Override

View File

@ -93,7 +93,7 @@
android:id="@+id/swReverse" android:id="@+id/swReverse"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="12dp"
android:text="@string/title_setup_theme_reverse" android:text="@string/title_setup_theme_reverse"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -103,7 +103,7 @@
android:id="@+id/rgThemeOptions" android:id="@+id/rgThemeOptions"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="12dp"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -149,12 +149,22 @@
android:id="@+id/swBlack" android:id="@+id/swBlack"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="12dp"
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/tvSystem" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHtmlLight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_setup_theme_html_light"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBlack" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvMore" android:id="@+id/tvMore"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -164,6 +174,6 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorLink" android:textColor="?android:attr/textColorLink"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBlack" /> app:layout_constraintTop_toBottomOf="@id/swHtmlLight" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx> </eu.faircode.email.ScrollViewEx>

View File

@ -292,6 +292,7 @@
<string name="title_setup_theme_dark">Dark</string> <string name="title_setup_theme_dark">Dark</string>
<string name="title_setup_theme_system">Follow system</string> <string name="title_setup_theme_system">Follow system</string>
<string name="title_setup_theme_black_background">Black background</string> <string name="title_setup_theme_black_background">Black background</string>
<string name="title_setup_theme_html_light">Light background for original message view</string>
<string name="title_setup_theme_system_hint">This will automatically switch to a light/dark theme on day/night mode, if supported by Android</string> <string name="title_setup_theme_system_hint">This will automatically switch to a light/dark theme on day/night mode, if supported by Android</string>
<string name="title_setup_theme_more_colors">I want more colors</string> <string name="title_setup_theme_more_colors">I want more colors</string>