File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
ui/src/main/java/com/wireguard/android/activity Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,13 @@ class TvMainActivity : AppCompatActivity() {
68
68
override fun onCreate (savedInstanceState : Bundle ? ) {
69
69
super .onCreate(savedInstanceState)
70
70
binding = TvActivityBinding .inflate(layoutInflater)
71
- lifecycleScope.launch { binding.tunnels = Application .getTunnelManager().getTunnels() }
71
+ lifecycleScope.launch {
72
+ binding.tunnels = Application .getTunnelManager().getTunnels()
73
+ if (binding.tunnels?.isEmpty() == true )
74
+ binding.importButton.requestFocus()
75
+ else
76
+ binding.tunnelList.requestFocus()
77
+ }
72
78
binding.isDeleting = isDeleting
73
79
binding.rowConfigurationHandler = object : ObservableKeyedRecyclerViewAdapter .RowConfigurationHandler <TvTunnelListItemBinding , ObservableTunnel > {
74
80
override fun onConfigureRow (binding : TvTunnelListItemBinding , item : ObservableTunnel , position : Int ) {
@@ -122,7 +128,8 @@ class TvMainActivity : AppCompatActivity() {
122
128
123
129
private suspend fun updateStats () {
124
130
binding.tunnelList.forEach { viewItem ->
125
- val listItem = DataBindingUtil .findBinding<TvTunnelListItemBinding >(viewItem) ? : return @forEach
131
+ val listItem = DataBindingUtil .findBinding<TvTunnelListItemBinding >(viewItem)
132
+ ? : return @forEach
126
133
try {
127
134
val tunnel = listItem.item!!
128
135
if (tunnel.state != Tunnel .State .UP || isDeleting.get()) {
You can’t perform that action at this time.
0 commit comments