]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Add the move to folder icon to the top of the dialog. https://redmine.stoutner.com...
authorSoren Stoutner <soren@stoutner.com>
Sat, 12 Sep 2020 17:46:57 +0000 (10:46 -0700)
committerSoren Stoutner <soren@stoutner.com>
Sat, 12 Sep 2020 17:46:57 +0000 (10:46 -0700)
app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java
app/src/main/res/drawable/move_to_folder_blue_day.xml [new file with mode: 0644]
app/src/main/res/drawable/move_to_folder_blue_night.xml [new file with mode: 0644]

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);
 
diff --git a/app/src/main/res/drawable/move_to_folder_blue_day.xml b/app/src/main/res/drawable/move_to_folder_blue_day.xml
new file mode 100644 (file)
index 0000000..c87a645
--- /dev/null
@@ -0,0 +1,19 @@
+<!-- This file is derived from elements of `folder` and `exit_to_app`, which are part of the Android Material icon set.  They are released under the Apache License 2.0.
+    Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>.  The resulting image is released under the GPLv3+ license. -->
+
+<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportHeight="24"
+    android:viewportWidth="24"
+    android:autoMirrored="true"
+    tools:ignore="VectorRaster" >
+
+    <!-- A hard coded color must be used until API >= 21.  Then `@color` or `?attr/colorControlNormal` may be used. -->
+    <path
+        android:fillColor="#FF1565C0"
+        android:pathData="M4,4C2.9,4 2.01,4.9 2.01,6L2,18C2,19.1 2.9,20 4,20L20,20C21.1,20 22,19.1 22,18L22,8C22,6.9 21.1,6 20,6L12,6L10,4L4,4zM13.75,7.83L18.75,12.83L13.75,17.83L12.34,16.421L14.92,13.83L5.25,13.83L5.25,11.83L14.92,11.83L12.34,9.24L13.75,7.83z" />
+</vector>
diff --git a/app/src/main/res/drawable/move_to_folder_blue_night.xml b/app/src/main/res/drawable/move_to_folder_blue_night.xml
new file mode 100644 (file)
index 0000000..1464f6e
--- /dev/null
@@ -0,0 +1,19 @@
+<!-- This file is derived from elements of `folder` and `exit_to_app`, which are part of the Android Material icon set.  They are released under the Apache License 2.0.
+    Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>.  The resulting image is released under the GPLv3+ license. -->
+
+<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportHeight="24"
+    android:viewportWidth="24"
+    android:autoMirrored="true"
+    tools:ignore="VectorRaster" >
+
+    <!-- A hard coded color must be used until API >= 21.  Then `@color` or `?attr/colorControlNormal` may be used. -->
+    <path
+        android:fillColor="#FF8AB4F8"
+        android:pathData="M4,4C2.9,4 2.01,4.9 2.01,6L2,18C2,19.1 2.9,20 4,20L20,20C21.1,20 22,19.1 22,18L22,8C22,6.9 21.1,6 20,6L12,6L10,4L4,4zM13.75,7.83L18.75,12.83L13.75,17.83L12.34,16.421L14.92,13.83L5.25,13.83L5.25,11.83L14.92,11.83L12.34,9.24L13.75,7.83z" />
+</vector>