mirror of https://github.com/M66B/FairEmail.git
Added remarks
This commit is contained in:
parent
6107511d94
commit
fe0166e8e1
|
@ -1441,6 +1441,7 @@ public class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isDarkTheme(Context context) {
|
static boolean isDarkTheme(Context context) {
|
||||||
|
// R.attr.isLightTheme
|
||||||
TypedValue tv = new TypedValue();
|
TypedValue tv = new TypedValue();
|
||||||
context.getTheme().resolveAttribute(R.attr.themeName, tv, true);
|
context.getTheme().resolveAttribute(R.attr.themeName, tv, true);
|
||||||
return (tv.string != null && !"light".contentEquals(tv.string));
|
return (tv.string != null && !"light".contentEquals(tv.string));
|
||||||
|
|
|
@ -123,6 +123,8 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
|
||||||
WebSettingsCompat.setForceDark(settings, dark && !force_light ? FORCE_DARK_ON : FORCE_DARK_OFF);
|
WebSettingsCompat.setForceDark(settings, dark && !force_light ? FORCE_DARK_ON : FORCE_DARK_OFF);
|
||||||
setBackgroundColor(canForce && force_light ? Color.WHITE : Color.TRANSPARENT);
|
setBackgroundColor(canForce && force_light ? Color.WHITE : Color.TRANSPARENT);
|
||||||
} else {
|
} else {
|
||||||
|
// https://developer.android.com/reference/android/webkit/WebSettings#setAlgorithmicDarkeningAllowed(boolean)
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
|
||||||
settings.setAlgorithmicDarkeningAllowed(dark && !force_light);
|
settings.setAlgorithmicDarkeningAllowed(dark && !force_light);
|
||||||
setBackgroundColor(force_light ? Color.WHITE : Color.TRANSPARENT);
|
setBackgroundColor(force_light ? Color.WHITE : Color.TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue