<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2015 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.
-->

<com.android.messaging.ui.mediapicker.CameraMediaChooserView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/black">

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

        <!-- Default to using the hardware rendered camera preview, we will fall back to
        SoftwareCameraPreview in CameraMediaChooserView if needed -->
        <com.android.messaging.ui.mediapicker.HardwareCameraPreview
            android:id="@+id/camera_preview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center" />

        <com.android.messaging.ui.mediapicker.camerafocus.RenderOverlay
            android:id="@+id/focus_visual"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <View
            android:id="@+id/camera_shutter_visual"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white"
            android:visibility="gone" />

        <!-- Need a background on this view in order for the ripple effect to have a place to draw -->
        <FrameLayout
            android:id="@+id/camera_button_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:paddingTop="20dp"
            android:layout_gravity="bottom">

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="start|center_vertical"
                style="@style/CameraChooserFrameStyle">

                <ImageButton
                    android:id="@+id/camera_swap_mode_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="48dp"
                    android:minHeight="48dp"
                    android:background="@drawable/transparent_button_background"
                    android:src="@drawable/ic_mp_video_small_light"
                    android:contentDescription="@string/camera_switch_to_video_mode"/>

                <Chronometer
                    android:id="@+id/camera_video_counter"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@android:color/white"
                    android:textSize="18sp"
                    android:padding="16dp"
                    android:visibility="gone" />

            </FrameLayout>

            <ImageButton
                android:id="@+id/camera_capture_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:minWidth="96dp"
                android:minHeight="96dp"
                android:background="@drawable/transparent_button_background"
                android:src="@drawable/ic_checkmark_large_light"
                android:contentDescription="@string/camera_take_picture"/>

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="end|center_vertical"
                android:paddingEnd="16dp">

                <ImageButton
                    android:id="@+id/camera_fullScreen_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="48dp"
                    android:minHeight="48dp"
                    android:background="@drawable/transparent_button_background"
                    android:src="@drawable/ic_mp_full_screen_light"
                    android:contentDescription="@string/camera_switch_full_screen" />

                <ImageButton
                    android:id="@+id/camera_swapCamera_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="48dp"
                    android:minHeight="48dp"
                    android:background="@drawable/transparent_button_background"
                    android:visibility="gone"
                    android:contentDescription="@string/camera_switch_camera_facing"/>

                <ImageButton
                    android:id="@+id/camera_cancel_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="48dp"
                    android:minHeight="48dp"
                    android:background="@drawable/transparent_button_background"
                    android:src="@drawable/ic_remove_small_light"
                    android:visibility="gone"
                    android:contentDescription="@string/camera_cancel_recording" />

            </FrameLayout>

        </FrameLayout>

    </FrameLayout>

    <!-- This view will hide all other views if the required permission is not granted -->
    <TextView
        android:id="@+id/missing_permission_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="@string/enable_permission_procedure"
        android:contentDescription="@string/enable_permission_procedure_description"
        android:background="@android:color/white"
        android:gravity="center"
        android:visibility="gone" />

</com.android.messaging.ui.mediapicker.CameraMediaChooserView>
