X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FEditBookmarkFolderDatabaseViewDialog.java;h=1b7c3d70849b499158fdb2281a2ec3e18da7a736;hp=5033ece87bcb22c59b7f234e91727f3979a8ed1e;hb=f0393ca22075be3e5fe9199c7db87381256236fa;hpb=54c70ca476ba2f53ae274df1ac725be3919e8f56 diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java index 5033ece8..1b7c3d70 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java @@ -24,6 +24,7 @@ import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; +import android.content.SharedPreferences; import android.database.Cursor; import android.database.DatabaseUtils; import android.database.MatrixCursor; @@ -31,6 +32,7 @@ import android.database.MergeCursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; +import android.preference.PreferenceManager; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; @@ -52,7 +54,6 @@ import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; // The AndroidX dialog fragment must be used or an error is produced on API <=22. import com.stoutner.privacybrowser.R; -import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; import java.io.ByteArrayOutputStream; @@ -139,8 +140,15 @@ public class EditBookmarkFolderDatabaseViewDialog extends DialogFragment { // Use an alert dialog builder to create the alert dialog. AlertDialog.Builder dialogBuilder; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); + + // Get the screenshot and theme preferences. + boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); + // Set the style according to the theme. - if (MainWebViewActivity.darkTheme) { + if (darkTheme) { dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark); } else { dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight); @@ -173,7 +181,7 @@ public class EditBookmarkFolderDatabaseViewDialog extends DialogFragment { assert alertDialog.getWindow() != null; // Disable screenshots if not allowed. - if (!MainWebViewActivity.allowScreenshots) { + if (!allowScreenshots) { alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); }