X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Ffragments%2FAboutWebViewFragment.kt;h=87ee8a64dc5497f443cd44f09d439dd2b86de531;hp=3f14e183bd8f00cf273e19b3c3e7b34e9b7cbf3f;hb=89d388e324a3b9f719c70e590cfbaf866f727092;hpb=8142ac5fc2489de735de4b6fa21a1eae733ccfce 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 3f14e183..87ee8a64 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 @@ -91,6 +92,7 @@ class AboutWebViewFragment : Fragment() { // Set a WebView client. tabWebView.webViewClient = object : WebViewClient() { // // Send external links back to the main Privacy Browser WebView. The deprecated `shouldOverrideUrlLoading` must be used until API >= 24. + @Deprecated("Deprecated in Java") override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean { // Create an intent to view the URL. val urlIntent = Intent(Intent.ACTION_VIEW) @@ -115,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) }