<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright 2019 Jeremy Jamet / Kunzisoft.
     
 This file is part of KeePassDX.

  KeePassDX is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  KeePassDX is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with KeePassDX.  If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:fitsSystemWindows="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:filterTouchesWhenObscured="true"
    tools:targetApi="o">

    <com.kunzisoft.keepass.view.ToolbarSpecial
        app:layout_constraintTop_toTopOf="parent"
        android:id="@+id/special_mode_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/activity_password_coordinator_layout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="@drawable/background_repeat"
        android:backgroundTint="?android:attr/textColor"
        app:layout_constraintTop_toBottomOf="@+id/special_mode_view"
        app:layout_constraintBottom_toTopOf="@+id/activity_password_footer">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/app_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:id="@+id/toolbar_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:layout_collapseMode="parallax"
                    android:layout_gravity="center_horizontal|bottom"
                    android:gravity="center_horizontal"
                    android:paddingTop="?attr/actionBarSize">
                    <androidx.appcompat.widget.AppCompatImageView
                        android:id="@+id/activity_password_logotype"
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:layout_gravity="center"
                        android:layout_margin="12dp"
                        android:contentDescription="@string/about"
                        android:elevation="4dp"
                        android:src="@drawable/ic_app_lock_white_24dp"
                        app:tint="?attr/colorSecondary"
                        android:background="@drawable/background_image"
                        app:backgroundTint="?attr/colorPrimaryContainer"/>
                    <androidx.appcompat.widget.AppCompatImageView
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:layout_gravity="center"
                        android:layout_margin="12dp"
                        android:contentDescription="@string/about"
                        android:elevation="4dp"
                        android:src="@drawable/ic_app_key_white_24dp"
                        app:tint="?attr/colorOnPrimaryContainer"/>
                </FrameLayout>

                <com.google.android.material.appbar.MaterialToolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:elevation="0dp"
                    app:elevation="0dp"
                    app:layout_collapseMode="pin">
                    <TextView
                        android:id="@+id/filename"
                        style="@style/KeepassDXStyle.Title.OnSurface"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentStart="true"
                        android:ellipsize="marquee"
                        android:marqueeRepeatLimit="marquee_forever"
                        android:scrollHorizontally="true"
                        android:singleLine="true"/>
                </com.google.android.material.appbar.MaterialToolbar>

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

        <androidx.core.widget.NestedScrollView
            android:id="@+id/scroll_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbarStyle="insideOverlay"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <View
                    android:layout_width="match_parent"
                    android:layout_height="116dp"
                    app:layout_constraintTop_toTopOf="parent"
                    android:background="?attr/colorSurface" />
                <FrameLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="12dp"
                    app:layout_constraintWidth_percent="@dimen/content_percent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintEnd_toEndOf="parent">
                    <com.google.android.material.card.MaterialCardView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/KeepassDXStyle.Cardview.SurfaceContainer"
                        android:layout_margin="16dp">
                        <com.kunzisoft.keepass.view.MainCredentialView
                            android:id="@+id/activity_password_credentials"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content" />
                    </com.google.android.material.card.MaterialCardView>
                </FrameLayout>
            </androidx.constraintlayout.widget.ConstraintLayout>

        </androidx.core.widget.NestedScrollView>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <LinearLayout
        android:id="@+id/activity_password_footer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintBottom_toTopOf="@+id/screenshot_mode_banner">
        <LinearLayout
            android:id="@+id/activity_password_info_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="gone"
            android:orientation="vertical">
            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/activity_password_info_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:minHeight="24dp"
                android:paddingStart="24dp"
                android:paddingLeft="24dp"
                android:paddingEnd="24dp"
                android:paddingRight="24dp"
                style="@style/KeepassDXStyle.Text.Tiny"
                android:text="@string/warning_database_link_revoked"
                android:textColor="?attr/colorOnSecondary"
                android:background="?attr/colorSecondary"
                app:layout_constraintBottom_toTopOf="@+id/activity_password_info_delimiter"
                android:layout_gravity="bottom"/>
        </LinearLayout>

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?attr/colorSurface">
            <androidx.fragment.app.FragmentContainerView
                android:id="@+id/fragment_device_unlock_container_view"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toStartOf="@+id/activity_password_open_button"
                app:layout_constraintBottom_toBottomOf="parent"/>
            <Button
                android:id="@+id/activity_password_open_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:focusable="true"
                android:text="@string/unlock"
                style="@style/KeepassDXStyle.Button.Primary"
                app:icon="@drawable/ic_lock_open_white_24dp"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintStart_toEndOf="@+id/fragment_device_unlock_container_view"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"/>
        </androidx.constraintlayout.widget.ConstraintLayout>
    </LinearLayout>

    <include layout="@layout/view_screenshot_mode_banner" />
</androidx.constraintlayout.widget.ConstraintLayout>
