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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:orientation="vertical">

        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.google.android.material.appbar.MaterialToolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="?attr/actionBarSize" />

        </com.google.android.material.appbar.AppBarLayout>

        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <LinearLayout
                android:id="@+id/details_main_layout"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/activity_horizontal_margin"
                    android:layout_marginTop="@dimen/activity_vertical_margin"
                    android:layout_marginRight="@dimen/activity_horizontal_margin"
                    android:layout_marginBottom="@dimen/activity_vertical_margin">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:padding="@dimen/card_padding_regular">

                        <com.google.android.material.imageview.ShapeableImageView
                            android:id="@+id/details_avatar"
                            android:layout_width="@dimen/publish_avatar_size"
                            android:layout_height="@dimen/publish_avatar_size"
                            android:layout_alignParentTop="true"
                            android:layout_centerHorizontal="true"
                            android:scaleType="centerCrop"
                            app:shapeAppearanceOverlay="@style/ShapeAppearance.RoundedCornersMedium" />

                        <TextView
                            android:id="@+id/details_contact_xmpp_address"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/details_avatar"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="16sp"
                            android:gravity="center_horizontal"
                            android:minWidth="288dp"
                            android:text="@string/account_settings_example_jabber_id"
                            android:textAppearance="?textAppearanceTitleLarge" />



                        <LinearLayout
                            android:id="@+id/button_box"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/details_contact_xmpp_address"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="16dp"
                            android:orientation="horizontal">

                            <Button
                                android:id="@+id/add_contact_button"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginHorizontal="8dp"
                                android:text="@string/add_contact" />

                            <Button
                                android:id="@+id/add_address_book"
                                style="@style/Widget.Material3.Button.TonalButton"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginHorizontal="8dp"
                                android:text="@string/save_to_contact"
                                app:icon="@drawable/ic_contacts_24dp" />
                        </LinearLayout>


                        <androidx.constraintlayout.widget.ConstraintLayout
                            android:id="@+id/tags"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/button_box"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="16sp"
                            android:visibility="gone">

                            <androidx.constraintlayout.helper.widget.Flow
                                android:id="@+id/flow_widget"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                app:flow_horizontalBias="0"
                                app:flow_horizontalGap="8sp"
                                app:flow_horizontalStyle="packed"
                                app:flow_verticalGap="4sp"
                                app:flow_wrapMode="chain"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toTopOf="parent" />
                        </androidx.constraintlayout.widget.ConstraintLayout>


                        <TextView
                            android:id="@+id/details_last_seen"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/tags"
                            android:layout_centerHorizontal="true"
                            android:layout_marginTop="8sp"
                            android:textAppearance="?textAppearanceTitleSmall"
                            tools:text="@string/just_now" />

                        <LinearLayout
                            android:id="@+id/status_message_subscription_box"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/details_last_seen"
                            android:layout_alignStart="@+id/details_contact_xmpp_address"
                            android:layout_marginTop="8sp"
                            android:orientation="vertical">

                            <TextView
                                android:id="@+id/status_message"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginBottom="8sp"
                                android:textAppearance="?textAppearanceBodyMedium"
                                tools:text="Hey there! I’m using Conversations" />

                            <CheckBox
                                android:id="@+id/details_send_presence"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/send_presence_updates" />

                            <CheckBox
                                android:id="@+id/details_receive_presence"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/receive_presence_updates" />
                        </LinearLayout>

                        <TextView
                            android:id="@+id/details_account"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/status_message_subscription_box"
                            android:layout_alignParentEnd="true"
                            android:layout_alignParentBottom="true"
                            android:layout_marginTop="16sp"
                            android:text="@string/using_account"
                            android:textAppearance="?textAppearanceLabelMedium" />
                    </RelativeLayout>
                </com.google.android.material.card.MaterialCardView>

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/media_wrapper"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/activity_horizontal_margin"
                    android:layout_marginTop="@dimen/activity_vertical_margin"
                    android:layout_marginRight="@dimen/activity_horizontal_margin"
                    android:layout_marginBottom="@dimen/activity_vertical_margin">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:padding="@dimen/card_padding_regular">

                        <androidx.recyclerview.widget.RecyclerView
                            android:id="@+id/media"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_margin="-2dp"
                            android:orientation="horizontal" />

                        <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:layout_gravity="end"
                            android:layout_marginTop="16dp"
                            android:orientation="horizontal">

                            <Button
                                android:id="@+id/show_media"
                                style="?attr/materialButtonOutlinedStyle"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/view_media" />
                        </LinearLayout>
                    </LinearLayout>
                </com.google.android.material.card.MaterialCardView>

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/keys_wrapper"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/activity_horizontal_margin"
                    android:layout_marginTop="@dimen/activity_vertical_margin"
                    android:layout_marginRight="@dimen/activity_horizontal_margin"
                    android:layout_marginBottom="@dimen/activity_vertical_margin">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">

                        <LinearLayout
                            android:id="@+id/details_contact_keys"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="vertical"
                            android:padding="@dimen/card_padding_list" />

                        <LinearLayout
                            android:id="@+id/unverified_warning"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:paddingHorizontal="@dimen/card_padding_list">

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginHorizontal="@dimen/list_padding"
                                android:text="@string/contact_uses_unverified_keys"
                                android:textAppearance="?textAppearanceBodyMedium"
                                android:textColor="?colorOnSurfaceVariant" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:layout_marginTop="8dp"
                            android:orientation="horizontal"
                            android:padding="@dimen/card_padding_list">


                            <Button
                                android:id="@+id/scan_button"
                                style="@style/Widget.Material3.Button.TextButton"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/scan_qr_code" />

                            <Button
                                android:id="@+id/show_inactive_devices"
                                style="@style/Widget.Material3.Button.TextButton"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/show_inactive_devices" />
                        </LinearLayout>
                    </LinearLayout>
                </com.google.android.material.card.MaterialCardView>
            </LinearLayout>
        </ScrollView>
    </LinearLayout>
</layout>
