diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-09-22 23:50:26 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-09-22 23:54:41 +0200 |
commit | e72b4fc144e642eb99328d637549d805c14d9033 (patch) | |
tree | 1c9a4fe9c409ecc18f86f71b41d30660a21deaa7 /ui/src/main/java | |
parent | 03189e7b20b326b83ab484c436214f1610334c73 (diff) |
tv: hook up isFocused as observable property
This is kind of ridiculous, since the items own state should clearly be
queryable, but it doesn't appear to be the case here, so just shuffle it
around into kotlin and back.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/java')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt | 4 |
1 files changed, 4 insertions, 0 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 2b12d545..1528ac95 100644 --- a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt @@ -79,6 +79,10 @@ class TvMainActivity : AppCompatActivity() { binding.rowConfigurationHandler = object : ObservableKeyedRecyclerViewAdapter.RowConfigurationHandler<TvTunnelListItemBinding, ObservableTunnel> { override fun onConfigureRow(binding: TvTunnelListItemBinding, item: ObservableTunnel, position: Int) { binding.isDeleting = isDeleting + binding.isFocused = ObservableBoolean() + binding.root.setOnFocusChangeListener { _, focused -> + binding.isFocused?.set(focused) + } binding.root.setOnClickListener { lifecycleScope.launch { if (isDeleting.get()) { |