<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2020 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
  ~
  ~     https://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.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/camera_container"
    android:layout_width="match_parent"
    android:layoutDirection="ltr"
    android:layout_height="match_parent">

    <androidx.camera.view.PreviewView
        android:id="@+id/view_finder"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" />

    <com.google.android.material.card.MaterialCardView
        android:visibility="invisible"
        style="?attr/materialCardViewElevatedStyle"
        app:cardBackgroundColor="?attr/colorSecondaryContainer"
        tools:visibility="visible"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:id="@+id/camera_permission_error_card"
        android:layout_margin="20dp">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginEnd="8dp">

            <ImageView
                android:id="@+id/checkMarkStabilize"
                app:tint="?attr/colorOnSecondaryContainer"
                android:layout_width="50dp"
                android:layout_height="match_parent"
                android:importantForAccessibility="no"
                android:src="@drawable/error"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintBottom_toBottomOf="@id/checkMarkStabilize"
                app:layout_constraintTop_toTopOf="@id/checkMarkStabilize"
                app:layout_constraintStart_toEndOf="@id/checkMarkStabilize"
                android:layout_marginEnd="8dp"
                android:text="@string/no_camera_permission" />
        </androidx.constraintlayout.widget.ConstraintLayout>
    </com.google.android.material.card.MaterialCardView>

    <!-- Camera control and gallery buttons -->
    <ImageButton
        android:id="@+id/camera_switch_button"
        android:layout_width="@dimen/round_button_medium"
        android:layout_height="@dimen/round_button_medium"
        android:layout_marginBottom="@dimen/margin_xlarge"
        android:layout_marginStart="@dimen/margin_small"
        android:padding="@dimen/spacing_small"
        android:scaleType="fitCenter"
        android:background="@android:color/transparent"
        app:srcCompat="@drawable/ic_switch"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        android:contentDescription="@string/switch_camera_button_alt" />

    <ImageButton
        android:id="@+id/camera_capture_button"
        android:layout_width="@dimen/round_button_large"
        android:layout_height="@dimen/round_button_large"
        android:layout_marginBottom="@dimen/shutter_button_margin"
        android:scaleType="fitCenter"
        android:background="@drawable/ic_shutter"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        android:contentDescription="@string/capture_button_alt" />

    <ImageButton
        android:id="@+id/photo_view_button"
        android:layout_width="@dimen/round_button_medium"
        android:layout_height="@dimen/round_button_medium"
        android:layout_marginBottom="@dimen/margin_xlarge"
        android:layout_marginEnd="@dimen/margin_small"
        android:padding="@dimen/spacing_large"
        android:scaleType="fitCenter"
        android:background="@drawable/ic_outer_circle"
        app:srcCompat="@drawable/ic_photo"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        android:contentDescription="@string/gallery_button_alt" />

</androidx.constraintlayout.widget.ConstraintLayout>
