<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
     
 This file is part of KeePass DX.

  KeePass DX 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.

  KeePass DX 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 KeePass DX.  If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout 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:id="@+id/container"
    android:importantForAutofill="noExcludeDescendants"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:targetApi="o">

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/app_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="true">

            <android.support.design.widget.CollapsingToolbarLayout
                android:id="@+id/toolbar_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:titleEnabled="false"
                app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="?attr/actionBarSize">
                    <include
                        layout="@layout/fingerprint_show" />
                </LinearLayout>

                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    android:background="?attr/colorPrimary"
                    app:theme="?attr/toolbarAppearance"
                    app:popupTheme="?attr/toolbarPopupAppearance"
                    app:layout_collapseMode="pin"
                    tools:targetApi="lollipop" >
                    <TextView
                        android:id="@+id/filename"
                        style="@style/KeepassDXStyle.TextAppearance.TitleTextOnPrimary"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentStart="true"
                        android:ellipsize="marquee"
                        android:focusable="true"
                        android:focusableInTouchMode="true"
                        android:marqueeRepeatLimit="marquee_forever"
                        android:scrollHorizontally="true"
                        android:singleLine="true" />
                </android.support.v7.widget.Toolbar>

            </android.support.design.widget.CollapsingToolbarLayout>
        </android.support.design.widget.AppBarLayout>

        <android.support.v4.widget.NestedScrollView
            android:id="@+id/scroll_container"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="fill_vertical"
            android:fillViewport="true">

            <LinearLayout
                android:orientation="vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="@dimen/default_margin">

                <!-- Password Input -->
                <RelativeLayout
                    android:id="@+id/password_input_container"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                    <android.support.v7.widget.AppCompatCheckBox
                        android:id="@+id/password_checkbox"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingBottom="20dp"
                        android:layout_alignBottom="@+id/password_input_layout"
                        android:gravity="center_vertical" />

                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/password_input_layout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_toRightOf="@+id/password_checkbox"
                        android:layout_toEndOf="@+id/password_checkbox"
                        app:passwordToggleEnabled="true"
                        app:passwordToggleTint="?attr/colorAccent">

                        <android.support.design.widget.TextInputEditText
                            android:id="@+id/password"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:hint="@string/password"
                            android:inputType="textPassword"
                            android:imeOptions="actionDone"
                            android:maxLines="1"/>
                    </android.support.design.widget.TextInputLayout>
                </RelativeLayout>

                <!-- File Input -->
                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                    <android.support.v7.widget.AppCompatCheckBox
                        android:id="@+id/keyfile_checkox"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingBottom="20dp"
                        android:layout_alignBottom="@+id/input_entry_keyfile"
                        android:gravity="center_vertical" />

                    <android.support.design.widget.TextInputLayout
                        android:id="@+id/input_entry_keyfile"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toEndOf="@+id/keyfile_checkox"
                        android:layout_toRightOf="@+id/keyfile_checkox"
                        android:layout_toLeftOf="@+id/browse_button"
                        android:layout_toStartOf="@+id/browse_button">

                        <android.support.v7.widget.AppCompatEditText
                            android:id="@+id/pass_keyfile"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:hint="@string/entry_keyfile"
                            android:inputType="text"
                            android:maxLines="1" />
                    </android.support.design.widget.TextInputLayout>

                    <android.support.v7.widget.AppCompatImageView
                        android:id="@+id/browse_button"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignBottom="@+id/input_entry_keyfile"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"
                        android:padding="12dp"
                        android:src="@drawable/ic_folder_white_24dp"
                        android:tint="?attr/colorAccentCompat" />
                </RelativeLayout>

                <android.support.v7.widget.SwitchCompat
                    android:id="@+id/default_database"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    style="@style/KeepassDXStyle.TextAppearance.Default"
                    android:layout_margin="16dp"
                    android:text="@string/default_checkbox" />

            </LinearLayout>

        </android.support.v4.widget.NestedScrollView>

    </android.support.design.widget.CoordinatorLayout>

    <android.support.v7.widget.AppCompatButton
        android:id="@+id/pass_ok"
        android:layout_marginRight="@dimen/default_margin"
        android:layout_marginEnd="@dimen/default_margin"
        android:layout_marginTop="@dimen/default_margin"
        android:layout_marginBottom="@dimen/default_margin"
        android:layout_width="100sp"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:text="@string/menu_open" />

</RelativeLayout>