]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Add controls for the viewport. https://redmine.stoutner.com/issues/399
authorSoren Stoutner <soren@stoutner.com>
Fri, 10 May 2019 00:00:37 +0000 (17:00 -0700)
committerSoren Stoutner <soren@stoutner.com>
Fri, 10 May 2019 00:00:37 +0000 (17:00 -0700)
34 files changed:
.idea/assetWizardSettings.xml
.idea/dictionaries/soren.xml
app/src/main/assets/de/about_licenses_dark.html
app/src/main/assets/de/about_licenses_light.html
app/src/main/assets/en/about_licenses_dark.html
app/src/main/assets/en/about_licenses_light.html
app/src/main/assets/es/about_licenses_dark.html
app/src/main/assets/es/about_licenses_light.html
app/src/main/assets/it/about_licenses_dark.html
app/src/main/assets/it/about_licenses_light.html
app/src/main/assets/ru/about_licenses_dark.html
app/src/main/assets/ru/about_licenses_light.html
app/src/main/assets/shared_images/settings_overscan_dark.png [new file with mode: 0644]
app/src/main/assets/shared_images/settings_overscan_light.png [new file with mode: 0644]
app/src/main/assets/tr/about_licenses_dark.html
app/src/main/assets/tr/about_licenses_light.html
app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java
app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java
app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java
app/src/main/java/com/stoutner/privacybrowser/helpers/DomainsDatabaseHelper.java
app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java
app/src/main/res/drawable/tab_disabled_light.xml
app/src/main/res/drawable/wide_viewport_disabled_dark.xml [new file with mode: 0644]
app/src/main/res/drawable/wide_viewport_disabled_light.xml [new file with mode: 0644]
app/src/main/res/drawable/wide_viewport_enabled_dark.xml [new file with mode: 0644]
app/src/main/res/drawable/wide_viewport_enabled_light.xml [new file with mode: 0644]
app/src/main/res/layout/domain_settings_fragment.xml
app/src/main/res/menu/webview_options_menu.xml
app/src/main/res/values-de/strings.xml
app/src/main/res/values-es/strings.xml
app/src/main/res/values-it/strings.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preferences.xml

index 1db0caefebce263a3ed9c3b70c45fba359d2a761..69358445524b83310ec507f8792402850cc4c980 100644 (file)
@@ -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>
index d708ca015d1ceb2a8ce8a51327e84e2f85b52ace..ad8034ee153358a2637be6f2560b69b3da9d33ba 100644 (file)
       <w>webkay</w>
       <w>webkitversion</w>
       <w>webpage</w>
+      <w>webpages</w>
       <w>websocket</w>
       <w>webview</w>
       <w>webviewpager</w>
index 86b8293aef140cdb4bc22d2ec216cf3f283a3cc8..64fc350ca7173c1936ce07d60ecf17af2ee21aaa 100644 (file)
         <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>
index e156dcbcd6033d59428673a42cd7c39aa547d236..f56bf4c6af06b0ab856a2c9ac9770726dfd8f770 100644 (file)
         <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>
index 2efa366bffe3de6500c0784706e8ec53f1548bfd..f76ebb0bc5f5fcb41fa1e76ed1347f63e2fdea22 100644 (file)
         <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>
index 8da7e03599dd72d46ad2866f764831c8ddcc8063..9d8bdee563f5f258dea7c9a8a6d504391ee533fa 100644 (file)
         <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>
index 117dd369fb2a101849d4fa651ea934cd95c54b73..7e0985160b789f4448ee7f5112186792e56edaae 100644 (file)
         <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>
index b2e078ab185662516e83fc092255274dd9202ce4..7eae83663fee899ea9895fd7814b6e2dcec05a45 100644 (file)
         <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>
index 231f25aa9022c9dee456aec6574766f952ea100a..f27baae457c4ecb54304e673ff13aa59498da175 100644 (file)
         <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>
