<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
    android:background="?android:colorBackground">

    <androidx.core.widget.NestedScrollView style="@style/LoginFormScrollView">

        <androidx.constraintlayout.widget.ConstraintLayout style="@style/LoginFormContainer">

            <ImageView
                style="@style/LoginLogo"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:ignore="ContentDescription" />

            <TextView
                android:id="@+id/loginServerTitle"
                style="@style/Widget.Vector.TextView.Title"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="36dp"
                android:text="@string/login_server_title"
                android:textColor="?vctr_content_primary"
                android:transitionName="loginTitleTransition"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/loginLogo" />

            <TextView
                android:id="@+id/loginServerText"
                style="@style/Widget.Vector.TextView.Body"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/layout_vertical_margin"
                android:gravity="start"
                android:text="@string/login_server_text"
                android:textColor="?vctr_content_secondary"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/loginServerTitle" />

            <!-- Use a CheckableConstraintLayout to keep the pressed state when retrieving login flow -->
            <im.vector.app.core.platform.CheckableConstraintLayout
                android:id="@+id/loginServerChoiceMatrixOrg"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="24dp"
                android:background="@drawable/bg_login_server_selector"
                android:contentDescription="@string/login_a11y_choose_matrix_org"
                android:minHeight="80dp"
                android:paddingStart="@dimen/layout_horizontal_margin"
                android:paddingEnd="@dimen/layout_horizontal_margin"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/loginServerText">

                <ImageView
                    android:id="@+id/loginServerChoiceMatrixOrgIcon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:importantForAccessibility="no"
                    android:src="@drawable/ic_logo_matrix_org"
                    app:layout_constraintBottom_toTopOf="@id/loginServerChoiceMatrixOrgText"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintVertical_chainStyle="packed"
                    app:tint="?vctr_content_primary"
                    tools:ignore="MissingPrefix" />

                <TextView
                    android:id="@+id/loginServerChoiceMatrixOrgText"
                    style="@style/Widget.Vector.TextView.Caption"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:gravity="start"
                    android:text="@string/login_server_matrix_org_text"
                    android:textColor="?vctr_content_secondary"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/loginServerChoiceMatrixOrgIcon" />

            </im.vector.app.core.platform.CheckableConstraintLayout>

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/loginServerChoiceEms"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/layout_vertical_margin"
                android:background="@drawable/bg_login_server_selector"
                android:contentDescription="@string/login_a11y_choose_modular"
                android:minHeight="80dp"
                android:paddingStart="@dimen/layout_horizontal_margin"
                android:paddingEnd="0dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/loginServerChoiceMatrixOrg">

                <ImageView
                    android:id="@+id/loginServerChoiceEmsIcon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:importantForAccessibility="no"
                    android:src="@drawable/ic_logo_element_matrix_services"
                    app:layout_constraintBottom_toTopOf="@id/loginServerChoiceEmsText"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintVertical_chainStyle="packed"
                    app:tint="?vctr_content_primary"
                    tools:ignore="MissingPrefix" />

                <TextView
                    android:id="@+id/loginServerChoiceEmsText"
                    style="@style/Widget.Vector.TextView.Caption"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="7dp"
                    android:gravity="start"
                    android:text="@string/login_server_modular_text"
                    android:textColor="?vctr_content_secondary"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toStartOf="@id/loginServerChoiceEmsLearnMore"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/loginServerChoiceEmsIcon" />

                <TextView
                    android:id="@+id/loginServerChoiceEmsLearnMore"
                    style="@style/Widget.Vector.TextView.Caption"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:padding="16dp"
                    android:text="@string/login_server_modular_learn_more"
                    android:textColor="?colorPrimary"
                    app:layout_constraintBottom_toBottomOf="@id/loginServerChoiceEmsText"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="@id/loginServerChoiceEmsText" />

            </androidx.constraintlayout.widget.ConstraintLayout>

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/loginServerChoiceOther"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/layout_vertical_margin"
                android:background="@drawable/bg_login_server_selector"
                android:contentDescription="@string/login_a11y_choose_other"
                android:minHeight="80dp"
                android:paddingStart="@dimen/layout_horizontal_margin"
                android:paddingEnd="@dimen/layout_horizontal_margin"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/loginServerChoiceEms">

                <TextView
                    android:id="@+id/loginServerChoiceOtherTitle"
                    style="@style/Widget.Vector.TextView.Subtitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="start"
                    android:text="@string/login_server_other_title"
                    android:textColor="?vctr_content_primary"
                    app:layout_constraintBottom_toTopOf="@id/loginServerChoiceOtherText"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintVertical_chainStyle="packed" />

                <TextView
                    android:id="@+id/loginServerChoiceOtherText"
                    style="@style/Widget.Vector.TextView.Caption"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:gravity="start"
                    android:text="@string/login_server_other_text"
                    android:textColor="?vctr_content_secondary"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/loginServerChoiceOtherTitle" />

            </androidx.constraintlayout.widget.ConstraintLayout>

            <Button
                android:id="@+id/loginServerIKnowMyIdSubmit"
                style="@style/Widget.Vector.Button.Text.Login"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="32dp"
                android:layout_marginBottom="32dp"
                android:text="@string/login_connect_using_matrix_id_submit"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/loginServerChoiceOther" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </androidx.core.widget.NestedScrollView>

</FrameLayout>

