<?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/>.
-->

<LinearLayout 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:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:importantForAutofill="noExcludeDescendants"
    android:paddingBottom="@dimen/card_view_margin_vertical"
    tools:targetApi="o">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <View
            android:layout_width="match_parent"
            android:layout_height="68dp"
            android:background="?attr/colorSurface" />
        <androidx.cardview.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/card_view_margin_horizontal"
            android:layout_marginEnd="@dimen/card_view_margin_horizontal"
            android:layout_marginLeft="@dimen/card_view_margin_horizontal"
            android:layout_marginRight="@dimen/card_view_margin_horizontal"
            android:layout_marginTop="@dimen/default_margin"
            android:layout_marginBottom="@dimen/card_view_margin_vertical"
            android:layout_gravity="bottom">
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/card_view_padding">

                <com.kunzisoft.keepass.view.PasswordEditView
                    android:id="@+id/passphrase_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_toStartOf="@+id/passphrase_copy_button"
                    android:layout_toLeftOf="@+id/passphrase_copy_button"
                    app:passwordHint="@string/passphrase"
                    app:passwordMaxLines="7"/>

                <androidx.appcompat.widget.AppCompatImageButton
                    android:id="@+id/passphrase_copy_button"
                    style="@style/KeepassDXStyle.ImageButton.Simple"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignTop="@+id/passphrase_view"
                    android:layout_alignBottom="@+id/passphrase_view"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentRight="true"
                    android:contentDescription="@string/menu_copy"
                    android:src="@drawable/ic_content_copy_white_24dp" />
            </RelativeLayout>
        </androidx.cardview.widget.CardView>
    </FrameLayout>

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

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/card_view_margin_horizontal"
            android:layout_marginEnd="@dimen/card_view_margin_horizontal"
            android:layout_marginLeft="@dimen/card_view_margin_horizontal"
            android:layout_marginRight="@dimen/card_view_margin_horizontal"
            android:layout_marginTop="@dimen/card_view_margin_vertical"
            android:layout_marginBottom="@dimen/card_view_margin_vertical"
            app:cardCornerRadius="4dp">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/card_view_padding"
                android:orientation="vertical">

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                    <com.google.android.material.slider.Slider
                        android:id="@+id/slider_word_count"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignBottom="@+id/word_count"
                        android:layout_alignParentStart="true"
                        android:layout_alignParentLeft="true"
                        android:layout_toStartOf="@+id/word_count"
                        android:layout_toLeftOf="@+id/word_count"
                        android:contentDescription="@string/content_description_password_length"
                        android:stepSize="1"
                        android:value="@integer/passphrase_generator_word_count_default"
                        android:valueFrom="@integer/passphrase_generator_word_count_min"
                        android:valueTo="@integer/passphrase_generator_word_count_max" />

                    <EditText
                        android:id="@+id/word_count"
                        android:layout_width="50dp"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"
                        android:inputType="number"
                        android:maxLength="2"
                        android:maxLines="1" />

                </RelativeLayout>
                <TextView
                    android:id="@+id/character_count"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    tools:text="Character count: 51" />

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                    <Spinner
                        android:id="@+id/word_case"
                        android:layout_width="wrap_content"
                        android:layout_height="48dp"
                        android:layout_marginTop="12dp"/>

                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/word_separator_layout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_toEndOf="@+id/word_case"
                        android:layout_toRightOf="@+id/word_case">

                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/word_separator"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:hint="@string/word_separator" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>

            </LinearLayout>
        </FrameLayout>
    </ScrollView>
</LinearLayout>