<!--
Polassis: personal voice assistant for Android devices
Copyright (C) 2018 Maksymilian Graczyk

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/>.
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/mainLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".misc.Assistant">

    <ImageButton
        android:id="@+id/microphoneButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_gravity="center_horizontal"
        android:background="@android:color/transparent"
        android:contentDescription="start_recognition"
        android:nestedScrollingEnabled="true"
        android:onClick="onMicClick"
        android:paddingLeft="15px"
        android:src="@drawable/microphone"
        tools:clickable="true" />

    <ImageButton
        android:id="@+id/settingsButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:background="?android:attr/selectableItemBackground"
        android:clickable="true"
        android:contentDescription="settings"
        android:onClick="onMenuClick"
        android:paddingTop="10px"
        android:src="@drawable/settings" />

    <TextView
        android:id="@+id/recognisedText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/microphoneButton"
        android:layout_alignParentEnd="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentStart="true"
        android:layout_alignWithParentIfMissing="false"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center_horizontal|bottom"
        android:layout_marginBottom="10dp"
        android:gravity="center"
        android:singleLine="false"
        android:textColor="#ffffffff"
        android:textSize="22sp" />

    <TextView
        android:id="@+id/assistantAnswer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentStart="true"
        android:layout_gravity="top|center_horizontal"
        android:gravity="center"
        android:textColor="@android:color/background_light"
        android:textIsSelectable="false"
        android:textSize="24sp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/notSpeakingAnymore"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/recognisedText"
        android:layout_centerHorizontal="true"
        android:background="?android:attr/selectableItemBackground"
        android:clickable="true"
        android:gravity="center"
        android:onClick="onCancelClick"
        android:text="not_speaking_anymore"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="#fffbff00"
        android:textIsSelectable="false"
        android:textSize="22sp"
        android:textStyle="bold"
        android:visibility="invisible" />

    <FrameLayout
        android:id="@+id/frameLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignLeft="@+id/notSpeakingAnymore"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="false"
        android:layout_alignParentRight="true"
        android:layout_alignStart="@+id/notSpeakingAnymore"
        android:layout_below="@+id/recognisedText"
        android:background="#80000000"
        android:clickable="true"
        android:focusable="false"
        android:visibility="gone"></FrameLayout>

    <TextView
        android:id="@+id/problem"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignTop="@+id/settingsButton"
        android:layout_alignWithParentIfMissing="false"
        android:layout_gravity="center_horizontal|bottom"
        android:layout_toLeftOf="@+id/microphoneButton"
        android:layout_toStartOf="@+id/microphoneButton"
        android:autoLink="all"
        android:clickable="true"
        android:contentDescription="problem_button"
        android:gravity="center"
        android:linksClickable="false"
        android:onClick="onNotWorkingClick"
        android:text="problem"
        android:textColor="#ffffffff"
        android:textSize="18sp" />

    <EditText
        android:id="@+id/commandEditText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/settingsButton"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/recognisedText"
        android:layout_toLeftOf="@+id/microphoneButton"
        android:layout_toStartOf="@+id/microphoneButton"
        android:background="@android:color/white"
        android:ems="10"
        android:hint="write_command"
        android:inputType="text"
        android:padding="5dp" />

    <RelativeLayout
        android:id="@+id/sourceLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/assistantAnswer"
        android:layout_marginTop="10dp"
        android:animateLayoutChanges="false"
        android:background="@drawable/external_source_shape"
        android:padding="10dp"
        android:visibility="gone"></RelativeLayout>

</RelativeLayout>
