<?xml version="1.0" encoding="utf-8"?><!--
    Copyright 2023 Thomas Schneider

    This file is a part of Fedilab

    This program is free software; you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation; either version 3 of the
    License, or (at your option) any later version.

    Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
    the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    Public License for more details.

    You should have received a copy of the GNU General Public License along with Fedilab; if not,
    see <http://www.gnu.org/licenses>.
-->
<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:background="?android:windowBackground">

    <!-- Listview status -->
    <FrameLayout
        android:id="@+id/main_frame"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@+id/compose"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/swipeContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recycler_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clipToPadding="false"
                android:paddingBottom="6dp"
                android:scrollbars="none" />

        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

    </FrameLayout>

    <!-- Main Loader -->
    <RelativeLayout
        android:id="@+id/loader"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:indeterminate="true" />

    </RelativeLayout>

    <com.google.android.material.card.MaterialCardView
        android:id="@+id/compose"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_margin="6dp"
        android:layout_marginBottom="?actionBarSize"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/main_frame">
        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:baselineAligned="false"
            android:orientation="vertical">

            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:baselineAligned="false"
                android:orientation="horizontal">

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

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/button_attach"
                        style="@style/Widget.Material3.Button.IconButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:icon="@drawable/ic_compose_attach"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <androidx.constraintlayout.helper.widget.Flow
                        android:id="@+id/attachment_choices_panel"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@drawable/bg_compose_panels"
                        android:padding="6dp"
                        android:visibility="gone"
                        app:constraint_referenced_ids="button_attach_image,button_attach_audio,button_attach_video,button_close_attachment_panel,button_poll,button_attach_manual"
                        app:flow_maxElementsWrap="3"
                        app:flow_wrapMode="aligned"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintStart_toStartOf="parent" />

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/button_attach_image"
                        style="@style/Widget.Material3.Button.IconButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:icon="@drawable/ic_compose_attach_image" />

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/button_attach_audio"
                        style="@style/Widget.Material3.Button.IconButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:icon="@drawable/ic_compose_attach_audio" />

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/button_attach_video"
                        style="@style/Widget.Material3.Button.IconButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:icon="@drawable/ic_compose_attach_video" />

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/button_close_attachment_panel"
                        style="@style/Widget.Material3.Button.IconButton.Outlined"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:icon="@drawable/ic_baseline_close_24" />

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/button_poll"
                        style="@style/Widget.Material3.Button.IconButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:icon="@drawable/ic_compose_poll" />

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/button_attach_manual"
                        style="@style/Widget.Material3.Button.IconButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        app:icon="@drawable/ic_compose_attach_more" />
                </androidx.constraintlayout.widget.ConstraintLayout>

                <app.fedilab.android.mastodon.helper.FedilabAutoCompleteTextView
                    android:id="@+id/text"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:maxLines="6"
                    tools:text="@tools:sample/lorem/random" />

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/send_button"
                    style="@style/Widget.Material3.Button.IconButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:icon="@drawable/ic_baseline_send_24" />

            </androidx.appcompat.widget.LinearLayoutCompat>

            <HorizontalScrollView
                android:id="@+id/attachments_list_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="6dp"
                app:layout_constraintTop_toBottomOf="@id/sensitive_media">

                <androidx.appcompat.widget.LinearLayoutCompat
                    android:id="@+id/attachments_list"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:clipToPadding="false"
                    android:paddingEnd="6dp"
                    tools:ignore="RtlSymmetry" />

            </HorizontalScrollView>
        </androidx.appcompat.widget.LinearLayoutCompat>


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