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

Commit b36d5d5a authored by Jeremie Boulic's avatar Jeremie Boulic
Browse files

[DocsUI Peek] Metadata sheet container

Only the SideSheetBehavior is used from the side sheet material
component (dragging/expand/collapse animation and resizing of
sibling). This behavior is applied to the container of the metadata
sheet, which is transparent. A custom background with rounded corners
is applied for the metadata sheet itself. This is because a margin
issue raised in b/419417692, which prevents us from using the material
component as-is.

This implementation is only valid on large screens. The full
responsive layout will be implemented in later changes.

The metadatat sheet is systematically expanded (in a task posted via
`metadataContainer.post` after the fragment is created and visible,
because of b/419446581). Expand/collapse handling will also be added
in later changes.

Bug: 382163595
Bug: 419446581
Bug: 419417692
Flag: com.android.documentsui.flags.use_material3
Flag: com.android.documentsui.flags.use_peek_preview_ro
Test: PeekUiTest#testMetadataSheet
Change-Id: Ib0786faa52813b7cd96e0415d3bd7d2575f31ea0
parent c8f5434e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@
  int option_menu_show_hidden_files;
  int option_menu_sort;
  int peek_container;
  int peek_preview_container;
  int root_menu_eject_root;
  int root_menu_open_in_new_window;
  int root_menu_paste_into_folder;
@@ -224,3 +225,8 @@
  static void overrideMappingForTest(java.util.Map);
  static void setEnabledForTest(boolean);
}

# The SideSheetBehavior state is not directly accessed from DocumentsUI, but is used in tests
-keep class com.google.android.material.sidesheet.SideSheetBehavior {
  public int getState();
}
+19 −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">
    <corners android:radius="@dimen/peek_metadata_sheet_corner_radius" />
</shape>
 No newline at end of file
+31 −17
Original line number Diff line number Diff line
@@ -24,12 +24,17 @@
    android:clickable="true"
    android:focusable="false">

    <FrameLayout
        android:id="@+id/peek_preview_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.android.documentsui.peek.RenderView
            android:id="@+id/peek_preview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    <!-- Text and icons using android:white because the underlying black scrim doesn't dynamically
    change colour. -->
        <!-- Text and icons using android:white because the underlying black scrim doesn't
        dynamically change colour. -->
        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/peek_toolbar"
            android:layout_width="match_parent"
@@ -42,4 +47,13 @@
            app:navigationIconTint="@android:color/white"
            app:titleMarginStart="@dimen/space_extra_small_2"
            app:titleTextAppearance="@style/PeekTopBarTitleText" />
    </FrameLayout>

    <FrameLayout
        android:id="@+id/peek_metadata_container"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="end"
        app:coplanarSiblingViewId="@id/peek_preview_container"
        app:layout_behavior="com.google.android.material.sidesheet.SideSheetBehavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
+22 −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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="@dimen/peek_metadata_sheet_width"
    android:layout_height="match_parent"
    android:layout_margin="@dimen/space_small_1"
    android:background="@drawable/peek_metadata_sheet_background"
    android:backgroundTint="?attr/colorSurfaceContainerHigh"
    android:orientation="vertical"/>
+3 −0
Original line number Diff line number Diff line
@@ -307,4 +307,7 @@
    <dimen name="job_progress_item_status_separator_margin">@dimen/space_extra_small_2</dimen>
    <dimen name="job_progress_item_buttons_margin_start">@dimen/space_extra_small_2</dimen>
    <dimen name="job_progress_item_buttons_margin_top">@dimen/space_extra_small_1</dimen>

    <dimen name="peek_metadata_sheet_width">320dp</dimen>
    <dimen name="peek_metadata_sheet_corner_radius">16dp</dimen>
</resources>
Loading