diff options
-rw-r--r-- | ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt | 6 |
1 files 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<TvTunnelListItemBinding, ObservableTunnel> { override fun onConfigureRow(binding: TvTunnelListItemBinding, item: ObservableTunnel, position: Int) { @@ -119,7 +119,7 @@ class TvMainActivity : AppCompatActivity() { val listItem = DataBindingUtil.findBinding<TvTunnelListItemBinding>(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() |