<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Nextcloud Talk - Android Client
  ~
  ~ SPDX-FileCopyrightText: 2023 Julius Linus <juliuslinus1@gmail.com>
  ~ SPDX-FileCopyrightText: 2021 Andy Scherzinger <info@andy-scherzinger.de>
  ~ SPDX-FileCopyrightText: 2017-2018 Mario Danic <mario@lovelyhq.com>
  ~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<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:id="@+id/chat_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:animateLayoutChanges="true"
    android:background="@color/bg_default"
    android:orientation="vertical"
    tools:ignore="Overdraw">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/chat_appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/chat_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/appbar"
            android:theme="?attr/actionBarPopupTheme"
            app:layout_scrollFlags="scroll|enterAlways"
            app:navigationIconTint="@color/fontAppbar"
            app:popupTheme="@style/appActionBarPopupMenu">

            <FrameLayout
                android:id="@+id/chat_toolbar_avatar_container"
                android:layout_width="46dp"
                android:layout_height="46dp"
                android:layout_marginEnd="@dimen/standard_half_margin"
                android:visibility="gone"
                tools:visibility="visible">

                <ImageView
                    android:id="@+id/chat_toolbar_avatar"
                    android:layout_width="42dp"
                    android:layout_height="42dp"
                    android:layout_gravity="start|center_vertical"
                    android:contentDescription="@null"
                    tools:src="@drawable/ic_avatar_group" />

                <ImageView
                    android:id="@+id/chat_toolbar_status"
                    android:layout_width="18dp"
                    android:layout_height="18dp"
                    android:layout_gravity="end|bottom"
                    android:contentDescription="@null"
                    tools:src="@drawable/online_status" />

            </FrameLayout>

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

                <TextView
                    android:id="@+id/chat_toolbar_title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:lines="1"
                    android:text="@string/nc_app_product_name"
                    android:textColor="@color/fontAppbar"
                    android:textSize="18sp" />

                <androidx.emoji2.widget.EmojiTextView
                    android:id="@+id/chat_toolbar_status_message"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:lines="1"
                    android:text="@string/nc_app_product_name"
                    android:textColor="@color/fontAppbar"
                    android:textSize="12sp"
                    android:visibility="gone"
                    tools:text="Offline"
                    tools:visibility="visible" />

            </LinearLayout>

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

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <include
            android:id="@+id/lobby"
            layout="@layout/lobby_view"
            android:visibility="gone"
            tools:visibility="visible" />

        <LinearLayout
            android:id="@+id/progressBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingTop="@dimen/standard_padding"
            android:visibility="gone"
            tools:visibility="visible">

            <include layout="@layout/item_custom_incoming_text_message_shimmer" />

            <include layout="@layout/item_custom_incoming_text_message_shimmer" />

            <include layout="@layout/item_custom_incoming_text_message_shimmer" />

        </LinearLayout>

        <com.stfalcon.chatkit.messages.MessagesList
            android:id="@+id/messagesListView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false"
            android:paddingBottom="20dp"
            android:visibility="gone"
            app:dateHeaderTextSize="13sp"
            app:incomingBubblePaddingBottom="@dimen/message_bubble_corners_vertical_padding"
            app:incomingBubblePaddingLeft="@dimen/message_bubble_corners_horizontal_padding"
            app:incomingBubblePaddingRight="@dimen/message_bubble_corners_horizontal_padding"
            app:incomingBubblePaddingTop="@dimen/message_bubble_corners_vertical_padding"
            app:incomingDefaultBubbleColor="@color/bg_message_list_incoming_bubble"
            app:incomingDefaultBubblePressedColor="@color/bg_message_list_incoming_bubble"
            app:incomingDefaultBubbleSelectedColor="@color/transparent"
            app:incomingImageTimeTextSize="12sp"
            app:incomingTextColor="@color/nc_incoming_text_default"
            app:incomingTextLinkColor="@color/nc_incoming_text_default"
            app:incomingTextSize="@dimen/chat_text_size"
            app:incomingTimeTextColor="@color/no_emphasis_text"
            app:incomingTimeTextSize="12sp"
            app:outcomingBubblePaddingBottom="@dimen/message_bubble_corners_vertical_padding"
            app:outcomingBubblePaddingLeft="@dimen/message_bubble_corners_horizontal_padding"
            app:outcomingBubblePaddingRight="@dimen/message_bubble_corners_horizontal_padding"
            app:outcomingBubblePaddingTop="@dimen/message_bubble_corners_vertical_padding"
            app:outcomingDefaultBubbleColor="@color/colorPrimary"
            app:outcomingDefaultBubblePressedColor="@color/colorPrimary"
            app:outcomingDefaultBubbleSelectedColor="@color/transparent"
            app:outcomingImageTimeTextSize="12sp"
            app:outcomingTextColor="@color/high_emphasis_text"
            app:outcomingTextLinkColor="@color/high_emphasis_text"
            app:outcomingTextSize="@dimen/chat_text_size"
            app:outcomingTimeTextSize="12sp"
            app:textAutoLink="all"
            tools:visibility="visible" />

        <com.nextcloud.ui.popupbubble.PopupBubble
            android:id="@+id/unreadMessagesPopup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@id/typing_indicator_wrapper"
            android:layout_centerHorizontal="true"
            android:layout_marginStart="64dp"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="64dp"
            android:layout_marginBottom="45dp"
            android:layout_toStartOf="@+id/scrollDownButton"
            android:ellipsize="middle"
            android:minHeight="@dimen/min_size_clickable_area"
            android:text="@string/nc_new_messages"
            android:theme="@style/Button.Primary"
            app:background="@color/colorPrimary"
            app:cornerRadius="@dimen/button_corner_radius"
            app:icon="@drawable/ic_baseline_arrow_downward_24px" />

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/voice_recording_lock"
            android:layout_width="@dimen/min_size_clickable_area"
            android:layout_height="@dimen/min_size_clickable_area"
            android:layout_alignParentEnd="true"
            android:layout_alignParentBottom="true"
            android:layout_marginEnd="@dimen/standard_margin"
            android:layout_marginBottom="@dimen/standard_margin"
            android:contentDescription="@string/continuous_voice_message_recording"
            android:visibility="gone"
            app:fabCustomSize="@dimen/min_size_clickable_area"
            app:srcCompat="@drawable/ic_lock_open_grey600_24dp" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/scrollDownButton"
            style="@style/Widget.AppTheme.Button.ElevatedButton"
            android:layout_width="@dimen/min_size_clickable_area"
            android:layout_height="@dimen/min_size_clickable_area"
            android:layout_alignParentEnd="true"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginEnd="@dimen/standard_margin"
            android:layout_marginBottom="@dimen/standard_margin"
            android:contentDescription="@string/scroll_to_bottom"
            android:paddingStart="@dimen/standard_padding"
            android:paddingEnd="@dimen/standard_padding"
            android:visibility="gone"
            app:cornerRadius="@dimen/button_corner_radius"
            app:icon="@drawable/ic_keyboard_double_arrow_down"
            app:iconPadding="0dp"
            app:iconSize="24dp" />

        <LinearLayout
            android:id="@+id/typing_indicator_wrapper"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_marginBottom="-19dp"
            android:orientation="vertical">

            <View
                android:id="@+id/separator_1"
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/chat_separator" />

            <TextView
                android:id="@+id/typing_indicator"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingStart="@dimen/side_margin"
                android:paddingEnd="@dimen/side_margin"
                android:background="@color/bg_default"
                android:ellipsize="end"
                android:maxLines="2"
                android:textColor="@color/low_emphasis_text"
                tools:ignore="Overdraw"
                tools:text="Marcel is typing"/>

        </LinearLayout>

    </RelativeLayout>

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/fragment_container_activity_chat"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="0dp"
        />
</LinearLayout>