Merge pull request #6220 from Bnyro/master

chore: remove no longer needed safe dot calls
This commit is contained in:
Bnyro 2024-07-11 18:54:00 +02:00 committed by GitHub
commit aaa9792001
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,17 +48,17 @@ class WelcomeActivity : BaseActivity() {
// ALl the binding values are optional due to two different possible layouts (normal, landscape) // ALl the binding values are optional due to two different possible layouts (normal, landscape)
viewModel.instances.observe(this) { instances -> viewModel.instances.observe(this) { instances ->
binding.instancesRecycler?.layoutManager = LinearLayoutManager(this@WelcomeActivity) binding.instancesRecycler.layoutManager = LinearLayoutManager(this@WelcomeActivity)
binding.instancesRecycler?.adapter = InstancesAdapter(instances, viewModel.selectedInstanceIndex.value) { index -> binding.instancesRecycler.adapter = InstancesAdapter(instances, viewModel.selectedInstanceIndex.value) { index ->
viewModel.selectedInstanceIndex.value = index viewModel.selectedInstanceIndex.value = index
binding.okay?.alpha = 1f binding.okay.alpha = 1f
} }
binding.progress?.isGone = true binding.progress.isGone = true
} }
viewModel.fetchInstances() viewModel.fetchInstances()
binding.okay?.alpha = if (viewModel.selectedInstanceIndex.value != null) 1f else 0.5f binding.okay.alpha = if (viewModel.selectedInstanceIndex.value != null) 1f else 0.5f
binding.okay?.setOnClickListener { binding.okay.setOnClickListener {
if (viewModel.selectedInstanceIndex.value != null) { if (viewModel.selectedInstanceIndex.value != null) {
val selectedInstance = val selectedInstance =
viewModel.instances.value!![viewModel.selectedInstanceIndex.value!!] viewModel.instances.value!![viewModel.selectedInstanceIndex.value!!]
@ -69,7 +69,7 @@ class WelcomeActivity : BaseActivity() {
} }
} }
binding.restore?.setOnClickListener { binding.restore.setOnClickListener {
restoreFilePicker.launch(BackupRestoreSettings.JSON) restoreFilePicker.launch(BackupRestoreSettings.JSON)
} }
} }