<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2013 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->

<!-- In-call onscreen touch UI elements, used on some platforms.

     This layout is a fullscreen overlay, drawn on top of the
     non-touch-sensitive parts of the in-call UI (i.e. the call card).

     The top-level View here is a InCallTouchUi (FrameLayout) with 2 children:
       (1) inCallControls: the widgets visible while a regular call (or calls) is in progress
       (2) incomingCallWidget: the UI displayed while an incoming call is ringing
     In usual cases, one of these is visible at any given moment.
     One exception is when incomingCallWidget is fading-out. At that moment, we show
     inCallControls beneath incomingCallWidget for smoother transition.
     -->

<!-- Main cluster of onscreen buttons on the lower part of the screen. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/bottomButtons"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_margin="0dp"
    android:padding="0dp"
    android:background="@color/button_background_color"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:animateLayoutChanges="true"
    android:visibility="invisible" >

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom|center_horizontal"
        android:baselineAligned="false">

        <!-- This row only ever shows either 4 or 5 buttons. This may depend on whether the device
             supports "Hold" (i.e. 4 buttons on CDMA devices, 5 buttons on GSM devices.) or whether
             it is in a video call.

             There are a couple of *pairs* of buttons that share a single "slot", namely Hold/Swap
             and Add/Merge.  For these, the code in InCallTouchUi is responsible for making sure
             that at any point exactly one of the pair is VISIBLE and the other is GONE.

             If there are more than 5 buttons eligible to be shown, the presenter is responsible for
             collapsing those options into an overflow menu, which appears as one of the buttons
             in the row instead. -->

        <!-- FAR LEFT SLOT ===================================================================== -->

        <!-- "Audio mode". this is a multi-mode button that can behave either like a simple
             "compound button" with two states *or* like an action button that brings up a popup
             menu; see btn_compound_audio.xml and CallButtonFragment.updateAudioButtons(). -->
        <ToggleButton android:id="@+id/audioButton"
            style="@style/InCallCompoundButton"
            android:background="@drawable/btn_compound_audio"
            android:contentDescription="@string/audio_mode_speaker" />

        <!-- "Change to audio call" for video calls. -->
        <ImageButton android:id="@+id/changeToVoiceButton"
            style="@style/InCallButton"
            android:background="@drawable/btn_change_to_voice"
            android:contentDescription="@string/onscreenChangeToVoiceText"
            android:visibility="gone" />

        <!-- MIDDLE LEFT SLOT ================================================================== -->

        <!-- "Mute" -->
        <ToggleButton android:id="@+id/muteButton"
            style="@style/InCallCompoundButton"
            android:background="@drawable/btn_compound_mute"
            android:contentDescription="@string/onscreenMuteText" />

        <!-- CENTER SLOT ======================================================================= -->

        <!-- "Dialpad" -->
        <ToggleButton android:id="@+id/dialpadButton"
            style="@style/InCallCompoundButton"
            android:background="@drawable/btn_compound_dialpad"
            android:contentDescription="@string/onscreenShowDialpadText" />

        <!-- MIDDLE RIGHT SLOT ================================================================= -->

        <!-- This slot is either "Hold" or "Swap", depending on the state of the call. One or the
             other of these must always be set to GONE. -->

        <!-- "Hold" -->
        <ToggleButton android:id="@+id/holdButton"
            style="@style/InCallCompoundButton"
            android:background="@drawable/btn_compound_hold"
            android:contentDescription="@string/onscreenHoldText" />

        <!-- "Swap" (or "Manage calls" in some CDMA states) -->
        <ImageButton android:id="@+id/swapButton"
            style="@style/InCallButton"
            android:background="@drawable/btn_swap"
            android:contentDescription="@string/onscreenSwapCallsText"
            android:visibility="gone" />

        <!-- "Change to video call" -->
        <ImageButton android:id="@+id/changeToVideoButton"
            style="@style/InCallButton"
            android:background="@drawable/btn_change_to_video"
            android:contentDescription="@string/onscreenVideoCallText"
            android:visibility="gone" />

        <!-- "Switch camera" for video calls. -->
        <ToggleButton android:id="@+id/switchCameraButton"
            style="@style/InCallCompoundButton"
            android:background="@drawable/btn_compound_video_switch"
            android:contentDescription="@string/onscreenSwitchCameraText"
            android:visibility="gone" />

        <!-- FAR RIGHT SLOT ==================================================================== -->

        <!-- This slot is either "Add" or "Merge", depending on the state of the call.  One or the
             other of these must always be set to GONE. -->

        <!-- "Add Call" -->
        <ImageButton android:id="@+id/addButton"
            style="@style/InCallButton"
            android:background="@drawable/btn_add"
            android:contentDescription="@string/onscreenAddCallText"
            android:visibility="gone" />

        <!-- "Merge calls". This button is used only on GSM devices, where we know that "Add" and
             "Merge" are never available at the same time. The "Merge" button for CDMA devices is
             "cdmaMergeButton" above. -->
        <ImageButton android:id="@+id/mergeButton"
            style="@style/InCallButton"
            android:background="@drawable/btn_merge"
            android:contentDescription="@string/onscreenMergeCallsText"
            android:visibility="gone" />

        <!-- "Switch camera" for video calls. -->
        <ToggleButton android:id="@+id/pauseVideoButton"
            style="@style/InCallCompoundButton"
            android:background="@drawable/btn_compound_video_off"
            android:contentDescription="@string/onscreenPauseVideoText"
            android:visibility="gone" />

        <!-- "Overflow" -->
        <ImageButton android:id="@+id/overflowButton"
            style="@style/InCallButton"
            android:background="@drawable/btn_overflow"
            android:contentDescription="@string/onscreenOverflowText"
            android:visibility="gone" />

    </LinearLayout>

</LinearLayout>