summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main/res/layout/tunnel_detail_peer.xml
blob: 0fbee8f118b44aeb4cd881f2f57711c19a7dfdc2 (plain)
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?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.util.ClipboardUtils" />

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

    <com.google.android.material.card.MaterialCardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp">

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

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

            <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/peer_title" />

            <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"
                android:ellipsize="end"
                android:maxLines="1"
                android:nextFocusDown="@id/pre_shared_key_text"
                android:nextFocusForward="@id/pre_shared_key_text"
                android:onClick="@{ClipboardUtils::copyTextView}"
                android:singleLine="true"
                android:text="@{item.publicKey.toBase64}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/public_key_label"
                tools:text="wOs2eguFEohqIZxlSJ1CAT9584tc6ejj9hfGFsoBVkA=" />

            <TextView
                android:id="@+id/pre_shared_key_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:labelFor="@+id/pre_shared_key_text"
                android:text="@string/pre_shared_key"
                android:visibility="@{!item.preSharedKey.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/public_key_text" />

            <TextView
                android:id="@+id/pre_shared_key_text"
                style="@style/DetailText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:contentDescription="@string/pre_shared_key"
                android:ellipsize="end"
                android:maxLines="1"
                android:nextFocusUp="@id/public_key_text"
                android:nextFocusDown="@id/allowed_ips_text"
                android:nextFocusForward="@id/allowed_ips_text"
                android:singleLine="true"
                android:text="@string/pre_shared_key_enabled"
                android:visibility="@{!item.preSharedKey.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/pre_shared_key_label"
                tools:text="8VyS8W8XeMcBWfKp1GuG3/fZlnUQFkqMNbrdmZtVQIM=" />

            <TextView
                android:id="@+id/allowed_ips_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:labelFor="@+id/allowed_ips_text"
                android:text="@string/allowed_ips"
                android:visibility="@{item.allowedIps.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/pre_shared_key_text" />

            <TextView
                android:id="@+id/allowed_ips_text"
                style="@style/DetailText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:contentDescription="@string/allowed_ips"
                android:nextFocusUp="@id/pre_shared_key_text"
                android:nextFocusDown="@id/endpoint_text"
                android:nextFocusForward="@id/endpoint_text"
                android:onClick="@{ClipboardUtils::copyTextView}"
                android:text="@{item.allowedIps}"
                android:visibility="@{item.allowedIps.isEmpty() ? android.view.View.GONE : android.view.View.VISIBLE}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/allowed_ips_label"
                tools:text="0.0.0.0/5, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3" />

            <TextView
                android:id="@+id/endpoint_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:labelFor="@+id/endpoint_text"
                android:text="@string/endpoint"
                android:visibility="@{!item.endpoint.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/allowed_ips_text" />

            <TextView
                android:id="@+id/endpoint_text"
                style="@style/DetailText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:contentDescription="@string/endpoint"
                android:nextFocusUp="@id/allowed_ips_text"
                android:nextFocusDown="@id/persistent_keepalive_text"
                android:nextFocusForward="@id/persistent_keepalive_text"
                android:onClick="@{ClipboardUtils::copyTextView}"
                android:text="@{item.endpoint}"
                android:visibility="@{!item.endpoint.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/endpoint_label"
                tools:text="192.168.0.1:51820" />

            <TextView
                android:id="@+id/persistent_keepalive_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:labelFor="@+id/persistent_keepalive_text"
                android:text="@string/persistent_keepalive"
                android:visibility="@{!item.persistentKeepalive.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/endpoint_text" />

            <TextView
                android:id="@+id/persistent_keepalive_text"
                style="@style/DetailText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:contentDescription="@string/persistent_keepalive"
                android:nextFocusUp="@id/endpoint_text"
                android:nextFocusDown="@id/transfer_text"
                android:nextFocusForward="@id/transfer_text"
                android:onClick="@{ClipboardUtils::copyTextView}"
                android:text="@{@plurals/persistent_keepalive_seconds_unit(item.persistentKeepalive.orElse(0), item.persistentKeepalive.orElse(0))}"
                android:visibility="@{!item.persistentKeepalive.isPresent() ? android.view.View.GONE : android.view.View.VISIBLE}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/persistent_keepalive_label"
                tools:text="every 3 seconds" />

            <TextView
                android:id="@+id/transfer_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/endpoint_text"
                android:layout_marginTop="8dp"
                android:labelFor="@+id/transfer_text"
                android:text="@string/transfer"
                android:visibility="gone"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/persistent_keepalive_text"
                tools:visibility="visible" />

            <TextView
                android:id="@+id/transfer_text"
                style="@style/DetailText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/transfer_label"
                android:contentDescription="@string/transfer"
                android:nextFocusUp="@id/persistent_keepalive_text"
                android:onClick="@{ClipboardUtils::copyTextView}"
                android:visibility="gone"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/transfer_label"
                tools:text="1024 MB"
                tools:visibility="visible" />
        </androidx.constraintlayout.widget.ConstraintLayout>
    </com.google.android.material.card.MaterialCardView>
</layout>