From eb8cab411057e6b8d75838550b9ac3665d38acd6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 22 Sep 2020 17:55:33 +0200 Subject: tv: do not redisplay stats when deleting Signed-off-by: Jason A. Donenfeld --- ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 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 70165a26..7e3d425d 100644 --- a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt @@ -60,13 +60,13 @@ class TvMainActivity : AppCompatActivity() { } } - lateinit var binding: TvActivityBinding + private lateinit var binding: TvActivityBinding + private val isDeleting = ObservableBoolean() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = TvActivityBinding.inflate(layoutInflater) lifecycleScope.launch { binding.tunnels = Application.getTunnelManager().getTunnels() } - val isDeleting = ObservableBoolean() binding.isDeleting = isDeleting binding.rowConfigurationHandler = object : ObservableKeyedRecyclerViewAdapter.RowConfigurationHandler { override fun onConfigureRow(binding: TvTunnelListItemBinding, item: ObservableTunnel, position: Int) { @@ -119,7 +119,7 @@ class TvMainActivity : AppCompatActivity() { val listItem = DataBindingUtil.findBinding(viewItem) ?: return@forEach try { val tunnel = listItem.item!! - if (tunnel.state != Tunnel.State.UP) { + if (tunnel.state != Tunnel.State.UP || isDeleting.get()) { throw Exception() } val statistics = tunnel.getStatisticsAsync() -- cgit v1.2.3