Skip to content

Commit 03189e7

Browse files
committed
tv: add text when there are no tunnels
Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 10bb413 commit 03189e7

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ class TvMainActivity : AppCompatActivity() {
8484
if (isDeleting.get()) {
8585
try {
8686
item.deleteAsync()
87+
if (this@TvMainActivity.binding.tunnels?.isEmpty() != false)
88+
isDeleting.set(false)
8789
} catch (e: Throwable) {
8890
val error = ErrorMessages[e]
8991
val message = getString(R.string.config_delete_error, error)

ui/src/main/res/layout/tv_activity.xml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
android:layout_marginTop="5dp"
3636
app:cardElevation="2dp"
3737
app:contentPadding="0dp"
38-
app:layout_constraintStart_toStartOf="parent"
3938
app:layout_constraintEnd_toEndOf="parent"
39+
app:layout_constraintStart_toStartOf="parent"
4040
app:layout_constraintTop_toTopOf="parent">
4141

4242
<ImageView
@@ -54,6 +54,7 @@
5454
android:layout_height="0dp"
5555
android:layout_marginTop="16dp"
5656
android:orientation="horizontal"
57+
android:visibility="@{tunnels.isEmpty() ? View.GONE : View.VISIBLE}"
5758
app:configurationHandler="@{rowConfigurationHandler}"
5859
app:items="@{tunnels}"
5960
app:layout="@{@layout/tv_tunnel_list_item}"
@@ -65,6 +66,19 @@
6566
tools:itemCount="10"
6667
tools:listitem="@layout/tv_tunnel_list_item" />
6768

69+
<TextView
70+
style="@style/TextAppearance.MaterialComponents.Headline4"
71+
android:layout_width="wrap_content"
72+
android:layout_height="wrap_content"
73+
android:layout_gravity="center_horizontal"
74+
android:text="@string/tv_add_tunnel_get_started"
75+
android:visibility="@{tunnels.isEmpty() ? View.VISIBLE : View.GONE}"
76+
app:layout_constraintBottom_toTopOf="@id/delete_button"
77+
app:layout_constraintEnd_toEndOf="parent"
78+
app:layout_constraintStart_toStartOf="parent"
79+
app:layout_constraintTop_toBottomOf="@id/banner_logo"
80+
tools:visibility="gone" />
81+
6882
<com.google.android.material.button.MaterialButton
6983
android:id="@+id/import_button"
7084
style="@style/Widget.MaterialComponents.Button"

ui/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
<string name="delete">Delete</string>
104104
<string name="tv_delete">Select tunnel to delete</string>
105105
<string name="tv_error">Your TV does not have a file picker</string>
106+
<string name="tv_add_tunnel_get_started">Add a tunnel to get started</string>
106107
<string name="disable_config_export_title">Disable config exporting</string>
107108
<string name="disable_config_export_description">Disabling config exporting makes private keys less accessible</string>
108109
<string name="dns_servers">DNS servers</string>

0 commit comments

Comments
 (0)