summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_audio.xml24
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_document.xml25
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_from_this_week.xml2
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_image.xml24
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_large_files.xml2
-rw-r--r--res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_video.xml24
-rw-r--r--src/com/android/documentsui/queries/SearchChipViewManager.java41
7 files changed, 129 insertions, 13 deletions
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_audio.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_audio.xml
new file mode 100644
index 000000000..ad9707b68
--- /dev/null
+++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_audio.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2025 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960">
+ <path
+ android:fillColor="?attr/colorPrimary"
+ android:pathData="M400,840Q334,840 287,793Q240,746 240,680Q240,614 287,567Q334,520 400,520Q423,520 442.5,525.5Q462,531 480,542L480,120L720,120L720,280L560,280L560,680Q560,746 513,793Q466,840 400,840Z"/>
+</vector> \ No newline at end of file
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_document.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_document.xml
new file mode 100644
index 000000000..45b8afe1f
--- /dev/null
+++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_document.xml
@@ -0,0 +1,25 @@
+<!--
+Copyright (C) 2025 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960"
+ android:autoMirrored="true">
+ <path
+ android:fillColor="?attr/colorPrimary"
+ android:pathData="M240,880Q207,880 183.5,856.5Q160,833 160,800L160,160Q160,127 183.5,103.5Q207,80 240,80L560,80L800,320L800,800Q800,833 776.5,856.5Q753,880 720,880L240,880ZM520,360L520,160L240,160Q240,160 240,160Q240,160 240,160L240,800Q240,800 240,800Q240,800 240,800L720,800Q720,800 720,800Q720,800 720,800L720,360L520,360ZM240,160L240,160L240,360L240,360L240,160L240,360L240,360L240,800Q240,800 240,800Q240,800 240,800L240,800Q240,800 240,800Q240,800 240,800L240,160Q240,160 240,160Q240,160 240,160Z"/>
+</vector> \ No newline at end of file
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_from_this_week.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_from_this_week.xml
index dca3b19a0..269a2cab5 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_from_this_week.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_from_this_week.xml
@@ -20,6 +20,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
- android:fillColor="#5F6368"
+ android:fillColor="?attr/colorPrimary"
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l4,3.99L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.25,2.52 0.77,-1.28 -3.52,-2.09L13.5,8z"/>
</vector> \ No newline at end of file
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_image.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_image.xml
new file mode 100644
index 000000000..8a85244b2
--- /dev/null
+++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_image.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2025 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960">
+ <path
+ android:fillColor="?attr/colorPrimary"
+ android:pathData="M200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L760,120Q793,120 816.5,143.5Q840,167 840,200L840,760Q840,793 816.5,816.5Q793,840 760,840L200,840ZM200,760L760,760Q760,760 760,760Q760,760 760,760L760,200Q760,200 760,200Q760,200 760,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760ZM240,680L720,680L570,480L450,640L360,520L240,680ZM200,760Q200,760 200,760Q200,760 200,760L200,200Q200,200 200,200Q200,200 200,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760Z"/>
+</vector> \ No newline at end of file
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_large_files.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_large_files.xml
index d0fe55090..39c09c97a 100644
--- a/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_large_files.xml
+++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_large_files.xml
@@ -20,6 +20,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
- android:fillColor="#5F6368"
+ android:fillColor="?attr/colorPrimary"
android:pathData="M21.41,11.58l-9,-9C12.05,2.22 11.55,2 11,2H4c-1.1,0 -2,0.9 -2,2v7c0,0.55 0.22,1.05 0.59,1.42l9,9c0.36,0.36 0.86,0.58 1.41,0.58s1.05,-0.22 1.41,-0.59l7,-7c0.37,-0.36 0.59,-0.86 0.59,-1.41s-0.23,-1.06 -0.59,-1.42zM13,20.01L4,11V4h7v-0.01l9,9 -7,7.02zM8,6.5C8,7.33 7.33,8 6.5,8S5,7.33 5,6.5 5.67,5 6.5,5 8,5.67 8,6.5z"/>
</vector> \ No newline at end of file
diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_video.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_video.xml
new file mode 100644
index 000000000..e22e2fc8a
--- /dev/null
+++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/ic_chip_video.xml
@@ -0,0 +1,24 @@
+<!--
+Copyright (C) 2025 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960">
+ <path
+ android:fillColor="?attr/colorPrimary"
+ android:pathData="M160,160L240,320L360,320L280,160L360,160L440,320L560,320L480,160L560,160L640,320L760,320L680,160L800,160Q833,160 856.5,183.5Q880,207 880,240L880,720Q880,753 856.5,776.5Q833,800 800,800L160,800Q127,800 103.5,776.5Q80,753 80,720L80,240Q80,207 103.5,183.5Q127,160 160,160ZM160,400L160,720Q160,720 160,720Q160,720 160,720L800,720Q800,720 800,720Q800,720 800,720L800,400L160,400ZM160,400L160,400L160,720Q160,720 160,720Q160,720 160,720L160,720Q160,720 160,720Q160,720 160,720L160,400Z"/>
+</vector> \ No newline at end of file
diff --git a/src/com/android/documentsui/queries/SearchChipViewManager.java b/src/com/android/documentsui/queries/SearchChipViewManager.java
index ad1dfc201..8bc548493 100644
--- a/src/com/android/documentsui/queries/SearchChipViewManager.java
+++ b/src/com/android/documentsui/queries/SearchChipViewManager.java
@@ -395,17 +395,7 @@ public class SearchChipViewManager {
final Context context = mChipGroup.getContext();
chip.setTag(chipData);
chip.setText(context.getString(chipData.getTitleRes()));
- Drawable chipIcon;
- if (chipData.getChipType() == TYPE_LARGE_FILES) {
- chipIcon = context.getDrawable(R.drawable.ic_chip_large_files);
- } else if (chipData.getChipType() == TYPE_FROM_THIS_WEEK) {
- chipIcon = context.getDrawable(R.drawable.ic_chip_from_this_week);
- } else if (chipData.getChipType() == TYPE_DOCUMENTS) {
- chipIcon = IconUtils.loadMimeIcon(context, MimeTypes.GENERIC_TYPE);
- } else {
- // get the icon drawable with the first mimeType in chipData
- chipIcon = IconUtils.loadMimeIcon(context, chipData.getMimeTypes()[0]);
- }
+ Drawable chipIcon = getChipIcon(chipData);
chip.setChipIcon(chipIcon);
chip.setOnClickListener(this::onChipClick);
@@ -418,6 +408,35 @@ public class SearchChipViewManager {
}
}
+ private Drawable getChipIcon(SearchChipData chipData) {
+ final Context context = mChipGroup.getContext();
+ int chipType = chipData.getChipType();
+ if (chipType == TYPE_LARGE_FILES) {
+ return context.getDrawable(R.drawable.ic_chip_large_files);
+ }
+ if (chipType == TYPE_FROM_THIS_WEEK) {
+ return context.getDrawable(R.drawable.ic_chip_from_this_week);
+ }
+
+ // For M3, we don't want to use MIME type icons for image/audio/video/document from the
+ // system.
+ if (useMaterial3()) {
+ return switch (chipType) {
+ case TYPE_IMAGES -> context.getDrawable(R.drawable.ic_chip_image);
+ case TYPE_AUDIO -> context.getDrawable(R.drawable.ic_chip_audio);
+ case TYPE_VIDEOS -> context.getDrawable(R.drawable.ic_chip_video);
+ case TYPE_DOCUMENTS -> context.getDrawable(R.drawable.ic_chip_document);
+ default -> null;
+ };
+ }
+
+ if (chipType == TYPE_DOCUMENTS) {
+ return IconUtils.loadMimeIcon(context, MimeTypes.GENERIC_TYPE);
+ }
+ // get the icon drawable with the first mimeType in chipData
+ return IconUtils.loadMimeIcon(context, chipData.getMimeTypes()[0]);
+ }
+
/**
* Reorder the chips in chip group. The checked chip has higher order.
*