<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/root"
    android:minWidth="320dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/username"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="@dimen/spacing_large"
        android:layout_marginVertical="@dimen/spacing_small"
        android:paddingTop="@dimen/spacing_medlarge"
        app:layout_constraintBottom_toTopOf="@id/password"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/username_input"
            android:hint="@string/achievements_username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:importantForAutofill="no"
            android:inputType="text"
            android:minHeight="48dp"
            android:textAlignment="viewStart" />

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

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/password"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="@dimen/spacing_large"
        app:layout_constraintBottom_toTopOf="@id/login_in_progress"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/username">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/password_input"
            android:hint="@string/achievements_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="48dp"
            android:importantForAutofill="no"
            android:inputType="textPassword"
            android:textAlignment="viewStart" />

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

    <TextView
        android:id="@+id/login_in_progress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:text="@string/achievements_login_in_progress"
        android:textAlignment="center"
        android:textColor="?attr/colorOnErrorContainer"
        android:visibility="invisible"
        android:clickable="false"
        android:focusable="false"
        app:layout_constraintBottom_toTopOf="@id/login_failed"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/password"/>

    <TextView
        android:id="@+id/login_failed"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:text="@string/achievements_login_failed"
        android:textAlignment="center"
        android:textColor="?attr/colorOnErrorContainer"
        android:visibility="invisible"
        android:clickable="false"
        android:focusable="false"
        app:layout_constraintBottom_toTopOf="@id/button_cancel"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/login_in_progress"/>

    <Button
        android:id="@+id/button_cancel"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/spacing_large"
        android:text="@string/cancel"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/button_login"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/login_failed" />

    <Button
        android:id="@+id/button_login"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/spacing_large"
        android:text="@string/ok"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@id/button_cancel"
        app:layout_constraintTop_toBottomOf="@id/login_failed" />

</androidx.constraintlayout.widget.ConstraintLayout>
