<?xml version="1.0" encoding="utf-8"?><!--
    Copyright 2017 Thomas Schneider

    This file is a part of Fedilab

    This program 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.

    Fedilab 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 Fedilab; 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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/step_instance"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/main_logo"
                android:layout_width="150dp"
                android:layout_height="150dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="20dp"
                android:contentDescription="@string/app_logo"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/login_instance_layout"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="50dp"
                android:layout_marginTop="30dp"
                app:errorEnabled="true"
                app:layout_constraintEnd_toStartOf="@id/info_instance"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/main_logo">

                <androidx.appcompat.widget.AppCompatAutoCompleteTextView
                    android:id="@+id/login_instance"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:dropDownAnchor="@id/login_instance_layout"
                    android:hint="@string/instance_example"
                    android:imeOptions="actionNext"
                    android:inputType="textWebEmailAddress"
                    android:singleLine="true" />

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

            <ImageView
                android:id="@+id/info_instance"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginEnd="50dp"
                android:contentDescription="@string/more_information"
                android:src="@drawable/ic_info_login"
                app:layout_constraintBottom_toBottomOf="@id/login_instance_layout"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="@id/login_instance_layout" />

            <androidx.constraintlayout.widget.Barrier
                android:id="@+id/barrier_instance_bottom"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:barrierDirection="bottom"
                app:constraint_referenced_ids="info_instance,login_instance_layout" />

            <Button
                android:id="@+id/connect_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="20dp"
                android:drawableStart="@drawable/ic_check_circle"
                android:drawablePadding="10dp"
                android:gravity="center"
                android:paddingStart="15dp"
                android:paddingTop="12dp"
                android:paddingEnd="20dp"
                android:paddingBottom="12dp"
                android:singleLine="true"
                android:text="@string/connect_instance"
                android:textAllCaps="false"
                android:textSize="20sp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/barrier_instance_bottom" />

            <TextView
                android:id="@+id/create_an_account"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="30dp"
                android:drawableStart="@drawable/mastodon_icon_item"
                android:drawablePadding="10dp"
                android:gravity="center"
                android:text="@string/join_mastodon"
                android:textSize="16sp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/connect_button" />

            <TextView
                android:id="@+id/create_an_account_peertube"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="20dp"
                android:drawableStart="@drawable/peertube_icon"
                android:drawablePadding="10dp"
                android:gravity="center"
                android:text="@string/join_peertube"
                android:textSize="16sp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/create_an_account" />

        </androidx.constraintlayout.widget.ConstraintLayout>

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/step_login_credential"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingStart="50dp"
            android:paddingEnd="50dp"
            android:visibility="gone">

            <TextView
                android:id="@+id/instance_chosen"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="20dp"
                android:textColor="?colorAccent"
                android:textSize="20sp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/login_uid_container"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/instance_chosen">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/login_uid"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/username"
                    android:inputType="textEmailAddress"
                    android:singleLine="true" />

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

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/login_passwd_container"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/login_uid_container"
                app:passwordToggleEnabled="true">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/login_passwd"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/password"
                    android:inputType="textPassword"
                    android:singleLine="true" />

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

            <TextView
                android:id="@+id/login_issue"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp"
                android:visibility="gone"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/login_passwd_container" />

            <Button
                android:id="@+id/login_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="20dp"
                android:drawableStart="@drawable/mastodon_icon"
                android:drawablePadding="10dp"
                android:gravity="center"
                android:paddingStart="15dp"
                android:paddingTop="12dp"
                android:paddingEnd="20dp"
                android:paddingBottom="12dp"
                android:singleLine="true"
                android:text="@string/login"
                android:textAllCaps="false"
                android:textSize="20sp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/login_issue" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </LinearLayout>

</ScrollView>