<?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/>.
-->
<ScrollView 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:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:padding="@dimen/default_margin"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:importantForAutofill="noExcludeDescendants"
        tools:targetApi="o">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toStartOf="@+id/otp_information"
                android:text="@string/entry_setup_otp"
                style="@style/KeepassDXStyle.Title"/>
            <ImageView
                android:id="@+id/otp_information"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                android:src="@drawable/ic_info_white_24dp"
                style="@style/KeepassDXStyle.ImageButton.Simple"
                android:contentDescription="@string/content_description_otp_information"/>
        </androidx.constraintlayout.widget.ConstraintLayout>

        <TextView
            android:id="@+id/setup_otp_type_message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/card_view_margin_horizontal"
            android:layout_marginLeft="@dimen/card_view_margin_horizontal"
            android:layout_marginEnd="@dimen/card_view_margin_horizontal"
            android:layout_marginRight="@dimen/card_view_margin_horizontal"
            android:text="@string/error_otp_type"
            android:textColor="?attr/colorSecondary"/>

        <androidx.cardview.widget.CardView
            android:id="@+id/card_view_otp_selection"
            android:layout_margin="4dp"
            android:layout_gravity="center"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cardCornerRadius="4dp">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/default_margin"
                android:orientation="vertical">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" >
                    <TextView
                        android:id="@+id/setup_otp_type_label"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:layout_constraintTop_toTopOf="parent"
                        android:text="@string/otp_type"
                        style="@style/KeepassDXStyle.TextAppearance.LabelTextStyle"/>

                    <!-- HOTP / TOTP -->
                    <androidx.appcompat.widget.AppCompatSpinner
                        android:id="@+id/setup_otp_type"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:layout_constraintTop_toBottomOf="@+id/setup_otp_type_label"
                        app:layout_constraintStart_toStartOf="parent"
                        android:minHeight="48dp" />

                    <androidx.appcompat.widget.AppCompatSpinner
                        android:id="@+id/setup_otp_token_type"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:minHeight="48dp"
                        app:layout_constraintTop_toBottomOf="@+id/setup_otp_type_label"
                        app:layout_constraintStart_toEndOf="@+id/setup_otp_type"
                        app:layout_constraintEnd_toEndOf="parent" />
                </androidx.constraintlayout.widget.ConstraintLayout>

                <!-- Secret -->
                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/setup_otp_secret_label"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:endIconMode="password_toggle"
                    app:endIconTint="?attr/colorSecondary">
                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/setup_otp_secret"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="textPassword"
                        android:importantForAccessibility="no"
                        android:importantForAutofill="no"
                        android:hint="@string/otp_secret" />
                </com.google.android.material.textfield.TextInputLayout>

            </LinearLayout>
        </androidx.cardview.widget.CardView>

        <androidx.cardview.widget.CardView
            android:id="@+id/card_view_otp_advanced"
            android:layout_margin="4dp"
            android:layout_gravity="center"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cardCornerRadius="4dp">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/default_margin"
                android:orientation="vertical">

                <!-- Algorithm -->
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/otp_algorithm"
                    style="@style/KeepassDXStyle.TextAppearance.LabelTextStyle"/>
                <androidx.appcompat.widget.AppCompatSpinner
                    android:id="@+id/setup_otp_algorithm"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="48dp" />

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">
                    <!-- Period / Counter -->
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/setup_otp_period_label"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:visibility="visible"
                        app:layout_constraintTop_toTopOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintEnd_toStartOf="@+id/vertical_guideline">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/setup_otp_period"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:inputType="numberSigned"
                            android:importantForAccessibility="no"
                            android:importantForAutofill="no"
                            android:hint="@string/otp_period"
                            tools:text="30"
                            android:maxLength="3"
                            android:digits="0123456789"
                            android:imeOptions="actionNext" />
                    </com.google.android.material.textfield.TextInputLayout>
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/setup_otp_counter_label"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:visibility="gone"
                        app:layout_constraintTop_toTopOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintEnd_toStartOf="@+id/vertical_guideline">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/setup_otp_counter"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:inputType="numberSigned"
                            android:importantForAccessibility="no"
                            android:importantForAutofill="no"
                            android:hint="@string/otp_counter"
                            tools:text="1"
                            android:imeOptions="actionNext" />
                    </com.google.android.material.textfield.TextInputLayout>

                    <androidx.constraintlayout.widget.Guideline
                        android:id="@+id/vertical_guideline"
                        android:layout_width="1dp"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        app:layout_constraintGuide_percent="0.5" />

                    <!-- Digits -->
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/setup_otp_digits_label"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        app:layout_constraintTop_toTopOf="parent"
                        app:layout_constraintStart_toEndOf="@+id/vertical_guideline"
                        app:layout_constraintEnd_toEndOf="parent">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/setup_otp_digits"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:inputType="numberSigned"
                            android:importantForAccessibility="no"
                            android:importantForAutofill="no"
                            android:hint="@string/otp_digits"
                            tools:text="6"
                            android:maxLength="2"
                            android:digits="0123456789"
                            android:imeOptions="actionNext" />
                    </com.google.android.material.textfield.TextInputLayout>
                </androidx.constraintlayout.widget.ConstraintLayout>


            </LinearLayout>
        </androidx.cardview.widget.CardView>
    </LinearLayout>
</ScrollView>
