<?xml version="1.0" encoding="utf-8"?>

<android.support.design.widget.CoordinatorLayout
        xmlns:tools="http://schemas.android.com/tools" android:id="@+id/coordinatorLayout"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".StarterNameActivity">

        <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:id="@+id/WhoStarts" android:text="@string/who_starts"
                app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp"
                android:layout_marginStart="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Headline"
                android:layout_marginTop="8dp" app:layout_constraintTop_toTopOf="parent"/>
        <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                app:layout_constraintTop_toBottomOf="@+id/WhoStarts"
                app:layout_constraintStart_toStartOf="parent"
                android:layout_marginLeft="8dp" android:layout_marginStart="8dp" app:layout_constraintEnd_toEndOf="parent"
                android:layout_marginEnd="8dp" android:layout_marginRight="8dp" android:id="@+id/linearLayout"
                android:layout_margin="8dp">
            <RadioGroup
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_marginTop="8dp"
                    app:layout_constraintTop_toBottomOf="@+id/WhoStarts" android:id="@+id/starterRadioGroup"
                    android:layout_marginStart="8dp" app:layout_constraintStart_toStartOf="parent"
                    android:layout_marginLeft="8dp" app:layout_constraintEnd_toEndOf="parent"
                    android:layout_marginEnd="8dp"
                    android:layout_marginRight="8dp" android:layout_marginBottom="8dp">
                <RadioButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" tools:layout_editor_absoluteY="93dp"
                        tools:layout_editor_absoluteX="16dp" android:id="@+id/radioPlayer1Starts"
                        android:layout_weight="1" android:gravity="top" android:checked="true"/>
                <RadioButton
                        android:layout_height="wrap_content" tools:layout_editor_absoluteY="93dp"
                        tools:layout_editor_absoluteX="16dp" android:id="@+id/radioPlayer2Starts"
                        android:layout_width="wrap_content" android:layout_weight="1"
                        android:gravity="bottom"
                        android:checked="false"/>
            </RadioGroup>
            <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                <AutoCompleteTextView
                        android:text="@string/player_1_default_name"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" tools:layout_editor_absoluteY="48dp"
                        android:id="@+id/player1Name"
                        tools:layout_editor_absoluteX="143dp" android:hint="@string/player_1_default_name"
                        android:selectAllOnFocus="true"
                        android:completionThreshold="1"
                        android:singleLine="true"
                        android:imeOptions="actionNext"/>
                <ImageButton
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" app:srcCompat="@drawable/ic_swap_vert"
                        android:id="@+id/swapNamesButton" android:contentDescription="@string/swap_names"
                        android:onClick="swapNames"/>
                <AutoCompleteTextView
                        android:text="@string/player_2_default_name"
                        tools:layout_editor_absoluteX="136dp" android:id="@+id/player2Name"
                        android:hint="@string/player_2_default_name" android:layout_height="wrap_content"
                        android:layout_width="match_parent" android:selectAllOnFocus="true"
                        android:completionThreshold="1"
                        android:singleLine="true"
                        android:imeOptions="actionNext"/>
            </LinearLayout>
        </LinearLayout>
        <Switch
                android:text="@string/TTS"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:id="@+id/enableTtsSwitch"
                app:layout_constraintStart_toStartOf="parent"
                android:layout_marginLeft="8dp" android:layout_marginStart="8dp" app:layout_constraintEnd_toEndOf="parent"
                android:layout_marginEnd="6dp" android:layout_marginRight="6dp" app:layout_constraintHorizontal_bias="0.0"
                android:layout_marginTop="8dp" app:layout_constraintTop_toBottomOf="@+id/linearLayout"/>
        <Switch
                android:text="@string/STT"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:id="@+id/enableSttSwitch"
                android:layout_marginTop="8dp"
                app:layout_constraintTop_toBottomOf="@+id/enableTtsSwitch" android:layout_marginStart="8dp"
                app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp" android:layout_marginEnd="8dp"
                app:layout_constraintEnd_toEndOf="parent" android:layout_marginRight="8dp"/>
        <Button
                android:text="@string/start"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/startMatchButton"
                style="@android:style/Widget.DeviceDefault.Button"
                android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent" android:layout_marginRight="8dp"
                android:layout_marginBottom="8dp" app:layout_constraintBottom_toBottomOf="parent"
                android:drawableStart="@drawable/ic_new_match"
                android:drawableLeft="@drawable/ic_new_match" android:onClick="startMatch"/>

    </android.support.constraint.ConstraintLayout>

</android.support.design.widget.CoordinatorLayout>