]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java
Fix a rare crash in `onBackPresses()`. https://redmine.stoutner.com/issues/651
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / dialogs / MoveToFolderDialog.java
index 25701f7792fd4a76ec5fc1734d17b22e2cecd6f2..a421177cabcf509250f6a3e4e440447a38654eb2 100644 (file)
@@ -24,6 +24,7 @@ import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.SharedPreferences;
+import android.content.res.Configuration;
 import android.database.Cursor;
 import android.database.DatabaseUtils;
 import android.database.MatrixCursor;
@@ -74,7 +75,7 @@ public class MoveToFolderDialog extends DialogFragment {
         moveToFolderListener = (MoveToFolderListener) context;
     }
 
-    // `@SuppressLint("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`.
+    // `@SuppressLint("InflateParams")` removes the warning about using `null` as the parent view group when inflating the alert dialog.
     @SuppressLint("InflateParams")
     @Override
     @NonNull
@@ -85,6 +86,16 @@ public class MoveToFolderDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog);
 
+        // Get the current theme status.
+        int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+
+        // Set the icon according to the theme.
+        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+            dialogBuilder.setIcon(R.drawable.move_to_folder_blue_day);
+        } else {
+            dialogBuilder.setIcon(R.drawable.move_to_folder_blue_night);
+        }
+
         // Set the title.
         dialogBuilder.setTitle(R.string.move_to_folder);