<?xml version="1.0" encoding="utf-8"?>
<layout 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">

    <data>

        <import type="com.getbubblenow.android.model.ObservableTunnel" />

        <import type="com.wireguard.android.backend.Tunnel.State" />

        <variable
            name="collection"
            type="com.getbubblenow.android.databinding.ObservableKeyedArrayList&lt;String, ObservableTunnel&gt;" />

        <variable
            name="key"
            type="String" />

        <variable
            name="item"
            type="com.getbubblenow.android.model.ObservableTunnel" />

        <variable
            name="fragment"
            type="com.getbubblenow.android.fragment.TunnelListFragment" />
    </data>

    <com.getbubblenow.android.widget.MonkeyedTextInputEditText
        android:id="@+id/tunnel_list_item"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/list_item_background"
        android:descendantFocusability="beforeDescendants"
        android:focusable="true"
        android:nextFocusRight="@+id/tunnel_switch"
        android:padding="16dp">

        <TextView
            android:id="@+id/tunnel_name"
            style="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:ellipsize="end"
            android:maxLines="1"
            android:text="@{key}"
            tools:text="@sample/interface_names.json/names/names/name" />

        <com.getbubblenow.android.widget.ToggleSwitch
            android:id="@+id/tunnel_switch"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/tunnel_name"
            android:layout_alignParentEnd="true"
            android:nextFocusLeft="@+id/tunnel_list_item"
            app:checked="@{item.state == State.UP}"
            app:onBeforeCheckedChanged="@{fragment::setTunnelState}"
            tools:checked="@sample/interface_names.json/names/checked/checked" />
    </com.getbubblenow.android.widget.MonkeyedTextInputEditText>
</layout>
