<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="@dimen/space_lg">

    <!-- Header: app glyph + name, Settings on the right. -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:layout_marginBottom="@dimen/space_lg">

        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:src="@drawable/ic_launcher_foreground"
            android:scaleType="fitCenter"
            android:contentDescription="@null"/>

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_marginStart="@dimen/space_sm"
            android:text="@string/app_name"
            android:textColor="@color/on_surface"
            android:textSize="22sp"
            android:textStyle="bold"/>

        <ImageButton
            android:id="@+id/settings"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:src="@drawable/ic_settings"
            android:scaleType="centerInside"
            android:background="?android:attr/selectableItemBackgroundBorderless"
            android:contentDescription="@string/settings"/>

    </LinearLayout>

    <!-- Pairing form. Fields are grouped and labelled by where their
         value comes from on the target's Wireless debugging screen. -->
    <LinearLayout
        style="@style/Card"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            style="@style/SectionHeader"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/pair_a_device"/>

        <TextView
            style="@style/Caption"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pair_help"/>

        <TextView
            style="@style/FieldLabel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/label_host"/>

        <EditText
            android:id="@+id/host"
            style="@style/Field"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/host_hint"
            android:inputType="text"
            android:autofillHints="postalAddress"/>

        <TextView
            style="@style/FieldLabel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/label_pairing"/>

        <TextView
            style="@style/Caption"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/sub_pairing"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginTop="@dimen/space_xs">

            <EditText
                android:id="@+id/pair_port"
                style="@style/Field"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginEnd="@dimen/space_sm"
                android:hint="@string/pair_port_hint"
                android:inputType="number"
                android:autofillHints="off"/>

            <EditText
                android:id="@+id/pair_code"
                style="@style/Field"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:hint="@string/pair_code_hint"
                android:inputType="numberPassword"
                android:maxLength="6"
                android:autofillHints="off"/>

        </LinearLayout>

        <TextView
            style="@style/FieldLabel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/label_connect"/>

        <TextView
            style="@style/Caption"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/sub_connect"/>

        <EditText
            android:id="@+id/connect_port"
            style="@style/Field"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/space_xs"
            android:hint="@string/connect_port_hint"
            android:inputType="number"
            android:autofillHints="off"/>

        <Button
            android:id="@+id/pair"
            style="@style/Button.Primary"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/space_lg"
            android:text="@string/pair_and_save"/>

    </LinearLayout>

    <TextView
        style="@style/SectionHeader"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/saved_devices"/>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <ListView
            android:id="@+id/devices"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:divider="@color/stroke"
            android:dividerHeight="1dp"/>

        <TextView
            android:id="@+id/devices_empty"
            style="@style/Note"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:paddingTop="@dimen/space_xl"
            android:text="@string/no_devices_yet"/>

    </FrameLayout>

</LinearLayout>
