<?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:tools="http://schemas.android.com/tools"
    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="20dp"
        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/app_name"
            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:paddingStart="5dp"
            android:paddingEnd="5dp"
            android:layout_marginBottom="10dp"
            android:gravity="start" />

        <RadioGroup
            android:id="@+id/loginMethod"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingStart="5dp"
            android:paddingEnd="5dp"
            android:layout_margin="10dp"
            android:background="@drawable/shape_inputs"
            android:orientation="vertical">

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

            <RadioButton
                android:id="@+id/loginUsernamePassword"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/loginViaPassword"
                android:layout_marginEnd="30dp"
                android:theme="@style/radioButtonsInDarkTheme"
                android:textColor="?attr/primaryTextColor"/>

        </RadioGroup>

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/shape_dropdown"
            android:layout_marginStart="10dp"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp" >

            <Spinner
                android:id="@+id/httpsSpinner"
                android:layout_width="120dp"
                android:layout_height="44dp"
                android:spinnerMode="dropdown"
                android:padding="10dp" />

        </RelativeLayout>

        <LinearLayout
            android:visibility="gone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/info"
                android:layout_width="28dp"
                android:layout_height="28dp"
                android:src="@drawable/ic_info_24dp"
                android:layout_marginStart="120dp"
                android:layout_marginTop="10dp"
                android:contentDescription="@string/urlInfoTooltip" />

        </LinearLayout>

        <EditText
            android:id="@+id/instance_url"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:padding="10dp"
            android:textSize="14sp"
            tools:ignore="Autofill"
            android:drawableStart="@drawable/ic_link_24dp"
            android:drawablePadding="10dp"
            android:inputType="textUri"
            android:background="@drawable/shape_inputs"
            android:textColor="?attr/inputTextColor"
            android:textColorHint="?attr/hintColor"
            android:textColorHighlight="?attr/hintColor"
            android:hint="@string/instanceUrl" />

        <EditText
            android:id="@+id/login_uid"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:padding="10dp"
            android:textSize="14sp"
            tools:ignore="Autofill"
            android:drawableStart="@drawable/ic_person_24dp"
            android:drawablePadding="10dp"
            android:background="@drawable/shape_inputs"
            android:textColor="?attr/inputTextColor"
            android:textColorHint="?attr/hintColor"
            android:textColorHighlight="?attr/hintColor"
            android:hint="@string/userName"
            android:inputType="text"
            android:visibility="gone" />

        <EditText
            android:id="@+id/login_passwd"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:padding="10dp"
            android:textSize="14sp"
            tools:ignore="Autofill"
            android:drawableStart="@drawable/ic_lock_24dp"
            android:drawablePadding="10dp"
            android:background="@drawable/shape_inputs"
            android:textColor="?attr/inputTextColor"
            android:textColorHint="?attr/hintColor"
            android:textColorHighlight="?attr/hintColor"
            android:hint="@string/passWord"
            android:inputType="textPassword"
            android:visibility="gone" />

        <EditText
            android:id="@+id/otpCode"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:padding="10dp"
            android:textSize="14sp"
            tools:ignore="Autofill"
            android:drawableStart="@drawable/ic_otp"
            android:drawablePadding="10dp"
            android:background="@drawable/shape_inputs"
            android:textColor="?attr/inputTextColor"
            android:textColorHint="?attr/hintColor"
            android:textColorHighlight="?attr/hintColor"
            android:hint="@string/loginOTP"
            android:inputType="number"
            android:visibility="gone" />

        <EditText
            android:id="@+id/loginTokenCode"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:padding="10dp"
            android:textSize="14sp"
            tools:ignore="Autofill"
            android:drawableStart="@drawable/ic_lock_24dp"
            android:drawablePadding="10dp"
            android:background="@drawable/shape_inputs"
            android:textColor="?attr/inputTextColor"
            android:textColorHint="?attr/hintColor"
            android:textColorHighlight="?attr/hintColor"
            android:hint="@string/copyToken"
            android:inputType="text"
            android:visibility="visible" />

        <TextView
            android:id="@+id/otpInfo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/otpMessage"
            android:textColor="@color/hintColor"
            android:textSize="12sp"
            android:paddingStart="10dp"
            android:paddingEnd="10dp"
            android:gravity="end"
            android:visibility="gone" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/btnLogin"
            android:layout_marginStart="10dp"
            android:layout_marginEnd="10dp"
            android:layout_marginBottom="15dp"
            android:layout_marginTop="15dp"
            android:textColor="@color/btnTextColor"
            android:textSize="16sp"
            android:background="@drawable/shape_buttons"
            android:id="@+id/login_button"/>

        <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>