<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:visibility="visible"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:navigationIcon="@drawable/ic_arrow_left_24"
        app:title="@string/UsernameEditFragment_username" />

    <EditText
        android:id="@+id/username_text"
        style="@style/Signal.Text.Body"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:hint="@string/UsernameEditFragment_username"
        android:imeOptions="actionDone"
        android:importantForAutofill="no"
        android:inputType="text"
        android:maxLines="1"
        android:minHeight="56dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/toolbar" />

    <TextView
        android:id="@+id/username_subtext"
        style="@style/Signal.Text.Caption"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/username_text"
        tools:text="Some error code" />

    <TextView
        android:id="@+id/username_description"
        style="@style/Signal.Text.Caption"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="16dp"
        android:text="@string/UsernameEditFragment_usernames_on_signal_are_optional"
        app:layout_constraintBottom_toTopOf="@id/username_button_barrier"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/username_subtext" />

    <com.dd.CircularProgressButton
        android:id="@+id/username_submit_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="32dp"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="16dp"
        android:background="@color/core_ultramarine"
        android:textAllCaps="true"
        android:textColor="@color/white"
        app:cpb_colorIndicator="?colorAccent"
        app:cpb_colorProgress="@color/transparent"
        app:cpb_cornerRadius="4dp"
        app:cpb_selectorIdle="@drawable/progress_button_state"
        app:cpb_textIdle="@string/save"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <com.dd.CircularProgressButton
        android:id="@+id/username_delete_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="32dp"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="16dp"
        android:background="@color/core_red"
        android:textAllCaps="true"
        android:textColor="@color/white"
        android:visibility="gone"
        app:cpb_colorIndicator="@color/core_red"
        app:cpb_colorProgress="@color/transparent"
        app:cpb_cornerRadius="4dp"
        app:cpb_selectorIdle="@drawable/progress_button_state_red"
        app:cpb_textIdle="@string/UsernameEditFragment_delete"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/username_button_barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="top"
        app:constraint_referenced_ids="username_submit_button,username_delete_button" />

</androidx.constraintlayout.widget.ConstraintLayout>