<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="?attr/primaryBackgroundColor"
    android:orientation="vertical"
    android:gravity="center"
    android:id="@+id/loginForm">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="16dp"
        android:fitsSystemWindows="true" >

        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="20dp"
            android:layout_marginBottom="20dp"
            android:baselineAligned="false"
            android:contentDescription="@string/appName"
            android:src="@mipmap/app_logo" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/loginMethodText"
            android:textColor="?attr/primaryTextColor"
            android:textSize="12sp"
            android:layout_marginBottom="10dp"
            android:gravity="start" />

        <RadioGroup
            android:id="@+id/loginMethod"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:orientation="vertical">

            <RadioButton
                android:id="@+id/loginToken"
                android:layout_width="wrap_content"
                android:layout_height="36dp"
                android:text="@string/copyToken"
                android:checked="true"
                android:textColor="?attr/primaryTextColor"/>

            <RadioButton
                android:id="@+id/loginUsernamePassword"
                android:layout_width="wrap_content"
                android:layout_height="36dp"
                android:text="@string/loginViaPassword"
                android:textColor="?attr/primaryTextColor"/>

        </RadioGroup>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/httpsSpinnerLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:boxBackgroundColor="?attr/inputBackgroundColor"
            android:textColorHint="?attr/hintColor"
            app:hintTextColor="?attr/hintColor"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:hint="@string/protocol"
            app:endIconTint="?attr/iconsColor"
            style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu">

            <AutoCompleteTextView
                android:id="@+id/httpsSpinner"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="none"
                android:textColor="?attr/inputTextColor"
                android:labelFor="@+id/httpsSpinner"
                android:textSize="16sp" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/instance_urlLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:boxBackgroundColor="?attr/inputBackgroundColor"
            android:textColorHint="?attr/hintColor"
            app:hintTextColor="?attr/hintColor"
            app:boxStrokeErrorColor="@color/darkRed"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            app:startIconDrawable="@drawable/ic_link"
            app:startIconTint="?attr/iconsColor"
            app:endIconMode="clear_text"
            app:endIconTint="?attr/iconsColor"
            android:hint="@string/instanceUrl">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/instance_url"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="?attr/inputTextColor"
                android:textColorHighlight="?attr/hintColor"
                android:textColorHint="?attr/hintColor"
                android:inputType="textUri"
                android:singleLine="true"
                android:textSize="16sp" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/login_uidLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:boxBackgroundColor="?attr/inputBackgroundColor"
            android:textColorHint="?attr/hintColor"
            app:hintTextColor="?attr/hintColor"
            app:boxStrokeErrorColor="@color/darkRed"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            app:startIconDrawable="@drawable/ic_person"
            app:startIconTint="?attr/iconsColor"
            app:endIconMode="clear_text"
            app:endIconTint="?attr/iconsColor"
            android:hint="@string/userName">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/login_uid"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="?attr/inputTextColor"
                android:textColorHighlight="?attr/hintColor"
                android:textColorHint="?attr/hintColor"
                android:singleLine="true"
                android:textSize="16sp" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/login_passwdLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:boxBackgroundColor="?attr/inputBackgroundColor"
            android:textColorHint="?attr/hintColor"
            app:hintTextColor="?attr/hintColor"
            app:boxStrokeErrorColor="@color/darkRed"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            app:startIconDrawable="@drawable/ic_lock"
            app:startIconTint="?attr/iconsColor"
            app:endIconTint="?attr/iconsColor"
            app:endIconMode="password_toggle"
            android:hint="@string/passWord">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/login_passwd"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="?attr/inputTextColor"
                android:textColorHighlight="?attr/hintColor"
                android:textColorHint="?attr/hintColor"
                android:inputType="textPassword"
                android:singleLine="true"
                android:textSize="16sp" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/otpCodeLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:boxBackgroundColor="?attr/inputBackgroundColor"
            android:textColorHint="?attr/hintColor"
            app:hintTextColor="?attr/hintColor"
            app:boxStrokeErrorColor="@color/darkRed"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            app:startIconDrawable="@drawable/ic_otp"
            app:startIconTint="?attr/iconsColor"
            app:endIconMode="clear_text"
            app:endIconTint="?attr/iconsColor"
            app:helperText="@string/otpMessage"
            app:helperTextTextColor="?attr/inputTextColor"
            app:helperTextEnabled="true"
            android:hint="@string/loginOTP">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/otpCode"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="?attr/inputTextColor"
                android:textColorHighlight="?attr/hintColor"
                android:textColorHint="?attr/hintColor"
                android:inputType="number"
                android:singleLine="true"
                android:textSize="16sp" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/loginTokenCodeLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:boxBackgroundColor="?attr/inputBackgroundColor"
            android:textColorHint="?attr/hintColor"
            app:hintTextColor="?attr/hintColor"
            app:boxStrokeErrorColor="@color/darkRed"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            app:startIconDrawable="@drawable/ic_lock"
            app:startIconTint="?attr/iconsColor"
            app:endIconMode="clear_text"
            app:endIconTint="?attr/iconsColor"
            android:hint="@string/copyToken">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/loginTokenCode"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="?attr/inputTextColor"
                android:textColorHighlight="?attr/hintColor"
                android:textColorHint="?attr/hintColor"
                android:singleLine="true"
                android:textSize="16sp" />

        </com.google.android.material.textfield.TextInputLayout>

        <Button
            android:id="@+id/login_button"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_marginTop="8dp"
            android:text="@string/btnLogin"
            android:textColor="@color/btnTextColor" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/appRepoLink"
            android:textColor="?attr/primaryTextColor"
            android:textSize="14sp"
            android:gravity="center"
            android:autoLink="web"
            android:textColorLink="@color/lightBlue"
            android:layout_marginTop="20dp"
            android:layout_marginStart="10dp"
            android:layout_marginEnd="10dp" />

        <TextView
            android:id="@+id/appVersion"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_marginTop="5dp"
            android:layout_weight="1"
            android:maxLines="1"
            android:textSize="14sp"
            android:textColor="?attr/primaryTextColor"
            android:layout_gravity="center_horizontal"/>

    </LinearLayout>

</ScrollView>
