Detail/Edit/ListFragment: Update the layouts

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Samuel Holland 2017-08-16 01:47:18 -05:00
parent 645e263424
commit 452641a0eb
4 changed files with 22 additions and 27 deletions

View File

@ -19,26 +19,25 @@
android:padding="16dp"> android:padding="16dp">
<TextView <TextView
android:id="@+id/config_name_label" android:id="@+id/status_label"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:labelFor="@+id/config_name_text" android:text="@string/status" />
android:text="@string/config_name" />
<TextView <TextView
android:id="@+id/config_name_text" android:id="@+id/status_text"
style="?android:attr/textAppearanceMedium" style="?android:attr/textAppearanceMedium"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/config_name_label" android:layout_below="@+id/status_label"
android:text="@{config.name}" /> android:text="@{config.enabled ? @string/enabled : @string/disabled}" />
<TextView <TextView
android:id="@+id/public_key_label" android:id="@+id/public_key_label"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/config_name_text" android:layout_below="@id/status_text"
android:labelFor="@+id/public_key_text" android:labelFor="@+id/public_key_text"
android:text="@string/public_key" /> android:text="@string/public_key" />
@ -51,12 +50,6 @@
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="@{config.interface.publicKey}" /> android:text="@{config.interface.publicKey}" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/public_key_text"
android:text="@{config.toString()}" />
</RelativeLayout> </RelativeLayout>
</ScrollView> </ScrollView>
</layout> </layout>

View File

@ -154,12 +154,6 @@
android:inputType="number" android:inputType="number"
android:text="@={config.interface.mtu}" android:text="@={config.interface.mtu}"
android:textAlignment="center" /> android:textAlignment="center" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/dns_server_text"
android:text="@{config.toString()}" />
</RelativeLayout> </RelativeLayout>
</ScrollView> </ScrollView>
</layout> </layout>

View File

@ -3,6 +3,8 @@
<data> <data>
<import type="com.wireguard.android.VpnService" />
<variable <variable
name="item" name="item"
type="com.wireguard.config.Config" /> type="com.wireguard.config.Config" />
@ -19,16 +21,20 @@
style="?android:attr/textAppearanceMedium" style="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/config_switch"
android:text="@{item.name}" /> android:text="@{item.name}" />
<TextView <TextView
style="?android:attr/textAppearanceMedium" android:id="@+id/config_switch"
style="?android:attr/textAppearanceButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/config_name"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_toEndOf="@+id/config_name" android:gravity="center_vertical"
android:text="@{item.isEnabled ? @string/connected : @string/disconnected}" android:onClick="@{() -> item.enabled ? VpnService.instance.disable(item.name) : VpnService.instance.enable(item.name)}"
android:textAlignment="textEnd" android:text="@string/toggle"
android:textColor="@{item.isEnabled ? @android:color/holo_green_dark : @android:color/holo_red_dark}" /> android:textColor="@{item.enabled ? @android:color/holo_green_dark : @android:color/holo_red_dark}" />
</RelativeLayout> </RelativeLayout>
</layout> </layout>

View File

@ -6,11 +6,12 @@
</plurals> </plurals>
<string name="app_name">WireGuard</string> <string name="app_name">WireGuard</string>
<string name="config_name">Configuration name</string> <string name="config_name">Configuration name</string>
<string name="connected">Connected</string> <string name="delete">Delete</string>
<string name="disconnected">Disconnected</string> <string name="disabled">Disabled</string>
<string name="dns_servers">DNS servers</string> <string name="dns_servers">DNS servers</string>
<string name="edit">Edit</string> <string name="edit">Edit</string>
<string name="edit_activity_title">Add WireGuard Configuration</string> <string name="edit_activity_title">Add WireGuard Configuration</string>
<string name="enabled">Enabled</string>
<string name="generate">Generate</string> <string name="generate">Generate</string>
<string name="hint_automatic">(auto)</string> <string name="hint_automatic">(auto)</string>
<string name="hint_generated">(generated)</string> <string name="hint_generated">(generated)</string>
@ -23,5 +24,6 @@
<string name="public_key">Public key</string> <string name="public_key">Public key</string>
<string name="save">Save</string> <string name="save">Save</string>
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="delete">Delete</string> <string name="status">Status</string>
<string name="toggle">Toggle</string>
</resources> </resources>