index f31976f715b7e7b67d887dc64aafbf227792845d..82777e8a82bc838c9f20793c0e3d1cceb6547361 100644 (file)
         <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>
index a7c1bbe04993f62e3fedcd27025202fef56249fa..d0bf230ece789424edef937791cb1863d1763237 100644 (file)
         <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>
index 9304d2b80f1fbeafe7b47923459fff0781760e02..6ddaa780706a966854457a4feb578458d49a7ec1 100644 (file)
         <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 (file)
index 0000000..099edfe
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 (file)
index 0000000..8df0441
Binary files /dev/null and b/app/src/main/assets/shared_images/settings_overscan_light.png differ
index aa4fc54d71de410b9628a21bd851e8f65354d279..9e49ed81d4ce3ba004e99090fa6521534b94ad74 100644 (file)
         <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>
index fbe184befe84af6325861e54a715c22f71bf2add..9731681fa44e60bc72902f4bbc0cd321bab29ae1 100644 (file)
         <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>
index ba70f4e298266babf1dc6f38ddce8ccfaf1e1cca..e73b94e0425846b2cdc89db1bbb1f6c8746c8f74 100644 (file)
@@ -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()) {
index d397a619e3c0cd9a35a32aa8ef9c7a37f2fcaef6..a9fb6e85a55a57654b4da63c55888cfbf95522aa 100644 (file)
@@ -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();
index 9694778f05a400540581033f96eb82aa88bbe3f0..5386b77dbb2135b9f7e76d469d700df9af7a9d37 100644 (file)
@@ -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;
                 }
index 73ad08bad1eccb8df00d8b8058b625e1471c7fdd..1834ea88ba7ade254decaec103b2f2a6e2f6a9eb 100644 (file)
@@ -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
index b74ca52b6f191fed02186a4b6c9b0ae035e943b9..d7f92af6f8d9d7c88e6956c099ab6a35aac13b81 100644 (file)
@@ -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);
index c1f0f26453f1809760d72bf31b12e574af5d40f2..f0262d12b755fd9775f4ebde0173e9c63b3dbac3 100644 (file)
@@ -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
index 16962a7fe5785446e0c61e1ea54de176ba69643e..bb6ce4d660624952170fa84cd10b72bf6436d259 100644 (file)
@@ -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 (file)
index 0000000..1ca8326
--- /dev/null
@@ -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 (file)
index 0000000..382904c
--- /dev/null
@@ -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 (file)
index 0000000..44e36fe
--- /dev/null
@@ -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 (file)
index 0000000..2f24f6d
--- /dev/null
@@ -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>
index 1c706fb2bc7a08fbde8f5776a74234a40be83b6e..6673bbed9fdd6958cfd918125f5d0aac56b4a372 100644 (file)
                 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"
index 66c1498057b2c5dd3f8cf92e3a676dc7f9c1fc07..6fda1577b19065330e1a5267ee467b039ca67728 100644 (file)
                 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>
index b2214d7592e04cd2cbee0d6974bcc597f475f34e..4db196553414f6f8da47cf6dc9652c97d5c4563d 100644 (file)
         <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 “&amp;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 “&amp;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>
index 7fd38918f83e5319e7ff1e608f738c111d28d712..b33cbe17c9c95c729fc14ea6fb660dc6c05d3a89 100644 (file)
         <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 “&amp;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 “&amp;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>
index 1154c735f96000c631338fcf2f9e0d3294520dd0..ebde1bca923f35d3c677c98b1128f6e1d1dbf29a 100644 (file)
         <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 “&amp;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 “&amp;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>
index 83c8e81b697a11e20af7645a9c09ca602a56f813..c70ee571f781e8870f43cfba495291231cd08620 100644 (file)
             <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>
         <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>
         <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>
 
index b211879fda6799fbee3e0282990b2bbc9b5cba30..cef3f575f2510e6ca65fb5f49adfc2bf24ecf9ca 100644 (file)
             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"