<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2017 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.
  -->
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".MainActivity">

    <!-- Audio API container -->
    <LinearLayout
        android:id="@+id/audioApisContainer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:orientation="horizontal"
        >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/audio_api"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:id="@+id/audioApisTitleText"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_gravity="center_vertical"
            />
        <Spinner
            android:id="@+id/audioApiSpinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_gravity="center_vertical"/>
    </LinearLayout>

    <!-- Playback device container -->
    <LinearLayout
        android:id="@+id/playbackDevicesContainer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintTop_toBottomOf="@id/audioApisContainer"
        app:layout_constraintLeft_toLeftOf="parent">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/playback_device"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:id="@+id/playbackDeviceTitleText"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_gravity="center_vertical"/>

        <com.google.oboe.samples.audio_device.AudioDeviceSpinner
            android:id="@+id/playbackDevicesSpinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_gravity="center_vertical"/>
    </LinearLayout>

    <!-- Channel count container -->
    <LinearLayout
        android:id="@+id/channelCountContainer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintTop_toBottomOf="@id/playbackDevicesContainer"
        app:layout_constraintLeft_toLeftOf="parent">
        <TextView
            android:id="@+id/channelCountTitleText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:text="Channel count"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:layout_gravity="center_vertical"/>
        <Spinner
            android:id="@+id/channelCountSpinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:layout_gravity="center_vertical"/>
    </LinearLayout>

    <!-- Buffer size container -->
    <LinearLayout
        android:id="@+id/bufferSizeContainer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintTop_toBottomOf="@id/channelCountContainer"
        app:layout_constraintLeft_toLeftOf="parent">
        <TextView
            android:id="@+id/bufferSizeTitleText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:text="@string/buffer_size_title"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:layout_gravity="center_vertical"/>

        <Spinner
            android:id="@+id/bufferSizeSpinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_marginStart="@dimen/activity_horizontal_margin"
            android:layout_gravity="center_vertical"/>
    </LinearLayout>

    <!-- Audio stream latency -->
    <TextView
        android:id="@+id/latencyText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginTop="12dp"
        android:text="@string/latency"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/bufferSizeContainer"
        android:layout_marginStart="@dimen/activity_horizontal_margin" />

    <!-- User instructions -->
    <TextView
        android:id="@+id/userInstructionView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginTop="20dp"
        android:lines="3"
        android:text="@string/init_status"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/latencyText"
        android:layout_marginStart="@dimen/activity_horizontal_margin" />
</androidx.constraintlayout.widget.ConstraintLayout>
