X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;ds=sidebyside;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Ffragments%2FAboutWebViewFragment.kt;h=8ce9e2253163b5aada9735376e1f2ac309c35a4e;hb=a156c3942ca31a1afca3271245cc2bda7ed5aed8;hp=3b516ec546d53b5824f51f3ffdc4a1348999f611;hpb=9338dfa2f8a295736d35e4f468f0c0ba573a1b58;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt index 3b516ec5..8ce9e225 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt @@ -22,6 +22,7 @@ package com.stoutner.privacybrowser.fragments import android.content.Intent import android.content.res.Configuration import android.net.Uri +import android.os.Build import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -79,7 +80,7 @@ class AboutWebViewFragment : Fragment() { } override fun onCreateView(layoutInflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { - // Inflate the layout. False does not attach the inflated layout as a child of container. The fragment will take care of attaching the root automatically. + // Inflate the layout. The fragment will take care of attaching the root automatically. webViewLayout = layoutInflater.inflate(R.layout.bare_webview, container, false) // Get a handle for tab WebView. @@ -116,9 +117,10 @@ class AboutWebViewFragment : Fragment() { // Get the current theme status. val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK - // Check to see if the app is in night mode. - if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES && WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) { // The app is in night mode. + // Check to see if the app is in night mode. This can be removed once the minimum API >= 33. + if ((Build.VERSION.SDK_INT < 33) && (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) && WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) { // The app is in night mode. // Apply the dark WebView theme. + @Suppress("DEPRECATION") WebSettingsCompat.setForceDark(tabWebView.settings, WebSettingsCompat.FORCE_DARK_ON) }