From 5ec8d4fbc50f8fc88e883086fbce0e7c041c5527 Mon Sep 17 00:00:00 2001 From: Soren Stoutner <soren@stoutner.com> Date: Thu, 9 May 2019 17:00:37 -0700 Subject: [PATCH] Add controls for the viewport. https://redmine.stoutner.com/issues/399 --- .idea/assetWizardSettings.xml | 6 +- .idea/dictionaries/soren.xml | 1 + .../main/assets/de/about_licenses_dark.html | 1 + .../main/assets/de/about_licenses_light.html | 1 + .../main/assets/en/about_licenses_dark.html | 1 + .../main/assets/en/about_licenses_light.html | 1 + .../main/assets/es/about_licenses_dark.html | 1 + .../main/assets/es/about_licenses_light.html | 1 + .../main/assets/it/about_licenses_dark.html | 1 + .../main/assets/it/about_licenses_light.html | 1 + .../main/assets/ru/about_licenses_dark.html | 1 + .../main/assets/ru/about_licenses_light.html | 1 + .../shared_images/settings_overscan_dark.png | Bin 0 -> 1796 bytes .../shared_images/settings_overscan_light.png | Bin 0 -> 1612 bytes .../main/assets/tr/about_licenses_dark.html | 1 + .../main/assets/tr/about_licenses_light.html | 1 + .../activities/DomainsActivity.java | 8 +- .../activities/MainWebViewActivity.java | 56 +++-- .../fragments/DomainSettingsFragment.java | 212 ++++++++++++++---- .../fragments/SettingsFragment.java | 38 +++- .../helpers/DomainsDatabaseHelper.java | 32 +-- .../helpers/ImportExportDatabaseHelper.java | 75 ++++++- .../main/res/drawable/tab_disabled_light.xml | 2 +- .../drawable/wide_viewport_disabled_dark.xml | 13 ++ .../drawable/wide_viewport_disabled_light.xml | 13 ++ .../drawable/wide_viewport_enabled_dark.xml | 13 ++ .../drawable/wide_viewport_enabled_light.xml | 13 ++ .../res/layout/domain_settings_fragment.xml | 37 +++ .../main/res/menu/webview_options_menu.xml | 15 +- app/src/main/res/values-de/strings.xml | 7 + app/src/main/res/values-es/strings.xml | 7 + app/src/main/res/values-it/strings.xml | 7 + app/src/main/res/values/strings.xml | 8 + app/src/main/res/xml/preferences.xml | 6 + 34 files changed, 485 insertions(+), 96 deletions(-) create mode 100644 app/src/main/assets/shared_images/settings_overscan_dark.png create mode 100644 app/src/main/assets/shared_images/settings_overscan_light.png create mode 100644 app/src/main/res/drawable/wide_viewport_disabled_dark.xml create mode 100644 app/src/main/res/drawable/wide_viewport_disabled_light.xml create mode 100644 app/src/main/res/drawable/wide_viewport_enabled_dark.xml create mode 100644 app/src/main/res/drawable/wide_viewport_enabled_light.xml 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 @@ <PersistentState> <option name="values"> <map> - <entry key="url" value="jar:file:/home/soren/Android/android-studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_tab_black_24dp.xml" /> + <entry key="url" value="jar:file:/home/soren/Android/android-studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_settings_overscan_black_24dp.xml" /> </map> </option> </PersistentState> @@ -78,9 +78,7 @@ </option> <option name="values"> <map> - <entry key="assetSourceType" value="FILE" /> - <entry key="autoMirrored" value="true" /> - <entry key="outputName" value="modify_url" /> + <entry key="outputName" value="wide_viewport_enabled_light" /> <entry key="sourceFile" value="$USER_HOME$/ownCloud/Android/Privacy Browser/Icons/Icons/link_off_light.svg" /> </map> </option> 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 @@ <w>webkay</w> <w>webkitversion</w> <w>webpage</w> + <w>webpages</w> <w>websocket</w> <w>webview</w> <w>webviewpager</w> 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 @@ <p><img class="icon" src="../shared_images/search_dark.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_dark.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_dark.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_dark.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_dark.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_dark.png"> sort.</p> <p><img class="icon" src="../shared_images/style_dark.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_light.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_light.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_light.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_light.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_light.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_light.png"> sort.</p> <p><img class="icon" src="../shared_images/style_light.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_dark.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_dark.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_dark.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_dark.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_dark.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_dark.png"> sort.</p> <p><img class="icon" src="../shared_images/style_dark.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_light.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_light.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_light.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_light.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_light.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_light.png"> sort.</p> <p><img class="icon" src="../shared_images/style_light.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_dark.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_dark.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_dark.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_dark.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_dark.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_dark.png"> sort.</p> <p><img class="icon" src="../shared_images/style_dark.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_light.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_light.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_light.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_light.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_light.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_light.png"> sort.</p> <p><img class="icon" src="../shared_images/style_light.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_dark.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_dark.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_dark.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_dark.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_dark.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_dark.png"> sort.</p> <p><img class="icon" src="../shared_images/style_dark.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_light.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_light.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_light.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_light.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_light.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_light.png"> sort.</p> <p><img class="icon" src="../shared_images/style_light.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_dark.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_dark.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_dark.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_dark.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_dark.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_dark.png"> sort.</p> <p><img class="icon" src="../shared_images/style_dark.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_light.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_light.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_light.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_light.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_light.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_light.png"> sort.</p> <p><img class="icon" src="../shared_images/style_light.png"> style.</p> 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 0000000000000000000000000000000000000000..099edfebf5031c17e9af8d2acb8f12a3214da1b3 GIT binary patch literal 1796 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 QCjPMi8tLoV>W;bjUwp4kasU7T literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..8df0441cea0ffc2e170890c21078a7b818a941e9 GIT binary patch literal 1612 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 IeuQ%IPeF3##Q*>R literal 0 HcmV?d00001 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 @@ <p><img class="icon" src="../shared_images/search_dark.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_dark.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_dark.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_dark.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_dark.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_dark.png"> sort.</p> <p><img class="icon" src="../shared_images/style_dark.png"> style.</p> 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 @@ <p><img class="icon" src="../shared_images/search_light.png"> search.</p> <p><img class="icon" src="../shared_images/select_all_light.png"> select_all.</p> <p><img class="icon" src="../shared_images/settings_light.png"> settings.</p> + <p><img class="icon" src="../shared_images/settings_overscan_light.png"> settings_overscan.</p> <p><img class="icon" src="../shared_images/smartphone_light.png"> smartphone.</p> <p><img class="icon" src="../shared_images/sort_light.png"> sort.</p> <p><img class="icon" src="../shared_images/style_light.png"> style.</p> 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<CharSequence> fontSizeEntryValuesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.domain_settings_font_size_entry_values, R.layout.spinner_item); ArrayAdapter<CharSequence> swipeToRefreshArrayAdapter = ArrayAdapter.createFromResource(context, R.array.swipe_to_refresh_array, R.layout.spinner_item); ArrayAdapter<CharSequence> nightModeArrayAdapter = ArrayAdapter.createFromResource(context, R.array.night_mode_array, R.layout.spinner_item); + ArrayAdapter<CharSequence> wideViewportArrayAdapter = ArrayAdapter.createFromResource(context, R.array.wide_viewport_array, R.layout.spinner_item); ArrayAdapter<CharSequence> 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 @@ -<!-- `tab_disabled_light.xml` comes from the Android Material icon set, where it is called `tab`. It is released under the Apache License 2.0. --> +<!-- `tab` comes from the Android Material icon set, where it is called `tab`. It is released under the Apache License 2.0. --> <!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. --> <vector diff --git a/app/src/main/res/drawable/wide_viewport_disabled_dark.xml b/app/src/main/res/drawable/wide_viewport_disabled_dark.xml new file mode 100644 index 00000000..1ca8326e --- /dev/null +++ b/app/src/main/res/drawable/wide_viewport_disabled_dark.xml @@ -0,0 +1,13 @@ +<!-- `wide_viewport_disabled_dark.xml` comes from the Android Material icon set, where it is called `settings_overscan`. It is released under the Apache License 2.0. --> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:height="24dp" + android:width="24dp" + android:viewportHeight="24.0" + android:viewportWidth="24.0" > + + <!-- A hard coded color must be used until the minimum API >= 21. Then `@color` can be used. --> + <path + android:fillColor="#FF9E9E9E" + android:pathData="M12.01,5.5L10,8h4l-1.99,-2.5zM18,10v4l2.5,-1.99L18,10zM6,10l-2.5,2.01L6,14v-4zM14,16h-4l2.01,2.5L14,16zM21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM21,19.01L3,19.01L3,4.99h18v14.02z"/> +</vector> 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 @@ +<!-- `wide_viewport` comes from the Android Material icon set, where it is called `settings_overscan`. It is released under the Apache License 2.0. --> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:height="24dp" + android:width="24dp" + android:viewportHeight="24.0" + android:viewportWidth="24.0" > + + <!-- A hard coded color must be used until the minimum API >= 21. Then `@color` can be used. --> + <path + android:fillColor="#FF757575" + android:pathData="M12.01,5.5L10,8h4l-1.99,-2.5zM18,10v4l2.5,-1.99L18,10zM6,10l-2.5,2.01L6,14v-4zM14,16h-4l2.01,2.5L14,16zM21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM21,19.01L3,19.01L3,4.99h18v14.02z"/> +</vector> 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 @@ +<!-- `wide_viewport_enabled_dark.xml` comes from the Android Material icon set, where it is called `settings_overscan`. It is released under the Apache License 2.0. --> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:height="24dp" + android:width="24dp" + android:viewportHeight="24.0" + android:viewportWidth="24.0" > + + <!-- A hard coded color must be used until the minimum API >= 21. Then `@color` can be used. --> + <path + android:fillColor="#FF1E88E5" + android:pathData="M12.01,5.5L10,8h4l-1.99,-2.5zM18,10v4l2.5,-1.99L18,10zM6,10l-2.5,2.01L6,14v-4zM14,16h-4l2.01,2.5L14,16zM21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM21,19.01L3,19.01L3,4.99h18v14.02z"/> +</vector> 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 @@ +<!-- `wide_viewport_enabled_light.xml` comes from the Android Material icon set, where it is called `settings_overscan`. It is released under the Apache License 2.0. --> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:height="24dp" + android:width="24dp" + android:viewportHeight="24.0" + android:viewportWidth="24.0" > + + <!-- A hard coded color must be used until the minimum API >= 21. Then `@color` can be used. --> + <path + android:fillColor="#FF1565C0" + android:pathData="M12.01,5.5L10,8h4l-1.99,-2.5zM18,10v4l2.5,-1.99L18,10zM6,10l-2.5,2.01L6,14v-4zM14,16h-4l2.01,2.5L14,16zM21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM21,19.01L3,19.01L3,4.99h18v14.02z"/> +</vector> 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" /> </LinearLayout> + <!-- Wide Viewport. --> + <LinearLayout + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:orientation="vertical" + android:layout_marginTop="14dp" + android:layout_marginBottom="14dp" > + + <LinearLayout + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:orientation="horizontal" > + + <ImageView + android:id="@+id/wide_viewport_imageview" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_marginTop="1dp" + android:layout_marginEnd="10dp" + android:layout_gravity="center_vertical" + android:contentDescription="@string/wide_viewport" /> + + <Spinner + android:id="@+id/wide_viewport_spinner" + android:layout_height="wrap_content" + android:layout_width="match_parent" /> + </LinearLayout> + + <TextView + android:id="@+id/wide_viewport_textview" + android:layout_height="match_parent" + android:layout_width="match_parent" + android:layout_marginStart="45dp" + android:layout_marginEnd="36dp" + android:textSize="13sp" /> + </LinearLayout> + <!-- Display Images. --> <LinearLayout android:layout_height="wrap_content" diff --git a/app/src/main/res/menu/webview_options_menu.xml b/app/src/main/res/menu/webview_options_menu.xml index 66c14980..6fda1577 100644 --- a/app/src/main/res/menu/webview_options_menu.xml +++ b/app/src/main/res/menu/webview_options_menu.xml @@ -307,30 +307,37 @@ android:checkable="true" app:showAsAction="never" /> + <item + android:id="@+id/wide_viewport" + android:title="@string/wide_viewport" + android:orderInCategory="950" + android:checkable="true" + app:showAsAction="never" /> + <item android:id="@+id/display_images" android:title="@string/display_images" - android:orderInCategory="950" + android:orderInCategory="960" android:checkable="true" app:showAsAction="never" /> <item android:id="@+id/night_mode" android:title="@string/options_night_mode" - android:orderInCategory="960" + android:orderInCategory="970" android:checkable="true" app:showAsAction="never" /> <item android:id="@+id/find_on_page" android:title="@string/find_on_page" - android:orderInCategory="970" + android:orderInCategory="980" app:showAsAction="never|collapseActionView" /> <item android:id="@+id/view_source" android:title="@string/view_source" - android:orderInCategory="980" + android:orderInCategory="990" app:showAsAction="never" /> </menu> </item> 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 @@ <string name="ultraprivacy_summary">UltraPrivacy blockiert Tracker, die von EasyPrivacy nicht blockiert werden, da dies Webseiten verunstalten kann.</string> <string name="block_all_third_party_requests">Alle Zugriffe auf Dritt-Anbieter-Inhalte blockieren</string> <string name="block_all_third_party_requests_summary">Alle Zugriffe auf Dritt-Anbieter-Inhalte zu blockieren verbessert die Privatsphäre, kann jedoch Webseiten verunstalten.</string> + <string name="url_modification">URL-Bereinigung</string> + <string name="google_analytics">Google Analytics</string> + <string name="google_analytics_summary">Entfernt â?utm_â oder â&utm_â sowie alles danach aus URLs.</string> + <string name="facebook_click_ids">Facebook Click-IDs</string> + <string name="facebook_click_ids_summary">Entfernt â?fbclid=â or â&fbclid=â sowie alles danach aus URLs.</string> + <string name="twitter_amp_redirects">Twitter AMP-Umleitungen</string> + <string name="twitter_amp_redirects_summary">Entfernt â?amp=1â sowie alles danach URLs.</string> <string name="tor">Tor</string> <string name="proxy_through_orbot">Proxy durch Orbot</string> <string name="proxy_through_orbot_summary">Sämtlichen Web-Verkehr durch Orbot mittels localhost:8118 leiten.</string> 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 @@ <string name="ultraprivacy_summary">Ultra Privacidad bloquea los rastreadores que no bloquea EasyPrivacy, porque al hacerlo puede romper páginas web.</string> <string name="block_all_third_party_requests">Bloquear todas las solicitudes de terceras partes</string> <string name="block_all_third_party_requests_summary">Bloquear todas las solicitudes de terceras partes aumenta la privacidad, pero rompe muchas páginas web.</string> + <string name="url_modification">Modificación de URL</string> + <string name="google_analytics">Google Analytics</string> + <string name="google_analytics_summary">Eliminar â?utm_â o â&utm_â y cualquier cosa después de esto de las URLs.</string> + <string name="facebook_click_ids">IDs de clics en Facebook</string> + <string name="facebook_click_ids_summary">Eliminar â?fbclid=â o â&fbclid=â y cualquier cosa después de esto de las URLs.</string> + <string name="twitter_amp_redirects">Redirecciones de Twitter AMP</string> + <string name="twitter_amp_redirects_summary">Eliminar â?amp=1â y cualquier cosa después de esto de las URLs.</string> <string name="tor">Tor</string> <string name="proxy_through_orbot">Enviar a través de Orbot</string> <string name="proxy_through_orbot_summary">Enviar todo el tráfico web a través de Orbot en localhost:8118.</string> 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 @@ <string name="ultraprivacy_summary">L\'UltraPrivacy blocca i tracciamenti che EasyPrivacy ignora perché potrebbero impedire la visualizzazione dei siti web.</string> <string name="block_all_third_party_requests">Blocca tutte le richieste di Terze Parti</string> <string name="block_all_third_party_requests_summary">Il blocco di tutte le richieste di Terze Parti aumenta privacy, ma impedisce la visualizzazione di molti siti web.</string> + <string name="url_modification">Modifica delle URL</string> + <string name="google_analytics">Google Analytics</string> + <string name="google_analytics_summary">Rimuovi â?utm_â o â&utm_â e tutto quello che segue dalle URL.</string> + <string name="facebook_click_ids">Facebook Click ID</string> + <string name="facebook_click_ids_summary">Rimuovi â?fbclid=â o â&fbclid=â e tutto quello che segue dalle URL.</string> + <string name="twitter_amp_redirects">Reindirizzamenti Twitter AMP</string> + <string name="twitter_amp_redirects_summary">Rimuovi â?amp=1â e tutto quello che segue dalle URL.</string> <string name="tor">Tor</string> <string name="proxy_through_orbot">Utilizza Proxy con Orbot</string> <string name="proxy_through_orbot_summary">Utilizza Proxy attraverso Orbot su localhost:8118.</string> 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 @@ <string name="one_hundred_seventy_five_percent">175%</string> <string name="two_hundred_percent">200%</string> <string name="swipe_to_refresh_options_menu">Swipe to Refresh</string> + <string name="wide_viewport">Wide Viewport</string> <string name="display_images">Display Images</string> <string name="options_night_mode">Night Mode</string> <string name="view_source">View Source</string> @@ -317,6 +318,11 @@ <item>Night mode enabled</item> <item>Night mode disabled</item> </string-array> + <string-array name="wide_viewport_array"> + <item>System default</item> + <item>Wide viewport enabled</item> + <item>Wide viewport disabled</item> + </string-array> <string-array name="display_webpage_images_array"> <item>System default</item> <item>Images enabled</item> @@ -643,6 +649,8 @@ <string name="dark_theme_summary">Changing the theme will restart Privacy Browser.</string> <string name="night_mode">Night mode</string> <string name="night_mode_summary">Enabling night mode will also enable JavaScript for all web pages.</string> + <string name="wide_viewport_preference">Wide viewport</string> + <string name="wide_viewport_summary">Using a wide viewport makes some webpages layout more like the desktop site.</string> <string name="display_webpage_images">Display webpage images</string> <string name="display_webpage_images_summary">Disable to conserve bandwidth.</string> 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" /> + <SwitchPreference + android:key="wide_viewport" + android:title="@string/wide_viewport_preference" + android:summary="@string/wide_viewport_summary" + android:defaultValue="true" /> + <SwitchPreference android:key="display_webpage_images" android:title="@string/display_webpage_images" -- 2.47.2