// Set the status of the additional app bar icons. The default is `false`.
if (sharedPreferences.getBoolean("display_additional_app_bar_icons", false)) {
toggleFirstPartyCookies.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
- toggleThirdPartyCookies.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
toggleDomStorage.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
toggleSaveFormData.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
} else { //Do not display the additional icons.
toggleFirstPartyCookies.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- toggleThirdPartyCookies.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
toggleDomStorage.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
toggleSaveFormData.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
}
// Get handles for the icons.
MenuItem privacyIcon = mainMenu.findItem(R.id.toggleJavaScript);
MenuItem firstPartyCookiesIcon = mainMenu.findItem(R.id.toggleFirstPartyCookies);
- MenuItem thirdPartyCookiesIcon = mainMenu.findItem(R.id.toggleThirdPartyCookies);
MenuItem domStorageIcon = mainMenu.findItem(R.id.toggleDomStorage);
MenuItem formDataIcon = mainMenu.findItem(R.id.toggleSaveFormData);
// Update `privacyIcon`.
- if (javaScriptEnabled) {
- // `JavaScript` is enabled.
+ if (javaScriptEnabled) { // JavaScript is enabled.
privacyIcon.setIcon(R.drawable.javascript_enabled);
- } else {
- if (firstPartyCookiesEnabled) {
- // `JavaScript` is disabled but cookies are enabled.
- privacyIcon.setIcon(R.drawable.warning);
- } else {
- // All the dangerous features are disabled.
- privacyIcon.setIcon(R.drawable.privacy_mode);
- }
+ } else if (firstPartyCookiesEnabled) { // JavaScript is disabled but cookies are enabled.
+ privacyIcon.setIcon(R.drawable.warning);
+ } else { // All the dangerous features are disabled.
+ privacyIcon.setIcon(R.drawable.privacy_mode);
}
// Update `firstPartyCookiesIcon`.
- if (firstPartyCookiesEnabled) {
- // First-party cookies are enabled.
- firstPartyCookiesIcon.setIcon(R.drawable.cookies_warning);
- } else {
- // First-party cookies are disabled.
+ if (firstPartyCookiesEnabled) { // First-party cookies are enabled.
+ firstPartyCookiesIcon.setIcon(R.drawable.cookies_enabled);
+ } else { // First-party cookies are disabled.
firstPartyCookiesIcon.setIcon(R.drawable.cookies_disabled);
}
- // Update `thirdPartyCookiesIcon`.
- if (firstPartyCookiesEnabled) {
- if (thirdPartyCookiesEnabled) {
- // Third-party cookies are enabled. Bad!
- thirdPartyCookiesIcon.setIcon(R.drawable.cookies_critical);
- } else {
- // Third-party cookies are disabled.
- thirdPartyCookiesIcon.setIcon(R.drawable.cookies_disabled);
- }
- } else {
- // First-party cookies are disabled, so third-party cookies are ghosted.
- thirdPartyCookiesIcon.setIcon(R.drawable.cookies_ghosted);
- }
-
// Update `domStorageIcon`.
- if (javaScriptEnabled) {
- if (domStorageEnabled) {
- domStorageIcon.setIcon(R.drawable.dom_storage_enabled);
- } else {
- domStorageIcon.setIcon(R.drawable.dom_storage_disabled);
- }
- } else {
+ if (javaScriptEnabled && domStorageEnabled) { // Both JavaScript and DOM storage is enabled.
+ domStorageIcon.setIcon(R.drawable.dom_storage_enabled);
+ } else if (javaScriptEnabled){ // JavaScript is enabled but DOM storage is disabled.
+ domStorageIcon.setIcon(R.drawable.dom_storage_disabled);
+ } else { // JavaScript is disabled, so DOM storage is ghosted.
domStorageIcon.setIcon(R.drawable.dom_storage_ghosted);
}
// Update `formDataIcon`.
- if (saveFormDataEnabled) {
+ if (saveFormDataEnabled) { // Form data is enabled.
formDataIcon.setIcon(R.drawable.form_data_enabled);
- } else {
+ } else { // Form data is disabled.
formDataIcon.setIcon(R.drawable.form_data_disabled);
}
javaScriptDisabledSearchCustomURLPreference.setEnabled(javaScriptDisabledSearchString.equals("Custom URL"));
- // Set the JavaScript-enabed searchURL as the summary text for the JavaScript-enabled search preference when the preference screen is loaded.
+ // Set the JavaScript-enabled searchURL as the summary text for the JavaScript-enabled search preference when the preference screen is loaded.
// The default is "https://duckduckgo.com/?q=".
final Preference javaScriptEnabledSearchPreference = findPreference("javascript_enabled_search");
String javaScriptEnabledSearchString = savedPreferences.getString("javascript_enabled_search", "https://duckduckgo.com/?q=");
if (javaScriptEnabledSearchString.equals("Custom URL")) {
- // If set to "Custom URL", use R.string.custom_url, which will be tgranslated, instead of the array value, which will not.
+ // If set to "Custom URL", use R.string.custom_url, which will be translated, instead of the array value, which will not.
javaScriptEnabledSearchPreference.setSummary(R.string.custom_url);
} else {
// Set the array value as the summary text.
if (Build.VERSION.SDK_INT >= 21) {
MainWebViewActivity.cookieManager.setAcceptThirdPartyCookies(MainWebViewActivity.mainWebView, MainWebViewActivity.thirdPartyCookiesEnabled);
}
-
- // Update the privacy icons.
- MainWebViewActivity.updatePrivacyIcons(MainWebViewActivity.privacyBrowserActivity);
break;
case "dom_storage_enabled":
<!-- We have to use a hard coded color code until API >= 21. Then we can use`@color`. -->
<path
- android:fillColor="#FFD50000"
+ android:fillColor="#FFF57F17"
android:pathData="M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12C21,11.5 20.96,11 20.87,10.5C20.6,10 20,10 20,10H18V9C18,8 17,8 17,8H15V7C15,6 14,6 14,6H13V4C13,3 12,3 12,3M9.5,6A1.5,1.5 0 0,1 11,7.5A1.5,1.5 0 0,1 9.5,9A1.5,1.5 0 0,1 8,7.5A1.5,1.5 0 0,1 9.5,6M6.5,10A1.5,1.5 0 0,1 8,11.5A1.5,1.5 0 0,1 6.5,13A1.5,1.5 0 0,1 5,11.5A1.5,1.5 0 0,1 6.5,10M11.5,11A1.5,1.5 0 0,1 13,12.5A1.5,1.5 0 0,1 11.5,14A1.5,1.5 0 0,1 10,12.5A1.5,1.5 0 0,1 11.5,11M16.5,13A1.5,1.5 0 0,1 18,14.5A1.5,1.5 0 0,1 16.5,16H16.5A1.5,1.5 0 0,1 15,14.5H15A1.5,1.5 0 0,1 16.5,13M11,16A1.5,1.5 0 0,1 12.5,17.5A1.5,1.5 0 0,1 11,19A1.5,1.5 0 0,1 9.5,17.5A1.5,1.5 0 0,1 11,16Z" />
</vector>
\ No newline at end of file
+++ /dev/null
-<!-- cookies_ghosted.xml was created by Google and downloaded from https://materialdesignicons.com/icon/cookie.
- It is released under the Apache License 2.0. -->
-
-<vector
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:height="26dp"
- android:width="26dp"
- android:viewportHeight="24.0"
- android:viewportWidth="24.0"
- android:autoMirrored="true" >
-
- <!-- We have to use a hard coded color code until API >= 21. Then we can use`@color`. -->
- <path
- android:fillColor="#22000000"
- android:pathData="M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12C21,11.5 20.96,11 20.87,10.5C20.6,10 20,10 20,10H18V9C18,8 17,8 17,8H15V7C15,6 14,6 14,6H13V4C13,3 12,3 12,3M9.5,6A1.5,1.5 0 0,1 11,7.5A1.5,1.5 0 0,1 9.5,9A1.5,1.5 0 0,1 8,7.5A1.5,1.5 0 0,1 9.5,6M6.5,10A1.5,1.5 0 0,1 8,11.5A1.5,1.5 0 0,1 6.5,13A1.5,1.5 0 0,1 5,11.5A1.5,1.5 0 0,1 6.5,10M11.5,11A1.5,1.5 0 0,1 13,12.5A1.5,1.5 0 0,1 11.5,14A1.5,1.5 0 0,1 10,12.5A1.5,1.5 0 0,1 11.5,11M16.5,13A1.5,1.5 0 0,1 18,14.5A1.5,1.5 0 0,1 16.5,16H16.5A1.5,1.5 0 0,1 15,14.5H15A1.5,1.5 0 0,1 16.5,13M11,16A1.5,1.5 0 0,1 12.5,17.5A1.5,1.5 0 0,1 11,19A1.5,1.5 0 0,1 9.5,17.5A1.5,1.5 0 0,1 11,16Z" />
-</vector>
\ No newline at end of file
+++ /dev/null
-<!-- cookies_warning.xml was created by Google and downloaded from https://materialdesignicons.com/icon/cookie.
- It is released under the Apache License 2.0. -->
-
-<vector
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:height="26dp"
- android:width="26dp"
- android:viewportHeight="24.0"
- android:viewportWidth="24.0"
- android:autoMirrored="true" >
-
- <!-- We have to use a hard coded color code until API >= 21. Then we can use`@color`. -->
- <path
- android:fillColor="#FFF57F17"
- android:pathData="M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12C21,11.5 20.96,11 20.87,10.5C20.6,10 20,10 20,10H18V9C18,8 17,8 17,8H15V7C15,6 14,6 14,6H13V4C13,3 12,3 12,3M9.5,6A1.5,1.5 0 0,1 11,7.5A1.5,1.5 0 0,1 9.5,9A1.5,1.5 0 0,1 8,7.5A1.5,1.5 0 0,1 9.5,6M6.5,10A1.5,1.5 0 0,1 8,11.5A1.5,1.5 0 0,1 6.5,13A1.5,1.5 0 0,1 5,11.5A1.5,1.5 0 0,1 6.5,10M11.5,11A1.5,1.5 0 0,1 13,12.5A1.5,1.5 0 0,1 11.5,14A1.5,1.5 0 0,1 10,12.5A1.5,1.5 0 0,1 11.5,11M16.5,13A1.5,1.5 0 0,1 18,14.5A1.5,1.5 0 0,1 16.5,16H16.5A1.5,1.5 0 0,1 15,14.5H15A1.5,1.5 0 0,1 16.5,13M11,16A1.5,1.5 0 0,1 12.5,17.5A1.5,1.5 0 0,1 11,19A1.5,1.5 0 0,1 9.5,17.5A1.5,1.5 0 0,1 11,16Z" />
-</vector>
\ No newline at end of file