mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Force dark for full screen HTML
This commit is contained in:
parent
3245dce63b
commit
55a2550885
1 changed files with 10 additions and 0 deletions
|
@ -137,6 +137,7 @@ import androidx.recyclerview.widget.DiffUtil;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
import androidx.webkit.WebSettingsCompat;
|
||||
import androidx.webkit.WebViewFeature;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
@ -188,6 +189,8 @@ import biweekly.util.ICalDate;
|
|||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
import static androidx.webkit.WebSettingsCompat.FORCE_DARK_OFF;
|
||||
import static androidx.webkit.WebSettingsCompat.FORCE_DARK_ON;
|
||||
|
||||
public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHolder> {
|
||||
private Fragment parentFragment;
|
||||
|
@ -6814,6 +6817,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean overview_mode = prefs.getBoolean("overview_mode", false);
|
||||
boolean safe_browsing = prefs.getBoolean("safe_browsing", false);
|
||||
boolean confirm_html = prefs.getBoolean("confirm_html", true);
|
||||
boolean html_dark = prefs.getBoolean("html_dark", confirm_html);
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_open_full, container, false);
|
||||
WebView wv = view.findViewById(R.id.wv);
|
||||
|
@ -6834,6 +6839,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
settings.setSafeBrowsingEnabled(safe_browsing);
|
||||
|
||||
if (html_dark &&
|
||||
WebViewEx.isFeatureSupported(WebViewFeature.FORCE_DARK))
|
||||
WebSettingsCompat.setForceDark(settings,
|
||||
Helper.isDarkTheme(getContext()) ? FORCE_DARK_ON : FORCE_DARK_OFF);
|
||||
|
||||
settings.setLoadsImagesAutomatically(true);
|
||||
settings.setBlockNetworkLoads(false);
|
||||
settings.setBlockNetworkImage(false);
|
||||
|
|
Loading…
Reference in a new issue