diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-09-22 20:37:41 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-09-22 23:54:38 +0200 |
commit | 03189e7b20b326b83ab484c436214f1610334c73 (patch) | |
tree | 969ce8414b0cbabf666bc5e11fc48bac634dd4c4 /ui/src/main | |
parent | 10bb413187cb205e3e294f3e0b27fe0d31a959f6 (diff) |
tv: add text when there are no tunnels
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt | 2 | ||||
-rw-r--r-- | ui/src/main/res/layout/tv_activity.xml | 16 | ||||
-rw-r--r-- | ui/src/main/res/values/strings.xml | 1 |
3 files changed, 18 insertions, 1 deletions
diff --git a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt index d6840993..2b12d545 100644 --- a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt @@ -84,6 +84,8 @@ class TvMainActivity : AppCompatActivity() { if (isDeleting.get()) { try { item.deleteAsync() + if (this@TvMainActivity.binding.tunnels?.isEmpty() != false) + isDeleting.set(false) } catch (e: Throwable) { val error = ErrorMessages[e] val message = getString(R.string.config_delete_error, error) diff --git a/ui/src/main/res/layout/tv_activity.xml b/ui/src/main/res/layout/tv_activity.xml index 75fe6490..5e29ed5f 100644 --- a/ui/src/main/res/layout/tv_activity.xml +++ b/ui/src/main/res/layout/tv_activity.xml @@ -35,8 +35,8 @@ android:layout_marginTop="5dp" app:cardElevation="2dp" app:contentPadding="0dp" - app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <ImageView @@ -54,6 +54,7 @@ android:layout_height="0dp" android:layout_marginTop="16dp" android:orientation="horizontal" + android:visibility="@{tunnels.isEmpty() ? View.GONE : View.VISIBLE}" app:configurationHandler="@{rowConfigurationHandler}" app:items="@{tunnels}" app:layout="@{@layout/tv_tunnel_list_item}" @@ -65,6 +66,19 @@ tools:itemCount="10" tools:listitem="@layout/tv_tunnel_list_item" /> + <TextView + style="@style/TextAppearance.MaterialComponents.Headline4" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:text="@string/tv_add_tunnel_get_started" + android:visibility="@{tunnels.isEmpty() ? View.VISIBLE : View.GONE}" + app:layout_constraintBottom_toTopOf="@id/delete_button" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/banner_logo" + tools:visibility="gone" /> + <com.google.android.material.button.MaterialButton android:id="@+id/import_button" style="@style/Widget.MaterialComponents.Button" diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml index 0bcadbca..f539b0ba 100644 --- a/ui/src/main/res/values/strings.xml +++ b/ui/src/main/res/values/strings.xml @@ -103,6 +103,7 @@ <string name="delete">Delete</string> <string name="tv_delete">Select tunnel to delete</string> <string name="tv_error">Your TV does not have a file picker</string> + <string name="tv_add_tunnel_get_started">Add a tunnel to get started</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> |