aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/src/main/res/layout/tunnel_list_item.xml
blob: cf25b83e50a41593bb80e551f63e43dfa469ea4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?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">

    <data>

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

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

        <variable
            name="collection"
            type="com.wireguard.android.util.ObservableKeyedList&lt;String, Tunnel&gt;" />

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

        <variable
            name="item"
            type="com.wireguard.android.model.Tunnel" />

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

    <com.wireguard.android.widget.MultiselectableRelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/list_item_background"
        android:descendantFocusability="blocksDescendants"
        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}" />

        <com.wireguard.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"
            app:checked="@{item.state == State.UP}"
            app:onBeforeCheckedChanged="@{fragment::setTunnelState}" />
    </com.wireguard.android.widget.MultiselectableRelativeLayout>
</layout>