X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Ffragments%2FSettingsFragment.kt;fp=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Ffragments%2FSettingsFragment.kt;h=2ce103dcbda524fdbe74db3cbe538836ca6f3e9d;hp=d73c905f65de62593c05fffeaadbab9a9438c6d3;hb=eac401700379e6ac5e6b0b696b932354001ef738;hpb=6b2cf168a9c3697be63dee603d05a88506c380a1 diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.kt index d73c905f..2ce103dc 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.kt @@ -173,6 +173,15 @@ 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(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 @@ -273,8 +282,8 @@ class SettingsFragment : PreferenceFragmentCompat() { // Set the current theme as the summary text for the preference. appThemePreference.summary = appThemeEntriesStringArray[appThemeEntryNumber] - // Enable the WebView theme preference if the API < 33 or the app theme is not set to light. Google no longer allows light themes to display dark WebViews. - webViewThemePreference.isEnabled = ((Build.VERSION.SDK_INT < 33) || (appThemeEntryNumber != 1)) + // Enable the WebView theme preference if the app theme is not set to light. Google does not allow light themes to display dark WebViews. + webViewThemePreference.isEnabled = (appThemeEntryNumber != 1) // Get the WebView theme string arrays. webViewThemeEntriesStringArray = resources.getStringArray(R.array.webview_theme_entries) @@ -1090,8 +1099,8 @@ class SettingsFragment : PreferenceFragmentCompat() { } } - // Enable the WebView theme preference if the API < 33 or the app theme is set to light. - webViewThemePreference.isEnabled = ((Build.VERSION.SDK_INT < 33) || (appThemeEntryNumber != 1)) + // Enable the WebView theme preference if the app theme is not set to light. Google does not allow light themes to display dark WebViews. + webViewThemePreference.isEnabled = (appThemeEntryNumber != 1) // Get the webView theme entry number that matches the new WebView theme. val webViewThemeEntryNumber: Int = when (sharedPreferences.getString(getString(R.string.webview_theme_key), getString(R.string.webview_theme_default_value))) {