+ case "proxy":
+ // Get current proxy string.
+ String currentProxyString = sharedPreferences.getString("proxy", getString(R.string.proxy_default_value));
+
+ // Update the summary text for the proxy preference.
+ switch (currentProxyString) {
+ case ProxyHelper.NONE:
+ proxyPreference.setSummary(getString(R.string.no_proxy_enabled));
+ break;
+
+ case ProxyHelper.TOR:
+ proxyPreference.setSummary(getString(R.string.tor_enabled));
+ break;
+
+ case ProxyHelper.I2P:
+ proxyPreference.setSummary(getString(R.string.i2p_enabled));
+ break;
+
+ case ProxyHelper.CUSTOM:
+ proxyPreference.setSummary(getString(R.string.custom_proxy));
+ break;
+ }
+
+ // Update the status of the custom proxy options.
+ proxyCustomHostPreference.setEnabled(currentProxyString.equals("Custom"));
+ proxyCustomPortPreference.setEnabled(currentProxyString.equals("Custom"));
+
+ // Update the icons.
+ if (currentProxyString.equals("None")) { // Proxying is disabled.
+ if (darkTheme) { // Dark theme.
+ // Set the main proxy icon to be disabled
+ proxyPreference.setIcon(R.drawable.proxy_disabled_dark);
+
+ // Set the custom proxy icons to be ghosted.
+ proxyCustomHostPreference.setIcon(R.drawable.proxy_ghosted_dark);
+ proxyCustomPortPreference.setIcon(R.drawable.proxy_ghosted_dark);
+ } else { // Light theme.
+ // Set the main proxy icon to be disabled.
+ proxyPreference.setIcon(R.drawable.proxy_disabled_light);
+
+ // Set the custom proxy icons to be ghosted.
+ proxyCustomHostPreference.setIcon(R.drawable.proxy_ghosted_light);
+ proxyCustomPortPreference.setIcon(R.drawable.proxy_ghosted_light);
+ }
+ } else { // Proxying is enabled.
+ if (darkTheme) { // Dark theme.
+ // Set the main proxy icon to be enabled.
+ proxyPreference.setIcon(R.drawable.proxy_enabled_dark);
+
+ /// Set the custom proxy icons according to their status.
+ if (proxyCustomHostPreference.isEnabled()) { // Custom proxy is enabled.
+ proxyCustomHostPreference.setIcon(R.drawable.proxy_enabled_dark);
+ proxyCustomPortPreference.setIcon(R.drawable.proxy_enabled_dark);
+ } else { // Custom proxy is disabled.
+ proxyCustomHostPreference.setIcon(R.drawable.proxy_ghosted_dark);
+ proxyCustomPortPreference.setIcon(R.drawable.proxy_ghosted_dark);
+ }
+ } else { // Light theme.
+ // Set the main proxy icon to be enabled.
+ proxyPreference.setIcon(R.drawable.proxy_enabled_light);
+
+ // Set the custom proxy icons according to their status.
+ if (proxyCustomHostPreference.isEnabled()) { // Custom proxy is enabled.
+ proxyCustomHostPreference.setIcon(R.drawable.proxy_enabled_light);
+ proxyCustomPortPreference.setIcon(R.drawable.proxy_enabled_light);
+ } else { // Custom proxy is disabled.
+ proxyCustomHostPreference.setIcon(R.drawable.proxy_ghosted_light);
+ proxyCustomPortPreference.setIcon(R.drawable.proxy_ghosted_light);
+ }
+ }
+ }
+ break;
+
+ case "proxy_custom_host":
+ // Set the summary text for the proxy custom host.
+ proxyCustomHostPreference.setSummary(sharedPreferences.getString("proxy_custom_host", getString(R.string.proxy_custom_host_default_value)));
+ break;
+
+ case "proxy_custom_port":
+ // Set the summary text for the proxy custom port.
+ proxyCustomPortPreference.setSummary(sharedPreferences.getString("proxy_custom_port", getString(R.string.proxy_custom_port_default_value)));
+