<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ F7cloud Talk - Android Client
  ~
  ~ SPDX-FileCopyrightText: 2023 Andy Scherzinger <info@andy-scherzinger.de>
  ~ SPDX-FileCopyrightText: 2022 Tim Krüger <t@timkrueger.me>
  ~ SPDX-FileCopyrightText: 2021-2025 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:id="@+id/callLayout"
    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="match_parent"
            android:background="@color/grey950"
            android:visibility="visible"
            tools:ignore="UselessParent"
            tools:visibility="visible">

            <LinearLayout
                android:id="@+id/call_indicator_controls"
                android:layout_width="match_parent"
                android:layout_height="20dp"
                android:layout_margin="20dp"
                android:animateLayoutChanges="true"
                android:background="@android:color/transparent"
                android:orientation="horizontal"
                android:weightSum="1">
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:animateLayoutChanges="true"
                android:gravity="center"
                android:orientation="vertical"
                android:paddingTop="10dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingStart="20dp"
                    android:paddingEnd="20dp">

                    <TextView
                        android:id="@+id/callConversationNameTextView"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:ellipsize="end"
                        android:maxLines="1"
                        android:textColor="@color/white"
                        android:textSize="16sp"
                        android:textStyle="bold"
                        tools:text="Marsellus Wallace" />

                    <ImageView
                        android:id="@+id/call_recording_indicator"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:contentDescription="@null"
                        android:src="@drawable/record_stop"
                        android:translationZ="2dp"
                        android:visibility="gone"
                        tools:visibility="visible">
                    </ImageView>

                    <TextView
                        android:id="@+id/call_duration"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ellipsize="end"
                        android:maxLines="1"
                        android:minWidth="60dp"
                        android:textAlignment="center"
                        android:textColor="@color/white"
                        android:textSize="16sp"
                        tools:text="01:20:22"/>
                </LinearLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1">

                    <androidx.compose.ui.platform.ComposeView
                        android:id="@+id/composeParticipantGrid"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignBottom="@id/composeParticipantGrid"
                        android:gravity="center_vertical"
                        android:orientation="vertical">

                        <RelativeLayout
                            android:layout_width="match_parent"
                            android:layout_height="300dp"
                            tools:ignore="UselessParent">

                            <RelativeLayout
                                android:id="@+id/reaction_animation_wrapper"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_marginStart="50dp"
                                android:layout_marginBottom="50dp"/>

                            <com.google.android.flexbox.FlexboxLayout
                                android:id="@+id/flexboxLayout"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_alignParentBottom="true"
                                android:layout_marginEnd="@dimen/standard_margin"
                                android:layout_marginBottom="@dimen/standard_half_margin"
                                app:alignItems="center"
                                app:flexDirection="row"
                                app:justifyContent="flex_end">

                                <com.google.android.material.button.MaterialButton
                                    android:id="@+id/end_call_popup_menu"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:layout_marginEnd="8dp"
                                    android:backgroundTint="@android:color/white"
                                    android:textColor="@android:color/holo_red_light"
                                    android:visibility="gone"
                                    app:icon="@drawable/ic_call_end_white_24px"
                                    app:iconGravity="textEnd"
                                    app:iconPadding="16dp"
                                    app:iconTint="@android:color/holo_red_light"
                                    tools:text="@string/end_call_for_everyone"
                                    tools:visibility="visible"/>

                                <com.google.android.material.floatingactionbutton.FloatingActionButton
                                    android:id="@+id/lower_hand_button"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:contentDescription="@string/lower_hand"
                                    android:visibility="gone"
                                    app:backgroundTint="@color/call_buttons_background"
                                    app:borderWidth="0dp"
                                    app:fabCustomSize="40dp"
                                    app:shapeAppearance="@style/fab_3_rounded"
                                    app:srcCompat="@drawable/ic_baseline_do_not_touch_24"
                                    app:tint="@color/white"
                                    tools:visibility = "visible"/>

                            </com.google.android.flexbox.FlexboxLayout>

                        </RelativeLayout>

                    </LinearLayout>

                </RelativeLayout>

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/callControls"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="30dp"
                    android:animateLayoutChanges="true"
                    android:background="@android:color/transparent"
                    android:gravity="center"
                    android:minHeight="@dimen/call_controls_height"
                    android:orientation="horizontal"
                    android:paddingStart="@dimen/standard_half_padding"
                    android:paddingEnd="@dimen/standard_half_padding"
                    app:alignItems="center"
                    app:flexWrap="wrap"
                    app:justifyContent="center">

                    <com.google.android.material.floatingactionbutton.FloatingActionButton
                        android:id="@+id/pictureInPictureButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="@dimen/standard_quarter_margin"
                        android:contentDescription="@string/nc_call_button_content_description_pip"
                        app:backgroundTint="@color/call_buttons_background"
                        app:borderWidth="0dp"
                        app:fabCustomSize="@dimen/fab_small"
                        app:shapeAppearance="@style/fab_3_rounded"
                        app:srcCompat="@drawable/ic_baseline_picture_in_picture_alt_24"
                        app:tint="@color/white" />

                    <com.google.android.material.floatingactionbutton.FloatingActionButton
                        android:id="@+id/audioOutputButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="@dimen/standard_quarter_margin"
                        android:contentDescription="@string/nc_call_button_content_description_audio_output"
                        app:backgroundTint="@color/call_buttons_background"
                        app:borderWidth="0dp"
                        app:fabCustomSize="40dp"
                        app:shapeAppearance="@style/fab_3_rounded"
                        app:srcCompat="@drawable/ic_volume_mute_white_24dp"
                        app:tint="@color/white" />

                    <com.google.android.material.floatingactionbutton.FloatingActionButton
                        android:id="@+id/cameraButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="@dimen/standard_quarter_margin"
                        android:alpha="0.7"
                        android:contentDescription="@string/nc_call_button_content_description_camera"
                        app:backgroundTint="@color/call_buttons_background"
                        app:borderWidth="0dp"
                        app:fabCustomSize="40dp"
                        app:shapeAppearance="@style/fab_3_rounded"
                        app:srcCompat="@drawable/ic_videocam_white_24px"
                        app:tint="@color/white" />

                    <com.google.android.material.floatingactionbutton.FloatingActionButton
                        android:id="@+id/microphoneButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="@dimen/standard_quarter_margin"
                        android:alpha="0.7"
                        android:contentDescription="@string/nc_call_button_content_description_microphone"
                        app:backgroundTint="@color/call_buttons_background"
                        app:borderWidth="0dp"
                        app:fabCustomSize="40dp"
                        app:shapeAppearance="@style/fab_3_rounded"
                        app:srcCompat="@drawable/ic_mic_off_white_24px"
                        app:tint="@color/white" />

                    <com.google.android.material.floatingactionbutton.FloatingActionButton
                        android:id="@+id/more_call_actions"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="@dimen/standard_quarter_margin"
                        android:contentDescription="@string/nc_common_more_options"
                        app:backgroundTint="@color/call_buttons_background"
                        app:borderWidth="0dp"
                        app:fabCustomSize="40dp"
                        app:shapeAppearance="@style/fab_3_rounded"
                        app:srcCompat="@drawable/ic_dots_horizontal_white"
                        app:tint="@color/white" />

                    <com.google.android.material.floatingactionbutton.FloatingActionButton
                        android:id="@+id/hangupButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="@dimen/standard_quarter_margin"
                        android:contentDescription="@string/end_call"
                        app:backgroundTint="@color/nc_darkRed"
                        app:borderWidth="0dp"
                        app:fabCustomSize="40dp"
                        app:shapeAppearance="@style/fab_3_rounded"
                        app:srcCompat="@drawable/ic_call_end_white_24px"
                        app:tint="@color/white" />
                </com.google.android.flexbox.FlexboxLayout>
            </LinearLayout>

            <FrameLayout
                android:id="@+id/selfVideoViewWrapper"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginStart="20dp"
                android:layout_marginTop="100dp">

                <androidx.compose.ui.platform.ComposeView
                    android:id="@+id/selfVideoComposeView"
                    android:layout_width="80dp"
                    android:layout_height="104dp"
                    android:visibility="visible" />
            </FrameLayout>

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

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

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

        <ImageView
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:layout_centerInParent="true"
            app:srcCompat="@drawable/ic_circular_group"
            tools:ignore="ContentDescription" />

        <org.webrtc.SurfaceViewRenderer
            android:id="@+id/pipSelfVideoRenderer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:clickable="false"
            tools:visibility="gone" />

    </RelativeLayout>

    <androidx.compose.ui.platform.ComposeView
        android:id="@+id/screenShareFullscreenView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout>
