diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-09-22 16:28:13 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-09-22 23:53:44 +0200 |
commit | 9df8e5e239a298d1b17ce2486af5277b53c35411 (patch) | |
tree | 41c970e8b228982a559a5ee8a3bd8676f1a71a44 /ui/src/main/res | |
parent | 444a86cc9f642373ea04a42966e16869dac8dd69 (diff) |
tv: add ugly deletion mode
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/res')
-rw-r--r-- | ui/src/main/res/layout/tv_activity.xml | 17 | ||||
-rw-r--r-- | ui/src/main/res/layout/tv_tunnel_list_item.xml | 22 | ||||
-rw-r--r-- | ui/src/main/res/values/strings.xml | 1 |
3 files changed, 38 insertions, 2 deletions
diff --git a/ui/src/main/res/layout/tv_activity.xml b/ui/src/main/res/layout/tv_activity.xml index 4ca5f839..8a544258 100644 --- a/ui/src/main/res/layout/tv_activity.xml +++ b/ui/src/main/res/layout/tv_activity.xml @@ -4,10 +4,15 @@ xmlns:tools="http://schemas.android.com/tools"> <data> + <import type="android.view.View" /> <import type="com.wireguard.android.model.ObservableTunnel" /> <variable + name="isDeleting" + type="androidx.databinding.ObservableBoolean" /> + + <variable name="tunnels" type="com.wireguard.android.databinding.ObservableKeyedArrayList<String, ObservableTunnel>" /> @@ -43,8 +48,20 @@ android:layout_height="wrap_content" android:layout_margin="16dp" android:text="@string/create_from_file" + android:visibility="@{isDeleting ? View.GONE : View.VISIBLE}" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> + <!-- TODO: Text should probably be a drawable, right? --> + <com.google.android.material.button.MaterialButton + android:id="@+id/delete_button" + style="?attr/textAppearanceButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:text="@{isDeleting ? "⏎" : "🗑"}" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" /> + </androidx.constraintlayout.widget.ConstraintLayout> </layout>
\ No newline at end of file diff --git a/ui/src/main/res/layout/tv_tunnel_list_item.xml b/ui/src/main/res/layout/tv_tunnel_list_item.xml index 4d2a943c..c5dd6c37 100644 --- a/ui/src/main/res/layout/tv_tunnel_list_item.xml +++ b/ui/src/main/res/layout/tv_tunnel_list_item.xml @@ -5,11 +5,17 @@ <data> + <import type="android.view.View" /> + <import type="com.wireguard.android.model.ObservableTunnel" /> <import type="com.wireguard.android.backend.Tunnel.State" /> <variable + name="isDeleting" + type="androidx.databinding.ObservableBoolean" /> + + <variable name="key" type="String" /> @@ -18,15 +24,16 @@ type="com.wireguard.android.model.ObservableTunnel" /> </data> + <!-- Rather than changing the background tint to red for deleting mode, it should instead just change the selection color --> <com.google.android.material.card.MaterialCardView android:layout_width="300dp" android:layout_height="150dp" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" - app:cardCornerRadius="12dp" + android:backgroundTint="@{isDeleting ? @color/error_tag_color : item.state == State.UP ? @color/secondary_light_color : @color/primary_color}" android:checkable="true" android:focusable="true" - android:backgroundTint="@{item.state == State.UP ? @color/secondary_light_color : @color/primary_color}"> + app:cardCornerRadius="12dp"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" @@ -46,10 +53,21 @@ android:id="@+id/tunnel_transfer" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:visibility="@{isDeleting ? View.GONE : View.VISIBLE}" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" tools:text="rx: 200 MB, tx: 100 MB" /> + <!-- TODO: replace the "&& true" stuff with && isSelected() --> + <com.google.android.material.textview.MaterialTextView + android:id="@+id/tunnel_delete" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/tv_delete" + android:visibility="@{isDeleting && true ? View.VISIBLE : View.GONE}" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" /> + </androidx.constraintlayout.widget.ConstraintLayout> </com.google.android.material.card.MaterialCardView> diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml index 63703ad6..6f4d935a 100644 --- a/ui/src/main/res/values/strings.xml +++ b/ui/src/main/res/values/strings.xml @@ -101,6 +101,7 @@ <string name="dark_theme_summary_on">Currently using dark (night) theme</string> <string name="dark_theme_title">Use dark theme</string> <string name="delete">Delete</string> + <string name="tv_delete">Select tunnel to delete</string> <string name="disable_config_export_title">Disable config exporting</string> <string name="disable_config_export_description">Disabling config exporting makes private keys less accessible</string> <string name="dns_servers">DNS servers</string> |