<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Nextcloud Talk application
  ~
  ~ @author Julius Linus
  ~ @author Andy Scherzinger
  ~ Copyright (C) 2023 Julius Linus <julius.linus@nextcloud.com>
  ~ Copyright (C) 2023 Andy Scherzinger <info@andy-scherzinger.de>
  ~
  ~ 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/>.
  -->
<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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="2">

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

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/translation_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"
            app:titleTextColor="@color/fontAppbar"
            tools:title="@string/translation" />

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

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

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/fromLanguageInputLayout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:hint="@string/translation_from">

            <com.google.android.material.textfield.MaterialAutoCompleteTextView
                android:id="@+id/fromLanguage"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="none" />

        </com.google.android.material.textfield.TextInputLayout>

        <ImageView
            android:layout_width="@dimen/standard_double_margin"
            android:layout_height="match_parent"
            android:contentDescription="@null"
            android:src="@drawable/ic_chevron_right" />

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/toLanguageInputLayout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:hint="@string/translation_to">

            <com.google.android.material.textfield.MaterialAutoCompleteTextView
                android:id="@+id/toLanguage"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="none" />

        </com.google.android.material.textfield.TextInputLayout>

    </LinearLayout>

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

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

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

                <TextView
                    android:id="@+id/original_message_textview"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/standard_margin"
                    android:layout_marginEnd="@dimen/standard_margin"
                    android:layout_weight="1"
                    android:background="@drawable/shape_grouped_incoming_message"
                    android:padding="@dimen/dialog_padding"
                    android:scrollbars="vertical"
                    android:textColor="@color/nc_incoming_text_default"
                    android:textSize="@dimen/message_text_size"
                    tools:text="This is the last message\nof an incredibly long two line conversation text" />

                <LinearLayout
                    android:id="@+id/translated_message_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/standard_margin"
                    android:layout_marginEnd="@dimen/standard_margin"
                    android:layout_weight="1"
                    android:orientation="vertical"
                    android:visibility="visible">

                    <TextView
                        android:id="@+id/translated_message_textview"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="@drawable/shape_grouped_incoming_message"
                        android:padding="@dimen/dialog_padding"
                        android:scrollbars="vertical"
                        android:textColor="@color/nc_incoming_text_default"
                        android:textSize="@dimen/message_text_size"
                        tools:text="This is the last message\nof an incredibly long two line conversation text" />

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/copy_translated_message"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="end"
                        android:layout_marginTop="@dimen/standard_half_margin"
                        android:text="@string/translation_copy_translated_text"
                        app:icon="@drawable/ic_content_copy" />

                </LinearLayout>

            </LinearLayout>

            <ProgressBar
                android:id="@+id/progressBar"
                style="?android:attr/progressBarStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:visibility="gone"
                tools:visibility="visible" />

        </LinearLayout>

    </ScrollView>

</LinearLayout>
