]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Create default .onion search option for when Orbot proxying is enabled. Implements...
authorSoren Stoutner <soren@stoutner.com>
Mon, 20 Feb 2017 18:06:47 +0000 (11:06 -0700)
committerSoren Stoutner <soren@stoutner.com>
Mon, 20 Feb 2017 18:06:47 +0000 (11:06 -0700)
app/src/main/assets/de/about_changelog.html
app/src/main/assets/en/about_changelog.html
app/src/main/assets/es/about_changelog.html
app/src/main/assets/it/about_changelog.html
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java
app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java
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 dc86e77b563adbe9781d353a81aaad8d0e6662dc..379eab545dde254b8dea651709a62f5344b207e1 100644 (file)
@@ -32,7 +32,7 @@
 \r
     <body>\r
         <h3>1.15 (version code 18)</h3>\r
-        <p>11 February 2017 - minimum API 19, target API 25</p>\r
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=8f4d6373a35a43a36050ed383f58c4074143b264">11 February 2017</a> - minimum API 19, target API 25</p>\r
         <ul>\r
             <li>Delete the <a href="https://redmine.stoutner.com/issues/84">secret, undocumented WebView cache</a> on Clear and Exit.</li>\r
             <li><a href="https://redmine.stoutner.com/issues/83">Automatically start Orbot</a> when proxying through Orbot is enabled.</li>\r
index ad57451ca480728b932f187e119a0304d68fd9da..8919c531c0597620e8c3dc6a305e09ce7425466b 100644 (file)
@@ -27,7 +27,7 @@
 
     <body>
         <h3>1.15 (version code 18)</h3>
-        <p>11 February 2017 - minimum API 19, target API 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=8f4d6373a35a43a36050ed383f58c4074143b264">11 February 2017</a> - minimum API 19, target API 25</p>
         <ul>
             <li>Delete the <a href="https://redmine.stoutner.com/issues/84">secret, undocumented WebView cache</a> on Clear and Exit.</li>
             <li><a href="https://redmine.stoutner.com/issues/83">Automatically start Orbot</a> when proxying through Orbot is enabled.</li>
index e0e0b6edace3142eeef8171dc5c12793f4b5724a..7b8f8cba7880994d9625c5b86cf3ef3c0c75f9bc 100644 (file)
@@ -29,7 +29,7 @@
 
     <body>
         <h3>1.15 (c&oacute;digo de versi&oacute;n 18)</h3>
-        <p>11 de febrero de 2017 - API m&iacute;nimo 19, API dirigido 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=8f4d6373a35a43a36050ed383f58c4074143b264">11 de febrero de 2017</a> - API m&iacute;nimo 19, API dirigido 25</p>
         <ul>
             <li>Eliminar <a href="https://redmine.stoutner.com/issues/84">la cach&eacute; secreta y no documentada de WebView</a> en Eliminar y salir.</li>
             <li><a href="https://redmine.stoutner.com/issues/83">Iniciar autom&aacute;ticamente Orbot</a> cuando se habilita el proxy a trav&eacute;s de Orbot.</li>
index ad57451ca480728b932f187e119a0304d68fd9da..8919c531c0597620e8c3dc6a305e09ce7425466b 100644 (file)
@@ -27,7 +27,7 @@
 
     <body>
         <h3>1.15 (version code 18)</h3>
-        <p>11 February 2017 - minimum API 19, target API 25</p>
+        <p><a href="https://git.stoutner.com/?p=PrivacyBrowser.git;a=commitdiff;h=8f4d6373a35a43a36050ed383f58c4074143b264">11 February 2017</a> - minimum API 19, target API 25</p>
         <ul>
             <li>Delete the <a href="https://redmine.stoutner.com/issues/84">secret, undocumented WebView cache</a> on Clear and Exit.</li>
             <li><a href="https://redmine.stoutner.com/issues/83">Automatically start Orbot</a> when proxying through Orbot is enabled.</li>
index 1700ba4c5c3a82d075cc3c4086024617148bfa61..3ee406ce8abe77c648230ca9c827766c2e69b0a7 100644 (file)
@@ -1758,10 +1758,15 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN
         String userAgentString = sharedPreferences.getString("user_agent", "PrivacyBrowser/1.0");
         String customUserAgentString = sharedPreferences.getString("custom_user_agent", "PrivacyBrowser/1.0");
         String javaScriptDisabledSearchString = sharedPreferences.getString("javascript_disabled_search", "https://duckduckgo.com/html/?q=");
-        String javaScriptDisabledCustomSearchString = sharedPreferences.getString("javascript_disabled_search_custom_url", "");
+        String javaScriptDisabledSearchCustomURLString = sharedPreferences.getString("javascript_disabled_search_custom_url", "");
         String javaScriptEnabledSearchString = sharedPreferences.getString("javascript_enabled_search", "https://duckduckgo.com/?q=");
