<?xml version="1.0" encoding="utf-8"?><!--
  ~ Nextcloud Talk application
  ~
  ~ @author Mario Danic
  ~ @author Marcel Hibbe
  ~ @author Andy Scherzinger
  ~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
  ~ Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
  ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
  ~
  ~ 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.
  ~
  ~ This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
  -->

<merge 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">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="4dp"
        android:layoutDirection="ltr">

        <include layout="@layout/item_message_quote"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="4dp"
            android:visibility="gone"/>

        <ImageButton
            android:id="@id/attachmentButton"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:padding="12dp"
            android:layout_below="@id/quotedChatMessageView"
            android:background="@color/transparent"
            android:src="@drawable/ic_baseline_attach_file_24"
            app:tint="?attr/colorControlNormal"
            android:scaleType="centerCrop"
            android:contentDescription="@string/nc_add_attachment" />

        <ImageButton
            android:id="@+id/smileyButton"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:padding="12dp"
            android:layout_below="@id/quotedChatMessageView"
            android:layout_toEndOf="@id/attachmentButton"
            android:background="@color/transparent"
            android:src="@drawable/ic_insert_emoticon_black_24dp"
            android:scaleType="centerCrop"
            app:tint="?attr/colorControlNormal"
            android:contentDescription="@string/nc_add_emojis" />

        <com.nextcloud.talk.utils.ImageEmojiEditText
            android:id="@id/messageInput"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/quotedChatMessageView"
            android:layout_centerHorizontal="true"
            android:layout_toStartOf="@id/messageSendButton"
            android:layout_toEndOf="@id/smileyButton"
            android:imeOptions="actionDone"
            android:inputType="textAutoCorrect|textMultiLine|textCapSentences"
            android:lineSpacingMultiplier="1.2"
            android:minHeight="48dp"
            android:textAlignment="viewStart"
            android:layoutDirection="locale"
            tools:hint="@string/nc_hint_enter_a_message" />

        <TextView
            android:id="@+id/slideToCancelDescription"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/quotedChatMessageView"
            android:layout_centerInParent="true"
            android:layout_toStartOf="@id/recordAudioButton"
            android:layout_toEndOf="@id/audioRecordDuration"
            android:text="@string/nc_voice_message_slide_to_cancel"
            android:textAlignment="viewStart"
            android:textColor="@color/low_emphasis_text"
            android:textSize="16sp"
            android:textStyle="bold"
            android:visibility="gone"
            tools:visibility="visible" />

        <ImageView
            android:id="@+id/microphoneEnabledInfoBackground"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_below="@id/quotedChatMessageView"
            android:scaleType="centerInside"
            android:layout_alignParentStart="true"
            android:background="@color/bg_default"
            android:visibility="gone"
            tools:visibility="gone"
            android:contentDescription="@null" />

        <!-- the height of this ImageView is used to define the overall height of the
         parent layout whenever the voice recording mode is enabled. parent layout has
         height=wrap_content because it must enlarge whenever user types a message with
          linebreaks. -->
        <ImageView
            android:id="@+id/microphoneEnabledInfo"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_below="@id/quotedChatMessageView"
            android:scaleType="centerInside"
            android:layout_alignParentStart="true"
            android:src="@drawable/ic_baseline_mic_red_24"
            android:contentDescription="@null"
            android:visibility="gone"
            tools:visibility="gone"/>

        <Chronometer
            android:id="@+id/audioRecordDuration"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/quotedChatMessageView"
            android:layout_toEndOf="@id/microphoneEnabledInfo"
            android:layout_centerVertical="true"
            android:textSize="16sp"
            android:textStyle="bold"
            android:textColor="@color/low_emphasis_text"
            android:paddingStart="5dp"
            android:paddingEnd="5dp"
            android:background="@color/bg_default"
            android:visibility="gone"
            tools:visibility="gone" />

        <ImageButton
            android:id="@id/messageSendButton"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:padding="12dp"
            android:layout_below="@id/quotedChatMessageView"
            android:layout_alignParentEnd="true"
            android:adjustViewBounds="true"
            android:scaleType="centerInside"
            android:contentDescription="@string/nc_description_send_message_button" />

        <ImageButton
            android:id="@+id/recordAudioButton"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_below="@id/quotedChatMessageView"
            android:layout_alignParentEnd="true"
            android:background="@color/transparent"
            android:src="@drawable/ic_baseline_mic_24"
            android:contentDescription="@string/nc_description_record_voice" />

        <Space
            android:id="@id/attachmentButtonSpace"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_below="@id/quotedChatMessageView"
            android:layout_toEndOf="@id/attachmentButton"
            android:visibility="gone"/>

        <Space
            android:id="@id/sendButtonSpace"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_below="@id/quotedChatMessageView"
            android:layout_toStartOf="@id/smileyButton" />
    </RelativeLayout>

</merge>
