- // Set the activity theme.
- if (MainWebViewActivity.darkTheme) {
- setTheme(R.style.PrivacyBrowserSettingsDark);
- } else {
- setTheme(R.style.PrivacyBrowserSettingsLight);
+ // Get a handle for the shared preferences.
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+
+ // Get the screenshot and theme preferences.
+ boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
+ // Disable screenshots if not allowed.
+ if (!allowScreenshots) {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);