<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/showUserCodeToolBar"
            style="@style/VectorToolbarStyle"
            android:layout_width="0dp"
            android:layout_height="?actionBarSize"
            android:elevation="4dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

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

                <ImageView
                    android:id="@+id/showUserCodeClose"
                    android:layout_width="@dimen/layout_touch_size"
                    android:layout_height="@dimen/layout_touch_size"
                    android:contentDescription="@string/action_close"
                    android:scaleType="center"
                    android:src="@drawable/ic_x_18dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/showUserCodeTitle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="8dp"
                    android:layout_marginEnd="8dp"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:text="@string/add_by_qr_code"
                    android:textColor="?riotx_text_primary"
                    android:textSize="18sp"
                    android:textStyle="bold"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintHorizontal_bias="0.0"
                    app:layout_constraintStart_toEndOf="@+id/showUserCodeClose"
                    app:layout_constraintTop_toTopOf="parent" />

            </androidx.constraintlayout.widget.ConstraintLayout>

        </androidx.appcompat.widget.Toolbar>


        <ImageView
            android:id="@+id/showUserCodeAvatar"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_marginStart="@dimen/layout_horizontal_margin"
            android:contentDescription="@string/avatar"
            android:elevation="4dp"
            android:transitionName="profile"
            app:layout_constraintBottom_toBottomOf="@id/showUserCodeCardTopBarrier"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@id/showUserCodeCardTopBarrier"
            tools:src="@tools:sample/avatars" />

        <androidx.constraintlayout.widget.Barrier
            android:id="@+id/showUserCodeCardTopBarrier"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:barrierDirection="top"
            app:constraint_referenced_ids="showUserCodeCard" />

        <androidx.cardview.widget.CardView
            android:id="@+id/showUserCodeCard"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="50dp"
            android:padding="16dp"
            app:cardCornerRadius="20dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/showUserCodeToolBar"
            app:layout_constraintWidth_percent="0.8">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minWidth="300dp"
                android:paddingTop="40dp">

                <TextView
                    android:id="@+id/showUserCodeCardNameText"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="16dp"
                    android:layout_marginEnd="16dp"
                    android:maxLines="1"
                    android:singleLine="true"
                    android:textAlignment="center"
                    android:textColor="?riotx_text_primary"
                    android:textSize="15sp"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:text="@sample/matrix.json/data/displayName" />

                <TextView
                    android:id="@+id/showUserCodeCardUserIdText"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="16dp"
                    android:layout_marginTop="4dp"
                    android:layout_marginEnd="16dp"
                    android:maxLines="1"
                    android:singleLine="true"
                    android:textAlignment="center"
                    android:textColor="?riotx_text_secondary"
                    android:textSize="15sp"
                    app:layout_constraintTop_toBottomOf="@id/showUserCodeCardNameText"
                    tools:text="@sample/matrix.json/data/mxid" />


                <!--                android:id="@+id/itemShareQrCodeImage"-->
                <!--                android:layout_width="300dp"-->
                <!--                android:layout_height="300dp"-->
                <!--                android:layout_gravity="center_horizontal"-->
                <!--                android:contentDescription="@string/a11y_qr_code_for_verification"-->
                <!--                tools:src="@color/riotx_header_panel_background_black" />-->

                <im.vector.app.core.ui.views.QrCodeImageView
                    android:id="@+id/showUserCodeQRImage"
                    android:layout_width="260dp"
                    android:layout_height="260dp"
                    android:layout_gravity="center"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="@dimen/layout_vertical_margin"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/showUserCodeCardUserIdText"
                    tools:src="@drawable/ic_qr_code_add" />

            </androidx.constraintlayout.widget.ConstraintLayout>

        </androidx.cardview.widget.CardView>

        <TextView
            android:id="@+id/showUserCodeInfoText"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            android:text="@string/user_code_info_text"
            android:textAlignment="center"
            android:textColor="?riotx_text_secondary"
            android:textSize="15sp"
            app:layout_constraintEnd_toEndOf="@id/showUserCodeCard"
            app:layout_constraintStart_toStartOf="@id/showUserCodeCard"
            app:layout_constraintTop_toBottomOf="@id/showUserCodeCard" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/showUserCodeShareButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:minWidth="130dp"
            android:text="@string/user_code_share"
            app:icon="@drawable/ic_share"
            app:iconTint="@color/white"
            app:layout_constraintBottom_toTopOf="@id/showUserCodeScanButton"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/showUserCodeInfoText"
            app:layout_constraintVertical_bias="0" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/showUserCodeScanButton"
            style="@style/Widget.MaterialComponents.Button.TextButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/layout_vertical_margin"
            android:minWidth="130dp"
            android:text="@string/user_code_scan"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/showUserCodeShareButton"
            app:layout_constraintVertical_bias="0" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</ScrollView>