<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/coordinator_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fitsSystemWindows="true">

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fabEdit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        app:srcCompat="@drawable/ic_mode_edit_white_24dp"
        android:contentDescription="@string/edit"
        android:layout_margin="16dp" />

    <FrameLayout
        android:clipChildren="false"
        android:clipToPadding="false"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

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

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

            <ImageButton
                android:id="@+id/maximizeButton"
                android:visibility="gone"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_marginStart="15.0dip"
                android:layout_marginEnd="15.0dip"
                android:layout_marginTop="10dp"
                android:padding="0dp"
                app:srcCompat="@drawable/ic_baseline_arrow_drop_up_24"
                android:contentDescription="@string/moveBarcodeToTopOfScreen"
                app:tint="#ffffff"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toTopOf="@+id/mainImage"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent" />

            <ImageView
                android:id="@+id/mainImage"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:orientation="horizontal"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="10dp"
                android:layout_marginStart="15.0dip"
                android:layout_marginEnd="15.0dip"
                app:layout_constraintBottom_toTopOf="@+id/centerGuideline"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/maximizeButton"/>

            <ImageButton
                android:id="@+id/minimizeButton"
                android:visibility="gone"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_marginStart="15.0dip"
                android:layout_marginEnd="15.0dip"
                android:layout_marginTop="10dp"
                android:padding="0dp"
                app:srcCompat="@drawable/ic_baseline_arrow_drop_down_24"
                android:contentDescription="@string/moveBarcodeToCenterOfScreen"
                app:tint="#ffffff"
                app:layout_constraintTop_toBottomOf="@+id/mainImage"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent" />

            <LinearLayout
                android:id="@+id/dotIndicator"
                android:visibility="gone"
                android:gravity="center_vertical"
                android:layout_gravity="center_vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="10dp"
                android:layout_marginStart="15.0dip"
                android:layout_marginEnd="15.0dip"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/minimizeButton"/>

            <SeekBar
                android:id="@+id/barcodeScaler"
                android:visibility="gone"
                android:max="100"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/inputPadding"
                android:layout_marginStart="15.0dip"
                android:layout_marginEnd="15.0dip"
                app:layout_constraintTop_toBottomOf="@+id/scalerGuideline"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent" />

            <TextView
                android:id="@+id/cardIdView"
                android:enabled="true"
                android:textIsSelectable="true"
                android:focusable="true"
                android:longClickable="true"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_marginLeft="10.0dip"
                android:layout_marginRight="10.0dip"
                android:paddingBottom="80dp"
                app:layout_constraintTop_toBottomOf="@+id/dotIndicator"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                android:textAlignment="center"
                app:autoSizeTextType="uniform"
                app:autoSizeMinTextSize="@dimen/singleCardCardIdTextSizeMin"
                app:autoSizeMaxTextSize="@dimen/singleCardCardIdTextSizeMax"
                android:ellipsize="end"/>

        </androidx.constraintlayout.widget.ConstraintLayout>

        <View
            android:id="@+id/drop_shadow_actionbar"
            android:layout_width="fill_parent"
            android:layout_height="5.0dip"
            android:layout_gravity="top"/>
    </FrameLayout>

    <LinearLayout
        android:id="@+id/bottom_sheet"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/inputBackground"
        android:orientation="vertical"
        android:paddingTop="0px"
        android:visibility="gone"
        app:behavior_hideable="false"
        app:behavior_peekHeight="80dp"
        app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
        tools:visibility="visible">

        <ImageButton
            android:id="@+id/bottomSheetButton"
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:layout_gravity="top|start"
            android:contentDescription="@string/toggleMoreInfo"
            android:scaleType="fitCenter"
            app:srcCompat="@drawable/ic_baseline_arrow_drop_up_24"
            app:tint="#ffffff" />

        <androidx.core.widget.NestedScrollView
            android:id="@+id/bottomSheetContentWrapper"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/noteView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:autoLink="all"
                    android:enabled="true"
                    android:focusable="true"
                    android:gravity="center"
                    android:longClickable="true"
                    android:padding="20dp"
                    android:textIsSelectable="true"
                    android:textSize="@dimen/singleCardNoteTextSizeMin" />

                <TextView
                    android:id="@+id/groupsView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:enabled="true"
                    android:focusable="true"
                    android:gravity="center"
                    android:longClickable="true"
                    android:padding="20dp"
                    android:textIsSelectable="true"
                    android:textSize="@dimen/singleCardNoteTextSizeMin" />

                <TextView
                    android:id="@+id/balanceView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:enabled="true"
                    android:focusable="true"
                    android:gravity="center"
                    android:longClickable="true"
                    android:padding="20dp"
                    android:textIsSelectable="true"
                    android:textSize="@dimen/singleCardNoteTextSizeMin" />

                <TextView
                    android:id="@+id/expiryView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:enabled="true"
                    android:focusable="true"
                    android:gravity="center"
                    android:longClickable="true"
                    android:padding="20dp"
                    android:textIsSelectable="true"
                    android:textSize="@dimen/singleCardNoteTextSizeMin" />
            </LinearLayout>
        </androidx.core.widget.NestedScrollView>
    </LinearLayout>


    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:fitsSystemWindows="true"
        android:weightSum="1.0"
        >

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar_landscape"
            android:layout_width="fill_parent"
            android:layout_height="?actionBarSize"
            android:background="@android:color/transparent"
            android:fitsSystemWindows="false"
            android:paddingTop="0dp"
            android:theme="@style/CardView.ActionBarTheme"
            android:visibility="gone"
            app:contentInsetStart="72.0dip"
            app:layout_collapseMode="pin" />

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/collapsingToolbarLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:minHeight="56.0dip"
            app:contentScrim="?colorPrimary"
            app:expandedTitleGravity="top"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp">

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/storeName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="?actionBarSize"
                android:layout_marginBottom="?actionBarSize"
                android:ellipsize="end"
                android:maxLines="1"
                android:textAlignment="center"
                android:textColor="@android:color/white"
                android:textSize="40sp"
                app:layout_collapseMode="parallax" />

            <androidx.appcompat.widget.Toolbar
                android:id="@id/toolbar"
                android:layout_width="fill_parent"
                android:layout_height="?actionBarSize"
                android:background="@android:color/transparent"
                android:theme="@style/CardView.ActionBarTheme"
                app:contentInsetStart="72.0dip"
                app:layout_collapseMode="pin" />

        </com.google.android.material.appbar.CollapsingToolbarLayout>
    </com.google.android.material.appbar.AppBarLayout>

    <ImageView
        android:id="@+id/icon_image"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_alignParentTop="true"
        android:fitsSystemWindows="true"
        android:scaleType="centerCrop"
        app:srcCompat="@drawable/ic_launcher_foreground"
        tools:ignore="ContentDescription" />


</androidx.coordinatorlayout.widget.CoordinatorLayout>
