]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Enable WebView algorithmic darkening on API 24-28. https://redmine.stoutner.com...
authorSoren Stoutner <soren@stoutner.com>
Wed, 7 Jun 2023 22:01:17 +0000 (15:01 -0700)
committerSoren Stoutner <soren@stoutner.com>
Wed, 7 Jun 2023 22:01:17 +0000 (15:01 -0700)
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt
app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.kt
app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.kt
app/src/main/res/values-de/strings.xml
app/src/main/res/values-it/strings.xml
app/src/main/res/values-ru/strings.xml

index 96cd882bca9306d6222076f1da78ac00e1199e29..ffa89265081f2846a831cb6b55d8e22b981b1254 100644 (file)
@@ -1075,9 +1075,6 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook
         // Disable the clear form data menu item if the API >= 26 so that the status of the main Clear Data is calculated correctly.
         optionsClearFormDataMenuItem.isEnabled = Build.VERSION.SDK_INT < 26
 
-        // Only display the dark WebView menu item if the API >= 29.
-        optionsDarkWebViewMenuItem.isVisible = Build.VERSION.SDK_INT >= 29
-
         // Set the status of the additional app bar icons.  Setting the refresh menu item to `SHOW_AS_ACTION_ALWAYS` makes it appear even on small devices like phones.
         if (displayAdditionalAppBarIcons) {  // Display the additional icons.
             optionsRefreshMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS)
@@ -1159,8 +1156,8 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook
             // Enable dark WebView if night mode is enabled.
             optionsDarkWebViewMenuItem.isEnabled = (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES)
 
-            // Set the checkbox status for dark WebView if the device is running API >= 29 and algorithmic darkening is supported.
-            if ((Build.VERSION.SDK_INT >= 29) && WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING))
+            // Set the checkbox status for dark WebView if algorithmic darkening is supported.
+            if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING))
                 optionsDarkWebViewMenuItem.isChecked = WebSettingsCompat.isAlgorithmicDarkeningAllowed(currentWebView!!.settings)
         }
 
@@ -1918,7 +1915,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook
 
             R.id.dark_webview -> {  // Dark WebView.
                 // Toggle dark WebView if supported.
-                if ((Build.VERSION.SDK_INT >= 29) && WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING))
+                if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING))
                     WebSettingsCompat.setAlgorithmicDarkeningAllowed(currentWebView!!.settings, !WebSettingsCompat.isAlgorithmicDarkeningAllowed(currentWebView!!.settings)
                 )
 
@@ -3238,8 +3235,8 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook
                     }
                 }
 
-                // Set the WebView theme if device is running API >= 29 and algorithmic darkening is supported.
-                if ((Build.VERSION.SDK_INT >= 29) && WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
+                // Set the WebView theme if algorithmic darkening is supported.
+                if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
                     // Set the WebView theme.
                     when (webViewThemeInt) {
                         // Set the WebView theme.
@@ -3358,8 +3355,8 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook
                     else -> nestedScrollWebView.settings.userAgentString = userAgentDataArray[userAgentArrayPosition]
                 }
 
-                // Set the WebView theme if the device is running API >= 29 and algorithmic darkening is supported.
-                if ((Build.VERSION.SDK_INT >= 29) && WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
+                // Set the WebView theme if algorithmic darkening is supported.
+                if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
                     // Set the WebView theme.
                     when (defaultWebViewTheme) {
                         // The light theme is selected.  Turn off algorithmic darkening.
@@ -4443,8 +4440,8 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook
         // Get the WebView theme entry values string array.
         val webViewThemeEntryValuesStringArray = resources.getStringArray(R.array.webview_theme_entry_values)
 
-        // Set the WebView theme if device is running API >= 29 and algorithmic darkening is supported.
-        if (Build.VERSION.SDK_INT >= 29 && WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
+        // Set the WebView theme if algorithmic darkening is supported.
+        if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
             // Set the WebView them.  A switch statement cannot be used because the WebView theme entry values string array is not a compile time constant.
             if (webViewTheme == webViewThemeEntryValuesStringArray[1]) {  // The light theme is selected.
                 // Turn off algorithmic darkening.
index ee7bc883c93235af9d54f8709d753fd05fd6cd7b..2687adc7870878c98243f2fae72555364c2c8eef 100644 (file)
@@ -269,10 +269,6 @@ class DomainSettingsFragment : Fragment() {
         if (Build.VERSION.SDK_INT >= 26)
             formDataLinearLayout.visibility = View.GONE
 
-        // Hide the WebView theme linear layout if the API < 29.
-        if (Build.VERSION.SDK_INT < 29)
-            webViewThemeLinearLayout.visibility = View.GONE
-
         // Initialize the database handler.
         val domainsDatabaseHelper = DomainsDatabaseHelper(requireContext())
 
index 7935a8a1c1a38225416b934fec26fad1e2a55baa..397dad08fc69a281065dfd8e00e42da1aa7a304e 100644 (file)
@@ -191,15 +191,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
             clearAndExitCategory.removePreference(clearFormDataPreference)
         }
 
-        // Remove the WebView theme preference if the API < 29.
-        if (Build.VERSION.SDK_INT < 29) {
-            // Get a handle for the general category.
-            val generalCategory = findPreference<PreferenceCategory>(getString(R.string.general_category_key))!!
-
-            // Remove the WebView theme preference.
-            generalCategory.removePreference(webViewThemePreference)
-        }
-
         // Only enable Fanboy's social blocking list preference if Fanboy's annoyance list is disabled.
         fanboySocialBlockingListPreference.isEnabled = !fanboyAnnoyanceListEnabled
 
index 8799d33a9b58d457429b9640fb03a267161e8579..16087e37814f86a97eebf3e927836c4d8170f9bd 100644 (file)
         <string name="sorted_by_database_id">Nach Datenbank-ID sortiert.</string>
         <string name="sorted_by_display_order">Nach Anzeige-Reihenfolge sortiert.</string>
     <string name="database_id">Databank-ID:</string>
+    <string name="folder_id">Verzeichnis-ID:</string>
+    <string name="folder_id_separator">\u0020 – %1$d</string>
     <string name="folder">Ordner:</string>
     <string name="parent_folder">Übergeordneter Ordner:</string>
     <string name="display_order">Sortierung:</string>
index e313dfef2f0d463c01105c4797f8b5bb37ca2bbb..076d8109483d7ad3bc1439a75bd255d4c738b39d 100644 (file)
         <string name="sorted_by_database_id">Ordina per database ID.</string>
         <string name="sorted_by_display_order">Ordina come visualizzato.</string>
     <string name="database_id">ID Database:</string>
+    <string name="folder_id_separator">\u0020 – %1$d</string>
     <string name="folder">Cartella:</string>
     <string name="parent_folder">Cartella superiore:</string>
     <string name="display_order">Ordine di visualizzazione:</string>
index f3b9481667cee98b18a8ac460de472d704e7b9ed..477751d6c3488f83286b653704cd352ddd850caf 100644 (file)
         <string name="sorted_by_database_id">Сортировать по ID базы данных.</string>
         <string name="sorted_by_display_order">Сортировать по порядку отображения.</string>
     <string name="database_id">ID базы данных:</string>
+    <string name="folder_id">ID папки:</string>
+    <string name="folder_id_separator">\u0020 – %1$d</string>
     <string name="folder">Папка:</string>
     <string name="parent_folder">Родительская папка:</string>
     <string name="display_order">Порядок отображения:</string>