<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

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

            <de.hdodenhof.circleimageview.CircleImageView
                android:visibility="gone"
                android:id="@+id/avatar"
                android:layout_width="196dp"
                android:layout_height="196dp"
                android:paddingTop="12dp"
                android:src="@drawable/aldrin"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/jid"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:textAppearance="@style/TextAppearance.AppCompat.Title"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.497"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/avatar"
                tools:text="aldrin@mercury.im" />


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="12dp"
                android:orientation="vertical"
                android:padding="12dp"
                android:clipToPadding="false"
                app:layout_constraintTop_toBottomOf="@id/jid">


                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/layout_ikey"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="8dp"
                    android:layout_marginBottom="8dp"
                    android:visibility="gone"
                    tools:visibility="visible"
                    style="@style/Widget.Theme.Mercury.CardView">

                    <androidx.constraintlayout.widget.ConstraintLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:paddingStart="12dp"
                        android:paddingEnd="12dp"
                        android:paddingTop="12dp">

                        <TextView
                            android:id="@+id/title_ikey"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Identity Key"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toTopOf="parent" />


                        <include
                            android:id="@+id/ikey_fingerprint"
                            layout="@layout/view_openpgp_4_fingerprint"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="8dp"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintHorizontal_bias="0.5"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toBottomOf="@+id/title_ikey" />

                        <Button
                            android:id="@+id/btn_backup_ikey"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/btn_server_backup"
                            app:layout_constraintEnd_toStartOf="@+id/btn_share_ikey"
                            app:layout_constraintTop_toBottomOf="@+id/ikey_fingerprint" />

                        <Button
                            android:id="@+id/btn_share_ikey"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="share"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintTop_toBottomOf="@+id/ikey_fingerprint" />

                    </androidx.constraintlayout.widget.ConstraintLayout>

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

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:textAppearance="@style/TextAppearance.AppCompat.SearchResult.Title"
                    android:text="Encryption Keys" />

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="8dp"
                    android:layout_marginBottom="8dp"
                    style="@style/Widget.Theme.Mercury.CardView">

                    <androidx.constraintlayout.widget.ConstraintLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:paddingStart="12dp"
                        android:paddingEnd="12dp"
                        android:paddingTop="12dp">

                        <TextView
                            android:id="@+id/title"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="This Device"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toTopOf="parent" />


                        <include
                            android:id="@+id/local_fingerprint"
                            layout="@layout/view_openpgp_4_fingerprint"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="8dp"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintHorizontal_bias="0.5"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toBottomOf="@+id/title" />

                        <Button
                            android:id="@+id/btn_backup"
                            android:visibility="gone"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/btn_server_backup"
                            app:layout_constraintEnd_toStartOf="@+id/btn_share"
                            app:layout_constraintTop_toBottomOf="@+id/local_fingerprint" />

                        <Button
                            android:id="@+id/btn_share"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="share"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintTop_toBottomOf="@+id/local_fingerprint" />

                    </androidx.constraintlayout.widget.ConstraintLayout>

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

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/other_fingerprints_card"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:visibility="gone"
                    tools:visibility="visible"
                    style="@style/Widget.Theme.Mercury.CardView">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:paddingStart="12dp"
                        android:paddingEnd="12dp"
                        android:paddingTop="12dp">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Other Devices" />

                        <include layout="@layout/view_fingerprints_card_toggleable"
                            android:layout_height="wrap_content"
                            android:layout_width="match_parent"
                            android:layout_marginTop="8dp"
                            android:layout_marginBottom="8dp"/>

                        <Button
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/btn_send_ikey_element"
                            android:layout_gravity="end"
                            android:text="Publish Decisions" />
                    </LinearLayout>



                </com.google.android.material.card.MaterialCardView>
            </LinearLayout>
        </androidx.constraintlayout.widget.ConstraintLayout>
    </ScrollView>
</LinearLayout>