<?xml version="1.0" encoding="utf-8"?>
<!--
 ~ Copyright (C) 2016 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.dialer.callcomposer.cameraui.CameraMediaChooserView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/camera_view"
  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.dialer.callcomposer.camera.HardwareCameraPreview
      android:id="@+id/camera_preview"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_gravity="center" />

    <com.android.dialer.callcomposer.camera.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"/>

    <ImageView
      android:id="@+id/preview_image_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:scaleType="centerCrop"
      android:background="#000000"
      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="match_parent"
      android:background="@android:color/transparent"
      android:padding="16dp"
      android:layout_gravity="bottom">

      <ImageButton
        android:id="@+id/camera_fullscreen"
        android:layout_width="@dimen/camera_view_button_size"
        android:layout_height="@dimen/camera_view_button_size"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/camera_view_button_margin"
        android:layout_marginBottom="@dimen/camera_view_button_margin"
        android:src="@drawable/quantum_ic_fullscreen_white_48"
        android:background="?android:attr/selectableItemBackgroundBorderless"
        android:contentDescription="@string/description_camera_switch_full_screen"/>

      <ImageButton
        android:id="@+id/camera_exit_fullscreen"
        android:layout_width="@dimen/camera_view_button_size"
        android:layout_height="@dimen/camera_view_button_size"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/camera_view_button_margin"
        android:layout_marginBottom="@dimen/camera_view_button_margin"
        android:src="@drawable/quantum_ic_fullscreen_exit_white_48"
        android:visibility="gone"
        android:background="?android:attr/selectableItemBackgroundBorderless"
        android:contentDescription="@string/description_camera_switch_preview_screen"/>

      <ImageButton
        android:id="@+id/camera_capture_button"
        android:layout_width="@dimen/capture_button_size"
        android:layout_height="@dimen/capture_button_size"
        android:layout_gravity="bottom|center_horizontal"
        android:layout_marginBottom="@dimen/capture_button_bottom_margin"
        android:background="?android:attr/selectableItemBackgroundBorderless"
        android:src="@drawable/ic_capture"
        android:scaleType="fitXY"
        android:contentDescription="@string/description_camera_take_picture"/>

      <ImageButton
        android:id="@+id/swap_camera_button"
        android:layout_width="@dimen/camera_view_button_size"
        android:layout_height="@dimen/camera_view_button_size"
        android:layout_gravity="start|bottom"
        android:layout_marginStart="@dimen/camera_view_button_margin"
        android:layout_marginBottom="@dimen/camera_view_button_margin"
        android:src="@drawable/front_back_switch_button_animation"
        android:background="@drawable/transparent_button_background"/>

      <ImageButton
        android:id="@+id/camera_cancel_button"
        android:layout_width="@dimen/camera_view_button_size"
        android:layout_height="@dimen/camera_view_button_size"
        android:layout_gravity="start|bottom"
        android:layout_marginStart="@dimen/camera_view_button_margin"
        android:layout_marginBottom="@dimen/camera_view_button_margin"
        android:visibility="gone"
        android:background="@drawable/transparent_button_background"
        android:src="@drawable/quantum_ic_undo_white_48"
        android:contentDescription="@string/description_camera_cancel_photo" />
    </FrameLayout>
  </FrameLayout>

  <ProgressBar
    android:id="@+id/loading"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:visibility="gone"/>
</com.android.dialer.callcomposer.cameraui.CameraMediaChooserView>