mainWebView.getSettings().setTextZoom(200);
return true;
+ case R.id.share:
+ Intent shareIntent = new Intent();
+ shareIntent.setAction(Intent.ACTION_SEND);
+ shareIntent.putExtra(Intent.EXTRA_TEXT, urlTextBox.getText().toString());
+ shareIntent.setType("text/plain");
+ startActivity(Intent.createChooser(shareIntent, "Share URL"));
+ return true;
+
case R.id.find_on_page:
// Hide the URL app bar.
supportAppBar.setVisibility(View.GONE);
}, 200);
return true;
- case R.id.share:
- Intent shareIntent = new Intent();
- shareIntent.setAction(Intent.ACTION_SEND);
- shareIntent.putExtra(Intent.EXTRA_TEXT, urlTextBox.getText().toString());
- shareIntent.setType("text/plain");
- startActivity(Intent.createChooser(shareIntent, "Share URL"));
- return true;
-
- case R.id.addToHomescreen:
- // Show the `CreateHomeScreenShortcutDialog` `AlertDialog` and name this instance `R.string.create_shortcut`.
- AppCompatDialogFragment createHomeScreenShortcutDialogFragment = new CreateHomeScreenShortcutDialog();
- createHomeScreenShortcutDialogFragment.show(getSupportFragmentManager(), getResources().getString(R.string.create_shortcut));
-
- //Everything else will be handled by `CreateHomeScreenShortcutDialog` and the associated listener below.
+ case R.id.refresh:
+ mainWebView.reload();
return true;
case R.id.print:
printManager.print(getResources().getString(R.string.privacy_browser_web_page), printDocumentAdapter, null);
return true;
- case R.id.refresh:
- mainWebView.reload();
+ case R.id.addToHomescreen:
+ // Show the `CreateHomeScreenShortcutDialog` `AlertDialog` and name this instance `R.string.create_shortcut`.
+ AppCompatDialogFragment createHomeScreenShortcutDialogFragment = new CreateHomeScreenShortcutDialog();
+ createHomeScreenShortcutDialogFragment.show(getSupportFragmentManager(), getResources().getString(R.string.create_shortcut));
+
+ //Everything else will be handled by `CreateHomeScreenShortcutDialog` and the associated listener below.
return true;
default:
boolean hostHasDomainSettings = false;
String domainNameInDatabase = null;
- // Check all the subdomains of `hostname` against the list of domains in `domainCursor`.
+ // Check the hostname.
+ if (domainSettingsSet.contains(hostname)) {
+ hostHasDomainSettings = true;
+ domainNameInDatabase = hostname;
+ }
+
+ // Check all the subdomains of `hostname` against wildcard domains in `domainCursor`.
while (hostname.contains(".") && !hostHasDomainSettings) { // Stop checking if we run out of `.` or if we already know that `hostHasDomainSettings` is `true`.
- if (domainSettingsSet.contains(hostname)) { // Check the host name.
- hostHasDomainSettings = true;
- domainNameInDatabase = hostname;
- } else if (domainSettingsSet.contains("*." + hostname)) { // Check the host name prepended by `*.`.
+ if (domainSettingsSet.contains("*." + hostname)) { // Check the host name prepended by `*.`.
hostHasDomainSettings = true;
domainNameInDatabase = "*." + hostname;
}