-        String javaScriptEnabledCustomSearchString = sharedPreferences.getString("javascript_enabled_search_custom_url", "");
+        String javaScriptEnabledSearchCustomURLString = sharedPreferences.getString("javascript_enabled_search_custom_url", "");
         String homepageString = sharedPreferences.getString("homepage", "https://www.duckduckgo.com");
+        String torHomepageString = sharedPreferences.getString("tor_homepage", "https://3g2upl4pq6kufc4m.onion");
+        String torJavaScriptDisabledSearchString = sharedPreferences.getString("tor_javascript_disabled_search", "https://3g2upl4pq6kufc4m.onion/html/?q=");
+        String torJavaScriptDisabledSearchCustomURLString = sharedPreferences.getString("tor_javascript_disabled_search_custom_url", "");
+        String torJavaScriptEnabledSearchString = sharedPreferences.getString("tor_javascript_enabled_search", "https://3g2upl4pq6kufc4m.onion/?q=");
+        String torJavaScriptEnabledSearchCustomURLString = sharedPreferences.getString("tor_javascript_enabled_search_custom_url", "");
         String defaultFontSizeString = sharedPreferences.getString("default_font_size", "100");
         swipeToRefreshEnabled = sharedPreferences.getBoolean("swipe_to_refresh_enabled", false);
         adBlockerEnabled = sharedPreferences.getBoolean("block_ads", true);
@@ -1793,8 +1798,50 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN
             }
         }
 
-        // Apply the other settings from `sharedPreferences`.
-        homepage = homepageString;
+        // Set the homepage, search, and proxy options.
+        if (proxyThroughOrbot) {  // Set the Tor options.
+            // Set `torHomepageString` as `homepage`.
+            homepage = torHomepageString;
+
+            // Set JavaScript disabled search.
+            if (torJavaScriptDisabledSearchString.equals("Custom URL")) {  // Get the custom URL string.
+                javaScriptDisabledSearchURL = torJavaScriptDisabledSearchCustomURLString;
+            } else {  // Use the string from the pre-built list.
+                javaScriptDisabledSearchURL = torJavaScriptDisabledSearchString;
+            }
+
+            // Set JavaScript enabled search.
+            if (torJavaScriptEnabledSearchString.equals("Custom URL")) {  // Get the custom URL string.
+                javaScriptEnabledSearchURL = torJavaScriptEnabledSearchCustomURLString;
+            } else {  // Use the string from the pre-built list.
+                javaScriptEnabledSearchURL = torJavaScriptEnabledSearchString;
+            }
+
+            // Set the proxy.  `this` refers to the current activity where an `AlertDialog` might be displayed.
+            OrbotProxyHelper.setProxy(getApplicationContext(), this, "localhost", "8118");
+        } else {  // Set the non-Tor options.
+            // Set `homepageString` as `homepage`.
+            homepage = homepageString;
+
+            // Set JavaScript disabled search.
+            if (javaScriptDisabledSearchString.equals("Custom URL")) {  // Get the custom URL string.
+                javaScriptDisabledSearchURL = javaScriptDisabledSearchCustomURLString;
+            } else {  // Use the string from the pre-built list.
+                javaScriptDisabledSearchURL = javaScriptDisabledSearchString;
+            }
+
+            // Set JavaScript enabled search.
+            if (javaScriptEnabledSearchString.equals("Custom URL")) {  // Get the custom URL string.
+                javaScriptEnabledSearchURL = javaScriptEnabledSearchCustomURLString;
+            } else {  // Use the string from the pre-built list.
+                javaScriptEnabledSearchURL = javaScriptEnabledSearchString;
+            }
+
+            // Reset the proxy to default.  The host is `""` and the port is `"0"`.
+            OrbotProxyHelper.setProxy(getApplicationContext(), this, "", "0");
+        }
+
+        // Set swipe to refresh.
         swipeRefreshLayout.setEnabled(swipeToRefreshEnabled);
 
         // Set the user agent initial status.
@@ -1815,20 +1862,6 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN
                 break;
         }
 
-        // Set JavaScript disabled search.
-        if (javaScriptDisabledSearchString.equals("Custom URL")) {  // Get the custom URL string.
-            javaScriptDisabledSearchURL = javaScriptDisabledCustomSearchString;
-        } else {  // Use the string from the pre-built list.
-            javaScriptDisabledSearchURL = javaScriptDisabledSearchString;
-        }
-
-        // Set JavaScript enabled search.
-        if (javaScriptEnabledSearchString.equals("Custom URL")) {  // Get the custom URL string.
-            javaScriptEnabledSearchURL = javaScriptEnabledCustomSearchString;
-        } else {  // Use the string from the pre-built list.
-            javaScriptEnabledSearchURL = javaScriptEnabledSearchString;
-        }
-
         // Set Do Not Track status.
         if (doNotTrackEnabled) {
             customHeaders.put("DNT", "1");
@@ -1836,14 +1869,6 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN
             customHeaders.remove("DNT");
         }
 
