public class MainWebViewActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, CreateHomeScreenShortcutDialog.CreateHomeScreenSchortcutListener,
SslCertificateErrorDialog.SslCertificateErrorListener, DownloadFileDialog.DownloadFileListener, DownloadImageDialog.DownloadImageListener, UrlHistoryDialog.UrlHistoryListener {
+ // `darkTheme` is public static so it can be accessed from `AboutActivity`. It is also used in `onCreate()`, `applyAppSettings()`, and `applyDomainSettings()`.
+ public static boolean darkTheme;
+
// `favoriteIconBitmap` is public static so it can be accessed from `CreateHomeScreenShortcutDialog`, `BookmarksActivity`, `CreateBookmarkDialog`, `CreateBookmarkFolderDialog`, `EditBookmarkDialog`, `EditBookmarkFolderDialog`, `ViewSslCertificateDialog`.
// It is also used in `onCreate()`, `onCreateHomeScreenShortcutCreate()`, and `applyDomainSettings`.
public static Bitmap favoriteIconBitmap;
// `mainWebViewRelativeLayout` is used in `onCreate()` and `onNavigationItemSelected()`.
private RelativeLayout mainWebViewRelativeLayout;
- // `darkTheme` is used in `onCreate()`, `applyAppSettings()`, and `applyDomainSettings()`.
- private boolean darkTheme;
-
@Override
// Remove Android Studio's warning about the dangers of using SetJavaScriptEnabled. The whole premise of Privacy Browser is built around an understanding of these dangers.
@SuppressLint("SetJavaScriptEnabled")
// Run the default commands.
super.onCreate(savedInstanceState);
- // Set the content view according to the theme..
+ // Set the content view according to the theme.
if (darkTheme) {
setContentView(R.layout.main_drawerlayout_dark);
} else {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
- // Hide the keyboard (if displayed) so we can see the options menu. `0` indicates no additional flags.
- inputMethodManager.hideSoftInputFromWindow(mainWebView.getWindowToken(), 0);
-
// Get handles for the menu items.
MenuItem toggleFirstPartyCookiesMenuItem = menu.findItem(R.id.toggle_first_party_cookies);
MenuItem toggleThirdPartyCookiesMenuItem = menu.findItem(R.id.toggle_third_party_cookies);