aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/src/main/res/layout/tunnel_editor_peer.xml
blob: 472b4cac9087b1f0d834a6926373fb573ce676a6 (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
152
153
154
155
156
157
158
159
160
161
<?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="android.view.View"/>
        <import type="com.wireguard.android.widget.KeyInputFilter" />

        <variable
            name="collection"
            type="android.databinding.ObservableList&lt;com.wireguard.config.Peer.Observable&gt;" />

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

    <android.support.v7.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="4dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="4dp"
        android:background="?android:attr/colorBackground"
        app:cardCornerRadius="4dp"
        app:cardElevation="2dp"
        app:contentPadding="8dp">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/peer_title"
                style="?android:attr/textAppearanceMedium"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:layout_marginBottom="8dp"
                android:layout_toStartOf="@+id/peer_action_delete"
                android:text="@string/peer" />

            <ImageButton
                android:id="@+id/peer_action_delete"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentTop="true"
                android:background="@null"
                android:contentDescription="@string/delete"
                android:onClick="@{() -> collection.remove(item)}"
                android:src="@drawable/ic_action_delete" />

            <TextView
                android:id="@+id/public_key_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/peer_title"
                android:labelFor="@+id/public_key_text"
                android:text="@string/public_key" />

            <EditText
                android:id="@+id/public_key_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/public_key_label"
                android:inputType="textNoSuggestions|textVisiblePassword"
                android:text="@={item.publicKey}"
                app:filter="@{KeyInputFilter.newInstance()}" />

            <TextView
                android:id="@+id/pre_shared_key_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/public_key_text"
                android:labelFor="@+id/pre_shared_key_text"
                android:text="@string/pre_shared_key" />

            <EditText
                android:id="@+id/pre_shared_key_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/pre_shared_key_label"
                android:hint="@string/hint_optional"
                android:inputType="textNoSuggestions|textVisiblePassword"
                android:text="@={item.preSharedKey}" />

            <TextView
                android:id="@+id/allowed_ips_label"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/pre_shared_key_text"
                android:layout_toStartOf="@+id/exclude_private_ips"
                android:labelFor="@+id/allowed_ips_text"
                android:text="@string/allowed_ips" />

            <CheckBox
                android:id="@+id/exclude_private_ips"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/allowed_ips_label"
                android:layout_alignParentEnd="true"
                android:checked="@{item.isExcludePrivateIPsOn}"
                android:onClick="@{() -> item.toggleExcludePrivateIPs()}"
                android:text="@string/exclude_private_ips"
                android:visibility="@{item.canToggleExcludePrivateIPs ? View.VISIBLE : View.GONE}" />

            <EditText
                android:id="@+id/allowed_ips_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/allowed_ips_label"
                android:inputType="textNoSuggestions|textVisiblePassword"
                android:text="@={item.allowedIPs}" />

            <TextView
                android:id="@+id/endpoint_label"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/allowed_ips_text"
                android:layout_toStartOf="@+id/persistent_keepalive_label"
                android:labelFor="@+id/endpoint_text"
                android:text="@string/endpoint" />

            <EditText
                android:id="@+id/endpoint_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/endpoint_label"
                android:layout_toStartOf="@+id/persistent_keepalive_text"
                android:inputType="textNoSuggestions|textVisiblePassword"
                android:text="@={item.endpoint}" />

            <TextView
                android:id="@+id/persistent_keepalive_label"
                android:layout_width="96dp"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/endpoint_label"
                android:layout_alignParentEnd="true"
                android:labelFor="@+id/persistent_keepalive_text"
                android:text="@string/persistent_keepalive" />

            <EditText
                android:id="@+id/persistent_keepalive_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/endpoint_text"
                android:layout_alignParentEnd="true"
                android:layout_alignStart="@+id/persistent_keepalive_label"
                android:hint="@string/hint_optional"
                android:inputType="number"
                android:text="@={item.persistentKeepalive}"
                android:textAlignment="center" />
        </RelativeLayout>
    </android.support.v7.widget.CardView>
</layout>