- if (sharedPreferences.getBoolean(context.getString(R.string.allow_screenshots_key), false)) {
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
- allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_day);
- } else {
- allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_night);
- }
- } else {
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
- allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_day);
- } else {
- allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_night);
- }
- }
-
- // Create an intent to restart Privacy Browser.
- Intent allowScreenshotsRestartIntent = requireActivity().getParentActivityIntent();
-
- // Assert that the intent is not null to remove the lint error below.
- assert allowScreenshotsRestartIntent != null;
-
- // `Intent.FLAG_ACTIVITY_CLEAR_TASK` removes all activities from the stack. It requires `Intent.FLAG_ACTIVITY_NEW_TASK`.
- allowScreenshotsRestartIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
-
- // Create a handler to restart the activity.
- Handler allowScreenshotsRestartHandler = new Handler(Looper.getMainLooper());
-
- // Create a runnable to restart the activity.
- Runnable allowScreenshotsRestartRunnable = () -> {
- // Restart the activity.
- startActivity(allowScreenshotsRestartIntent);
-
- // Kill this instance of Privacy Browser. Otherwise, the app exhibits sporadic behavior after the restart.
- System.exit(0);
- };
+ if (sharedPreferences.getBoolean(context.getString(R.string.allow_screenshots_key), false))
+ allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled);
+ else
+ allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled);