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

Commit 821bcc43 authored by Wenbo Jie's avatar Wenbo Jie
Browse files

[DocsUI M3] Restyle the work profile icon

* Update the briefcase drawable file.
* Reposition the work profile icon in both list view and
  grid view, in list view compact/medium layout, the work
  profile icon is separate from the 2 title rows.

Check the attached bug for the demo.

Bug: 401108078
Test: m DocumentsUIGoogle && manual inspection
Flag: com.android.documentsui.flags.use_material3
Change-Id: I9f7096aa4f03ef15d6f7ed385a3fc185d6c5f67c
parent 53782538
Loading
Loading
Loading
Loading
+23 −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.
  -->

<!-- Though there's only one state here but we can't declare this as a normal color variable in
     colors.xml, it will trigger an attribute resolve error.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="?attr/colorSecondary" />
</selector>
+11 −4
Original line number Diff line number Diff line
@@ -17,9 +17,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
    android:viewportWidth="960"
    android:viewportHeight="960">
  <!--
        ic_briefcase is just a fallback drawable, the code logic loads the icon from the system
        first and if it fails, this drawable will be used. So we always need an android:tint
        attribute specified on the layout file (which overshadows the "white" color below),
        otherwise the icon loaded from the system won't have the correct icon color. That's why we
        just put "white" here, it will never be used.
   -->
  <path
      android:fillColor="?android:attr/colorAccent"
      android:pathData="M20,6h-4L16,4c0,-1.11 -0.89,-2 -2,-2h-4c-1.11,0 -2,0.89 -2,2v2L4,6c-1.11,0 -1.99,0.89 -1.99,2L2,19c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,8c0,-1.11 -0.89,-2 -2,-2zM12,15c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM14,6h-4L10,4h4v2z"/>
      android:fillColor="@android:color/white"
      android:pathData="M160,840Q127,840 103.5,816.5Q80,793 80,760L80,320Q80,287 103.5,263.5Q127,240 160,240L320,240L320,160Q320,127 343.5,103.5Q367,80 400,80L560,80Q593,80 616.5,103.5Q640,127 640,160L640,240L800,240Q833,240 856.5,263.5Q880,287 880,320L880,760Q880,793 856.5,816.5Q833,840 800,840L160,840ZM400,240L560,240L560,160Q560,160 560,160Q560,160 560,160L400,160Q400,160 400,160Q400,160 400,160L400,240Z"/>
</vector>
+1 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/list_item_background"
@@ -101,7 +100,7 @@
                    android:layout_marginEnd="@dimen/briefcase_icon_margin"
                    android:layout_gravity="center_vertical"
                    android:src="@drawable/ic_briefcase"
                    android:tint="@color/doc_list_item_badge_icon_color"
                    android:tint="@color/briefcase_icon_color"
                    android:contentDescription="@string/a11y_work"/>

                <com.google.android.material.textview.MaterialTextView
+19 −14
Original line number Diff line number Diff line
@@ -85,6 +85,21 @@
            android:scaleType="center"
            android:src="@drawable/ic_check_circle" />

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/icon_profile_badge"
            android:layout_width="@dimen/briefcase_icon_grid_size"
            android:layout_height="@dimen/briefcase_icon_grid_size"
            android:layout_marginBottom="@dimen/briefcase_icon_grid_margin"
            android:layout_marginEnd="@dimen/briefcase_icon_grid_margin"
            android:layout_gravity="bottom|end"
            android:contentDescription="@string/a11y_work"
            android:gravity="center_vertical"
            android:background="?attr/colorSurfaceContainerLowest"
            app:shapeAppearance="?attr/shapeAppearanceCornerExtraSmall"
            app:contentPadding="@dimen/briefcase_icon_grid_padding"
            android:src="@drawable/ic_briefcase"
            android:tint="@color/briefcase_icon_color" />

        <FrameLayout
            android:id="@+id/preview_icon"
            android:layout_width="@dimen/button_container_size"
@@ -134,17 +149,7 @@
            android:gravity="center"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/icon_profile_badge"
                android:layout_width="@dimen/briefcase_icon_size"
                android:layout_height="@dimen/briefcase_icon_size"
                android:layout_marginEnd="@dimen/briefcase_icon_margin"
                android:contentDescription="@string/a11y_work"
                android:gravity="center_vertical"
                android:src="@drawable/ic_briefcase"
                android:tint="?android:attr/colorAccent" />

            <TextView
            <com.google.android.material.textview.MaterialTextView
                android:id="@android:id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
@@ -162,7 +167,7 @@
            android:gravity="center"
            android:orientation="horizontal">

            <TextView
            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/details"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
@@ -172,7 +177,7 @@
                android:textAlignment="viewStart"
                android:textAppearance="@style/ItemCaptionText" />

            <TextView
            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/bullet"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
@@ -182,7 +187,7 @@
                android:textAlignment="viewStart"
                android:textAppearance="@style/ItemCaptionText" />

            <TextView
            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
+29 −30
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/item_root"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
@@ -82,15 +81,10 @@
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:orientation="vertical"
          android:orientation="horizontal"
          android:layout_gravity="center_vertical"
          android:layout_marginEnd="@dimen/list_item_icon_size">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="1">

        <ImageView
            android:id="@+id/icon_profile_badge"
            android:layout_height="@dimen/briefcase_icon_size"
@@ -98,9 +92,14 @@
            android:layout_marginEnd="@dimen/briefcase_icon_margin"
            android:layout_gravity="center_vertical"
            android:src="@drawable/ic_briefcase"
              android:tint="@color/doc_list_item_badge_icon_color"
            android:tint="@color/briefcase_icon_color"
            android:contentDescription="@string/a11y_work" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

          <com.google.android.material.textview.MaterialTextView
              android:id="@android:id/title"
              android:layout_width="wrap_content"
@@ -110,11 +109,9 @@
              android:textAlignment="viewStart"
              android:textAppearance="@style/FileItemLabelText" />

        </LinearLayout>

          <LinearLayout
              android:id="@+id/line2"
            android:layout_width="match_parent"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:baselineAligned="false"
              android:gravity="center_vertical"
@@ -132,6 +129,8 @@

        </LinearLayout>

      </LinearLayout>

      <FrameLayout
          android:id="@+id/preview_icon"
          android:layout_width="@dimen/list_item_icon_size"
Loading