<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Nextcloud Talk - Android Client
  ~
  ~ SPDX-FileCopyrightText: 2021 Andy Scherzinger <info@andy-scherzinger.de>
  ~ SPDX-FileCopyrightText: 2021 Marcel Hibbe <dev@mhibbe.de>
  ~ SPDX-FileCopyrightText: 2017-2018 Mario Danic <mario@lovelyhq.com>
  ~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<RelativeLayout 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="wrap_content"
    android:layout_marginStart="16dp"
    android:layout_marginTop="2dp"
    android:layout_marginEnd="14dp"
    android:layout_marginBottom="2dp">

    <com.google.android.flexbox.FlexboxLayout
        android:id="@+id/outgoing_preview_message_bubble"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp"
        android:orientation="vertical"
        app:alignContent="stretch"
        app:alignItems="stretch"
        app:flexWrap="wrap"
        app:justifyContent="flex_end">

        <FrameLayout
            android:id="@+id/preview_container"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            app:layout_alignSelf="flex_start"
            app:layout_flexGrow="1"
            app:layout_wrapBefore="true">

            <ImageView
                android:id="@id/image"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scaleType="fitStart"
                tools:src="@drawable/ic_call_black_24dp"
                tools:ignore="ContentDescription" />

            <ProgressBar
                android:id="@+id/progress_bar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:visibility="gone" />
        </FrameLayout>

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/contact_container"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="2dp"
            app:cardCornerRadius="@dimen/dialogBorderRadius"
            app:cardElevation="2dp"
            app:layout_alignSelf="flex_start"
            app:layout_flexGrow="1"
            app:layout_wrapBefore="true"
            app:strokeWidth="0dp"
            tools:visibility="gone">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:padding="@dimen/standard_padding">

                <FrameLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:adjustViewBounds="true">

                    <ImageView
                        android:id="@+id/contact_photo"
                        android:layout_width="@dimen/small_item_height"
                        android:layout_height="@dimen/small_item_height"
                        android:scaleType="fitStart"
                        tools:src="@drawable/ic_call_black_24dp"
                        tools:ignore="ContentDescription" />

                    <ProgressBar
                        android:id="@+id/contact_progress_bar"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_gravity="center"
                        android:visibility="gone"
                        tools:visibility="visible" />
                </FrameLayout>

                <androidx.emoji2.widget.EmojiTextView
                    android:id="@+id/contact_name"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:autoLink="none"
                    android:ellipsize="middle"
                    android:gravity="start|center_vertical"
                    android:maxLines="3"
                    android:paddingStart="@dimen/standard_padding"
                    android:paddingEnd="0dp"
                    android:textAlignment="viewStart"
                    android:textColor="@color/high_emphasis_text"
                    android:textColorLink="@color/high_emphasis_text"
                    android:textIsSelectable="false"
                    android:textSize="16sp"
                    app:layout_alignSelf="flex_start"
                    app:layout_flexGrow="1"
                    app:layout_wrapBefore="true"
                    tools:text="Charlotte D. Meyerheimers" />

            </LinearLayout>

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

        <androidx.emoji2.widget.EmojiTextView
            android:id="@id/messageText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingHorizontal="@dimen/standard_half_padding"
            android:alpha="0.6"
            android:autoLink="none"
            android:textColor="@color/no_emphasis_text"
            android:textColorLink="@color/no_emphasis_text"
            android:textIsSelectable="true"
            android:textSize="12sp"
            android:visibility="invisible"
            app:layout_alignSelf="flex_start"
            app:layout_flexGrow="1"
            app:layout_wrapBefore="true"
            tools:text="A simple message" />

        <TextView
            android:id="@id/messageTime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingHorizontal="@dimen/standard_half_padding"
            android:layout_alignParentEnd="true"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="2dp"
            android:alpha="0.6"
            android:gravity="end"
            android:textColor="@color/no_emphasis_text"
            app:layout_alignSelf="center"
            tools:text="12:34" />

        <androidx.emoji2.widget.EmojiTextView
            android:id="@+id/messageCaption"
            android:padding="@dimen/standard_half_padding"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center"
            android:layout_marginBottom="4dp"
            android:textColor="@color/high_emphasis_text"
            android:textIsSelectable="false"
            android:textSize="@dimen/chat_text_size"
            android:visibility="gone"
            tools:visibility="visible"
            tools:ignore="TextContrastCheck"
            tools:text="This is my caption" />

        <include
            android:id="@+id/reactions"
            layout="@layout/reactions_inside_message" />
    </com.google.android.flexbox.FlexboxLayout>

</RelativeLayout>
