aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/main/res/layout/tunnel_detail_fragment.xml
blob: 0bb3558c5800e482aad876ebe3502f5b4d0b5a26 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?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.backend.Tunnel.State" />

        <import type="com.wireguard.android.util.ClipboardUtils" />

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

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

        <variable
            name="config"
            type="com.wireguard.config.Config" />
    </data>

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="?attr/colorBackground"
        android:clickable="true"
        android:focusable="true">
        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/tunnel_detail_card"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="8dp"
                android:layout_marginBottom="8dp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

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

                    <com.google.android.material.textview.MaterialTextView
                        android:id="@+id/interface_title"
                        style="@style/SectionText"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/interface_title"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <com.wireguard.android.widget.ToggleSwitch
                        android:id="@+id/tunnel_switch"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        app:checked="@{tunnel.state == State.UP}"
                        app:layout_constraintBaseline_toBaselineOf="@+id/interface_title"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:onBeforeCheckedChanged="@{fragment::setTunnelState}" />

                    <TextView
                        android:id="@+id/interface_name_label"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:labelFor="@+id/interface_name_text"
                        android:text="@string/name"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/interface_title" />

                    <TextView
                        android:id="@+id/interface_name_text"
                        style="@style/DetailText"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@{tunnel.name}"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/interface_name_label"
                        tools:text="wg0" />

                    <TextView
                        android:id="@+id/public_key_label"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:labelFor="@+id/public_key_text"
                        android:text="@string/public_key"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@id/interface_name_text" />

                    <TextView
                        android:id="@+id/public_key_text"
                        style="@style/DetailText"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:contentDescription="@string/public_key_description"
                        android:ellipsize="end"
                        android:maxLines="1"
                        android:onClick="@{ClipboardUtils::copyTextView}"
                        android:singleLine="true"
                        android:text="@{config.interface.keyPair.publicKey.toBase64}"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/public_key_label"
                        tools:text="wOs2eguFEohqIZxlSJ1CAT9584tc6ejj9hfGFsoBVkA=" />

                    <TextView
                        android:id="@+id/addresses_label"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:labelFor="@+id/addresses_text"
                        android:text="@string/addresses"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@id/public_key_text" />

                    <TextView
                        android:id="@+id/addresses_text"
                        style="@style/DetailText"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:contentDescription="@string/addresses"
                        android:text="@{config.interface.addresses}"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="@+id/addresses_label"
                        tools:text="fc00:bbbb:bbbb:bb11::3:368b/128" />
                </androidx.constraintlayout.widget.ConstraintLayout>
            </com.google.android.material.card.MaterialCardView>

            <LinearLayout
                android:id="@+id/peers_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:divider="@null"
                android:orientation="vertical"
                app:items="@{config.peers}"
                app:layout="@{@layout/tunnel_detail_peer}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/tunnel_detail_card"
                tools:ignore="UselessLeaf" />
        </androidx.constraintlayout.widget.ConstraintLayout>
    </ScrollView>
</layout>