Remodel the Model
- The configuration and crypto model is now entirely independent of Android classes other than Nullable and TextUtils. - Model classes are immutable and use builders that enforce the appropriate optional/required attributes. - The Android config proxies (for Parcelable and databinding) are moved to the Android side of the codebase, and are designed to be safe for two-way databinding. This allows proper observability in TunnelDetailFragment. - Various robustness fixes and documentation updates to helper classes. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
committed by
Jason A. Donenfeld
parent
a264f7ab36
commit
d1e85633fb
@@ -10,11 +10,11 @@
|
||||
|
||||
<variable
|
||||
name="collection"
|
||||
type="android.databinding.ObservableList<com.wireguard.config.Peer.Observable>" />
|
||||
type="android.databinding.ObservableList<com.wireguard.android.viewmodel.PeerProxy>" />
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="com.wireguard.config.Peer.Observable" />
|
||||
type="com.wireguard.android.viewmodel.PeerProxy" />
|
||||
</data>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
@@ -52,7 +52,7 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@null"
|
||||
android:contentDescription="@string/delete"
|
||||
android:onClick="@{() -> collection.remove(item)}"
|
||||
android:onClick="@{() -> item.unbind()}"
|
||||
android:src="@drawable/ic_action_delete" />
|
||||
|
||||
<TextView
|
||||
@@ -104,10 +104,9 @@
|
||||
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:checked="@={item.excludingPrivateIps}"
|
||||
android:text="@string/exclude_private_ips"
|
||||
android:visibility="@{item.canToggleExcludePrivateIPs ? View.VISIBLE : View.GONE}" />
|
||||
android:visibility="@{item.ableToExcludePrivateIps ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/allowed_ips_text"
|
||||
@@ -115,7 +114,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/allowed_ips_label"
|
||||
android:inputType="textNoSuggestions|textVisiblePassword"
|
||||
android:text="@={item.allowedIPs}" />
|
||||
android:text="@={item.allowedIps}" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/endpoint_label"
|
||||
|
||||
Reference in New Issue
Block a user