aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/main/res/layout/tv_tunnel_list_item.xml
blob: a48b977b4a2a7faa9eb4273b3b3a04effaaee183 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?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.wireguard.android.model.ObservableTunnel" />

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

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

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

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

        <!-- Unused on TV but we retain this so the existing Adapter and ViewHolder can be reused -->
        <variable
            name="fragment"
            type="com.wireguard.android.fragment.TunnelListFragment" />
    </data>

    <com.google.android.material.card.MaterialCardView
        android:layout_width="300dp"
        android:layout_height="150dp"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="8dp"
        app:cardCornerRadius="12dp">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="16dp">

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/tunnel_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{item.name}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:text="@sample/interface_names.json/names/names/name" />

            <com.wireguard.android.widget.ToggleSwitch
                android:id="@+id/tunnel_toggle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:checked="@{item.state == State.UP}"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:checked="@sample/interface_names.json/names/checked/checked" />

            <!-- TODO: wire in updates here -->
            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/tunnel_transfer"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                tools:text="rx: 200 MB, tx: 100 MB" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </com.google.android.material.card.MaterialCardView>

</layout>