- // Set the JavaScript switch status.
- if (javaScriptInt == 1) { // JavaScript is enabled.
- javaScriptSwitch.setChecked(true);
- javaScriptImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.javascript_enabled, null));
- } else { // JavaScript is disabled.
- javaScriptSwitch.setChecked(false);
- javaScriptImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.privacy_mode, null));
- }
-
- // Set the cookies switch status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
- // Doing this makes no sense until it can also be done with the preferences.
- if (cookiesInt == 1) { // Cookies are enabled.
- // Turn the switch on.
- cookiesSwitch.setChecked(true);
-
- // Set the icon.
- cookiesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.cookies_enabled, null));
- } else { // Cookies are disabled.
- // Turn the switch off
- cookiesSwitch.setChecked(false);
-
- // Set the icon.
- cookiesImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.cookies_disabled, null));
- }
-
- // Only enable DOM storage if JavaScript is enabled.
- if (javaScriptInt == 1) { // JavaScript is enabled.
- // Enable the DOM storage switch.
- domStorageSwitch.setEnabled(true);
-
- // Set the DOM storage status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
- // Doing this makes no sense until it can also be done with the preferences.
- if (domStorageInt == 1) { // Both JavaScript and DOM storage are enabled.
- domStorageSwitch.setChecked(true);
- domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_enabled, null));
- } else { // JavaScript is enabled but DOM storage is disabled.
- // Set the DOM storage switch to off.
- domStorageSwitch.setChecked(false);
-
- // Set the icon.
- domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_disabled, null));
- }
- } else { // JavaScript is disabled.
- // Disable the DOM storage switch.
- domStorageSwitch.setEnabled(false);
-
- // Set the checked status of DOM storage.
- domStorageSwitch.setChecked(domStorageInt == 1);
-
- // Set the icon.
- domStorageImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.dom_storage_ghosted, null));
- }
-
- // Set the form data visibility. Form data can be removed once the minimum API >= 26.
- if (Build.VERSION.SDK_INT >= 26) { // Form data no longer applies to newer versions of Android.
- // Hide the form data image view and switch.
- formDataImageView.setVisibility(View.GONE);
- formDataSwitch.setVisibility(View.GONE);
- } else { // Form data should be displayed because this is an older version of Android.
- if (formDataInt == 1) { // Form data is on.
- // Turn the form data switch on.
- formDataSwitch.setChecked(true);
-
- // Set the form data icon.
- formDataImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.form_data_enabled, null));
- } else { // Form data is off.
- // Turn the form data switch to off.
- formDataSwitch.setChecked(false);
-
- // Set the icon. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
- // Doing this makes no sense until it can also be done with the preferences.
- formDataImageView.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.form_data_disabled, null));
- }
- }
-