Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 165058c8 authored by Wenbo Jie's avatar Wenbo Jie
Browse files

[DocsUI M3] Restyle drag drop badge for M3

* When there are multiple dragging files:
  * add an additional drag layer
  * add a file counter
* Update drag show (radius/offset) to match the new M3 spec.
* drag shadow view is an isolated view without the theme
  context, so M3 color attributes like "?attr/colorXXX"
  can't be used directly, instead, system color tokens are
  being used in light/dark mode. Since system color tokens
  are only available in SDK 31, fallback static colors are
  being used in the original colors.xml.

Check the attached bug for demo.

Bug: 377771158
Test: m DocumentsUIGoogle && manual inspection
Flag: com.android.documentsui.flags.use_material3
Change-Id: Ia00bb0037a19813b4137d9d6cd7a42441b7f255e
parent 595ae7b5
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/drag_file_counter_background" />
    <corners android:radius="@dimen/drag_file_counter_height" />
</shape>
+1 −5
Original line number Diff line number Diff line
@@ -17,9 +17,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
  <solid android:color="@color/item_drag_shadow_background" />
  <corners
      android:bottomRightRadius="2dp"
      android:bottomLeftRadius="2dp"
      android:topLeftRadius="2dp"
      android:topRightRadius="2dp"/>
  <corners android:radius="@dimen/drag_content_radius" />
</shape>
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:bottom="@dimen/drop_icon_offset"
        android:left="0dp"
        android:right="@dimen/drop_icon_offset"
        android:top="0dp">
        <shape android:shape="rectangle">
            <corners android:radius="@dimen/drop_mime_icon_wrapper_radius" />
            <solid android:color="@color/drag_mime_icon_wrapper_background" />
        </shape>
    </item>
</layer-list>
 No newline at end of file
+13 −18
Original line number Diff line number Diff line
@@ -16,22 +16,17 @@ Copyright (C) 2024 The Android Open Source Project
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="14dp"
    android:height="14dp"
        android:viewportWidth="28.0"
        android:viewportHeight="28.0">

    <group
         android:name="whiteBg">
    android:viewportWidth="14"
    android:viewportHeight="14">
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M0,15a15,15 0 1,0 30,0a15,15 0 1,0 -30,0" />
    </group>

    <group
         android:name="badge"
         android:translateX="2"
         android:translateY="2">
        android:pathData="M7,0L7,0A7,7 0,0 1,14 7L14,7A7,7 0,0 1,7 14L7,14A7,7 0,0 1,0 7L0,7A7,7 0,0 1,7 0z"
        android:fillColor="@color/drop_icon_copy_container_background"/>
    <group>
        <clip-path
            android:pathData="M1,1h12v12h-12z"/>
        <path
        android:fillColor="#FF0B8043"
        android:pathData="M13,0 C5.824,0 0,5.824 0,13 C0,20.176 5.824,26 13,26 C20.176,26 26,20.176 26,13 C26,5.824 20.176,0 13,0 L13,0 Z M19,14 L14,14 L14,19 L12,19 L12,14 L7,14 L7,12 L12,12 L12,7 L14,7 L14,12 L19,12 L19,14 Z" />
            android:pathData="M6.387,11.438V7.613H2.563V6.387H6.387V2.563H7.613V6.387H11.438V7.613H7.613V11.438H6.387Z"
            android:fillColor="@color/drop_icon_symbol_color"/>
    </group>
</vector>
+12 −18
Original line number Diff line number Diff line
@@ -17,22 +17,16 @@ Copyright (C) 2024 The Android Open Source Project
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="14dp"
    android:height="14dp"
        android:viewportWidth="28.0"
        android:viewportHeight="28.0">

    <group
         android:name="whiteBg">
    android:viewportWidth="14"
    android:viewportHeight="14">
    <path
            android:fillColor="#FFFFFFFF"
            android:pathData="M0,15a15,15 0 1,0 30,0a15,15 0 1,0 -30,0" />
    </group>

    <group
         android:name="badge"
         android:translateX="2"
         android:translateY="2">
        android:pathData="M7,0L7,0A7,7 0,0 1,14 7L14,7A7,7 0,0 1,7 14L7,14A7,7 0,0 1,0 7L0,7A7,7 0,0 1,7 0z"
        android:fillColor="@color/drop_icon_reject_container_background"/>
    <group>
        <clip-path
            android:pathData="M1,1h12v12h-12z"/>
        <path
            android:fillColor="#FFC53929"
            android:pathData="M3.8056487,3.8056487 C-1.26854957,8.87984696 -1.26854957,17.1162267 3.8056487,22.190425 C8.87984696,27.2646233 17.1162267,27.2646233 22.190425,22.190425 C27.2646233,17.1162267 27.2646233,8.87984696 22.190425,3.8056487 C17.1162267,-1.26854957 8.87984696,-1.26854957 3.8056487,3.8056487 L3.8056487,3.8056487 Z M16.5335708,17.9477843 L12.9980369,14.4122504 L9.46250295,17.9477843 L8.04828938,16.5335708 L11.5838233,12.9980369 L8.04828938,9.46250295 L9.46250295,8.04828938 L12.9980369,11.5838233 L16.5335708,8.04828938 L17.9477843,9.46250295 L14.4122504,12.9980369 L17.9477843,16.5335708 L16.5335708,17.9477843 L16.5335708,17.9477843 Z" />
            android:pathData="M7,12.038C6.308,12.038 5.654,11.908 5.037,11.65C4.429,11.383 3.896,11.021 3.438,10.563C2.979,10.096 2.617,9.558 2.35,8.95C2.092,8.333 1.962,7.679 1.962,6.988C1.962,6.287 2.092,5.637 2.35,5.037C2.617,4.429 2.979,3.896 3.438,3.438C3.896,2.979 4.429,2.621 5.037,2.362C5.654,2.096 6.308,1.962 7,1.962C7.7,1.962 8.354,2.096 8.962,2.362C9.571,2.621 10.104,2.979 10.563,3.438C11.021,3.896 11.379,4.429 11.637,5.037C11.904,5.637 12.038,6.287 12.038,6.988C12.038,7.679 11.904,8.333 11.637,8.95C11.379,9.558 11.021,10.096 10.563,10.563C10.104,11.021 9.571,11.383 8.962,11.65C8.354,11.908 7.7,12.038 7,12.038ZM7,10.813C7.417,10.813 7.817,10.75 8.2,10.625C8.583,10.5 8.925,10.317 9.225,10.075L3.912,4.762C3.679,5.079 3.5,5.425 3.375,5.8C3.25,6.175 3.188,6.571 3.188,6.988C3.188,8.046 3.558,8.95 4.3,9.7C5.042,10.442 5.942,10.813 7,10.813ZM10.087,9.212C10.321,8.896 10.5,8.55 10.625,8.175C10.75,7.8 10.813,7.404 10.813,6.988C10.813,5.929 10.442,5.033 9.7,4.3C8.958,3.558 8.058,3.188 7,3.188C6.583,3.188 6.188,3.25 5.813,3.375C5.446,3.492 5.104,3.662 4.787,3.888L10.087,9.212Z"
            android:fillColor="@color/drop_icon_symbol_color"/>
    </group>
</vector>
Loading