From: Soren Stoutner Date: Fri, 10 May 2019 00:00:37 +0000 (-0700) Subject: Add controls for the viewport. https://redmine.stoutner.com/issues/399 X-Git-Tag: v3.1~10 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=5ec8d4fbc50f8fc88e883086fbce0e7c041c5527;p=PrivacyBrowserAndroid.git Add controls for the viewport. https://redmine.stoutner.com/issues/399 --- diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index 1db0caef..69358445 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -68,7 +68,7 @@ @@ -78,9 +78,7 @@ diff --git a/.idea/dictionaries/soren.xml b/.idea/dictionaries/soren.xml index d708ca01..ad8034ee 100644 --- a/.idea/dictionaries/soren.xml +++ b/.idea/dictionaries/soren.xml @@ -184,6 +184,7 @@ webkay webkitversion webpage + webpages websocket webview webviewpager diff --git a/app/src/main/assets/de/about_licenses_dark.html b/app/src/main/assets/de/about_licenses_dark.html index 86b8293a..64fc350c 100644 --- a/app/src/main/assets/de/about_licenses_dark.html +++ b/app/src/main/assets/de/about_licenses_dark.html @@ -139,6 +139,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/de/about_licenses_light.html b/app/src/main/assets/de/about_licenses_light.html index e156dcbc..f56bf4c6 100644 --- a/app/src/main/assets/de/about_licenses_light.html +++ b/app/src/main/assets/de/about_licenses_light.html @@ -139,6 +139,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/en/about_licenses_dark.html b/app/src/main/assets/en/about_licenses_dark.html index 2efa366b..f76ebb0b 100644 --- a/app/src/main/assets/en/about_licenses_dark.html +++ b/app/src/main/assets/en/about_licenses_dark.html @@ -137,6 +137,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/en/about_licenses_light.html b/app/src/main/assets/en/about_licenses_light.html index 8da7e035..9d8bdee5 100644 --- a/app/src/main/assets/en/about_licenses_light.html +++ b/app/src/main/assets/en/about_licenses_light.html @@ -138,6 +138,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/es/about_licenses_dark.html b/app/src/main/assets/es/about_licenses_dark.html index 117dd369..7e098516 100644 --- a/app/src/main/assets/es/about_licenses_dark.html +++ b/app/src/main/assets/es/about_licenses_dark.html @@ -142,6 +142,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/es/about_licenses_light.html b/app/src/main/assets/es/about_licenses_light.html index b2e078ab..7eae8366 100644 --- a/app/src/main/assets/es/about_licenses_light.html +++ b/app/src/main/assets/es/about_licenses_light.html @@ -143,6 +143,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/it/about_licenses_dark.html b/app/src/main/assets/it/about_licenses_dark.html index 231f25aa..f27baae4 100644 --- a/app/src/main/assets/it/about_licenses_dark.html +++ b/app/src/main/assets/it/about_licenses_dark.html @@ -146,6 +146,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/it/about_licenses_light.html b/app/src/main/assets/it/about_licenses_light.html index f31976f7..82777e8a 100644 --- a/app/src/main/assets/it/about_licenses_light.html +++ b/app/src/main/assets/it/about_licenses_light.html @@ -147,6 +147,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/ru/about_licenses_dark.html b/app/src/main/assets/ru/about_licenses_dark.html index a7c1bbe0..d0bf230e 100644 --- a/app/src/main/assets/ru/about_licenses_dark.html +++ b/app/src/main/assets/ru/about_licenses_dark.html @@ -140,6 +140,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/ru/about_licenses_light.html b/app/src/main/assets/ru/about_licenses_light.html index 9304d2b8..6ddaa780 100644 --- a/app/src/main/assets/ru/about_licenses_light.html +++ b/app/src/main/assets/ru/about_licenses_light.html @@ -140,6 +140,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/shared_images/settings_overscan_dark.png b/app/src/main/assets/shared_images/settings_overscan_dark.png new file mode 100644 index 00000000..099edfeb Binary files /dev/null and b/app/src/main/assets/shared_images/settings_overscan_dark.png differ diff --git a/app/src/main/assets/shared_images/settings_overscan_light.png b/app/src/main/assets/shared_images/settings_overscan_light.png new file mode 100644 index 00000000..8df0441c Binary files /dev/null and b/app/src/main/assets/shared_images/settings_overscan_light.png differ diff --git a/app/src/main/assets/tr/about_licenses_dark.html b/app/src/main/assets/tr/about_licenses_dark.html index aa4fc54d..9e49ed81 100644 --- a/app/src/main/assets/tr/about_licenses_dark.html +++ b/app/src/main/assets/tr/about_licenses_dark.html @@ -137,6 +137,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/assets/tr/about_licenses_light.html b/app/src/main/assets/tr/about_licenses_light.html index fbe184be..9731681f 100644 --- a/app/src/main/assets/tr/about_licenses_light.html +++ b/app/src/main/assets/tr/about_licenses_light.html @@ -138,6 +138,7 @@

search.

select_all.

settings.

+

settings_overscan.

smartphone.

sort.

style.

diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java index ba70f4e2..e73b94e0 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java @@ -693,8 +693,9 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo EditText customUserAgentEditText = view.findViewById(R.id.custom_user_agent_edittext); Spinner fontSizeSpinner = view.findViewById(R.id.font_size_spinner); Spinner swipeToRefreshSpinner = view.findViewById(R.id.swipe_to_refresh_spinner); - Spinner displayWebpageImagesSpinner = view.findViewById(R.id.display_webpage_images_spinner); Spinner nightModeSpinner = view.findViewById(R.id.night_mode_spinner); + Spinner wideViewportSpinner = view.findViewById(R.id.wide_viewport_spinner); + Spinner displayWebpageImagesSpinner = view.findViewById(R.id.display_webpage_images_spinner); Switch pinnedSslCertificateSwitch = view.findViewById(R.id.pinned_ssl_certificate_switch); RadioButton currentWebsiteCertificateRadioButton = view.findViewById(R.id.current_website_certificate_radiobutton); Switch pinnedIpAddressesSwitch = view.findViewById(R.id.pinned_ip_addresses_switch); @@ -716,8 +717,9 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo int userAgentPosition = userAgentSpinner.getSelectedItemPosition(); int fontSizePosition = fontSizeSpinner.getSelectedItemPosition(); int swipeToRefreshInt = swipeToRefreshSpinner.getSelectedItemPosition(); - int displayWebpageImagesInt = displayWebpageImagesSpinner.getSelectedItemPosition(); int nightModeInt = nightModeSpinner.getSelectedItemPosition(); + int wideViewportInt = wideViewportSpinner.getSelectedItemPosition(); + int displayWebpageImagesInt = displayWebpageImagesSpinner.getSelectedItemPosition(); boolean pinnedSslCertificate = pinnedSslCertificateSwitch.isChecked(); boolean pinnedIpAddress = pinnedIpAddressesSwitch.isChecked(); @@ -750,7 +752,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo // Save the domain settings. domainsDatabaseHelper.updateDomain(DomainsActivity.currentDomainDatabaseId, domainNameString, javaScriptEnabled, firstPartyCookiesEnabled, thirdPartyCookiesEnabled, domStorageEnabled, formDataEnabled, easyListEnabled, easyPrivacyEnabled, fanboysAnnoyanceEnabled, fanboysSocialBlockingEnabled, ultraPrivacyEnabled, blockAllThirdPartyRequests, - userAgentName, fontSizeInt, swipeToRefreshInt, nightModeInt, displayWebpageImagesInt, pinnedSslCertificate, pinnedIpAddress); + userAgentName, fontSizeInt, swipeToRefreshInt, nightModeInt, wideViewportInt, displayWebpageImagesInt, pinnedSslCertificate, pinnedIpAddress); // Update the pinned SSL certificate if a new one is checked. if (currentWebsiteCertificateRadioButton.isChecked()) { diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index d397a619..a9fb6e85 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -1144,6 +1144,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook MenuItem blockAllThirdPartyRequestsMenuItem = menu.findItem(R.id.block_all_third_party_requests); MenuItem fontSizeMenuItem = menu.findItem(R.id.font_size); MenuItem swipeToRefreshMenuItem = menu.findItem(R.id.swipe_to_refresh); + MenuItem wideViewportMenuItem = menu.findItem(R.id.wide_viewport); MenuItem displayImagesMenuItem = menu.findItem(R.id.display_images); MenuItem nightModeMenuItem = menu.findItem(R.id.night_mode); MenuItem proxyThroughOrbotMenuItem = menu.findItem(R.id.proxy_through_orbot); @@ -1180,6 +1181,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook ultraPrivacyMenuItem.setChecked(currentWebView.isBlocklistEnabled(NestedScrollWebView.ULTRA_PRIVACY)); blockAllThirdPartyRequestsMenuItem.setChecked(currentWebView.isBlocklistEnabled(NestedScrollWebView.THIRD_PARTY_REQUESTS)); swipeToRefreshMenuItem.setChecked(currentWebView.getSwipeToRefresh()); + wideViewportMenuItem.setChecked(currentWebView.getSettings().getUseWideViewPort()); displayImagesMenuItem.setChecked(currentWebView.getSettings().getLoadsImagesAutomatically()); nightModeMenuItem.setChecked(currentWebView.getNightMode()); @@ -1911,6 +1913,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } return true; + case R.id.wide_viewport: + // Toggle the viewport. + currentWebView.getSettings().setUseWideViewPort(!currentWebView.getSettings().getUseWideViewPort()); + return true; + case R.id.display_images: if (currentWebView.getSettings().getLoadsImagesAutomatically()) { // Images are currently loaded automatically. // Disable loading of images. @@ -3321,8 +3328,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook String defaultFontSizeString = sharedPreferences.getString("font_size", getString(R.string.font_size_default_value)); String defaultUserAgentName = sharedPreferences.getString("user_agent", getString(R.string.user_agent_default_value)); boolean defaultSwipeToRefresh = sharedPreferences.getBoolean("swipe_to_refresh", true); - boolean displayWebpageImages = sharedPreferences.getBoolean("display_webpage_images", true); boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + boolean wideViewport = sharedPreferences.getBoolean("wide_viewport", true); + boolean displayWebpageImages = sharedPreferences.getBoolean("display_webpage_images", true); // Get a handle for the cookie manager. CookieManager cookieManager = CookieManager.getInstance(); @@ -3364,6 +3372,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook int fontSize = currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.FONT_SIZE)); int swipeToRefreshInt = currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.SWIPE_TO_REFRESH)); int nightModeInt = currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.NIGHT_MODE)); + int wideViewportInt = currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.WIDE_VIEWPORT)); int displayWebpageImagesInt = currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.DISPLAY_IMAGES)); boolean pinnedSslCertificate = (currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.PINNED_SSL_CERTIFICATE)) == 1); String pinnedSslIssuedToCName = currentDomainSettingsCursor.getString(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_TO_COMMON_NAME)); @@ -3406,17 +3415,17 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Set night mode according to the night mode int. switch (nightModeInt) { - case DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT: + case DomainsDatabaseHelper.SYSTEM_DEFAULT: // Set night mode according to the current default. nestedScrollWebView.setNightMode(sharedPreferences.getBoolean("night_mode", false)); break; - case DomainsDatabaseHelper.NIGHT_MODE_ENABLED: + case DomainsDatabaseHelper.ENABLED: // Enable night mode. nestedScrollWebView.setNightMode(true); break; - case DomainsDatabaseHelper.NIGHT_MODE_DISABLED: + case DomainsDatabaseHelper.DISABLED: // Disable night mode. nestedScrollWebView.setNightMode(false); break; @@ -3502,7 +3511,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Set swipe to refresh. switch (swipeToRefreshInt) { - case DomainsDatabaseHelper.SWIPE_TO_REFRESH_SYSTEM_DEFAULT: + case DomainsDatabaseHelper.SYSTEM_DEFAULT: // Store the swipe to refresh status in the nested scroll WebView. nestedScrollWebView.setSwipeToRefresh(defaultSwipeToRefresh); @@ -3510,7 +3519,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook swipeRefreshLayout.setEnabled(defaultSwipeToRefresh); break; - case DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED: + case DomainsDatabaseHelper.ENABLED: // Store the swipe to refresh status in the nested scroll WebView. nestedScrollWebView.setSwipeToRefresh(true); @@ -3518,7 +3527,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook swipeRefreshLayout.setEnabled(true); break; - case DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED: + case DomainsDatabaseHelper.DISABLED: // Store the swipe to refresh status in the nested scroll WebView. nestedScrollWebView.setSwipeToRefresh(false); @@ -3526,17 +3535,32 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook swipeRefreshLayout.setEnabled(false); } + // Set the viewport. + switch (wideViewportInt) { + case DomainsDatabaseHelper.SYSTEM_DEFAULT: + nestedScrollWebView.getSettings().setUseWideViewPort(wideViewport); + break; + + case DomainsDatabaseHelper.ENABLED: + nestedScrollWebView.getSettings().setUseWideViewPort(true); + break; + + case DomainsDatabaseHelper.DISABLED: + nestedScrollWebView.getSettings().setUseWideViewPort(false); + break; + } + // Set the loading of webpage images. switch (displayWebpageImagesInt) { - case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT: + case DomainsDatabaseHelper.SYSTEM_DEFAULT: nestedScrollWebView.getSettings().setLoadsImagesAutomatically(displayWebpageImages); break; - case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED: + case DomainsDatabaseHelper.ENABLED: nestedScrollWebView.getSettings().setLoadsImagesAutomatically(true); break; - case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED: + case DomainsDatabaseHelper.DISABLED: nestedScrollWebView.getSettings().setLoadsImagesAutomatically(false); break; } @@ -3619,6 +3643,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook nestedScrollWebView.getSettings().setUserAgentString(userAgentDataArray[userAgentArrayPosition]); } + // Set the viewport. + nestedScrollWebView.getSettings().setUseWideViewPort(wideViewport); + // Set the loading of webpage images. nestedScrollWebView.getSettings().setLoadsImagesAutomatically(displayWebpageImages); @@ -4395,9 +4422,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook nestedScrollWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW); } - // Set the WebView to use a wide viewport. Otherwise, some web pages will be scrunched and some content will render outside the screen. - nestedScrollWebView.getSettings().setUseWideViewPort(true); - // Set the WebView to load in overview mode (zoomed out to the maximum width). nestedScrollWebView.getSettings().setLoadWithOverviewMode(true); @@ -5306,12 +5330,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook @Override public void onPageFinished(WebView view, String url) { - // Reset the wide view port if it has been turned off by the waiting for Orbot message. - if (!waitingForOrbot) { - // Only use a wide view port if the URL starts with `http`, not for `file://` and `content://`. - nestedScrollWebView.getSettings().setUseWideViewPort(url.startsWith("http")); - } - // Flush any cookies to persistent storage. The cookie manager has become very lazy about flushing cookies in recent versions. if (nestedScrollWebView.getAcceptFirstPartyCookies() && Build.VERSION.SDK_INT >= 21) { CookieManager.getInstance().flush(); diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java index 9694778f..5386b77d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java @@ -89,6 +89,9 @@ public class DomainSettingsFragment extends Fragment { Context context = getContext(); Resources resources = getResources(); + // Remove the error below that the context might be null. + assert context != null; + // Get a handle for the shared preference. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); @@ -97,9 +100,10 @@ public class DomainSettingsFragment extends Fragment { String defaultCustomUserAgentString = sharedPreferences.getString("custom_user_agent", getString(R.string.custom_user_agent_default_value)); String defaultFontSizeString = sharedPreferences.getString("font_size", getString(R.string.font_size_default_value)); boolean defaultSwipeToRefresh = sharedPreferences.getBoolean("swipe_to_refresh", true); + boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); boolean defaultNightMode = sharedPreferences.getBoolean("night_mode", false); + boolean defaultWideViewport = sharedPreferences.getBoolean("wide_viewport", true); boolean defaultDisplayWebpageImages = sharedPreferences.getBoolean("display_webpage_images", true); - boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); // Get handles for the views in the fragment. EditText domainNameEditText = domainSettingsView.findViewById(R.id.domain_settings_name_edittext); @@ -137,6 +141,9 @@ public class DomainSettingsFragment extends Fragment { ImageView nightModeImageView = domainSettingsView.findViewById(R.id.night_mode_imageview); Spinner nightModeSpinner = domainSettingsView.findViewById(R.id.night_mode_spinner); TextView nightModeTextView = domainSettingsView.findViewById(R.id.night_mode_textview); + ImageView wideViewportImageView = domainSettingsView.findViewById(R.id.wide_viewport_imageview); + Spinner wideViewportSpinner = domainSettingsView.findViewById(R.id.wide_viewport_spinner); + TextView wideViewportTextView = domainSettingsView.findViewById(R.id.wide_viewport_textview); ImageView displayWebpageImagesImageView = domainSettingsView.findViewById(R.id.display_webpage_images_imageview); Spinner displayWebpageImagesSpinner = domainSettingsView.findViewById(R.id.display_webpage_images_spinner); TextView displayImagesTextView = domainSettingsView.findViewById(R.id.display_webpage_images_textview); @@ -207,6 +214,7 @@ public class DomainSettingsFragment extends Fragment { int fontSizeInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.FONT_SIZE)); int swipeToRefreshInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.SWIPE_TO_REFRESH)); int nightModeInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.NIGHT_MODE)); + int wideViewportInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.WIDE_VIEWPORT)); int displayImagesInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.DISPLAY_IMAGES)); int pinnedSslCertificateInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.PINNED_SSL_CERTIFICATE)); String savedSslIssuedToCNameString = domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_TO_COMMON_NAME)); @@ -237,6 +245,7 @@ public class DomainSettingsFragment extends Fragment { ArrayAdapter fontSizeEntryValuesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entry_values, R.layout.spinner_item); ArrayAdapter swipeToRefreshArrayAdapter = ArrayAdapter.createFromResource(context, R.array.swipe_to_refresh_array, R.layout.spinner_item); ArrayAdapter nightModeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.night_mode_array, R.layout.spinner_item); + ArrayAdapter wideViewportArrayAdapter = ArrayAdapter.createFromResource(context, R.array.wide_viewport_array, R.layout.spinner_item); ArrayAdapter displayImagesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.display_webpage_images_array, R.layout.spinner_item); // Set the drop down view resource on the spinners. @@ -244,6 +253,7 @@ public class DomainSettingsFragment extends Fragment { fontSizeArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items); swipeToRefreshArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items); nightModeArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items); + wideViewportArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items); displayImagesArrayAdapter.setDropDownViewResource(R.layout.domain_settings_spinner_dropdown_items); // Set the array adapters for the spinners. @@ -251,6 +261,7 @@ public class DomainSettingsFragment extends Fragment { fontSizeSpinner.setAdapter(fontSizeArrayAdapter); swipeToRefreshSpinner.setAdapter(swipeToRefreshArrayAdapter); nightModeSpinner.setAdapter(nightModeArrayAdapter); + wideViewportSpinner.setAdapter(wideViewportArrayAdapter); displayWebpageImagesSpinner.setAdapter(displayImagesArrayAdapter); // Create a spannable string builder for each TextView that needs multiple colors of text. @@ -349,7 +360,7 @@ public class DomainSettingsFragment extends Fragment { }); // Create a boolean to track if night mode is enabled. - boolean nightModeEnabled = (nightModeInt == DomainsDatabaseHelper.NIGHT_MODE_ENABLED) || ((nightModeInt == DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT) && defaultNightMode); + boolean nightModeEnabled = (nightModeInt == DomainsDatabaseHelper.ENABLED) || ((nightModeInt == DomainsDatabaseHelper.SYSTEM_DEFAULT) && defaultNightMode); // Disable the JavaScript switch if night mode is enabled. if (nightModeEnabled) { @@ -718,7 +729,7 @@ public class DomainSettingsFragment extends Fragment { } } - // Open the user agent spinner when the TextView is clicked. + // Open the user agent spinner when the text view is clicked. userAgentTextView.setOnClickListener((View v) -> { // Open the user agent spinner. userAgentSpinner.performClick(); @@ -750,14 +761,14 @@ public class DomainSettingsFragment extends Fragment { // Set the swipe to refresh text. if (defaultSwipeToRefresh) { - swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED)); + swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.ENABLED)); } else { - swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED)); + swipeToRefreshTextView.setText(swipeToRefreshArrayAdapter.getItem(DomainsDatabaseHelper.DISABLED)); } // Set the swipe to refresh icon and TextView settings. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. switch (swipeToRefreshInt) { - case DomainsDatabaseHelper.SWIPE_TO_REFRESH_SYSTEM_DEFAULT: + case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultSwipeToRefresh) { // Swipe to refresh is enabled by default. // Set the icon according to the theme. if (darkTheme) { @@ -778,7 +789,7 @@ public class DomainSettingsFragment extends Fragment { swipeToRefreshTextView.setVisibility(View.VISIBLE); break; - case DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED: + case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. if (darkTheme) { swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark)); @@ -790,7 +801,7 @@ public class DomainSettingsFragment extends Fragment { swipeToRefreshTextView.setVisibility(View.GONE); break; - case DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED: + case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. if (darkTheme) { swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark)); @@ -813,14 +824,14 @@ public class DomainSettingsFragment extends Fragment { // Set the default night mode text. if (defaultNightMode) { - nightModeTextView.setText(nightModeArrayAdapter.getItem(DomainsDatabaseHelper.NIGHT_MODE_ENABLED)); + nightModeTextView.setText(nightModeArrayAdapter.getItem(DomainsDatabaseHelper.ENABLED)); } else { - nightModeTextView.setText(nightModeArrayAdapter.getItem(DomainsDatabaseHelper.NIGHT_MODE_DISABLED)); + nightModeTextView.setText(nightModeArrayAdapter.getItem(DomainsDatabaseHelper.DISABLED)); } // Set the night mode icon and TextView settings. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. switch (nightModeInt) { - case DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT: + case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultNightMode) { // Night mode enabled by default. // Set the icon according to the theme. if (darkTheme) { @@ -841,7 +852,7 @@ public class DomainSettingsFragment extends Fragment { nightModeTextView.setVisibility(View.VISIBLE); break; - case DomainsDatabaseHelper.NIGHT_MODE_ENABLED: + case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. if (darkTheme) { nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark)); @@ -853,7 +864,7 @@ public class DomainSettingsFragment extends Fragment { nightModeTextView.setVisibility(View.GONE); break; - case DomainsDatabaseHelper.NIGHT_MODE_DISABLED: + case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. if (darkTheme) { nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark)); @@ -872,19 +883,82 @@ public class DomainSettingsFragment extends Fragment { nightModeSpinner.performClick(); }); + // Display the wide viewport in the spinner. + wideViewportSpinner.setSelection(wideViewportInt); + + // Set the default wide viewport text. + if (defaultWideViewport) { + wideViewportTextView.setText(wideViewportArrayAdapter.getItem(DomainsDatabaseHelper.ENABLED)); + } else { + wideViewportTextView.setText(wideViewportArrayAdapter.getItem(DomainsDatabaseHelper.DISABLED)); + } + + // Set the wide viewport icon and text view settings. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. + switch (wideViewportInt) { + case DomainsDatabaseHelper.SYSTEM_DEFAULT: + if (defaultWideViewport) { // Wide viewport enabled by default. + // Set the icon according to the theme. + if (darkTheme) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_dark)); + } else { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_light)); + } + } else { // Wide viewport disabled by default. + if (darkTheme) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_dark)); + } else { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_light)); + } + } + + // Show the wide viewport text view. + wideViewportTextView.setVisibility(View.VISIBLE); + break; + + case DomainsDatabaseHelper.ENABLED: + // Set the icon according to the theme. + if (darkTheme) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_dark)); + } else { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_light)); + } + + // Hide the wide viewport text view. + wideViewportTextView.setVisibility(View.GONE); + break; + + case DomainsDatabaseHelper.DISABLED: + // Set the icon according to the theme. + if (darkTheme) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_dark)); + } else { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_light)); + } + + // Hide the wide viewport text view. + wideViewportTextView.setVisibility(View.GONE); + break; + } + + // Open the wide viewport spinner when the text view is clicked. + wideViewportTextView.setOnClickListener((View view) -> { + // Open the wide viewport spinner. + wideViewportSpinner.performClick(); + }); + // Display the website images mode in the spinner. displayWebpageImagesSpinner.setSelection(displayImagesInt); // Set the default display images text. if (defaultDisplayWebpageImages) { - displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED)); + displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.ENABLED)); } else { - displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED)); + displayImagesTextView.setText(displayImagesArrayAdapter.getItem(DomainsDatabaseHelper.DISABLED)); } - // Set the display website images icon and TextView settings. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. + // Set the display website images icon and text view settings. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. switch (displayImagesInt) { - case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT: + case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultDisplayWebpageImages) { // Display webpage images enabled by default. // Set the icon according to the theme. if (darkTheme) { @@ -901,11 +975,11 @@ public class DomainSettingsFragment extends Fragment { } } - // Show the display images TextView. + // Show the display images text view. displayImagesTextView.setVisibility(View.VISIBLE); break; - case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED: + case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. if (darkTheme) { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark)); @@ -913,11 +987,11 @@ public class DomainSettingsFragment extends Fragment { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light)); } - // Hide the display images TextView. + // Hide the display images text view. displayImagesTextView.setVisibility(View.GONE); break; - case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED: + case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. if (darkTheme) { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark)); @@ -925,13 +999,13 @@ public class DomainSettingsFragment extends Fragment { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light)); } - // Hide the display images TextView. + // Hide the display images text view. displayImagesTextView.setVisibility(View.GONE); break; } - // Open the display images spinner when the TextView is clicked. - displayImagesTextView.setOnClickListener((View v) -> { + // Open the display images spinner when the text view is clicked. + displayImagesTextView.setOnClickListener((View view) -> { // Open the user agent spinner. displayWebpageImagesSpinner.performClick(); }); @@ -1562,7 +1636,7 @@ public class DomainSettingsFragment extends Fragment { public void onItemSelected(AdapterView parent, View view, int position, long id) { // Update the icon and the visibility of `nightModeTextView`. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. switch (position) { - case DomainsDatabaseHelper.SWIPE_TO_REFRESH_SYSTEM_DEFAULT: + case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultSwipeToRefresh) { // Swipe to refresh enabled by default. // Set the icon according to the theme. if (darkTheme) { @@ -1583,7 +1657,7 @@ public class DomainSettingsFragment extends Fragment { swipeToRefreshTextView.setVisibility(View.VISIBLE); break; - case DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED: + case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. if (darkTheme) { swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark)); @@ -1595,7 +1669,7 @@ public class DomainSettingsFragment extends Fragment { swipeToRefreshTextView.setVisibility(View.GONE); break; - case DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED: + case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. if (darkTheme) { swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark)); @@ -1620,7 +1694,7 @@ public class DomainSettingsFragment extends Fragment { public void onItemSelected(AdapterView parent, View view, int position, long id) { // Update the icon and the visibility of `nightModeTextView`. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. switch (position) { - case DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT: + case DomainsDatabaseHelper.SYSTEM_DEFAULT: if (defaultNightMode) { // Night mode enabled by default. // Set the icon according to the theme. if (darkTheme) { @@ -1641,7 +1715,7 @@ public class DomainSettingsFragment extends Fragment { nightModeTextView.setVisibility(View.VISIBLE); break; - case DomainsDatabaseHelper.NIGHT_MODE_ENABLED: + case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. if (darkTheme) { nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark)); @@ -1653,7 +1727,7 @@ public class DomainSettingsFragment extends Fragment { nightModeTextView.setVisibility(View.GONE); break; - case DomainsDatabaseHelper.NIGHT_MODE_DISABLED: + case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. if (darkTheme) { nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark)); @@ -1667,7 +1741,7 @@ public class DomainSettingsFragment extends Fragment { } // Create a `boolean` to store the current night mode setting. - boolean currentNightModeEnabled = (position == DomainsDatabaseHelper.NIGHT_MODE_ENABLED) || ((position == DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT) && defaultNightMode); + boolean currentNightModeEnabled = (position == DomainsDatabaseHelper.ENABLED) || ((position == DomainsDatabaseHelper.SYSTEM_DEFAULT) && defaultNightMode); // Disable the JavaScript `Switch` if night mode is enabled. if (currentNightModeEnabled) { @@ -1729,21 +1803,79 @@ public class DomainSettingsFragment extends Fragment { } }); + // Set the wide viewport spinner listener. + wideViewportSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + // Update the icon and the visibility of the wide viewport text view. + switch (position) { + case DomainsDatabaseHelper.SYSTEM_DEFAULT: + if (defaultWideViewport) { // Wide viewport is enabled by default. + // Set the icon according to the theme. + if (darkTheme) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_dark)); + } else { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_light)); + } + } else { // Wide viewport is disabled by default. + if (darkTheme) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_dark)); + } else { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_light)); + } + } + + // Show the wide viewport text view. + wideViewportTextView.setVisibility(View.VISIBLE); + break; + + case DomainsDatabaseHelper.ENABLED: + // Set the icon according to the theme. + if (darkTheme) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_dark)); + } else { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_enabled_light)); + } + + // Hide the wide viewport text view. + wideViewportTextView.setVisibility(View.GONE); + break; + + case DomainsDatabaseHelper.DISABLED: + // Set the icon according to the theme. + if (darkTheme) { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_dark)); + } else { + wideViewportImageView.setImageDrawable(resources.getDrawable(R.drawable.wide_viewport_disabled_light)); + } + + // Hid ethe wide viewport text view. + wideViewportTextView.setVisibility(View.GONE); + break; + } + } + + @Override + public void onNothingSelected(AdapterView parent) { + // Do nothing. + } + }); + // Set the display webpage images spinner listener. displayWebpageImagesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { - // Update the icon and the visibility of `displayImagesTextView`. + // Update the icon and the visibility of the display images text view. switch (position) { - case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT: - if (defaultDisplayWebpageImages) { + case DomainsDatabaseHelper.SYSTEM_DEFAULT: + if (defaultDisplayWebpageImages) { // Display webpage images is enabled by default. // Set the icon according to the theme. if (darkTheme) { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark)); } else { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light)); } - } else { + } else { // Display webpage images is disabled by default. // Set the icon according to the theme. if (darkTheme) { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark)); @@ -1752,11 +1884,11 @@ public class DomainSettingsFragment extends Fragment { } } - // Show `displayImagesTextView`. + // Show the display images text view. displayImagesTextView.setVisibility(View.VISIBLE); break; - case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED: + case DomainsDatabaseHelper.ENABLED: // Set the icon according to the theme. if (darkTheme) { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark)); @@ -1764,11 +1896,11 @@ public class DomainSettingsFragment extends Fragment { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light)); } - // Hide `displayImagesTextView`. + // Hide the display images text view. displayImagesTextView.setVisibility(View.GONE); break; - case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED: + case DomainsDatabaseHelper.DISABLED: // Set the icon according to the theme. if (darkTheme) { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark)); @@ -1776,7 +1908,7 @@ public class DomainSettingsFragment extends Fragment { displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light)); } - // Hide `displayImagesTextView`. + // Hide the display images text view. displayImagesTextView.setVisibility(View.GONE); break; } diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java index 73ad08ba..1834ea88 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java @@ -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 diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/DomainsDatabaseHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/DomainsDatabaseHelper.java index b74ca52b..d7f92af6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/DomainsDatabaseHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/DomainsDatabaseHelper.java @@ -28,7 +28,7 @@ import android.database.sqlite.SQLiteOpenHelper; import android.preference.PreferenceManager; public class DomainsDatabaseHelper extends SQLiteOpenHelper { - private static final int SCHEMA_VERSION = 9; + private static final int SCHEMA_VERSION = 10; static final String DOMAINS_DATABASE = "domains.db"; static final String DOMAINS_TABLE = "domains"; @@ -49,6 +49,7 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper { public static final String FONT_SIZE = "fontsize"; public static final String SWIPE_TO_REFRESH = "swipetorefresh"; public static final String NIGHT_MODE = "nightmode"; + public static final String WIDE_VIEWPORT = "wide_viewport"; public static final String DISPLAY_IMAGES = "displayimages"; public static final String PINNED_SSL_CERTIFICATE = "pinnedsslcertificate"; public static final String SSL_ISSUED_TO_COMMON_NAME = "sslissuedtocommonname"; @@ -62,20 +63,10 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper { public static final String PINNED_IP_ADDRESSES = "pinned_ip_addresses"; public static final String IP_ADDRESSES = "ip_addresses"; - // Swipe to refresh constants. - public static final int SWIPE_TO_REFRESH_SYSTEM_DEFAULT = 0; - public static final int SWIPE_TO_REFRESH_ENABLED = 1; - public static final int SWIPE_TO_REFRESH_DISABLED = 2; - - // Night mode constants. - public static final int NIGHT_MODE_SYSTEM_DEFAULT = 0; - public static final int NIGHT_MODE_ENABLED = 1; - public static final int NIGHT_MODE_DISABLED = 2; - - // Display webpage images constants. - public static final int DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT = 0; - public static final int DISPLAY_WEBPAGE_IMAGES_ENABLED = 1; - public static final int DISPLAY_WEBPAGE_IMAGES_DISABLED = 2; + // Spinner constants. + public static final int SYSTEM_DEFAULT = 0; + public static final int ENABLED = 1; + public static final int DISABLED = 2; static final String CREATE_DOMAINS_TABLE = "CREATE TABLE " + DOMAINS_TABLE + " (" + _ID + " INTEGER PRIMARY KEY, " + @@ -95,6 +86,7 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper { FONT_SIZE + " INTEGER, " + SWIPE_TO_REFRESH + " INTEGER, " + NIGHT_MODE + " INTEGER, " + + WIDE_VIEWPORT + " INTEGER, " + DISPLAY_IMAGES + " INTEGER, " + PINNED_SSL_CERTIFICATE + " BOOLEAN, " + SSL_ISSUED_TO_COMMON_NAME + " TEXT, " + @@ -219,6 +211,11 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper { // Add the Pinned IP Addresses columns. domainsDatabase.execSQL("ALTER TABLE " + DOMAINS_TABLE + " ADD COLUMN " + PINNED_IP_ADDRESSES + " BOOLEAN"); domainsDatabase.execSQL("ALTER TABLE " + DOMAINS_TABLE + " ADD COLUMN " + IP_ADDRESSES + " TEXT"); + + // Upgrade from schema version 9. + case 9: + // Add the Wide Viewport column. + domainsDatabase.execSQL("ALTER TABLE " + DOMAINS_TABLE + " ADD COLUMN " + WIDE_VIEWPORT + " INTEGER"); } } @@ -315,6 +312,7 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper { domainContentValues.put(FONT_SIZE, 0); domainContentValues.put(SWIPE_TO_REFRESH, 0); domainContentValues.put(NIGHT_MODE, 0); + domainContentValues.put(WIDE_VIEWPORT, 0); domainContentValues.put(DISPLAY_IMAGES, 0); // Get a writable database handle. @@ -343,7 +341,8 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper { public void updateDomain(int databaseId, String domainName, boolean javaScriptEnabled, boolean firstPartyCookiesEnabled, boolean thirdPartyCookiesEnabled, boolean domStorageEnabled, boolean formDataEnabled, boolean easyListEnabled, boolean easyPrivacyEnabled, boolean fanboysAnnoyanceEnabled, boolean fanboysSocialBlockingEnabled, boolean ultraPrivacyEnabled, - boolean blockAllThirdPartyRequests, String userAgent, int fontSize, int swipeToRefresh, int nightMode, int displayImages, boolean pinnedSslCertificate, boolean pinnedIpAddresses) { + boolean blockAllThirdPartyRequests, String userAgent, int fontSize, int swipeToRefresh, int nightMode, int wideViewport, int displayImages, boolean pinnedSslCertificate, + boolean pinnedIpAddresses) { // Store the domain data in a `ContentValues`. ContentValues domainContentValues = new ContentValues(); @@ -365,6 +364,7 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper { domainContentValues.put(FONT_SIZE, fontSize); domainContentValues.put(SWIPE_TO_REFRESH, swipeToRefresh); domainContentValues.put(NIGHT_MODE, nightMode); + domainContentValues.put(WIDE_VIEWPORT, wideViewport); domainContentValues.put(DISPLAY_IMAGES, displayImages); domainContentValues.put(PINNED_SSL_CERTIFICATE, pinnedSslCertificate); domainContentValues.put(PINNED_IP_ADDRESSES, pinnedIpAddresses); diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java index c1f0f264..f0262d12 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java @@ -38,7 +38,7 @@ public class ImportExportDatabaseHelper { public static final String EXPORT_SUCCESSFUL = "Export Successful"; public static final String IMPORT_SUCCESSFUL = "Import Successful"; - private static final int SCHEMA_VERSION = 6; + private static final int SCHEMA_VERSION = 7; private static final String PREFERENCES_TABLE = "preferences"; // The preferences constants. @@ -59,6 +59,9 @@ public class ImportExportDatabaseHelper { private static final String FANBOYS_SOCIAL_BLOCKING_LIST = "fanboys_social_blocking_list"; private static final String ULTRAPRIVACY = "ultraprivacy"; private static final String BLOCK_ALL_THIRD_PARTY_REQUESTS = "block_all_third_party_requests"; + private static final String GOOGLE_ANALYTICS = "google_analytics"; + private static final String FACEBOOK_CLICK_IDS = "facebook_click_ids"; + private static final String TWITTER_AMP_REDIRECTS = "twitter_amp_redirects"; private static final String PROXY_THROUGH_ORBOT = "proxy_through_orbot"; private static final String TOR_HOMEPAGE = "tor_homepage"; private static final String TOR_SEARCH = "tor_search"; @@ -81,6 +84,7 @@ public class ImportExportDatabaseHelper { private static final String DOWNLOAD_WITH_EXTERNAL_APP = "download_with_external_app"; private static final String DARK_THEME = "dark_theme"; private static final String NIGHT_MODE = "night_mode"; + private static final String WIDE_VIEWPORT = "wide_viewport"; private static final String DISPLAY_WEBPAGE_IMAGES = "display_webpage_images"; public String exportUnencrypted(File exportFile, Context context) { @@ -129,6 +133,7 @@ public class ImportExportDatabaseHelper { domainsContentValues.put(DomainsDatabaseHelper.FONT_SIZE, domainsCursor.getInt(domainsCursor.getColumnIndex(DomainsDatabaseHelper.FONT_SIZE))); domainsContentValues.put(DomainsDatabaseHelper.SWIPE_TO_REFRESH, domainsCursor.getInt(domainsCursor.getColumnIndex(DomainsDatabaseHelper.SWIPE_TO_REFRESH))); domainsContentValues.put(DomainsDatabaseHelper.NIGHT_MODE, domainsCursor.getInt(domainsCursor.getColumnIndex(DomainsDatabaseHelper.NIGHT_MODE))); + domainsContentValues.put(DomainsDatabaseHelper.WIDE_VIEWPORT, domainsCursor.getInt(domainsCursor.getColumnIndex(DomainsDatabaseHelper.WIDE_VIEWPORT))); domainsContentValues.put(DomainsDatabaseHelper.DISPLAY_IMAGES, domainsCursor.getInt(domainsCursor.getColumnIndex(DomainsDatabaseHelper.DISPLAY_IMAGES))); domainsContentValues.put(DomainsDatabaseHelper.PINNED_SSL_CERTIFICATE, domainsCursor.getInt(domainsCursor.getColumnIndex(DomainsDatabaseHelper.PINNED_SSL_CERTIFICATE))); domainsContentValues.put(DomainsDatabaseHelper.SSL_ISSUED_TO_COMMON_NAME, domainsCursor.getString(domainsCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_TO_COMMON_NAME))); @@ -208,6 +213,9 @@ public class ImportExportDatabaseHelper { FANBOYS_SOCIAL_BLOCKING_LIST + " BOOLEAN, " + ULTRAPRIVACY + " BOOLEAN, " + BLOCK_ALL_THIRD_PARTY_REQUESTS + " BOOLEAN, " + + GOOGLE_ANALYTICS + " BOOLEAN, " + + FACEBOOK_CLICK_IDS + " BOOLEAN, " + + TWITTER_AMP_REDIRECTS + " BOOLEAN, " + PROXY_THROUGH_ORBOT + " BOOLEAN, " + TOR_HOMEPAGE + " TEXT, " + TOR_SEARCH + " TEXT, " + @@ -230,6 +238,7 @@ public class ImportExportDatabaseHelper { DOWNLOAD_WITH_EXTERNAL_APP + " BOOLEAN, " + DARK_THEME + " BOOLEAN, " + NIGHT_MODE + " BOOLEAN, " + + WIDE_VIEWPORT + " BOOLEAN, " + DISPLAY_WEBPAGE_IMAGES + " BOOLEAN)"; // Create the export database preferences table. @@ -256,6 +265,9 @@ public class ImportExportDatabaseHelper { preferencesContentValues.put(FANBOYS_SOCIAL_BLOCKING_LIST, sharedPreferences.getBoolean(FANBOYS_SOCIAL_BLOCKING_LIST, true)); preferencesContentValues.put(ULTRAPRIVACY, sharedPreferences.getBoolean(ULTRAPRIVACY, true)); preferencesContentValues.put(BLOCK_ALL_THIRD_PARTY_REQUESTS, sharedPreferences.getBoolean(BLOCK_ALL_THIRD_PARTY_REQUESTS, false)); + preferencesContentValues.put(GOOGLE_ANALYTICS, sharedPreferences.getBoolean(GOOGLE_ANALYTICS, true)); + preferencesContentValues.put(FACEBOOK_CLICK_IDS, sharedPreferences.getBoolean(FACEBOOK_CLICK_IDS, true)); + preferencesContentValues.put(TWITTER_AMP_REDIRECTS, sharedPreferences.getBoolean(TWITTER_AMP_REDIRECTS, true)); preferencesContentValues.put(PROXY_THROUGH_ORBOT, sharedPreferences.getBoolean(PROXY_THROUGH_ORBOT, false)); preferencesContentValues.put(TOR_HOMEPAGE, sharedPreferences.getString(TOR_HOMEPAGE, context.getString(R.string.tor_homepage_default_value))); preferencesContentValues.put(TOR_SEARCH, sharedPreferences.getString(TOR_SEARCH, context.getString(R.string.tor_search_default_value))); @@ -278,6 +290,7 @@ public class ImportExportDatabaseHelper { preferencesContentValues.put(DOWNLOAD_WITH_EXTERNAL_APP, sharedPreferences.getBoolean(DOWNLOAD_WITH_EXTERNAL_APP, false)); preferencesContentValues.put(DARK_THEME, sharedPreferences.getBoolean(DARK_THEME, false)); preferencesContentValues.put(NIGHT_MODE, sharedPreferences.getBoolean(NIGHT_MODE, false)); + preferencesContentValues.put(WIDE_VIEWPORT, sharedPreferences.getBoolean(WIDE_VIEWPORT, true)); preferencesContentValues.put(DISPLAY_WEBPAGE_IMAGES, sharedPreferences.getBoolean(DISPLAY_WEBPAGE_IMAGES, true)); // Insert the preferences into the export database. @@ -357,7 +370,7 @@ public class ImportExportDatabaseHelper { switch (importDatabaseVersion){ // Upgrade from schema version 1. case 1: - // Add the download with external app preference. + // Add the download with external app column to the preferences table. importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + DOWNLOAD_WITH_EXTERNAL_APP + " BOOLEAN"); // Get the current setting for downloading with an external app. @@ -402,7 +415,7 @@ public class ImportExportDatabaseHelper { // Upgrade from schema version 4. case 4: - // Add the hide and scroll app bar preferences. + // Add the hide and scroll app bar columns to the preferences table. importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + HIDE_APP_BAR + " BOOLEAN"); importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + SCROLL_APP_BAR + " BOOLEAN"); @@ -425,10 +438,10 @@ public class ImportExportDatabaseHelper { // Upgrade from schema version 5. case 5: - // Add the open intents in new tab preference. + // Add the open intents in new tab column to the preferences table. importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + OPEN_INTENTS_IN_NEW_TAB + " BOOLEAN"); - // Get the current open intents in new tab setting. + // Get the current open intents in new tab preference. boolean openIntentsInNewTab = sharedPreferences.getBoolean(OPEN_INTENTS_IN_NEW_TAB, true); // Populate the database with the current value. @@ -437,6 +450,51 @@ public class ImportExportDatabaseHelper { } else { importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + OPEN_INTENTS_IN_NEW_TAB + " = " + 0); } + + // Upgrade from schema version 6. + case 6: + // Add the wide viewport column to the domains table. + importDatabase.execSQL("ALTER TABLE " + DomainsDatabaseHelper.DOMAINS_TABLE + " ADD COLUMN " + DomainsDatabaseHelper.WIDE_VIEWPORT + " INTEGER"); + + // Add the Google Analytics, Facebook Click IDs, Twitter AMP redirects, and wide viewport columns to the preferences table. + importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + GOOGLE_ANALYTICS + " BOOLEAN"); + importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + FACEBOOK_CLICK_IDS + " BOOLEAN"); + importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + TWITTER_AMP_REDIRECTS + " BOOLEAN"); + importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + WIDE_VIEWPORT + " BOOLEAN"); + + // Get the current preference values. + boolean googleAnalytics = sharedPreferences.getBoolean(GOOGLE_ANALYTICS, true); + boolean facebookClickIds = sharedPreferences.getBoolean(FACEBOOK_CLICK_IDS, true); + boolean twitterAmpRedirects = sharedPreferences.getBoolean(TWITTER_AMP_REDIRECTS, true); + boolean wideViewport = sharedPreferences.getBoolean(WIDE_VIEWPORT, true); + + // Populate the database with the current Google Analytics value. + if (googleAnalytics) { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + GOOGLE_ANALYTICS + " = " + 1); + } else { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + GOOGLE_ANALYTICS + " = " + 0); + } + + // Populate the database with the current Facebook Click IDs value. + if (facebookClickIds) { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + FACEBOOK_CLICK_IDS + " = " + 1); + } else { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + FACEBOOK_CLICK_IDS + " = " + 0); + } + + // Populate the database with the current Twitter AMP redirects value. + if (twitterAmpRedirects) { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + TWITTER_AMP_REDIRECTS + " = " + 1); + } else { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + TWITTER_AMP_REDIRECTS + " = " + 0); + } + + // Populate the database with the current wide viewport value. + if (wideViewport) { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + WIDE_VIEWPORT + " = " + 1); + } else { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + WIDE_VIEWPORT + " = " + 0); + } } } @@ -475,6 +533,7 @@ public class ImportExportDatabaseHelper { domainsContentValues.put(DomainsDatabaseHelper.FONT_SIZE, importDomainsCursor.getInt(importDomainsCursor.getColumnIndex(DomainsDatabaseHelper.FONT_SIZE))); domainsContentValues.put(DomainsDatabaseHelper.SWIPE_TO_REFRESH, importDomainsCursor.getInt(importDomainsCursor.getColumnIndex(DomainsDatabaseHelper.SWIPE_TO_REFRESH))); domainsContentValues.put(DomainsDatabaseHelper.NIGHT_MODE, importDomainsCursor.getInt(importDomainsCursor.getColumnIndex(DomainsDatabaseHelper.NIGHT_MODE))); + domainsContentValues.put(DomainsDatabaseHelper.WIDE_VIEWPORT, importDomainsCursor.getInt(importDomainsCursor.getColumnIndex(DomainsDatabaseHelper.WIDE_VIEWPORT))); domainsContentValues.put(DomainsDatabaseHelper.DISPLAY_IMAGES, importDomainsCursor.getInt(importDomainsCursor.getColumnIndex(DomainsDatabaseHelper.DISPLAY_IMAGES))); domainsContentValues.put(DomainsDatabaseHelper.PINNED_SSL_CERTIFICATE, importDomainsCursor.getInt(importDomainsCursor.getColumnIndex(DomainsDatabaseHelper.PINNED_SSL_CERTIFICATE))); domainsContentValues.put(DomainsDatabaseHelper.SSL_ISSUED_TO_COMMON_NAME, importDomainsCursor.getString(importDomainsCursor.getColumnIndex(DomainsDatabaseHelper.SSL_ISSUED_TO_COMMON_NAME))); @@ -566,6 +625,9 @@ public class ImportExportDatabaseHelper { .putBoolean(FANBOYS_SOCIAL_BLOCKING_LIST, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(FANBOYS_SOCIAL_BLOCKING_LIST)) == 1) .putBoolean(ULTRAPRIVACY, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(ULTRAPRIVACY)) == 1) .putBoolean(BLOCK_ALL_THIRD_PARTY_REQUESTS, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(BLOCK_ALL_THIRD_PARTY_REQUESTS)) == 1) + .putBoolean(GOOGLE_ANALYTICS, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(GOOGLE_ANALYTICS)) == 1) + .putBoolean(FACEBOOK_CLICK_IDS, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(FACEBOOK_CLICK_IDS)) == 1) + .putBoolean(TWITTER_AMP_REDIRECTS, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(TWITTER_AMP_REDIRECTS)) == 1) .putBoolean(PROXY_THROUGH_ORBOT, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(PROXY_THROUGH_ORBOT)) == 1) .putString(TOR_HOMEPAGE, importPreferencesCursor.getString(importPreferencesCursor.getColumnIndex(TOR_HOMEPAGE))) .putString(TOR_SEARCH, importPreferencesCursor.getString(importPreferencesCursor.getColumnIndex(TOR_SEARCH))) @@ -589,6 +651,7 @@ public class ImportExportDatabaseHelper { .putBoolean(DOWNLOAD_WITH_EXTERNAL_APP, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(DOWNLOAD_WITH_EXTERNAL_APP)) == 1) .putBoolean(DARK_THEME, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(DARK_THEME)) == 1) .putBoolean(NIGHT_MODE, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(NIGHT_MODE)) == 1) + .putBoolean(WIDE_VIEWPORT, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(WIDE_VIEWPORT)) == 1) .putBoolean(DISPLAY_WEBPAGE_IMAGES, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(DISPLAY_WEBPAGE_IMAGES)) == 1) .apply(); @@ -638,4 +701,4 @@ public class ImportExportDatabaseHelper { return exception.toString(); } } -} +} \ No newline at end of file diff --git a/app/src/main/res/drawable/tab_disabled_light.xml b/app/src/main/res/drawable/tab_disabled_light.xml index 16962a7f..bb6ce4d6 100644 --- a/app/src/main/res/drawable/tab_disabled_light.xml +++ b/app/src/main/res/drawable/tab_disabled_light.xml @@ -1,4 +1,4 @@ - + + + + + + diff --git a/app/src/main/res/drawable/wide_viewport_disabled_light.xml b/app/src/main/res/drawable/wide_viewport_disabled_light.xml new file mode 100644 index 00000000..382904c5 --- /dev/null +++ b/app/src/main/res/drawable/wide_viewport_disabled_light.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/app/src/main/res/drawable/wide_viewport_enabled_dark.xml b/app/src/main/res/drawable/wide_viewport_enabled_dark.xml new file mode 100644 index 00000000..44e36fe6 --- /dev/null +++ b/app/src/main/res/drawable/wide_viewport_enabled_dark.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/app/src/main/res/drawable/wide_viewport_enabled_light.xml b/app/src/main/res/drawable/wide_viewport_enabled_light.xml new file mode 100644 index 00000000..2f24f6d2 --- /dev/null +++ b/app/src/main/res/drawable/wide_viewport_enabled_light.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/app/src/main/res/layout/domain_settings_fragment.xml b/app/src/main/res/layout/domain_settings_fragment.xml index 1c706fb2..6673bbed 100644 --- a/app/src/main/res/layout/domain_settings_fragment.xml +++ b/app/src/main/res/layout/domain_settings_fragment.xml @@ -541,6 +541,43 @@ android:textSize="13sp" /> + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index b2214d75..4db19655 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -483,6 +483,13 @@ UltraPrivacy blockiert Tracker, die von EasyPrivacy nicht blockiert werden, da dies Webseiten verunstalten kann. Alle Zugriffe auf Dritt-Anbieter-Inhalte blockieren Alle Zugriffe auf Dritt-Anbieter-Inhalte zu blockieren verbessert die Privatsphäre, kann jedoch Webseiten verunstalten. + URL-Bereinigung + Google Analytics + Entfernt “?utm_” oder “&utm_” sowie alles danach aus URLs. + Facebook Click-IDs + Entfernt “?fbclid=” or “&fbclid=” sowie alles danach aus URLs. + Twitter AMP-Umleitungen + Entfernt “?amp=1” sowie alles danach URLs. Tor Proxy durch Orbot Sämtlichen Web-Verkehr durch Orbot mittels localhost:8118 leiten. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 7fd38918..b33cbe17 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -482,6 +482,13 @@ Ultra Privacidad bloquea los rastreadores que no bloquea EasyPrivacy, porque al hacerlo puede romper páginas web. Bloquear todas las solicitudes de terceras partes Bloquear todas las solicitudes de terceras partes aumenta la privacidad, pero rompe muchas páginas web. + Modificación de URL + Google Analytics + Eliminar “?utm_” o “&utm_” y cualquier cosa después de esto de las URLs. + IDs de clics en Facebook + Eliminar “?fbclid=” o “&fbclid=” y cualquier cosa después de esto de las URLs. + Redirecciones de Twitter AMP + Eliminar “?amp=1” y cualquier cosa después de esto de las URLs. Tor Enviar a través de Orbot Enviar todo el tráfico web a través de Orbot en localhost:8118. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 1154c735..ebde1bca 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -482,6 +482,13 @@ L\'UltraPrivacy blocca i tracciamenti che EasyPrivacy ignora perché potrebbero impedire la visualizzazione dei siti web. Blocca tutte le richieste di Terze Parti Il blocco di tutte le richieste di Terze Parti aumenta privacy, ma impedisce la visualizzazione di molti siti web. + Modifica delle URL + Google Analytics + Rimuovi “?utm_” o “&utm_” e tutto quello che segue dalle URL. + Facebook Click ID + Rimuovi “?fbclid=” o “&fbclid=” e tutto quello che segue dalle URL. + Reindirizzamenti Twitter AMP + Rimuovi “?amp=1” e tutto quello che segue dalle URL. Tor Utilizza Proxy con Orbot Utilizza Proxy attraverso Orbot su localhost:8118. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 83c8e81b..c70ee571 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -168,6 +168,7 @@ 175% 200% Swipe to Refresh + Wide Viewport Display Images Night Mode View Source @@ -317,6 +318,11 @@ Night mode enabled Night mode disabled + + System default + Wide viewport enabled + Wide viewport disabled + System default Images enabled @@ -643,6 +649,8 @@ Changing the theme will restart Privacy Browser. Night mode Enabling night mode will also enable JavaScript for all web pages. + Wide viewport + Using a wide viewport makes some webpages layout more like the desktop site. Display webpage images Disable to conserve bandwidth. diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index b211879f..cef3f575 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -315,6 +315,12 @@ android:summary="@string/night_mode_summary" android:defaultValue="false" /> + +