<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/bottom_content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_gravity="bottom">

        <LinearLayout
            android:id="@+id/top_row"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingStart="@dimen/dimen16dp"
            android:paddingEnd="@dimen/dimen16dp"
            android:paddingTop="@dimen/dimen16dp"
            android:gravity="center_vertical"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toTopOf="@id/card_view">

            <com.google.android.material.card.MaterialCardView
                style="?attr/materialCardViewFilledStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:cardCornerRadius="@dimen/dimen20dp">

                <ImageView
                    android:id="@+id/appLogo"
                    android:layout_width="@dimen/dimen72dp"
                    android:layout_height="@dimen/dimen72dp"
                    android:contentDescription="@string/appName"
                    android:src="@drawable/gitnex" />

            </com.google.android.material.card.MaterialCardView>

        </LinearLayout>

        <!-- Form card -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/card_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/dimen16dp"
            app:cardCornerRadius="@dimen/dimen32dp"
            app:cardElevation="@dimen/dimen0dp"
            app:strokeWidth="@dimen/dimen0dp"
            app:layout_constraintTop_toBottomOf="@id/top_row"
            app:layout_constraintBottom_toBottomOf="parent">

            <androidx.core.widget.NestedScrollView
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="@dimen/dimen28dp">

                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/providerSpinnerLayout"
                        style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/dimen8dp"
                        android:layout_marginBottom="@dimen/dimen8dp"
                        android:hint="@string/select_provider"
                        android:textColorHint="?attr/hintColor"
                        app:endIconTint="?attr/iconsColor"
                        app:hintTextColor="?attr/hintColor">

                        <AutoCompleteTextView
                            android:id="@+id/providerSpinner"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:inputType="none"
                            android:labelFor="@+id/providerSpinner"
                            android:textColor="?attr/inputTextColor"
                            android:textSize="@dimen/dimen16sp" />

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

                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/httpsSpinnerLayout"
                        style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/dimen8dp"
                        android:layout_marginBottom="@dimen/dimen8dp"
                        android:hint="@string/protocol"
                        android:textColorHint="?attr/hintColor"
                        app:endIconTint="?attr/iconsColor"
                        app:hintTextColor="?attr/hintColor">

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

                    </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"
                        android:layout_marginTop="@dimen/dimen8dp"
                        android:layout_marginBottom="@dimen/dimen8dp"
                        android:hint="@string/instanceUrl"
                        android:textColorHint="?attr/hintColor"
                        app:boxStrokeErrorColor="@color/darkRed"
                        app:endIconMode="clear_text"
                        app:endIconTint="?attr/iconsColor"
                        app:hintTextColor="?attr/hintColor"
                        app:startIconDrawable="@drawable/ic_link"
                        app:startIconTint="?attr/iconsColor"
                        app:helperText="@string/instanceHelperText">

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

                    </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"
                        android:layout_marginTop="@dimen/dimen8dp"
                        android:layout_marginBottom="@dimen/dimen8dp"
                        android:hint="@string/copyToken"
                        android:textColorHint="?attr/hintColor"
                        app:boxStrokeErrorColor="@color/darkRed"
                        app:endIconMode="clear_text"
                        app:endIconTint="?attr/iconsColor"
                        app:hintTextColor="?attr/hintColor"
                        app:startIconDrawable="@drawable/ic_lock"
                        app:startIconTint="?attr/iconsColor">

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

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

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/token_helper"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/dimen16dp"
                        android:layout_marginBottom="@dimen/dimen16dp"
                        android:layout_gravity="center_horizontal"
                        android:textSize="@dimen/dimen14sp"
                        android:autoLink="web"
                        android:text="@string/where_to_get_token_text" />

                    <androidx.constraintlayout.widget.ConstraintLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/dimen8dp"
                        android:layout_marginBottom="@dimen/dimen8dp">

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/restore_from_backup"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/restoreFromBackup"
                            android:textColor="?attr/materialCardBackgroundColor"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toTopOf="parent" />

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/login_button"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/btnLogin"
                            android:textColor="?attr/materialCardBackgroundColor"
                            android:letterSpacing="0.1"
                            android:textStyle="bold"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintTop_toTopOf="parent" />

                    </androidx.constraintlayout.widget.ConstraintLayout>

                    <TextView
                        android:id="@+id/appVersion"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/dimen8dp"
                        android:textColor="?attr/inputTextColor"
                        android:textSize="@dimen/dimen12sp"
                        android:gravity="center" />

                </LinearLayout>

            </androidx.core.widget.NestedScrollView>

        </com.google.android.material.card.MaterialCardView>

    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
