kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
fix region changes not updating UI
rodzic
436ac1af47
commit
9cdaf6f79a
|
@ -145,13 +145,19 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
private fun updateNodeInfo() {
|
||||
val connected = model.connectionState.value
|
||||
|
||||
val isConnected = connected == MeshService.ConnectionState.CONNECTED
|
||||
binding.nodeSettings.visibility = if (isConnected) View.VISIBLE else View.GONE
|
||||
binding.provideLocationCheckbox.visibility = if (isConnected) View.VISIBLE else View.GONE
|
||||
binding.nodeSettings.visibility = if (model.isConnected()) View.VISIBLE else View.GONE
|
||||
binding.provideLocationCheckbox.visibility = if (model.isConnected()) View.VISIBLE else View.GONE
|
||||
|
||||
if (connected == MeshService.ConnectionState.DISCONNECTED)
|
||||
model.setOwner("")
|
||||
|
||||
if (model.gpsDisabled) {
|
||||
model.provideLocation.value = false
|
||||
binding.provideLocationCheckbox.isChecked = false
|
||||
} else {
|
||||
binding.provideLocationCheckbox.isEnabled = isGooglePlayAvailable(requireContext())
|
||||
}
|
||||
|
||||
// update the region selection from the device
|
||||
val region = model.region
|
||||
val spinner = binding.regionSpinner
|
||||
|
@ -243,12 +249,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
}
|
||||
|
||||
model.localConfig.observe(viewLifecycleOwner) {
|
||||
binding.provideLocationCheckbox.isEnabled =
|
||||
isGooglePlayAvailable(requireContext()) && !model.gpsDisabled
|
||||
if (model.gpsDisabled) {
|
||||
model.provideLocation.value = false
|
||||
binding.provideLocationCheckbox.isChecked = false
|
||||
}
|
||||
updateNodeInfo()
|
||||
}
|
||||
|
||||
// Also watch myNodeInfo because it might change later
|
||||
|
|
Ładowanie…
Reference in New Issue