Add controls for the viewport. https://redmine.stoutner.com/issues/399
[PrivacyBrowser.git] / app / src / main / java / com / stoutner / privacybrowser / fragments / SettingsFragment.java
index 73ad08b..1834ea8 100644 (file)
@@ -97,6 +97,7 @@ public class SettingsFragment extends PreferenceFragment {
         Preference downloadWithExternalAppPreference = findPreference("download_with_external_app");
         Preference darkThemePreference = findPreference("dark_theme");
         Preference nightModePreference = findPreference("night_mode");
+        Preference wideViewportPreference = findPreference("wide_viewport");
         Preference displayWebpageImagesPreference = findPreference("display_webpage_images");
 
         // Set dependencies.
@@ -749,6 +750,21 @@ public class SettingsFragment extends PreferenceFragment {
             }
         }
 
+        // Set the wide viewport preference icon.
+        if (savedPreferences.getBoolean("wide_viewport", true)) {
+            if (darkTheme) {
+                wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_dark);
+            } else {
+                wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_light);
+            }
+        } else {
+            if (darkTheme) {
+                wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_dark);
+            } else {
+                wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_light);
+            }
+        }
+
         // Set the display webpage images preference icon.
         if (savedPreferences.getBoolean("display_webpage_images", true)) {
             if (darkTheme) {
@@ -1697,16 +1713,32 @@ public class SettingsFragment extends PreferenceFragment {
                     }
                     break;
 
+                case "wide_viewport":
+                    // Update the icon.
+                    if (sharedPreferences.getBoolean("wide_viewport", true)) {
+                        if (darkTheme) {
+                            wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_dark);
+                        } else {
+                            wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_light);
+                        }
+                    } else {
+                        if (darkTheme) {
+                            wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_dark);
+                        } else {
+                            wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_light);
+                        }
+                    }
+                    break;
+
                 case "display_webpage_images":
+                    // Update the icon.
                     if (sharedPreferences.getBoolean("display_webpage_images", true)) {
-                        // Update the icon.
                         if (darkTheme) {
                             displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_dark);
                         } else {
                             displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_light);
                         }
                     } else {
-                        // Update the icon.
                         if (darkTheme) {
                             displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_dark);
                         } else {
@@ -1733,4 +1765,4 @@ public class SettingsFragment extends PreferenceFragment {
         super.onResume();
         savedPreferences.registerOnSharedPreferenceChangeListener(preferencesListener);
     }
-}
+}
\ No newline at end of file