mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor config get and set methods
This commit is contained in:
parent
346a50a360
commit
fd0c8ef9b8
4 changed files with 72 additions and 118 deletions
|
|
@ -13,6 +13,7 @@ import android.widget.*
|
|||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.asLiveData
|
||||
import androidx.lifecycle.flowWithLifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.geeksville.mesh.analytics.DataPair
|
||||
|
|
@ -160,9 +161,9 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
if (connected == MeshService.ConnectionState.DISCONNECTED)
|
||||
model.setOwner("")
|
||||
|
||||
if (model.gpsDisabled) {
|
||||
model.provideLocation.value = false
|
||||
if (model.config.position.gpsDisabled) {
|
||||
binding.provideLocationCheckbox.isChecked = false
|
||||
binding.provideLocationCheckbox.isEnabled = false
|
||||
} else {
|
||||
binding.provideLocationCheckbox.isEnabled = true
|
||||
}
|
||||
|
|
@ -287,7 +288,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
updateDevicesButtons(scanModel.devices.value)
|
||||
}
|
||||
|
||||
model.localConfig.observe(viewLifecycleOwner) {
|
||||
model.localConfig.asLiveData().observe(viewLifecycleOwner) {
|
||||
if (!model.isConnected()) {
|
||||
val configCount = it.allFields.size
|
||||
binding.scanStatusText.text = "Device config ($configCount / 7)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue