Add option to remove Facebook Click IDs from URLs. https://redmine.stoutner.com...
[PrivacyBrowser.git] / app / src / main / java / com / stoutner / privacybrowser / fragments / SettingsFragment.java
index 37225fb6f4c176725786eef4eecfa70b78a9604e..51962b6bbb92904a988969ee34bda5029e22312c 100644 (file)
@@ -73,6 +73,7 @@ public class SettingsFragment extends PreferenceFragment {
         Preference ultraPrivacyPreference = findPreference("ultraprivacy");
         Preference blockAllThirdPartyRequestsPreference = findPreference("block_all_third_party_requests");
         Preference googleAnalyticsPreference = findPreference("google_analytics");
+        Preference facebookClickIdsPreference = findPreference("facebook_click_ids");
         Preference proxyThroughOrbotPreference = findPreference("proxy_through_orbot");
         Preference torHomepagePreference = findPreference("tor_homepage");
         Preference torSearchPreference = findPreference("tor_search");
@@ -458,7 +459,7 @@ public class SettingsFragment extends PreferenceFragment {
             }
         }
 
-        // Set the Google Analytics icons according to the theme.
+        // Set the Google Analytics icon according to the theme.
         if (savedPreferences.getBoolean("google_analytics", true)) {
             if (darkTheme) {
                 googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_dark);
@@ -473,6 +474,21 @@ public class SettingsFragment extends PreferenceFragment {
             }
         }
 
+        // Set the Facebook Click IDs icon according to the theme.
+        if (savedPreferences.getBoolean("facebook_click_ids", true)) {
+            if (darkTheme) {
+                facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_dark);
+            } else {
+                facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_light);
+            }
+        } else {
+            if (darkTheme) {
+                facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_dark);
+            } else {
+                facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_light);
+            }
+        }
+
         // Set the Tor icons according to the theme.
         if (proxyThroughOrbot) {  // Proxying is enabled.
             if (darkTheme) {
@@ -1143,6 +1159,23 @@ public class SettingsFragment extends PreferenceFragment {
                     }
                     break;
 
+                case "facebook_click_ids":
+                    // Update the icon.
+                    if (sharedPreferences.getBoolean("facebook_click_ids", true)) {
+                        if (darkTheme) {
+                            facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_dark);
+                        } else {
+                            facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_light);
+                        }
+                    } else {
+                        if (darkTheme) {
+                            facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_dark);
+                        } else {
+                            facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_light);
+                        }
+                    }
+                    break;
+
                 case "proxy_through_orbot":
                     // Get current settings.
                     boolean currentProxyThroughOrbot = sharedPreferences.getBoolean("proxy_through_orbot", false);