<w>listview</w>
<w>logins</w>
<w>lossless</w>
+ <w>macos</w>
<w>mailto</w>
<w>materialdesignicons</w>
<w>mimetype</w>
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
- implementation 'com.android.support:design:28.0.0-rc01'
+ implementation 'com.android.support:design:28.0.0-rc02'
// Only compile Firebase ads for the free flavor.
freeImplementation 'com.google.firebase:firebase-ads:15.0.1'
private boolean fanboysSocialBlockingListEnabled;
private boolean ultraPrivacyEnabled;
+ // `webViewDefaultUserAgent` is used in `onCreate()` and `onPrepareOptionsMenu()`.
+ private String webViewDefaultUserAgent;
+
+ // `defaultCustomUserAgentString` is used in `onPrepareOptionsMenu()` and `applyDomainSettings()`.
+ private String defaultCustomUserAgentString;
+
// `privacyBrowserRuntime` is used in `onCreate()`, `onOptionsItemSelected()`, and `applyAppSettings()`.
private Runtime privacyBrowserRuntime;
saveFormDataEnabled = false; // Form data can be removed once the minimum API >= 26.
nightMode = false;
+ // Store the default user agent.
+ webViewDefaultUserAgent = mainWebView.getSettings().getUserAgentString();
+
// Initialize the WebView title.
webViewTitle = getString(R.string.no_title);
ultraPrivacyMenuItem.setTitle(ultraPrivacyBlockedRequests + " - " + getString(R.string.ultraprivacy));
blockAllThirdParyRequestsMenuItem.setTitle(thirdPartyBlockedRequests + " - " + getString(R.string.block_all_third_party_requests));
+ // Get the current user agent.
+ String currentUserAgent = mainWebView.getSettings().getUserAgentString();
+
+ // Select the current user agent menu item. A switch statement cannot be used because the user agents are not compile time constants.
+ if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[0])) { // Privacy Browser.
+ menu.findItem(R.id.user_agent_privacy_browser).setChecked(true);
+ } else if (currentUserAgent.equals(webViewDefaultUserAgent)) { // WebView Default.
+ menu.findItem(R.id.user_agent_webview_default).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[2])) { // Firefox on Android.
+ menu.findItem(R.id.user_agent_firefox_on_android).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[3])) { // Chrome on Android.
+ menu.findItem(R.id.user_agent_chrome_on_android).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[4])) { // Safari on iOS.
+ menu.findItem(R.id.user_agent_safari_on_ios).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[5])) { // Firefox on Linux.
+ menu.findItem(R.id.user_agent_firefox_on_linux).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[6])) { // Chromium on Linux.
+ menu.findItem(R.id.user_agent_chromium_on_linux).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[7])) { // Firefox on Windows.
+ menu.findItem(R.id.user_agent_firefox_on_windows).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[8])) { // Chrome on Windows.
+ menu.findItem(R.id.user_agent_chrome_on_windows).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[9])) { // Edge on Windows.
+ menu.findItem(R.id.user_agent_edge_on_windows).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[10])) { // Internet Explorer on Windows.
+ menu.findItem(R.id.user_agent_internet_explorer_on_windows).setChecked(true);
+ } else if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[11])) { // Safari on macOS.
+ menu.findItem(R.id.user_agent_safari_on_macos).setChecked(true);
+ } else { // Custom user agent.
+ menu.findItem(R.id.user_agent_custom).setChecked(true);
+ }
+
// Initialize font size variables.
int fontSize = mainWebView.getSettings().getTextZoom();
String fontSizeTitle;
.show();
return true;
- case R.id.font_size_twenty_five_percent:
- mainWebView.getSettings().setTextZoom(25);
- return true;
-
- case R.id.font_size_fifty_percent:
- mainWebView.getSettings().setTextZoom(50);
- return true;
-
- case R.id.font_size_seventy_five_percent:
- mainWebView.getSettings().setTextZoom(75);
- return true;
-
- case R.id.font_size_one_hundred_percent:
- mainWebView.getSettings().setTextZoom(100);
- return true;
-
- case R.id.font_size_one_hundred_twenty_five_percent:
- mainWebView.getSettings().setTextZoom(125);
- return true;
-
- case R.id.font_size_one_hundred_fifty_percent:
- mainWebView.getSettings().setTextZoom(150);
- return true;
-
- case R.id.font_size_one_hundred_seventy_five_percent:
- mainWebView.getSettings().setTextZoom(175);
- return true;
-
- case R.id.font_size_two_hundred_percent:
- mainWebView.getSettings().setTextZoom(200);
- return true;
-
- case R.id.swipe_to_refresh:
- // Toggle swipe to refresh.
- swipeRefreshLayout.setEnabled(!swipeRefreshLayout.isEnabled());
- return true;
-
- case R.id.display_images:
- if (mainWebView.getSettings().getLoadsImagesAutomatically()) { // Images are currently loaded automatically.
- mainWebView.getSettings().setLoadsImagesAutomatically(false);
- mainWebView.reload();
- } else { // Images are not currently loaded automatically.
- mainWebView.getSettings().setLoadsImagesAutomatically(true);
- }
-
- // Set `onTheFlyDisplayImagesSet`.
- onTheFlyDisplayImagesSet = true;
- return true;
-
- case R.id.view_source:
- // Launch the View Source activity.
- Intent viewSourceIntent = new Intent(this, ViewSourceActivity.class);
- startActivity(viewSourceIntent);
- return true;
-
case R.id.easylist:
// Toggle the EasyList status.
easyListEnabled = !easyListEnabled;
mainWebView.reload();
return true;
+ case R.id.user_agent_privacy_browser:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[0]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_webview_default:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString("");
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_firefox_on_android:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[2]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_chrome_on_android:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[3]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_safari_on_ios:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[4]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_firefox_on_linux:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[5]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_chromium_on_linux:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[6]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_firefox_on_windows:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[7]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_chrome_on_windows:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[8]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_edge_on_windows:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[9]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_internet_explorer_on_windows:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[10]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_safari_on_macos:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(getResources().getStringArray(R.array.user_agent_data)[11]);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.user_agent_custom:
+ // Update the user agent.
+ mainWebView.getSettings().setUserAgentString(defaultCustomUserAgentString);
+
+ // Reload the WebView.
+ mainWebView.reload();
+ return true;
+
+ case R.id.font_size_twenty_five_percent:
+ mainWebView.getSettings().setTextZoom(25);
+ return true;
+
+ case R.id.font_size_fifty_percent:
+ mainWebView.getSettings().setTextZoom(50);
+ return true;
+
+ case R.id.font_size_seventy_five_percent:
+ mainWebView.getSettings().setTextZoom(75);
+ return true;
+
+ case R.id.font_size_one_hundred_percent:
+ mainWebView.getSettings().setTextZoom(100);
+ return true;
+
+ case R.id.font_size_one_hundred_twenty_five_percent:
+ mainWebView.getSettings().setTextZoom(125);
+ return true;
+
+ case R.id.font_size_one_hundred_fifty_percent:
+ mainWebView.getSettings().setTextZoom(150);
+ return true;
+
+ case R.id.font_size_one_hundred_seventy_five_percent:
+ mainWebView.getSettings().setTextZoom(175);
+ return true;
+
+ case R.id.font_size_two_hundred_percent:
+ mainWebView.getSettings().setTextZoom(200);
+ return true;
+
+ case R.id.swipe_to_refresh:
+ // Toggle swipe to refresh.
+ swipeRefreshLayout.setEnabled(!swipeRefreshLayout.isEnabled());
+ return true;
+
+ case R.id.display_images:
+ if (mainWebView.getSettings().getLoadsImagesAutomatically()) { // Images are currently loaded automatically.
+ mainWebView.getSettings().setLoadsImagesAutomatically(false);
+ mainWebView.reload();
+ } else { // Images are not currently loaded automatically.
+ mainWebView.getSettings().setLoadsImagesAutomatically(true);
+ }
+
+ // Set `onTheFlyDisplayImagesSet`.
+ onTheFlyDisplayImagesSet = true;
+ return true;
+
+ case R.id.view_source:
+ // Launch the View Source activity.
+ Intent viewSourceIntent = new Intent(this, ViewSourceActivity.class);
+ startActivity(viewSourceIntent);
+ return true;
+
case R.id.share:
// Setup the share string.
String shareString = webViewTitle + " – " + urlTextBox.getText().toString();
// Store the general preference information.
String defaultFontSizeString = sharedPreferences.getString("default_font_size", "100");
String defaultUserAgentName = sharedPreferences.getString("user_agent", "Privacy Browser");
- String defaultCustomUserAgentString = sharedPreferences.getString("custom_user_agent", "PrivacyBrowser/1.0");
+ defaultCustomUserAgentString = sharedPreferences.getString("custom_user_agent", "PrivacyBrowser/1.0");
boolean defaultSwipeToRefresh = sharedPreferences.getBoolean("swipe_to_refresh", true);
nightMode = sharedPreferences.getBoolean("night_mode", false);
app:showAsAction="never" >
<menu>
+ <item
+ android:id="@+id/user_agent"
+ android:title="@string/user_agent"
+ android:orderInCategory="910"
+ app:showAsAction="never" >
+
+ <menu>
+ <group android:checkableBehavior ="single">
+ <item
+ android:id="@+id/user_agent_privacy_browser"
+ android:title="@string/privacy_browser"
+ android:orderInCategory="911"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_webview_default"
+ android:title="@string/user_agent_webview_default"
+ android:orderInCategory="912"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_firefox_on_android"
+ android:title="@string/user_agent_firefox_on_android"
+ android:orderInCategory="913"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_chrome_on_android"
+ android:title="@string/user_agent_chrome_on_android"
+ android:orderInCategory="914"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_safari_on_ios"
+ android:title="@string/user_agent_safari_on_ios"
+ android:orderInCategory="915"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_firefox_on_linux"
+ android:title="@string/user_agent_firefox_on_linux"
+ android:orderInCategory="916"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_chromium_on_linux"
+ android:title="@string/user_agent_chromium_on_linux"
+ android:orderInCategory="917"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_firefox_on_windows"
+ android:title="@string/user_agent_firefox_on_windows"
+ android:orderInCategory="918"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_chrome_on_windows"
+ android:title="@string/user_agent_chrome_on_windows"
+ android:orderInCategory="919"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_edge_on_windows"
+ android:title="@string/user_agent_edge_on_windows"
+ android:orderInCategory="920"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_internet_explorer_on_windows"
+ android:title="@string/user_agent_internet_explorer_on_windows"
+ android:orderInCategory="921"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_safari_on_macos"
+ android:title="@string/user_agent_safari_on_macos"
+ android:orderInCategory="922"
+ app:showAsAction="never" />
+
+ <item
+ android:id="@+id/user_agent_custom"
+ android:title="@string/user_agent_custom"
+ android:orderInCategory="923"
+ app:showAsAction="never" />
+ </group>
+ </menu>
+ </item>
+
<item
android:id="@+id/font_size"
android:title="@string/font_size"
- android:orderInCategory="910"
+ android:orderInCategory="930"
app:showAsAction="never" >
<menu>
<item
android:id="@+id/font_size_twenty_five_percent"
android:title="@string/twenty_five_percent"
- android:orderInCategory="911"
+ android:orderInCategory="931"
app:showAsAction="never" />
<item
android:id="@+id/font_size_fifty_percent"
android:title="@string/fifty_percent"
- android:orderInCategory="912"
+ android:orderInCategory="932"
app:showAsAction="never" />
<item
android:id="@+id/font_size_seventy_five_percent"
android:title="@string/seventy_five_percent"
- android:orderInCategory="913"
+ android:orderInCategory="933"
app:showAsAction="never" />
<item
android:id="@+id/font_size_one_hundred_percent"
android:title="@string/one_hundred_percent"
- android:orderInCategory="914"
+ android:orderInCategory="934"
app:showAsAction="never" />
<item
android:id="@+id/font_size_one_hundred_twenty_five_percent"
android:title="@string/one_hundred_twenty_five_percent"
- android:orderInCategory="915"
+ android:orderInCategory="935"
app:showAsAction="never" />
<item
android:id="@+id/font_size_one_hundred_fifty_percent"
android:title="@string/one_hundred_fifty_percent"
- android:orderInCategory="916"
+ android:orderInCategory="936"
app:showAsAction="never" />
<item
android:id="@+id/font_size_one_hundred_seventy_five_percent"
android:title="@string/one_hundred_seventy_five_percent"
- android:orderInCategory="917"
+ android:orderInCategory="937"
app:showAsAction="never" />
<item
android:id="@+id/font_size_two_hundred_percent"
android:title="@string/two_hundred_percent"
- android:orderInCategory="918"
+ android:orderInCategory="938"
app:showAsAction="never" />
</group>
</menu>
<item
android:id="@+id/swipe_to_refresh"
android:title="@string/swipe_to_refresh_options_menu"
- android:orderInCategory="920"
+ android:orderInCategory="940"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/display_images"
android:title="@string/display_images"
- android:orderInCategory="930"
+ android:orderInCategory="950"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/view_source"
android:title="@string/view_source"
- android:orderInCategory="940"
+ android:orderInCategory="960"
app:showAsAction="never" />
</menu>
</item>
<string name="clear_cookies">Cookies löschen</string>
<string name="clear_dom_storage">DOM-Speicher löschen</string>
<string name="clear_form_data">Formulardaten löschen</string>
+ <string name="user_agent_webview_default">WebView-Standard</string>
+ <string name="user_agent_firefox_on_android">Firefox auf Android</string>
+ <string name="user_agent_chrome_on_android">Chrome auf Android</string>
+ <string name="user_agent_safari_on_ios">Safari auf iOS</string>
+ <string name="user_agent_firefox_on_linux">Firefox auf Linux</string>
+ <string name="user_agent_chromium_on_linux">Chromium auf Linux</string>
+ <string name="user_agent_firefox_on_windows">Firefox auf Windows</string>
+ <string name="user_agent_chrome_on_windows">Chrome auf Windows</string>
+ <string name="user_agent_edge_on_windows">Edge auf Windows</string>
+ <string name="user_agent_internet_explorer_on_windows">Internet Explorer auf Windows</string>
+ <string name="user_agent_safari_on_macos">Safari auf macOS</string>
+ <string name="user_agent_custom">Eigener</string>
<string name="font_size">Schriftgröße</string>
<string name="twenty_five_percent">25%</string>
<string name="fifty_percent">50%</string>
<string name="options_fanboys_social_blocking_list">Lista de bloqueo social de Fanboy</string>
<string name="options_block_all_third_party_requests">Bloquear todas las solicitudes de terceros</string>
<string name="layout">Diseño</string>
+ <string name="user_agent_webview_default">WebView por defecto</string>
+ <string name="user_agent_firefox_on_android">Firefox en Android</string>
+ <string name="user_agent_chrome_on_android">Chrome en Android</string>
+ <string name="user_agent_safari_on_ios">Safari en iOS</string>
+ <string name="user_agent_firefox_on_linux">Firefox en Linux</string>
+ <string name="user_agent_chromium_on_linux">Chromium en Linux</string>
+ <string name="user_agent_firefox_on_windows">Firefox en Windows</string>
+ <string name="user_agent_chrome_on_windows">Chrome en Windows</string>
+ <string name="user_agent_edge_on_windows">Edge en Windows</string>
+ <string name="user_agent_internet_explorer_on_windows">Internet Explorer en Windows</string>
+ <string name="user_agent_safari_on_macos">Safari en macOS</string>
+ <string name="user_agent_custom">Personalizado</string>
<string name="font_size">Tamaño de fuente</string>
<string name="twenty_five_percent">25%</string>
<string name="fifty_percent">50%</string>
<string name="options_fanboys_social_blocking_list">Fanboy’s social blocking list</string>
<string name="options_block_all_third_party_requests">Blocca tutte le richieste di Terze Parti</string>
<string name="layout">Layout</string>
+ <string name="user_agent_webview_default">WebView Default</string>
+ <string name="user_agent_firefox_on_android">Firefox su Android</string>
+ <string name="user_agent_chrome_on_android">Chrome su Android</string>
+ <string name="user_agent_safari_on_ios">Safari su iOS</string>
+ <string name="user_agent_firefox_on_linux">Firefox su Linux</string>
+ <string name="user_agent_chromium_on_linux">Chromium su Linux</string>
+ <string name="user_agent_firefox_on_windows">Firefox su Windows</string>
+ <string name="user_agent_chrome_on_windows">Chrome su Windows</string>
+ <string name="user_agent_edge_on_windows">Edge su Windows</string>
+ <string name="user_agent_internet_explorer_on_windows">Internet Explorer su Windows</string>
+ <string name="user_agent_safari_on_macos">Safari su macOS</string>
+ <string name="user_agent_custom">Personalizzato</string>
<string name="font_size">Dimensione font</string>
<string name="twenty_five_percent">25%</string>
<string name="fifty_percent">50%</string>
<string name="options_fanboys_social_blocking_list">Fanboy’s social blocking list</string>
<string name="options_block_all_third_party_requests">Блокировать все сторонние запросы</string>
<string name="layout">Внешний вид</string>
+ <string name="user_agent_webview_default">WebView по умолчанию</string>
+ <string name="user_agent_firefox_on_android">Firefox на Android</string>
+ <string name="user_agent_chrome_on_android">Chrome на Android</string>
+ <string name="user_agent_safari_on_ios">Safari на iOS</string>
+ <string name="user_agent_firefox_on_linux">Firefox на Linux</string>
+ <string name="user_agent_chromium_on_linux">Chromium на Linux</string>
+ <string name="user_agent_firefox_on_windows">Firefox на Windows</string>
+ <string name="user_agent_chrome_on_windows">Chrome на Windows</string>
+ <string name="user_agent_edge_on_windows">Edge на Windows</string>
+ <string name="user_agent_internet_explorer_on_windows">Internet Explorer на Windows</string>
+ <string name="user_agent_safari_on_macos">Safari на macOS</string>
+ <string name="user_agent_custom">Настраиваемый</string>
<string name="font_size">Размер шрифта</string>
<string name="twenty_five_percent">25%</string>
<string name="fifty_percent">50%</string>
<string name="options_fanboys_social_blocking_list">Fanboy’s Social Blocking List</string>
<string name="options_block_all_third_party_requests">Block All Third-Party Requests</string>
<string name="layout">Layout</string>
+ <string name="user_agent_webview_default">WebView Default</string>
+ <string name="user_agent_firefox_on_android">Firefox on Android</string>
+ <string name="user_agent_chrome_on_android">Chrome on Android</string>
+ <string name="user_agent_safari_on_ios">Safari on iOS</string>
+ <string name="user_agent_firefox_on_linux">Firefox on Linux</string>
+ <string name="user_agent_chromium_on_linux">Chromium on Linux</string>
+ <string name="user_agent_firefox_on_windows">Firefox on Windows</string>
+ <string name="user_agent_chrome_on_windows">Chrome on Windows</string>
+ <string name="user_agent_edge_on_windows">Edge on Windows</string>
+ <string name="user_agent_internet_explorer_on_windows">Internet Explorer on Windows</string>
+ <string name="user_agent_safari_on_macos">Safari on macOS</string>
+ <string name="user_agent_custom">Custom</string>
<string name="font_size">Font Size</string>
<string name="twenty_five_percent">25%</string>
<string name="fifty_percent">50%</string>