Add UltraPrivacy. https://redmine.stoutner.com/issues/310
[PrivacyBrowser.git] / app / src / main / java / com / stoutner / privacybrowser / fragments / SettingsFragment.java
index 19fa1e3a9190a9fdff4a581537ca1a1c20df8bd6..c8481c0b2548e0d31390fa45104e2c055055e44e 100644 (file)
@@ -66,6 +66,7 @@ public class SettingsFragment extends PreferenceFragment {
         final Preference easyPrivacyPreference = findPreference("easyprivacy");
         final Preference fanboyAnnoyanceListPreference = findPreference("fanboy_annoyance_list");
         final Preference fanboySocialBlockingListPreference = findPreference("fanboy_social_blocking_list");
+        final Preference ultraPrivacyPreference = findPreference("ultraprivacy");
         final Preference blockAllThirdPartyRequestsPreference = findPreference("block_all_third_party_requests");
         final Preference proxyThroughOrbotPreference = findPreference("proxy_through_orbot");
         final Preference torHomepagePreference = findPreference("tor_homepage");
@@ -424,6 +425,21 @@ public class SettingsFragment extends PreferenceFragment {
             }
         }
 
+        // Set the UltraPrivacy icon.
+        if (savedPreferences.getBoolean("ultraprivacy", true)) {
+            if (MainWebViewActivity.darkTheme) {
+                ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark);
+            } else {
+                ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light);
+            }
+        } else {
+            if (MainWebViewActivity.darkTheme) {
+                ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark);
+            } else {
+                ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light);
+            }
+        }
+
         // Set the block all third-party requests icon.
         if (savedPreferences.getBoolean("block_all_third_party_requests", false)) {
             if (MainWebViewActivity.darkTheme) {
@@ -1019,6 +1035,23 @@ public class SettingsFragment extends PreferenceFragment {
                     }
                     break;
 
+                case "ultraprivacy":
+                    // Update the icon.
+                    if (sharedPreferences.getBoolean("ultraprivacy", true)) {
+                        if (MainWebViewActivity.darkTheme) {
+                            ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark);
+                        } else {
+                            ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light);
+                        }
+                    } else {
+                        if (MainWebViewActivity.darkTheme) {
+                            ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark);
+                        } else {
+                            ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light);
+                        }
+                    }
+                    break;
+
                 case "block_all_third_party_requests":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("block_all_third_party_requests", false)) {