From 1719b39d1169ecdb32c53a4f42cc750d5b9237ab Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Mon, 30 Jul 2018 16:21:01 -0700 Subject: [PATCH] Change the default search engine to Searx. https://redmine.stoutner.com/issues/308 --- .../activities/DomainsActivity.java | 2 ++ .../activities/MainWebViewActivity.java | 8 +++--- .../fragments/DomainsListFragment.java | 10 +++---- .../fragments/SettingsFragment.java | 28 +++++++++---------- app/src/main/res/values-de/strings.xml | 10 +++++-- app/src/main/res/values-es/strings.xml | 5 ++-- app/src/main/res/values-it/strings.xml | 5 ++-- app/src/main/res/values-ru/strings.xml | 5 ++-- app/src/main/res/values/strings.xml | 10 ++++--- app/src/main/res/xml/preferences.xml | 8 +++--- 10 files changed, 52 insertions(+), 39 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java index cca88565..479b47a7 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java @@ -507,6 +507,8 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo } } }); + + // Show the Snackbar. undoDeleteSnackbar.show(); break; } diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index d8481199..bbaff98d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -3511,11 +3511,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); // Store the values from the shared preferences in variables. - String homepageString = sharedPreferences.getString("homepage", "https://start.duckduckgo.com"); - String torHomepageString = sharedPreferences.getString("tor_homepage", "https://3g2upl4pq6kufc4m.onion"); - String torSearchString = sharedPreferences.getString("tor_search", "https://3g2upl4pq6kufc4m.onion/html/?q="); + String homepageString = sharedPreferences.getString("homepage", "https://searx.me/"); + String torHomepageString = sharedPreferences.getString("tor_homepage", "http://ulrn6sryqaifefld.onion/"); + String torSearchString = sharedPreferences.getString("tor_search", "http://ulrn6sryqaifefld.onion/?q="); String torSearchCustomURLString = sharedPreferences.getString("tor_search_custom_url", ""); - String searchString = sharedPreferences.getString("search", "https://duckduckgo.com/html/?q="); + String searchString = sharedPreferences.getString("search", "https://searx.me/?q="); String searchCustomURLString = sharedPreferences.getString("search_custom_url", ""); incognitoModeEnabled = sharedPreferences.getBoolean("incognito_mode", false); boolean doNotTrackEnabled = sharedPreferences.getBoolean("do_not_track", false); diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java index 3caccf52..8f50d2fc 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java @@ -76,7 +76,7 @@ public class DomainsListFragment extends Fragment { Bundle argumentsBundle = new Bundle(); argumentsBundle.putInt(DomainSettingsFragment.DATABASE_ID, DomainsActivity.currentDomainDatabaseId); - // Add `argumentsBundle` to `domainSettingsFragment`. + // Add the arguments bundle to the domain settings fragment. DomainSettingsFragment domainSettingsFragment = new DomainSettingsFragment(); domainSettingsFragment.setArguments(argumentsBundle); @@ -84,7 +84,7 @@ public class DomainsListFragment extends Fragment { if (DomainsActivity.twoPanedMode) { // The device in in two-paned mode. // enable `deleteMenuItem` if the system is not waiting for a `Snackbar` to be dismissed. if (!DomainsActivity.dismissingSnackbar) { - // Enable `deleteMenuItem`. + // Enable the delete menu item. DomainsActivity.deleteMenuItem.setEnabled(true); // Set the delete icon according to the theme. @@ -95,7 +95,7 @@ public class DomainsListFragment extends Fragment { } } - // Display `domainSettingsFragment`. + // Display the domain settings fragment. supportFragmentManager.beginTransaction().replace(R.id.domain_settings_fragment_container, domainSettingsFragment).commit(); } else { // The device in in single-paned mode // Show `deleteMenuItem` if the system is not waiting for a `Snackbar` to be dismissed. @@ -103,11 +103,11 @@ public class DomainsListFragment extends Fragment { DomainsActivity.deleteMenuItem.setVisible(true); } - // Hide `add_domain_fab`. + // Hide the add domain FAB. FloatingActionButton addDomainFAB = getActivity().findViewById(R.id.add_domain_fab); addDomainFAB.setVisibility(View.GONE); - // Display `domainSettingsFragment`. + // Display the domain settings fragment. supportFragmentManager.beginTransaction().replace(R.id.domains_listview_fragment_container, domainSettingsFragment).commit(); } }); diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java index c8481c0b..17f0bdc2 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java @@ -96,8 +96,8 @@ public class SettingsFragment extends PreferenceFragment { hideSystemBarsPreference.setDependency("full_screen_browsing_mode"); // Get Strings from the preferences. - String torSearchString = savedPreferences.getString("tor_search", "https://3g2upl4pq6kufc4m.onion/html/?q="); - String searchString = savedPreferences.getString("search", "https://duckduckgo.com/html/?q="); + String torSearchString = savedPreferences.getString("tor_search", "http://ulrn6sryqaifefld.onion/?q="); + String searchString = savedPreferences.getString("search", "https://searx.me/?q="); // Get booleans that are used in multiple places from the preferences. final boolean javaScriptEnabled = savedPreferences.getBoolean("javascript_enabled", false); @@ -175,11 +175,11 @@ public class SettingsFragment extends PreferenceFragment { customUserAgentPreference.setEnabled(userAgentPreference.getSummary().equals(getString(R.string.custom_user_agent))); - // 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 homepage URL as the summary text for the `tor_homepage` preference when the preference screen is loaded. The default is Searx: `http://ulrn6sryqaifefld.onion/`. + torHomepagePreference.setSummary(savedPreferences.getString("tor_homepage", "http://ulrn6sryqaifefld.onion/")); - // Set the Tor search URL as the summary text for the Tor preference when the preference screen is loaded. The default is `https://3g2upl4pq6kufc4m.onion/html/?q=` + // Set the Tor search URL as the summary text for the Tor preference when the preference screen is loaded. if (torSearchString.equals("Custom URL")) { // Use R.string.custom_url, which will be translated, instead of the array value, which will not. torSearchPreference.setSummary(R.string.custom_url); @@ -195,7 +195,7 @@ public class SettingsFragment extends PreferenceFragment { torSearchCustomURLPreference.setEnabled(proxyThroughOrbot && torSearchString.equals("Custom URL")); - // Set the search URL as the summary text for the search preference when the preference screen is loaded. The default is `https://duckduckgo.com/html/?q=`. + // Set the search URL as the summary text for the search preference when the preference screen is loaded. if (searchString.equals("Custom URL")) { // Use R.string.custom_url, which will be translated, instead of the array value, which will not. searchPreference.setSummary(R.string.custom_url); @@ -219,7 +219,7 @@ public class SettingsFragment extends PreferenceFragment { clearCachePreference.setEnabled(!clearEverything); // Set the homepage URL as the summary text for the homepage preference. - homepagePreference.setSummary(savedPreferences.getString("homepage", "https://duckduckgo.com/?kao=-1&kak=-1")); + homepagePreference.setSummary(savedPreferences.getString("homepage", "https://searx.me/")); // Set the default font size as the summary text for the preference. defaultFontSizePreference.setSummary(savedPreferences.getString("default_font_size", "100") + "%%"); @@ -1072,7 +1072,7 @@ public class SettingsFragment extends PreferenceFragment { case "proxy_through_orbot": // Get current settings. boolean currentProxyThroughOrbot = sharedPreferences.getBoolean("proxy_through_orbot", false); - String currentTorSearchString = sharedPreferences.getString("tor_search", "https://3g2upl4pq6kufc4m.onion/html/?q="); + String currentTorSearchString = sharedPreferences.getString("tor_search", "http://ulrn6sryqaifefld.onion/?q="); // Enable the Tor custom URL search option only if `currentProxyThroughOrbot` is true and the search is set to `Custom URL`. torSearchCustomURLPreference.setEnabled(currentProxyThroughOrbot && currentTorSearchString.equals("Custom URL")); @@ -1119,13 +1119,13 @@ public class SettingsFragment extends PreferenceFragment { 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")); + // Set the new tor homepage URL as the summary text for the `tor_homepage` preference. The default is Searx: `http://ulrn6sryqaifefld.onion/`. + torHomepagePreference.setSummary(sharedPreferences.getString("tor_homepage", "http://ulrn6sryqaifefld.onion/")); break; case "tor_search": // Get the present search string. - String presentTorSearchString = sharedPreferences.getString("tor_search", "https://3g2upl4pq6kufc4m.onion/html/?q="); + String presentTorSearchString = sharedPreferences.getString("tor_search", "http://ulrn6sryqaifefld.onion/?q="); // Update the preferences. if (presentTorSearchString.equals("Custom URL")) { @@ -1164,7 +1164,7 @@ public class SettingsFragment extends PreferenceFragment { case "search": // Store the new search string. - String newSearchString = sharedPreferences.getString("search", "https://duckduckgo.com/html/?q="); + String newSearchString = sharedPreferences.getString("search", "https://searx.me/?q="); // Update `searchPreference` and `searchCustomURLPreference`. if (newSearchString.equals("Custom URL")) { // `Custom URL` is selected. @@ -1447,8 +1447,8 @@ public class SettingsFragment extends PreferenceFragment { 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")); + // Set the new homepage URL as the summary text for the Homepage preference. + homepagePreference.setSummary(sharedPreferences.getString("homepage", "https://searx.me/")); break; case "default_font_size": diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 03ccd1fe..8a4ec357 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -315,14 +315,20 @@ Tor Proxy durch Orbot Sämtlichen Web-Verkehr durch Orbot mittels localhost:8118 leiten. + + Searx + DuckDuckGo - JavaScript disabled + DuckDuckGo - JavaScript enabled + Eigene + Suche + Searx + StartPage DuckDuckGo - JavaScript disabled DuckDuckGo - JavaScript enabled - StartPage Qwant - JavaScript disabled Qwant - JavaScript enabled - Searx Google Bing Yahoo - JavaScript disabled diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 7620f054..b2629d0a 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -377,6 +377,7 @@ Página de inicio de Tor Búsqueda en Tor + Searx DuckDuckGo - Javascript deshabilitado DuckDuckGo - Javascript habilitado Personalizado @@ -384,12 +385,12 @@ URL personalizada de búsqueda en Tor Búsqueda + Searx + StartPage DuckDuckGo - Javascript deshabilitado DuckDuckGo - Javascript habilitado - StartPage Qwant - Javascript deshatilitado Qwant - Javascript habilitado - Searx Google Bing Yahoo - Javascript deshabilitado diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 6c061ede..da628811 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -376,6 +376,7 @@ Tor Homepage Tor - Ricerca + Searx DuckDuckGo - JavaScript disabilitato DuckDuckGo - JavaScript abilitato Personalizzata @@ -383,12 +384,12 @@ Tor - Ricerca personalizzata Ricerca + Searx + StartPage DuckDuckGo - JavaScript disabilitato DuckDuckGo - JavaScript abilitato - StartPage Qwant - JavaScript disabilitato Qwant - JavaScript abilitato - Searx Google Bing Yahoo - JavaScript disabilitato diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 1b48b260..b3f7cd3d 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -376,6 +376,7 @@ Домашняя страница Tor Поиск Tor + Searx DuckDuckGo - JavaScript выключен DuckDuckGo - JavaScript включен Настраиваемый @@ -383,12 +384,12 @@ Настраиваемый URL поиска Tor Поиск + Searx + StartPage DuckDuckGo - JavaScript выключен DuckDuckGo - JavaScript включен - StartPage Qwant - JavaScript выключен Qwant - JavaScript включен - Searx Google Bing Yahoo - JavaScript выключен diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d2501854..aefc1747 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -408,11 +408,13 @@ Tor homepage Tor search + Searx DuckDuckGo - JavaScript disabled DuckDuckGo - JavaScript enabled Custom + http://ulrn6sryqaifefld.onion/?q= https://3g2upl4pq6kufc4m.onion/html/?q= https://3g2upl4pq6kufc4m.onion/?q= Custom URL @@ -420,12 +422,12 @@ Tor search custom URL Search + Searx + StartPage DuckDuckGo - JavaScript disabled DuckDuckGo - JavaScript enabled - StartPage Qwant - JavaScript disabled Qwant - JavaScript enabled - Searx Google Bing Yahoo - JavaScript disabled @@ -433,12 +435,12 @@ Custom + https://searx.me/?q= + https://www.startpage.com/do/search?query= https://duckduckgo.com/html/?q= https://duckduckgo.com/?q= - https://www.startpage.com/do/search?query= https://lite.qwant.com/?q= https://www.qwant.com/?q= - https://searx.me/?q= https://www.google.com/search?q= https://www.bing.com/search?q= https://search.yahoo.com/mobile/s?nojs=1&p= diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index d52f56c7..ecf94094 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -142,7 +142,7 @@ + android:defaultValue="http://ulrn6sryqaifefld.onion/?q=" /> @@ -170,7 +170,7 @@ android:title="@string/search" android:entries="@array/search_entries" android:entryValues="@array/search_entry_values" - android:defaultValue="https://duckduckgo.com/html/?q=" + android:defaultValue="https://searx.me/?q=" android:icon="?attr/searchIcon" /> @@ -247,7 +247,7 @@ -- 2.45.2