aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/main/res/layout/tv_tunnel_list_item.xml
blob: 1561553646bd87fae70db038085ae72036b9c857 (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
74
75
76
77
78
79
80
81
<?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="android.view.View" />

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

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

        <variable
            name="isDeleting"
            type="androidx.databinding.ObservableBoolean" />

        <variable
            name="isFocused"
            type="androidx.databinding.ObservableBoolean" />

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

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

    <com.google.android.material.card.MaterialCardView
        android:layout_width="225dp"
        android:layout_height="110dp"
        android:layout_margin="8dp"
        android:layout_marginTop="4dp"
        android:layout_marginBottom="0dp"
        android:backgroundTint="@{(item.state == State.UP &amp;&amp; !isDeleting) ? @color/secondary_dark_color : (isDeleting &amp;&amp; isFocused) ? @color/tv_card_delete_background : @color/tv_card_background}"
        android:checkable="true"
        android:focusable="true"
        app:contentPadding="8dp">

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

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

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/tunnel_transfer"
                style="@style/TextAppearance.MaterialComponents.Body1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="@{isDeleting ? View.GONE : View.VISIBLE}"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                tools:text="rx: 200 MB, tx: 100 MB" />

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/tunnel_delete"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/tv_delete"
                android:visibility="@{(isDeleting &amp;&amp; isFocused) ? View.VISIBLE : View.GONE}"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                tools:visibility="gone" />

        </androidx.constraintlayout.widget.ConstraintLayout>

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

</layout>