<?xml version="1.0" encoding="utf-8"?><!--
  ~ Nextcloud Talk application
  ~
  ~ @author Mario Danic
  ~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
  ~ @author Marcel Hibbe
  ~ Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.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/>.
  -->

<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:id="@+id/controllerCallLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:orientation="vertical"
    tools:context=".activities.CallActivity">

    <LinearLayout
        android:id="@+id/linearWrapperLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <RelativeLayout
            android:id="@+id/conversationRelativeLayout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:background="@color/grey950"
            android:visibility="visible"
            tools:visibility="visible">

            <GridView
                android:id="@+id/gridview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:numColumns="2"
                android:scrollbars="vertical"
                android:stretchMode="columnWidth" />

            <FrameLayout
                android:id="@+id/selfVideoViewWrapper"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <org.webrtc.SurfaceViewRenderer
                    android:id="@+id/selfVideoRenderer"
                    android:layout_width="@dimen/large_preview_dimension"
                    android:layout_height="150dp"
                    android:layout_gravity="center"
                    android:layout_margin="16dp"
                    android:clickable="false"
                    android:visibility="invisible"
                    tools:visibility="visible" />

                <com.facebook.drawee.view.SimpleDraweeView
                    android:id="@+id/switchSelfVideoButton"
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_gravity="center_horizontal|bottom"
                    android:layout_marginBottom="20dp"
                    app:placeholderImage="@drawable/ic_switch_video_white_24px"
                    app:roundAsCircle="true" />
            </FrameLayout>

            <LinearLayout
                android:id="@+id/callInfosLinearLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:animateLayoutChanges="true"
                android:gravity="center"
                android:orientation="vertical"
                android:paddingTop="20dp">

                <TextView
                    android:id="@+id/callModeTextView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textAlignment="center"
                    android:textColor="@color/controller_call_incomingCallTextView"
                    android:textSize="16sp"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:text="Voice Call" />

                <TextView
                    android:id="@+id/callConversationNameTextView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="15dp"
                    android:ellipsize="marquee"
                    android:textAlignment="center"
                    android:textColor="@color/white"
                    android:textSize="22sp"
                    android:textStyle="bold"
                    tools:text="Marsellus Wallace" />
            </LinearLayout>

            <View
                android:id="@+id/verticalCenter"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true" />

            <include
                android:id="@+id/callStates"
                layout="@layout/call_states"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignTop="@id/verticalCenter"
                android:layout_marginTop="-50dp" />
        </RelativeLayout>

    </LinearLayout>

    <LinearLayout
        android:id="@+id/callControls"
        android:layout_width="match_parent"
        android:layout_height="@dimen/call_controls_height"
        android:layout_alignBottom="@id/linearWrapperLayout"
        android:animateLayoutChanges="true"
        android:background="@android:color/transparent"
        android:gravity="center"
        android:orientation="horizontal"
        android:weightSum="5">

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/pictureInPictureButton"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginStart="20dp"
            android:layout_marginEnd="10dp"
            android:elevation="10dp"
            app:backgroundImage="@color/call_buttons_background"
            app:placeholderImage="@drawable/ic_baseline_picture_in_picture_alt_24"
            app:roundAsCircle="true"
            android:layout_weight="1"/>

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/audioOutputButton"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginStart="10dp"
            android:layout_marginEnd="10dp"
            app:backgroundImage="@color/call_buttons_background"
            app:placeholderImage="@drawable/ic_volume_mute_white_24dp"
            app:roundAsCircle="true"
            android:layout_weight="1"/>

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/cameraButton"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginStart="10dp"
            android:layout_marginEnd="10dp"
            android:alpha="0.7"
            app:backgroundImage="@color/call_buttons_background"
            app:placeholderImage="@drawable/ic_videocam_white_24px"
            app:roundAsCircle="true"
            android:layout_weight="1"/>

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/microphoneButton"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginStart="10dp"
            android:layout_marginEnd="10dp"
            android:alpha="0.7"
            app:backgroundImage="@color/call_buttons_background"
            app:placeholderImage="@drawable/ic_mic_off_white_24px"
            app:roundAsCircle="true"
            android:layout_weight="1"/>

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/hangupButton"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginStart="10dp"
            android:layout_marginEnd="20dp"
            app:backgroundImage="@color/nc_darkRed"
            app:placeholderImage="@drawable/ic_call_end_white_24px"
            app:roundAsCircle="true"
            android:layout_weight="1"/>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/pipGroupCallOverlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@color/black"
        android:gravity="center"
        android:visibility="gone">

        <TextView
            android:id="@+id/pipCallConversationNameTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="-30dp"
            android:layout_marginBottom="15dp"
            android:layout_marginStart="5dp"
            android:layout_marginEnd="5dp"
            android:textAlignment="center"
            android:maxLines="3"
            android:ellipsize="end"
            android:textColor="@color/white"
            android:textSize="16sp"
            tools:text="our group call" />

        <com.facebook.drawee.view.SimpleDraweeView
            android:layout_width="80dp"
            android:layout_height="80dp"
            app:backgroundImage="@drawable/ic_circular_group"
            app:roundAsCircle="true" />

    </LinearLayout>

</RelativeLayout>
