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
// 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)
}
getString(R.string.app_theme_key) -> {
- // Get the app theme entry number that matches the current app theme. A switch statement cannot be used because the theme entry values string array is not a compile time constant.
+ // Get the app theme entry number that matches the current app theme.
val appThemeEntryNumber: Int = when (sharedPreferences.getString(getString(R.string.app_theme_key), getString(R.string.app_theme_default_value))) {
appThemeEntryValuesStringArray[1] -> 1 // The light theme is selected.
appThemeEntryValuesStringArray[2] -> 2 // The dark theme is selected.
}
}
- // 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))) {