-        // Set Orbot proxy status.
-        if (proxyThroughOrbot) {
-            // Set the proxy.  `this` refers to the current activity where an `AlertDialog` might be displayed.
-            OrbotProxyHelper.setProxy(getApplicationContext(), this, "localhost", "8118");
-        } else {  // Reset the proxy to default.  The host is `""` and the port is `"0"`.
-            OrbotProxyHelper.setProxy(getApplicationContext(), this, "", "0");
-        }
-
         // If we are in full screen mode update the `SYSTEM_UI` flags.
         if (inFullScreenBrowsingMode) {
             if (hideSystemBarsOnFullscreen) {  // Hide everything.
index 95ca66b720e9b73a8ab75f503cdff0ca748185c5..9fee293149a12598a9b627d2b4ead7b82ca7ad92 100644 (file)
@@ -42,12 +42,40 @@ public class SettingsFragment extends PreferenceFragment {
         // Initialize savedPreferences.
         savedPreferences = getPreferenceScreen().getSharedPreferences();
 
-        // Allow the user to access "dom_storage_enabled" if "javascript_enabled" is enabled.  The default is false.
+        // Get handles for the preferences we need to modify.
         final Preference domStorageEnabled = findPreference("dom_storage_enabled");
+        final Preference thirdPartyCookiesEnabled = findPreference("third_party_cookies_enabled");
+        final Preference userAgentPreference = findPreference("user_agent");
+        final Preference customUserAgent = findPreference("custom_user_agent");
+        final Preference javaScriptDisabledSearchPreference = findPreference("javascript_disabled_search");
+        final Preference javaScriptDisabledSearchCustomURLPreference = findPreference("javascript_disabled_search_custom_url");
+        final Preference javaScriptEnabledSearchPreference = findPreference("javascript_enabled_search");
+        final Preference javaScriptEnabledSearchCustomURLPreference = findPreference("javascript_enabled_search_custom_url");
+        final Preference hideSystemBarsPreference = findPreference("hide_system_bars");
+        final Preference translucentNavigationBarPreference = findPreference("translucent_navigation_bar");
+        final Preference torHomepagePreference = findPreference("tor_homepage");
+        final Preference torJavaScriptDisabledSearchPreference = findPreference("tor_javascript_disabled_search");
+        final Preference torJavaScriptDisabledSearchCustomURLPreference = findPreference("tor_javascript_disabled_search_custom_url");
+        final Preference torJavaScriptEnabledSearchPreference = findPreference("tor_javascript_enabled_search");
+        final Preference torJavaScriptEnabledSearchCustomURLPreference = findPreference("tor_javascript_enabled_search_custom_url");
+        final Preference homepagePreference = findPreference("homepage");
+        final Preference defaultFontSizePreference = findPreference("default_font_size");
+
+        // Get booleans from the preferences.
+        final boolean fullScreenBrowsingModeEnabled = savedPreferences.getBoolean("enable_full_screen_browsing_mode", false);
+        final boolean proxyThroughOrbot = savedPreferences.getBoolean("proxy_through_orbot", false);
+
+        // Get strings from the preferences.
+        String javaScriptDisabledSearchString = savedPreferences.getString("javascript_disabled_search", "https://duckduckgo.com/html/?q=");
+        String javaScriptEnabledSearchString = savedPreferences.getString("javascript_enabled_search", "https://duckduckgo.com/?q=");
+        String torJavaScriptDisabledSearchString = savedPreferences.getString("tor_javascript_disabled_search", "https://3g2upl4pq6kufc4m.onion/html/?q=");
+        String torJavaScriptEnabledSearchString = savedPreferences.getString("tor_javascript_enabled_search", "https://3g2upl4pq6kufc4m.onion/?q=");
+        String defaultFontSizeString = savedPreferences.getString("default_font_size", "100");
+
+        // Allow the user to access "dom_storage_enabled" if "javascript_enabled" is enabled.  The default is false.
         domStorageEnabled.setEnabled(savedPreferences.getBoolean("javascript_enabled", false));
 
         // Allow the user to access "third_party_cookies_enabled" if "first_party_cookies_enabled" is enabled.  The default is false.
-        final Preference thirdPartyCookiesEnabled = findPreference("third_party_cookies_enabled");
         thirdPartyCookiesEnabled.setEnabled(savedPreferences.getBoolean("first_party_cookies_enabled", false));
 
 
@@ -59,7 +87,6 @@ public class SettingsFragment extends PreferenceFragment {
         final WebView bareWebView = (WebView) bareWebViewLayout.findViewById(R.id.bare_webview);
 
         // Set the current user-agent as the summary text for the "user_agent" preference when the preference screen is loaded.
-        final Preference userAgentPreference = findPreference("user_agent");
         switch (savedPreferences.getString("user_agent", "PrivacyBrowser/1.0")) {
             case "Default user agent":
                 // Get the user agent text from the webview (which changes based on the version of Android and WebView installed).
@@ -78,17 +105,13 @@ public class SettingsFragment extends PreferenceFragment {
         }
 
         // Set the summary text for "custom_user_agent" (the default is "PrivacyBrowser/1.0") and enable it if "user_agent" it set to "Custom user agent".
-        final Preference customUserAgent = findPreference("custom_user_agent");
         customUserAgent.setSummary(savedPreferences.getString("custom_user_agent", "PrivacyBrowser/1.0"));
         customUserAgent.setEnabled(userAgentPreference.getSummary().equals("Custom user agent"));
 
 
-        // Set the JavaScript-disabled search URL as the summary text for the JavaScript-disabled search preference when the preference screen is loaded.
-        // The default is `https://duckduckgo.com/html/?q=`.
-        final Preference javaScriptDisabledSearchPreference = findPreference("javascript_disabled_search");
-        String javaScriptDisabledSearchString = savedPreferences.getString("javascript_disabled_search", "https://duckduckgo.com/html/?q=");
+        // Set the JavaScript-disabled search URL as the summary text for the JavaScript-disabled search preference when the preference screen is loaded.  The default is `https://duckduckgo.com/html/?q=`.
         if (javaScriptDisabledSearchString.equals("Custom URL")) {
-            // If set to "Custom URL", use R.string.custom_url, which will be translated, instead of the array value, which will not.
+            // Use R.string.custom_url, which will be translated, instead of the array value, which will not.
             javaScriptDisabledSearchPreference.setSummary(R.string.custom_url);
         } else {
             // Set the array value as the summary text.
@@ -96,15 +119,11 @@ public class SettingsFragment extends PreferenceFragment {
         }
 
         // Set the summary text for `javascript_disabled_search_custom_url` (the default is `""`) and enable it if `javascript_disabled_search` is set to `Custom URL`.
-        final Preference javaScriptDisabledSearchCustomURLPreference = findPreference("javascript_disabled_search_custom_url");
         javaScriptDisabledSearchCustomURLPreference.setSummary(savedPreferences.getString("javascript_disabled_search_custom_url", ""));
         javaScriptDisabledSearchCustomURLPreference.setEnabled(javaScriptDisabledSearchString.equals("Custom URL"));
 
 
-        // Set the JavaScript-enabled searchURL as the summary text for the JavaScript-enabled search preference when the preference screen is loaded.
-        // The default is `https://duckduckgo.com/?q=`.
-        final Preference javaScriptEnabledSearchPreference = findPreference("javascript_enabled_search");
-        String javaScriptEnabledSearchString = savedPreferences.getString("javascript_enabled_search", "https://duckduckgo.com/?q=");
+        // Set the JavaScript-enabled search URL as the summary text for the JavaScript-enabled search preference when the preference screen is loaded.  The default is `https://duckduckgo.com/?q=`.
         if (javaScriptEnabledSearchString.equals("Custom URL")) {
             // If set to "Custom URL", use R.string.custom_url, which will be translated, instead of the array value, which will not.
             javaScriptEnabledSearchPreference.setSummary(R.string.custom_url);
@@ -114,15 +133,11 @@ public class SettingsFragment extends PreferenceFragment {
         }
 
         // Set the summary text for `javascript_enabled_search_custom_url` (the default is `""`) and enable it if `javascript_enabled_search` is set to `Custom URL`.
-        final Preference javaScriptEnabledSearchCustomURLPreference = findPreference("javascript_enabled_search_custom_url");
         javaScriptEnabledSearchCustomURLPreference.setSummary(savedPreferences.getString("javascript_enabled_search_custom_url", ""));
         javaScriptEnabledSearchCustomURLPreference.setEnabled(javaScriptEnabledSearchString.equals("Custom URL"));
 
 
         // Enable the full screen options if full screen browsing mode is enabled.
-        final Preference hideSystemBarsPreference = findPreference("hide_system_bars");
-        final Preference translucentNavigationBarPreference = findPreference("translucent_navigation_bar");
-        final boolean fullScreenBrowsingModeEnabled = savedPreferences.getBoolean("enable_full_screen_browsing_mode", false);
         if (!fullScreenBrowsingModeEnabled) {
             // Disable the full screen options.
             hideSystemBarsPreference.setEnabled(false);
@@ -133,13 +148,50 @@ public class SettingsFragment extends PreferenceFragment {
         }
 
 
+        // Set the Tor homepage URL as the summary text for the `tor_homepage` preference when the preference screen is loaded.  The default is DuckDuckGo: `https://3g2upl4pq6kufc4m.onion`.
+        torHomepagePreference.setSummary(savedPreferences.getString("tor_homepage", "https://3g2upl4pq6kufc4m.onion"));
+
+
+        // Set the Tor JavaScript-disabled search URL as the summary text for the Tor JavaScript-disabled search preference when the preference screen is loaded.  The default is `https://3g2upl4pq6kufc4m.onion/html/?q=`
+        if (torJavaScriptDisabledSearchString.equals("Custom URL")) {
+            // Use R.string.custom_url, which will be translated, instead of the array value, which will not.
+            torJavaScriptDisabledSearchPreference.setSummary(R.string.custom_url);
+        } else {
+            // Set the array value as the summary text.
+            torJavaScriptDisabledSearchPreference.setSummary(torJavaScriptDisabledSearchString);
+        }
+
+        // Set the summary text for `tor_javascript_disabled_search_custom_url`.  The default is `""`.
+        torJavaScriptDisabledSearchCustomURLPreference.setSummary(savedPreferences.getString("tor_javascript_disabled_search_custom_url", ""));
+
+
+        // Set the Tor JavaScript-enabled search URL as the summary text for the Tor Javascript-enabled search preference when the preference screen is loaded.  The default is `https://3g2upl4pq6kufc4m.onion/?q=`.
+        if (torJavaScriptEnabledSearchString.equals("Custom URL")) {
+            // Use R.string.custom_url, which will be translated, instead of the array value, which will not.
+            torJavaScriptEnabledSearchPreference.setSummary(R.string.custom_url);
+        } else {
+            // Set the array value as the summary text.
+            torJavaScriptEnabledSearchPreference.setSummary(torJavaScriptEnabledSearchString);
+        }
+
+        // Set the summary text for `tor_javascript_enabled_search_custom_url`.  The default is `""`.
+        torJavaScriptEnabledSearchCustomURLPreference.setSummary(savedPreferences.getString("tor_javascript_enabled_search_custom_url", ""));
+
+
+        // Enable the Tor preferences only if `proxy_through_orbot` is enabled.  The default is `false`.
+        torHomepagePreference.setEnabled(proxyThroughOrbot);
+        torJavaScriptDisabledSearchPreference.setEnabled(proxyThroughOrbot);
+        torJavaScriptEnabledSearchPreference.setEnabled(proxyThroughOrbot);
+
+        // Enable the Tor custom URL search options only if `proxyThroughOrbot` is true and the search is set to `Custom URL`.
+        torJavaScriptDisabledSearchCustomURLPreference.setEnabled(proxyThroughOrbot && torJavaScriptDisabledSearchString.equals("Custom URL"));
+        torJavaScriptEnabledSearchCustomURLPreference.setEnabled(proxyThroughOrbot && torJavaScriptEnabledSearchString.equals("Custom URL"));
+
+
         // Set the homepage URL as the summary text for the `Homepage` preference when the preference screen is loaded.  The default is `https://www.duckduckgo.com`.
-        final Preference homepagePreference = findPreference("homepage");
         homepagePreference.setSummary(savedPreferences.getString("homepage", "https://www.duckduckgo.com"));
 
         // Set the default font size as the summary text for the `Default Font Size` preference when the preference screen is loaded.  The default is `100`.
-        final Preference defaultFontSizePreference = findPreference("default_font_size");
-        String defaultFontSizeString = savedPreferences.getString("default_font_size", "100");
         defaultFontSizePreference.setSummary(defaultFontSizeString + "%%");
 
 
@@ -241,6 +293,71 @@ public class SettingsFragment extends PreferenceFragment {
                         }
                         break;
 
+                    case "proxy_through_orbot":
+                        // Get current settings.
+                        boolean currentProxyThroughOrbot = sharedPreferences.getBoolean("proxy_through_orbot", false);
+                        String currentTorJavaScriptDisabledSearchString = sharedPreferences.getString("tor_javascript_disabled_search", "https://3g2upl4pq6kufc4m.onion/html/?q=");
+                        String currentTorJavaScriptEnabledSearchString = sharedPreferences.getString("tor_javascript_enabled_search", "https://3g2upl4pq6kufc4m.onion/?q=");
+
+                        // Enable the Tor preferences only if `proxy_through_orbot` is enabled.  The default is `false`.
+                        torHomepagePreference.setEnabled(currentProxyThroughOrbot);
+                        torJavaScriptDisabledSearchPreference.setEnabled(currentProxyThroughOrbot);
+                        torJavaScriptEnabledSearchPreference.setEnabled(currentProxyThroughOrbot);
+
+                        // Enable the Tor custom URL search options only if `currentProxyThroughOrbot` is true and the search is set to `Custom URL`.
+                        torJavaScriptDisabledSearchCustomURLPreference.setEnabled(currentProxyThroughOrbot && currentTorJavaScriptDisabledSearchString.equals("Custom URL"));
+                        torJavaScriptEnabledSearchCustomURLPreference.setEnabled(currentProxyThroughOrbot && currentTorJavaScriptEnabledSearchString.equals("Custom URL"));
+                        break;
+
+                    case "tor_homepage":
+                        // Set the new tor homepage URL as the summary text for the `tor_homepage` preference.  The default is DuckDuckGo:  `https://3g2upl4pq6kufc4m.onion`.
+                        torHomepagePreference.setSummary(sharedPreferences.getString("tor_homepage", "https://3g2upl4pq6kufc4m.onion"));
+                        break;
+
+                    case "tor_javascript_disabled_search":
+                        // Get the present search string.
+                        String presentTorJavaScriptDisabledSearchString = sharedPreferences.getString("tor_javascript_disabled_search", "https://3g2upl4pq6kufc4m.onion/html/?q=");
+
+                        // Set the summary text for `tor_javascript_disabled_search`.
+                        if (presentTorJavaScriptDisabledSearchString.equals("Custom URL")) {
+                            // Use R.string.custom_url, which is translated, instead of the array value, which isn't.
+                            torJavaScriptDisabledSearchPreference.setSummary(R.string.custom_url);
+                        } else {
+                            // Set the array value as the summary text.
+                            torJavaScriptDisabledSearchPreference.setSummary(presentTorJavaScriptDisabledSearchString);
+                        }
+
+                        // Set the status of `torJavaScriptDisabledSearchCustomURLPreference`.
+                        torJavaScriptDisabledSearchCustomURLPreference.setEnabled(presentTorJavaScriptDisabledSearchString.equals("Custom URL"));
+                        break;
+
+                    case "tor_javascript_disabled_search_custom_url":
+                        // Set the summary text for `tor_javascript_disabled_search_custom_url`.
+                        torJavaScriptDisabledSearchCustomURLPreference.setSummary(sharedPreferences.getString("tor_javascript_disabled_search_custom_url", ""));
+                        break;
+
+                    case "tor_javascript_enabled_search":
+                        // Get the present search string.
+                        String presentTorJavaScriptEnabledSearchString = sharedPreferences.getString("tor_javascript_enabled_search", "https://3g2upl4pq6kufc4m.onion/?q=");
+
+                        // Set the summary text for `tor_javascript_enabled_search`.
+                        if (presentTorJavaScriptEnabledSearchString.equals("Custom URL")) {
+                            // Use R.string.custom_url, which is translated, instead of the array value, which isn't.
+                            torJavaScriptEnabledSearchPreference.setSummary(R.string.custom_url);
+                        } else {
+                            // Set the array value as the summary text.
+                            torJavaScriptEnabledSearchPreference.setSummary(presentTorJavaScriptEnabledSearchString);
+                        }
+
+                        // Set the status of `torJavaScriptEnabledSearchCustomURLPreference`.
+                        torJavaScriptEnabledSearchCustomURLPreference.setEnabled(presentTorJavaScriptEnabledSearchString.equals("Custom URL"));
+                        break;
+
+                    case "tor_javascript_enabled_search_custom_url":
+                        // Set the summary text for `tor_javascript_enabled_search_custom_url`.
+                        torJavaScriptEnabledSearchCustomURLPreference.setSummary(sharedPreferences.getString("tor_javascript_enabled_search_custom_url", ""));
+                        break;
+
                     case "homepage":
                         // Set the new homepage URL as the summary text for the Homepage preference.  The default is `https://www.duckduckgo.com`.
                         homepagePreference.setSummary(sharedPreferences.getString("homepage", "https://www.duckduckgo.com"));
index 5a220cf9f76eb729d49099b96705d3eb8c3bd2e4..f25ac7edf92a888a18e241af18405c21b5cfcfd5 100644 (file)
     <string name="privacy_browser_guide">Privacy Browser Handbuch</string>
     <string name="overview">Übersicht</string>
     <string name="local_storage">Lokale Speicherung</string>
-    <string name="tor">Tor</string>
     <string name="tracking_ids">Verolgungs-IDs</string>
     <string name="planned_features">Geplante Features</string>
 
         <string name="custom_user_agent">Eigener User Agent</string>
         <string name="do_not_track">Nicht verfolgen (Do not track)</string>
         <string name="do_not_track_summary">Einen "Do Not Track-Header" senden, der freundlich anfragt, dass Webserver diesen Browser nicht nachverfolgen sollen.</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>
     <string name="search">Suche</string>
         <string name="javascript_disabled_search">Suchmaschine bei deaktiviertem JavaScript</string>
         <string-array name="javascript_disabled_search_entries">
         </string-array>
         <string name="javascript_enabled_search_custom_url">Suchmaschinen-URL bei aktivertem JavaScript</string>
         <string name="custom_url">Eigene URL</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>
     <string name="general">Allgemein</string>
-    <string name="homepage_preference">Startseite</string>
+    <string name="homepage">Startseite</string>
         <string name="default_font_size">Standard-Schriftgröße</string>
         <string-array name="default_font_size_entries">
             <item>50%</item>
index cf2620355bf260445e6948c1d82f9d7faf07c016..1b5688bc4d62f9f27fc7643f92431475b06ecd10 100644 (file)
     <string name="privacy_browser_guide">Guía de Navegador Privado</string>
     <string name="overview">Visión general</string>
     <string name="local_storage">Almacenamiento local</string>
-    <string name="tor">Tor</string>
     <string name="tracking_ids">Rastreo de IDs</string>
     <string name="planned_features">Funciones planeadas</string>
 
         <string name="block_ads_summary">Usar la lista de servidores de anuncios de pgl.yoyo.org para bloquear anuncios.</string>
         <string name="do_not_track">No rastrear</string>
         <string name="do_not_track_summary">Enviar la cabecera de no rastrear (DNT) que educadamente sugiere que los servidores web no rastreen este navegador.</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>
     <string name="search">Buscar</string>
         <string name="javascript_disabled_search">Búsqueda de Javascript deshabilitado</string>
         <string-array name="javascript_disabled_search_entries">
         <string name="hide_system_bars_summary">Esconder las barras de estado y de navegación en el modo de navegación a pantalla completa.  Esto no funciona bien si el teclado es mostrado durante el modo de navegación a pantalla completa.</string>
         <string name="translucent_navigation_bar">Barra de navegación translúcida</string>
         <string name="translucent_navigation_bar_summary">Hacer la barra de navegación translúcida en el modo de navegación a pantalla completa.</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>
     <string name="general">General</string>
-        <string name="homepage_preference">Página de inicio</string>
+        <string name="homepage">Página de inicio</string>
         <string name="default_font_size">Tamaño de fuente por defecto</string>
         <string-array name="default_font_size_entries">
             <item>50%</item>
index ffb09e62b34dda6313c9e72d802562418aa84d43..e76eca5ebfae1f48a5012143bc388a3aa13599a1 100644 (file)
     <string name="privacy_browser_guide">Guida di Privacy Browser</string>
     <string name="overview">Descrizione</string>
     <string name="local_storage">Archiviazione Locale</string>
-    <string name="tor">Tor</string>
     <string name="tracking_ids">Tracciamento utenti</string>
     <string name="planned_features">Funzionalità future</string>
 
         <string name="block_ads_summary">Per bloccare gli annunci utilizza la lista dei server di pgl.yoyo.org.</string>
         <string name="do_not_track">Non tracciare</string>
         <string name="do_not_track_summary">Invia un\'intestazione di non tracciamento per chiedere al web server di non tracciare il browser.</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>
     <string name="search">Ricerca</string>
         <string name="javascript_disabled_search">Ricerca con JavaScript disabilitato</string>
         <string-array name="javascript_disabled_search_entries">
         <string name="hide_system_bars_summary">Nasconde la barra di stato e la barra di navigazione durante la navigazione a schermo intero. Questa opzione non funziona perfettamente se si visualizza la tastiera durante la navigazione a schermo intero.</string>
         <string name="translucent_navigation_bar">Barra di navigazione trasparente</string>
         <string name="translucent_navigation_bar_summary">Rende la barra di navigazione trasparente durante la navigazione a schermo intero.</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>
     <string name="general">Generale</string>
-        <string name="homepage_preference">Homepage</string>
+        <string name="homepage">Homepage</string>
         <string name="default_font_size">Dimensione standard carattere</string>
         <string-array name="default_font_size_entries">
             <item>50%</item>
index 3f1b0cb81229d303c749d10ff4bad5a33e5a5e1c..f0bc0c203d1e9f037fb3470d53d9df2c82146c3d 100644 (file)
     <string name="privacy_browser_guide">Privacy Browser Guide</string>
     <string name="overview">Overview</string>
     <string name="local_storage">Local Storage</string>
-    <string name="tor">Tor</string>
     <string name="tracking_ids">Tracking IDs</string>
     <string name="planned_features">Planned Features</string>
 
         <string name="block_ads_summary">Use the list of ad servers from pgl.yoyo.org to block ads.</string>
         <string name="do_not_track">Do Not Track</string>
         <string name="do_not_track_summary">Send the Do Not Track header, which politely suggests that web servers not track this browser.</string>
-        <string name="proxy_through_orbot">Proxy through Orbot</string>
-        <string name="proxy_through_orbot_summary">Proxy all web traffic through Orbot on localhost:8118.</string>
     <string name="search">Search</string>
         <string name="javascript_disabled_search">JavaScript-disabled search</string>
         <string-array name="javascript_disabled_search_entries">
         <string name="hide_system_bars_summary">Hide the status and navigation bars in full screen browsing mode. This doesn\'t work well if the keyboard is displayed during full screen browsing mode.</string>
         <string name="translucent_navigation_bar">Translucent navigation bar</string>
         <string name="translucent_navigation_bar_summary">Make the navigation bar translucent in full screen browsing mode.</string>
+    <string name="tor">Tor</string>
+        <string name="proxy_through_orbot">Proxy through Orbot</string>
+        <string name="proxy_through_orbot_summary">Proxy all web traffic through Orbot on localhost:8118.</string>
+        <string name="tor_homepage">Tor Homepage</string>
+        <string name="tor_javascript_disabled_search">Tor JavaScript-disabled search</string>
+        <string-array name="tor_javascript_disabled_search_entries">
+            <item>DuckDuckGo</item>
+            <item>Torch</item>
+            <item>Custom</item>
+        </string-array>
+        <string-array name="tor_javascript_disabled_search_entry_values" translatable="false">  <!-- None of the items in this `string-array` should be translated. -->
+            <item>http://3g2upl4pq6kufc4m.onion/html/?q=</item>
+            <item>http://xmh57jrzrnw6insl.onion/4a1f6b371c/search.cgi?q=</item>
+            <item>Custom URL</item><!-- This item must not be translated into other languages because it is referenced in code.  It is never displayed on the screen. -->
+        </string-array>
+        <string name="tor_javascript_disabled_search_custom_url">Tor JavaScript-disabled search custom URL</string>
+        <string name="tor_javascript_enabled_search">Tor JavaScript-enabled search</string>
+        <string-array name="tor_javascript_enabled_search_entries">
+            <item>DuckDuckGo</item>
+            <item>Torch</item>
+            <item>Custom</item>
+        </string-array>
+        <string-array name="tor_javascript_enabled_search_entry_values" translatable="false">  <!-- None of the items in this `string-array` should be translated. -->
+            <item>http://3g2upl4pq6kufc4m.onion/?q=</item>
+            <item>http://xmh57jrzrnw6insl.onion/4a1f6b371c/search.cgi?q=</item>
+            <item>Custom URL</item>  <!-- This item must not be translated into other languages because it is referenced in code.  It is never displayed on the screen. -->
+        </string-array>
+        <string name="tor_javascript_enabled_search_custom_url">Tor JavaScript-enabled search custom URL</string>
     <string name="general">General</string>
-        <string name="homepage_preference">Homepage</string>
+        <string name="homepage">Homepage</string>
         <string name="default_font_size">Default font size</string>
         <string-array name="default_font_size_entries">
             <item>50%</item>
index d1cea49580a1acca572ea8999850b3782236dd21..a2576f5c1af0b954dea0ffba3f1d8c26836f38bf 100644 (file)
             android:title="@string/do_not_track"
             android:summary="@string/do_not_track_summary"
             android:defaultValue="false" />
-
-        <SwitchPreference
-            android:key="proxy_through_orbot"
-            android:title="@string/proxy_through_orbot"
-            android:summary="@string/proxy_through_orbot_summary"
-            android:defaultValue="false" />
-
     </PreferenceCategory>
 
     <PreferenceCategory
             android:defaultValue="true" />
     </PreferenceCategory>
 
+    <PreferenceCategory
+        android:key="tor"
+        android:title="@string/tor" >
+
+        <SwitchPreference
+            android:key="proxy_through_orbot"
+            android:title="@string/proxy_through_orbot"
+            android:summary="@string/proxy_through_orbot_summary"
+            android:defaultValue="false" />
+
+        <EditTextPreference
+            android:key="tor_homepage"
+            android:title="@string/tor_homepage"
+            android:defaultValue="https://3g2upl4pq6kufc4m.onion"
+            android:inputType="textUri" />
+
+        <ListPreference
+            android:key="tor_javascript_disabled_search"
+            android:title="@string/tor_javascript_disabled_search"
+            android:entries="@array/tor_javascript_disabled_search_entries"
+            android:entryValues="@array/tor_javascript_disabled_search_entry_values"
+            android:defaultValue="https://3g2upl4pq6kufc4m.onion/html/?q=" />
+
+        <EditTextPreference
+            android:key="tor_javascript_disabled_search_custom_url"
+            android:title="@string/tor_javascript_disabled_search_custom_url"
+            android:defaultValue=""
+            android:inputType="textUri" />
+
+        <ListPreference
+            android:key="tor_javascript_enabled_search"
+            android:title="@string/tor_javascript_enabled_search"
+            android:entries="@array/tor_javascript_enabled_search_entries"
+            android:entryValues="@array/tor_javascript_enabled_search_entry_values"
+            android:defaultValue="https://3g2upl4pq6kufc4m.onion/?q=" />
+
+        <EditTextPreference
+            android:key="tor_javascript_enabled_search_custom_url"
+            android:title="@string/tor_javascript_enabled_search_custom_url"
+            android:defaultValue=""
+            android:inputType="textUri" />
+    </PreferenceCategory>
+
     <PreferenceCategory
         android:key="general"
         android:title="@string/general" >
 
         <EditTextPreference
             android:key="homepage"
-            android:title="@string/homepage_preference"
+            android:title="@string/homepage"
             android:defaultValue="https://www.duckduckgo.com"
             android:inputType="textUri" />