]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java
Make first-party cookies tab aware.
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / SettingsActivity.java
index 2687ab1facfae4082212401a83b589653d26b7cc..8409912b96ff59d0a8e994d3680a8eacd0ad9183 100644 (file)
@@ -19,7 +19,9 @@
 
 package com.stoutner.privacybrowser.activities;
 
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.WindowManager;
 
 import androidx.appcompat.app.AppCompatActivity;
@@ -30,13 +32,20 @@ import com.stoutner.privacybrowser.fragments.SettingsFragment;
 public class SettingsActivity extends AppCompatActivity {
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        // 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);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the activity theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserSettingsDark);
         } else {
             setTheme(R.style.PrivacyBrowserSettingsLight);
@@ -48,4 +57,4 @@ public class SettingsActivity extends AppCompatActivity {
         // Display the settings fragment.
         getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
     }
-}
+}
\ No newline at end of file