tv: wire up tunnel start/stop
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
<variable
|
||||
name="tunnels"
|
||||
type="com.wireguard.android.databinding.ObservableKeyedArrayList<String, ObservableTunnel>" />
|
||||
|
||||
<variable
|
||||
name="rowConfigurationHandler"
|
||||
type="com.wireguard.android.databinding.ObservableKeyedRecyclerViewAdapter.RowConfigurationHandler" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -22,6 +26,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal"
|
||||
app:configurationHandler="@{rowConfigurationHandler}"
|
||||
app:items="@{tunnels}"
|
||||
app:layout="@{@layout/tv_tunnel_list_item}"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:cardCornerRadius="12dp">
|
||||
app:cardCornerRadius="12dp"
|
||||
android:checkable="true"
|
||||
android:focusable="true"
|
||||
android:backgroundTint="@{item.state == State.UP ? @color/secondary_light_color : @color/primary_color}">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -39,15 +42,6 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@sample/interface_names.json/names/names/name" />
|
||||
|
||||
<com.wireguard.android.widget.ToggleSwitch
|
||||
android:id="@+id/tunnel_toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:checked="@{item.state == State.UP}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:checked="@sample/interface_names.json/names/checked/checked" />
|
||||
|
||||
<!-- TODO: wire in updates here -->
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/tunnel_transfer"
|
||||
|
||||
Reference in New Issue
Block a user