<?xml version="1.0" encoding="utf-8"?>
<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/coordinator_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fitsSystemWindows="false">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            style="?attr/toolbarStyle" />
    </com.google.android.material.appbar.AppBarLayout>

    <LinearLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="?attr/actionBarSize"
        android:layout_marginBottom="100dp"
        android:orientation="vertical"
        android:layout_marginStart="0dp"
        android:layout_marginEnd="0dp">

        <LinearLayout
            android:id="@+id/icon_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="20dp">

            <Space
                android:layout_width="50dp"
                android:layout_height="0dp"/>

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1">

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/icon_holder"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    app:cardCornerRadius="8dp"
                    android:layout_margin="10dp"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintDimensionRatio="85.6f:53.98f">

                    <ImageView
                        android:id="@+id/icon_image"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"/>

                    <TextView
                        android:id="@+id/icon_text"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:textStyle="bold"
                        app:autoSizeTextType="uniform"
                        app:autoSizeMinTextSize="12sp"
                        app:autoSizeMaxTextSize="100sp"
                        app:autoSizeStepGranularity="2sp"
                        android:gravity="center"
                        android:maxLines="1"
                        android:layout_margin="20dp" />
                </com.google.android.material.card.MaterialCardView>
            </androidx.constraintlayout.widget.ConstraintLayout>

            <Space
                android:layout_width="50dp"
                android:layout_height="0dp"/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginStart="0dp"
            android:layout_marginEnd="0dp"
            android:layoutDirection="ltr">

            <!-- We don't use these buttons for Talkback -->
            <ImageButton
                android:importantForAccessibility="no"
                android:id="@+id/main_left_button"
                android:layout_width="50dp"
                android:layout_height="match_parent"
                app:srcCompat="@drawable/ic_baseline_chevron_left_24"
                android:background="@android:color/transparent"/>

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/card_holder"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1">

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/main_card_view"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:cardCornerRadius="8dp"
                    android:layout_margin="10dp"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintBottom_toBottomOf="parent">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_margin="4dp"
                        android:orientation="vertical">

                            <ImageView
                                android:id="@+id/main_image"
                                android:layout_width="match_parent"
                                android:layout_height="0dp"
                                android:layout_weight="1"/>

                            <TextView
                                android:id="@+id/main_image_description"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:textSize="@dimen/text_size_large"
                                android:ellipsize="end"
                                android:singleLine="true"
                                android:gravity="center"/>
                    </LinearLayout>
                </com.google.android.material.card.MaterialCardView>
            </androidx.constraintlayout.widget.ConstraintLayout>

            <!-- We don't use these buttons for Talkback -->
            <ImageButton
                android:importantForAccessibility="no"
                android:id="@+id/main_right_button"
                android:layout_width="50dp"
                android:layout_height="match_parent"
                app:srcCompat="@drawable/ic_baseline_chevron_right_24"
                android:background="@android:color/transparent"/>
        </LinearLayout>
    </LinearLayout>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/fullscreen_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <ImageView
            android:importantForAccessibility="no"
            android:id="@+id/fullscreen_image"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toTopOf="@+id/scaler_guideline"/>

        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/scaler_guideline"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.5"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toTopOf="@+id/fullscreen_button_minimize"
            android:layout_marginBottom="25dp"
            android:layout_marginStart="15.0dip"
            android:layout_marginEnd="15.0dip">

            <TextView
                android:importantForAccessibility="no"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="@string/height"/>

            <SeekBar
                android:id="@+id/barcode_scaler"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:contentDescription="@string/setBarcodeHeight"
                android:max="100" />
        </LinearLayout>

        <ImageButton
            android:id="@+id/fullscreen_button_minimize"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_baseline_expand_more_24"
            android:tooltipText="@string/moveDown"
            app:layout_constraintBottom_toBottomOf="parent"
            android:layout_marginBottom="25dp"
            android:background="@android:color/transparent"/>
    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/bottom_app_bar"
        style="@style/Widget.MaterialComponents.BottomAppBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="?attr/colorPrimary"
        app:contentInsetLeft="0dp"
        app:contentInsetStart="0dp"
        app:contentInsetRight="0dp"
        app:contentInsetEnd="0dp"
        app:fabAlignmentMode="center">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layoutDirection="ltr">

            <ImageButton
                android:id="@+id/bottom_app_bar_previous_button"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:paddingStart="12dp"
                android:paddingEnd="12dp"
                android:background="@android:color/transparent"
                android:src="@drawable/ic_baseline_chevron_left_24"
                android:tooltipText="@string/previousCard"
                android:visibility="gone" />

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="horizontal"
                android:layoutDirection="locale">

                <ImageButton
                    android:id="@+id/bottom_app_bar_info_button"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:paddingStart="12dp"
                    android:paddingEnd="12dp"
                    android:background="@android:color/transparent"
                    android:src="@drawable/ic_baseline_info_24"
                    android:tooltipText="@string/showMoreInfo"
                    android:visibility="gone" />

                <Space
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1" />

                <ImageButton
                    android:id="@+id/bottom_app_bar_update_balance_button"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:paddingStart="12dp"
                    android:paddingEnd="12dp"
                    android:background="@android:color/transparent"
                    android:src="@drawable/ic_baseline_shopping_cart_24"
                    android:tooltipText="@string/updateBalance"
                    android:visibility="gone" />

            </LinearLayout>

            <ImageButton
                android:id="@+id/bottom_app_bar_next_button"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:paddingStart="12dp"
                android:paddingEnd="12dp"
                android:background="@android:color/transparent"
                android:src="@drawable/ic_baseline_chevron_right_24"
                android:tooltipText="@string/nextCard"
                android:visibility="gone" />

        </LinearLayout>

    </com.google.android.material.bottomappbar.BottomAppBar>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fabEdit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/ic_mode_edit_white_24dp"
        android:contentDescription="@string/edit"
        app:layout_anchor="@id/bottom_app_bar" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
