<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2024 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.
  -->
<com.android.systemui.screenshot.ui.ScreenshotShelfView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:theme="@style/FloatingOverlay"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false"
    android:clipToPadding="false">
    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/screenshot_static"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipChildren="false"
        android:clipToPadding="false">
        <View
            android:id="@+id/screenshot_preview_border"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="@dimen/overlay_action_container_minimum_edge_spacing"
            android:layout_marginTop="@dimen/overlay_border_width_neg"
            android:layout_marginEnd="@dimen/overlay_border_width_neg"
            android:layout_marginBottom="@dimen/screenshot_shelf_vertical_margin"
            android:elevation="4dp"
            android:background="@drawable/overlay_border"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@id/screenshot_preview"
            app:layout_constraintEnd_toEndOf="@id/screenshot_preview"
            app:layout_constraintBottom_toTopOf="@id/actions_container_background"/>
        <ImageView
            android:id="@+id/screenshot_preview"
            android:layout_width="@dimen/overlay_x_scale"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/overlay_border_width"
            android:layout_marginBottom="@dimen/overlay_border_width"
            android:layout_gravity="center"
            android:elevation="4dp"
            android:scaleType="fitEnd"
            android:background="@drawable/overlay_preview_background"
            android:adjustViewBounds="true"
            android:clickable="true"
            app:layout_constraintStart_toStartOf="@id/screenshot_preview_border"
            app:layout_constraintBottom_toBottomOf="@id/screenshot_preview_border"/>
        <!--  Keep the same dimension with screenshot_preview.  -->
        <ImageView
            android:id="@+id/screenshot_preview_blur"
            android:layout_width="@dimen/overlay_x_scale"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/overlay_border_width"
            android:layout_marginBottom="@dimen/overlay_border_width"
            android:layout_gravity="center"
            android:elevation="4dp"
            android:scaleType="fitEnd"
            android:background="@drawable/overlay_preview_background"
            android:adjustViewBounds="true"
            android:visibility="invisible"
            app:layout_constraintStart_toStartOf="@id/screenshot_preview_border"
            app:layout_constraintBottom_toBottomOf="@id/screenshot_preview_border"/>
        <!-- Action bar should be drawn on top of the thumbnail -->
        <FrameLayout
            android:id="@+id/actions_container_background"
            android:visibility="gone"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:elevation="4dp"
            android:background="@drawable/shelf_action_chip_container_background"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintBottom_toTopOf="@id/guideline"
            >
            <HorizontalScrollView
                android:id="@+id/actions_container"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginVertical="@dimen/overlay_action_container_padding_vertical"
                android:layout_marginHorizontal="@dimen/overlay_action_chip_margin_start"
                android:background="@drawable/shelf_action_container_clipping_shape"
                android:clipToOutline="true"
                android:scrollbars="none">
                <LinearLayout
                    android:id="@+id/screenshot_actions"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:showDividers="middle"
                    android:divider="@drawable/shelf_action_chip_divider"
                    android:animateLayoutChanges="true"
                    android:orientation="horizontal" />
            </HorizontalScrollView>
        </FrameLayout>
        <ImageView
            android:id="@+id/screenshot_badge"
            android:layout_width="56dp"
            android:layout_height="56dp"
            android:visibility="gone"
            android:elevation="5dp"
            app:layout_constraintBottom_toBottomOf="@id/screenshot_preview_border"
            app:layout_constraintEnd_toEndOf="@id/screenshot_preview_border"/>
        <FrameLayout
            android:id="@+id/screenshot_dismiss_button"
            android:layout_width="@dimen/overlay_dismiss_button_tappable_size"
            android:layout_height="@dimen/overlay_dismiss_button_tappable_size"
            android:elevation="7dp"
            android:visibility="gone"
            app:layout_constraintStart_toEndOf="@id/screenshot_preview"
            app:layout_constraintEnd_toEndOf="@id/screenshot_preview"
            app:layout_constraintTop_toTopOf="@id/screenshot_preview"
            app:layout_constraintBottom_toTopOf="@id/screenshot_preview"
            android:contentDescription="@string/screenshot_dismiss_description">
            <ImageView
                android:id="@+id/screenshot_dismiss_image"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="@dimen/overlay_dismiss_button_margin"
                android:background="@drawable/circular_background"
                android:backgroundTint="?androidprv:attr/materialColorPrimary"
                android:tint="?androidprv:attr/materialColorOnPrimary"
                android:padding="4dp"
                android:src="@drawable/ic_close"/>
        </FrameLayout>
        <ImageView
            android:id="@+id/screenshot_scrollable_preview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clipToOutline="true"
            android:scaleType="matrix"
            android:visibility="gone"
            app:layout_constraintStart_toStartOf="@id/screenshot_preview"
            app:layout_constraintTop_toTopOf="@id/screenshot_preview"
            android:elevation="3dp"/>

        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/guideline"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_end="0dp" />

        <FrameLayout
            android:id="@+id/screenshot_message_container"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="@dimen/overlay_action_container_minimum_edge_spacing"
            android:layout_marginTop="4dp"
            android:layout_marginBottom="@dimen/overlay_action_container_margin_bottom"
            android:paddingHorizontal="@dimen/overlay_action_container_padding_end"
            android:paddingVertical="@dimen/overlay_action_container_padding_vertical"
            android:elevation="4dp"
            android:background="@drawable/action_chip_container_background"
            android:visibility="gone"
            app:layout_constraintTop_toBottomOf="@id/guideline"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintWidth_max="450dp"
            app:layout_constraintHorizontal_bias="0">
            <include layout="@layout/screenshot_work_profile_first_run" />
            <include layout="@layout/screenshot_detection_notice" />
        </FrameLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>
    <ImageView
        android:id="@+id/screenshot_scrolling_scrim"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        android:clickable="true"
        android:importantForAccessibility="no"/>
    <ImageView
        android:id="@+id/screenshot_flash"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        android:elevation="12dp"
        android:src="@android:color/white"/>
</com.android.systemui.screenshot.ui.ScreenshotShelfView>
