]> gitweb.stoutner.com Git - PrivacyCell.git/blobdiff - app/src/main/java/com/stoutner/privacycell/dialogs/WebViewDialog.kt
Remove deprecated `setForceDark` on WebViews. https://redmine.stoutner.com/issues/933
[PrivacyCell.git] / app / src / main / java / com / stoutner / privacycell / dialogs / WebViewDialog.kt
index 0a40933c95174739c3bc5e95d139c4b7851c8032..aa7d296a141def98def55dd87cfd32b767038b85 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2021-2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2021-2022 Soren Stoutner <soren@stoutner.com>.
  *
  * This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>.
  *
@@ -21,7 +21,6 @@ package com.stoutner.privacycell.dialogs
 
 import android.app.Dialog
 import android.content.Intent
-import android.content.res.Configuration
 import android.os.Bundle
 import android.webkit.WebResourceRequest
 import android.webkit.WebResourceResponse
@@ -30,9 +29,7 @@ import android.webkit.WebViewClient
 
 import androidx.appcompat.app.AlertDialog
 import androidx.fragment.app.DialogFragment
-import androidx.webkit.WebSettingsCompat
 import androidx.webkit.WebViewAssetLoader
-import androidx.webkit.WebViewFeature
 
 import com.stoutner.privacycell.R
 
@@ -388,15 +385,6 @@ class WebViewDialog : DialogFragment() {
         // Get a handle for the WebView.
         webView = alertDialog.findViewById(R.id.webview)!!
 
-        // 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.
-            // Apply the dark WebView theme.
-            WebSettingsCompat.setForceDark(webView.settings, WebSettingsCompat.FORCE_DARK_ON)
-        }
-
         // Create a WebView asset loader.
         val webViewAssetLoader = WebViewAssetLoader.Builder().addPathHandler("/assets/", WebViewAssetLoader.AssetsPathHandler(requireContext())).build()
 
@@ -481,4 +469,4 @@ class WebViewDialog : DialogFragment() {
         // Save the scroll position.
         savedInstanceState.putInt(SCROLL_Y, webView.scrollY)
     }
-}
\ No newline at end of file
+}