From b00d0c7f4762f5babb84da63afc4eaa0639c8370 Mon Sep 17 00:00:00 2001 From: Cassy Chun-Crogan Date: Thu, 20 Mar 2025 03:41:05 +0000 Subject: [DocsUI M3] Centre items in grid layout Previously items (columns) were not centred leading to any extra spacing going to the righthand side. Add an outer FrameLayout layer where width is match_parent which will evenly distribute the space between items. Within the FrameLayout centre the actual grid item with center_horizontal. See bug for demo. Bug: 404978773 Test: m DocumentsUIGoogle && manual inspection Flag: com.android.documentsui.flags.use_material3 Change-Id: I379a9a97c0e6c3b8656a9c730e862cdc903de370 --- .../layout/item_doc_grid.xml | 295 +++++++++++---------- 1 file changed, 151 insertions(+), 144 deletions(-) diff --git a/res/flag(com.android.documentsui.flags.use_material3)/layout/item_doc_grid.xml b/res/flag(com.android.documentsui.flags.use_material3)/layout/item_doc_grid.xml index 7d40f794b..a8e3148b4 100644 --- a/res/flag(com.android.documentsui.flags.use_material3)/layout/item_doc_grid.xml +++ b/res/flag(com.android.documentsui.flags.use_material3)/layout/item_doc_grid.xml @@ -13,163 +13,170 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - + app:cardBackgroundColor="?attr/colorSurfaceContainerLowest" + app:cardElevation="0dp" + app:strokeColor="?attr/colorSecondaryContainer" + app:strokeWidth="0dp"> + + + + + + + + + + - - + android:layout_width="@dimen/zoom_icon_size" + android:layout_height="@dimen/zoom_icon_size" + android:layout_gravity="center" + android:background="@drawable/circle_button_background" + android:padding="2dp" + android:scaleType="fitCenter" + android:src="@drawable/ic_zoom_out" /> - + + + - - - - - + + + - - + + + + + + + + + + android:gravity="center" + android:orientation="horizontal"> + + + + + + + + - + - \ No newline at end of file + \ No newline at end of file -- cgit v1.2.3-59-g8ed1b From b7e3e6e63350447a71053435b6c1ed82d07ca0b3 Mon Sep 17 00:00:00 2001 From: Cassy Chun-Crogan Date: Thu, 20 Mar 2025 04:18:27 +0000 Subject: [DocsUI M3] Uplift ripple for grid items See bug for attached demo. Bug: 404992153 Test: m DocumentsUIGoogle && manual inspection Flag: com.android.documentsui.flags.use_material3 Change-Id: Id7dbf1186b6828824c44f36b77f39e703ca8a15a --- .../color/grid_item_ripple_color.xml | 28 +++ .../drawable/grid_item_mask.xml | 21 ++ .../drawable/grid_nameplate_background.xml | 214 +++++++++++---------- 3 files changed, 161 insertions(+), 102 deletions(-) create mode 100644 res/flag(com.android.documentsui.flags.use_material3)/color/grid_item_ripple_color.xml create mode 100644 res/flag(com.android.documentsui.flags.use_material3)/drawable/grid_item_mask.xml diff --git a/res/flag(com.android.documentsui.flags.use_material3)/color/grid_item_ripple_color.xml b/res/flag(com.android.documentsui.flags.use_material3)/color/grid_item_ripple_color.xml new file mode 100644 index 000000000..85e5b46ce --- /dev/null +++ b/res/flag(com.android.documentsui.flags.use_material3)/color/grid_item_ripple_color.xml @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/grid_item_mask.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/grid_item_mask.xml new file mode 100644 index 000000000..98473059c --- /dev/null +++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/grid_item_mask.xml @@ -0,0 +1,21 @@ + + + + + + + + \ No newline at end of file diff --git a/res/flag(com.android.documentsui.flags.use_material3)/drawable/grid_nameplate_background.xml b/res/flag(com.android.documentsui.flags.use_material3)/drawable/grid_nameplate_background.xml index 502efaede..087fc1c15 100644 --- a/res/flag(com.android.documentsui.flags.use_material3)/drawable/grid_nameplate_background.xml +++ b/res/flag(com.android.documentsui.flags.use_material3)/drawable/grid_nameplate_background.xml @@ -14,56 +14,124 @@ limitations under the License. --> - - - - + + + + + + + + - - - - + android:state_focused="true" + android:state_hovered="true" + android:state_selected="true"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + android:state_hovered="true" + android:state_selected="true"> + + + + + + + + + + + + + + - + - + - - - - + + - - - - + android:state_focused="true" + android:state_hovered="true"> + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - + - - - - - - - - - - - - - + - \ No newline at end of file + \ No newline at end of file -- cgit v1.2.3-59-g8ed1b