<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="4dp"
    android:layout_marginRight="4dp"
    android:background="@color/version_release"
    tools:context="com.mobileer.oboetester.MainActivity">

    <TextView
        android:id="@+id/versionText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="V?"
        app:layout_constraintEnd_toEndOf="@+id/buttonGrid"
        app:layout_constraintStart_toStartOf="@+id/buttonGrid"
        />

    <GridLayout
        android:id="@+id/buttonGrid"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:columnCount="2"
        app:layout_constraintTop_toBottomOf="@+id/versionText">

        <Button
            android:id="@+id/buttonTestOutput"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_columnWeight="1"
            android:layout_gravity="fill"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchTestOutput"
            android:text="Test Output" />

        <Button
            android:id="@+id/buttonTestInput"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchTestInput"
            android:text="Test Input" />

        <Button
            android:id="@+id/buttonTapToTone"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_columnWeight="1"
            android:layout_gravity="fill"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchTapToTone"
            android:text="Tap to Tone Latency" />

        <Button
            android:id="@+id/button_rt_latency"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchRoundTripLatency"
            android:text="Round Trip Latency" />

        <Button
            android:id="@+id/buttonEcho"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchEcho"
            android:text="Echo Input to Output" />

        <Button
            android:id="@+id/buttonRecorder"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchRecorder"
            android:text="Record and Play"
            />

        <Button
            android:id="@+id/button_manual_glitches"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchManualGlitchTest"
            android:text="Glitch Test" />

        <Button
            android:id="@+id/button_auto_glitches"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchAutoGlitchTest"
            android:text="Auto Glitch Test" />

        <Button
            android:id="@+id/button_test_disconnect"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchTestDisconnect"
            android:text="Test Disconnect" />

        <Button
            android:id="@+id/button_test_device_report"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchTestDeviceReport"
            android:text="@string/title_report_devices" />

        <Button
            android:id="@+id/button_test_data_paths"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchTestDataPaths"
            android:text="Data Paths" />

        <Button
            android:id="@+id/button_extra_tests"
            android:layout_gravity="fill"
            android:layout_width="0dp"
            android:layout_columnWeight="1"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/button_tint"
            android:onClick="onLaunchExtratests"
            android:text="Extras..." />

    </GridLayout>


    <CheckBox
        android:id="@+id/useCallback"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="true"
        android:onClick="onUseCallbackClicked"
        android:text="Use Callback"
        app:layout_constraintEnd_toStartOf="@+id/textView"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/buttonGrid" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="4dp"
        android:text="Size:"
        app:layout_constraintBaseline_toBaselineOf="@+id/useCallback"
        app:layout_constraintEnd_toStartOf="@+id/callbackSize"
        app:layout_constraintStart_toEndOf="@+id/useCallback" />

    <EditText
        android:id="@+id/callbackSize"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:ems="8"
        android:inputType="number"
        android:text="0"
        app:layout_constraintBaseline_toBaselineOf="@+id/textView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/textView" />

    <LinearLayout
        android:id="@+id/layoutBluetoothSco"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintStart_toStartOf="@+id/callbackSize"
        app:layout_constraintTop_toBottomOf="@+id/callbackSize"
        >
        <CheckBox
            android:id="@+id/setBluetoothScoOn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="6dp"
            android:checked="false"
            android:onClick="onStartStopBluetoothSco"
            android:text="start/stopBluetoothSco()"
            />

        <TextView
            android:id="@+id/textBluetoothScoStatus"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginStart="12sp"
            android:text="\?" />
    </LinearLayout>

    <CheckBox
        android:id="@+id/boxEnableWorkarounds"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="6dp"
        android:checked="false"
        android:text="enable Oboe workarounds"
        app:layout_constraintStart_toStartOf="@+id/layoutBluetoothSco"
        app:layout_constraintTop_toBottomOf="@+id/layoutBluetoothSco" />

    <CheckBox
        android:id="@+id/boxEnableBackground"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="6dp"
        android:checked="false"
        android:text="enable background operation"
        app:layout_constraintStart_toStartOf="@+id/boxEnableWorkarounds"
        app:layout_constraintTop_toBottomOf="@+id/boxEnableWorkarounds" />


    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Mode:"
        app:layout_constraintBaseline_toBaselineOf="@+id/spinnerAudioMode"
        app:layout_constraintStart_toStartOf="@+id/boxEnableBackground" />

    <Spinner
        android:id="@+id/spinnerAudioMode"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:entries="@array/audio_modes"
        android:prompt="@string/audio_mode_prompt"
        app:layout_constraintStart_toEndOf="@+id/textView2"
        app:layout_constraintTop_toBottomOf="@+id/boxEnableBackground" />

    <TextView
        android:id="@+id/deviceView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:lines="1"
        android:text="@string/init_device"
        app:layout_constraintStart_toStartOf="@+id/textView2"
        app:layout_constraintTop_toBottomOf="@+id/spinnerAudioMode" />

    <TextView
        android:id="@+id/text_build_info"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="1dp"
        android:ems="10"
        android:text="V?"
        app:layout_constraintEnd_toEndOf="@+id/callbackSize"
        app:layout_constraintStart_toStartOf="@+id/deviceView"
        app:layout_constraintTop_toBottomOf="@+id/deviceView" />

</android.support.constraint.ConstraintLayout>
