<?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.
-->

<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/peek_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/peek_overlay_scrim"
    android:clickable="true"
    android:focusable="false">

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

        <FrameLayout
            android:id="@+id/peek_preview_frame"
            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. -->
        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/peek_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/peek_topbar_scrim"
            android:paddingEnd="@dimen/space_extra_small_4"
            android:paddingStart="@dimen/space_extra_small_4"
            app:menu="@menu/peek_top_bar_menu"
            app:navigationContentDescription="@string/a11y_peek_navigation_icon"
            app:navigationIcon="@drawable/ic_arrow_back_m3"
            app:navigationIconTint="@android:color/white"
            app:titleMarginStart="@dimen/space_extra_small_2"
            app:titleTextAppearance="@style/PeekTopBarTitleText" />
    </FrameLayout>

    <!--
    The half expanded state of the bottom sheet is the intermediary state between the collapsed
    state, when only the very top of the bottom sheet is visible, and the expanded state. The bottom
    sheet can also be completely hidden.

    Behavior attributes: the peek height is the height of the collapsed bottom sheet, the half
    expanded ration is a ratio relative to the height of the parent, and the expanded offset is
    the gap between the top of the bottom sheet and the top of its parent, when the bottom sheet
    is fully expanded. `fitToContents` is false so that those attributes aren't set automatically.
    -->
    <FrameLayout
        android:id="@+id/peek_bottom_metadata_sheet_container"
        style="@style/Widget.Material3.BottomSheet"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:behavior_halfExpandedRatio="@dimen/peek_metadata_bottom_sheet_half_expanded_ratio"
        app:behavior_expandedOffset="@dimen/peek_metadata_bottom_sheet_expanded_offset"
        app:behavior_peekHeight="@dimen/peek_metadata_bottom_sheet_collapsed_height"
        app:behavior_fitToContents="false"
        app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
        <!-- Drag handle for accessibility -->
        <com.google.android.material.bottomsheet.BottomSheetDragHandleView
            android:id="@+id/drag_handle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>
    </FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
