<?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">

    <ImageView
        android:id="@+id/profilePic"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_marginStart="24dp"
        android:layout_marginTop="24dp"
        app:layout_constraintBottom_toTopOf="@+id/textInputLayoutName"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:srcCompat="@tools:sample/avatars"
        android:contentDescription="@string/profile_picture" />


    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/textInputLayoutName"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/profilePic">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/nameEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/your_name"
            android:ems="10"
            android:imeOptions="actionDone" />
    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/textInputLayoutBio"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="24dp"
        android:layout_marginEnd="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textInputLayoutName">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/bioEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/your_bio" />
    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.materialswitch.MaterialSwitch
        android:id="@+id/privateSwitch"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="24dp"
        android:layout_marginEnd="8dp"
        app:layout_constraintEnd_toStartOf="@+id/privateText"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textInputLayoutBio" />

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/privateText"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toEndOf="@+id/privateSwitch"
    app:layout_constraintTop_toTopOf="@+id/privateSwitch"
    app:layout_constraintBottom_toBottomOf="@+id/privateSwitch">
    <TextView
        android:id="@+id/privateTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/private_account"
        android:textStyle="bold"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"/>

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="@string/private_account_explanation"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="@+id/privateTitle"
        app:layout_constraintTop_toBottomOf="@+id/privateTitle" />

</androidx.constraintlayout.widget.ConstraintLayout>


    <Button
        android:id="@+id/editButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/more_profile_settings"
        android:layout_marginTop="24dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:icon="@drawable/ic_baseline_open_in_browser_24"
        app:layout_constraintTop_toBottomOf="@+id/privateText" />


    <com.google.android.material.card.MaterialCardView
        android:id="@+id/progressCard"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        style="?attr/materialCardViewElevatedStyle"
        app:cardBackgroundColor="?attr/colorSecondaryContainer"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" >

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_margin="8dp"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/progressIcon"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">
            <ProgressBar
                android:id="@+id/savingProgressBar"
                style="?android:attr/progressBarStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"/>

            <ImageView
                android:id="@+id/error"
                app:tint="?attr/colorOnSecondaryContainer"
                android:src="@drawable/error"
                android:visibility="gone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                android:contentDescription="@string/profile_saved" />

            <ImageView
                android:id="@+id/done"
                android:src="@drawable/check_circle_24"
                android:visibility="gone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                android:contentDescription="@string/profile_saved" />
            </androidx.constraintlayout.widget.ConstraintLayout>
            <TextView
                android:id="@+id/progressText"
                tools:text="@string/fetching_profile"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/progressIcon"/>

        </androidx.constraintlayout.widget.ConstraintLayout>

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

</androidx.constraintlayout.widget.ConstraintLayout>