mirror of https://github.com/M66B/FairEmail.git
Added option to show original messages light for dark themes
This commit is contained in:
parent
89898123e7
commit
db35fb761d
|
@ -3707,18 +3707,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
full ? R.layout.dialog_show_full : R.layout.dialog_show_images, null);
|
||||
CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
|
||||
CheckBox cbNotAgainDomain = dview.findViewById(R.id.cbNotAgainDomain);
|
||||
CheckBox cbAlwaysImages = dview.findViewById(R.id.cbAlwaysImages);
|
||||
|
||||
if (full) {
|
||||
cbAlwaysImages.setChecked(prefs.getBoolean("html_always_images", false));
|
||||
|
||||
cbAlwaysImages.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
prefs.edit().putBoolean("html_always_images", isChecked).apply();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (message.from == null || message.from.length == 0) {
|
||||
cbNotAgain.setVisibility(View.GONE);
|
||||
|
@ -3749,9 +3737,32 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
if (full) {
|
||||
TextView tvDark = dview.findViewById(R.id.tvDark);
|
||||
tvDark.setVisibility(Helper.isDarkTheme(context)
|
||||
&& !WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)
|
||||
? View.VISIBLE : View.GONE);
|
||||
CheckBox cbDark = dview.findViewById(R.id.cbDark);
|
||||
CheckBox cbAlwaysImages = dview.findViewById(R.id.cbAlwaysImages);
|
||||
|
||||
cbDark.setChecked(prefs.getBoolean("html_dark", true));
|
||||
cbAlwaysImages.setChecked(prefs.getBoolean("html_always_images", false));
|
||||
|
||||
cbDark.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
prefs.edit().putBoolean("html_dark", isChecked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
cbAlwaysImages.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
prefs.edit().putBoolean("html_always_images", isChecked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
boolean isDark = Helper.isDarkTheme(context);
|
||||
boolean canDark = WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK);
|
||||
|
||||
tvDark.setVisibility(isDark && !canDark ? View.VISIBLE : View.GONE);
|
||||
cbDark.setVisibility(isDark && canDark ? View.VISIBLE : View.GONE);
|
||||
|
||||
} else {
|
||||
boolean disable_tracking = prefs.getBoolean("disable_tracking", true);
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean overview_mode = prefs.getBoolean("overview_mode", false);
|
||||
boolean safe_browsing = prefs.getBoolean("safe_browsing", false);
|
||||
boolean html_dark = prefs.getBoolean("html_dark", true);
|
||||
|
||||
setVerticalScrollBarEnabled(false);
|
||||
setHorizontalScrollBarEnabled(false);
|
||||
|
@ -73,7 +74,8 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
|||
if (WebViewFeature.isFeatureSupported(WebViewFeature.SAFE_BROWSING_ENABLE))
|
||||
WebSettingsCompat.setSafeBrowsingEnabled(settings, safe_browsing);
|
||||
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK))
|
||||
if (html_dark &&
|
||||
WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK))
|
||||
WebSettingsCompat.setForceDark(settings,
|
||||
Helper.isDarkTheme(context) ? FORCE_DARK_ON : FORCE_DARK_OFF);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,26 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvMessage" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbDark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_ask_show_html_dark"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDark" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbAlwaysImages"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_ask_show_html_images"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbDark" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbNotAgain"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -40,7 +60,7 @@
|
|||
android:text="@string/title_no_ask_for_again"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDark" />
|
||||
app:layout_constraintTop_toBottomOf="@id/cbAlwaysImages" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbNotAgainDomain"
|
||||
|
@ -52,15 +72,5 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbNotAgain" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbAlwaysImages"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_ask_show_html_images"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbNotAgainDomain" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</eu.faircode.email.ScrollViewEx>
|
|
@ -924,6 +924,7 @@
|
|||
<string name="title_ask_delete_rule">Delete rule permanently?</string>
|
||||
<string name="title_ask_discard">Discard draft?</string>
|
||||
<string name="title_ask_show_html">Showing the original message can leak privacy sensitive information</string>
|
||||
<string name="title_ask_show_html_dark">Use dark theme</string>
|
||||
<string name="title_ask_show_html_remark">Displaying the original message on a dark background is not possible as it may make dark texts and images invisible</string>
|
||||
<string name="title_ask_show_html_images">Always show images on showing original messages</string>
|
||||
<string name="title_ask_show_image">Showing images can leak privacy sensitive information</string>
|
||||
|
|
Loading…
Reference in New Issue