mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
add isAlwaysPowered
This commit is contained in:
parent
3c2cf3b26a
commit
460288d99f
3 changed files with 32 additions and 0 deletions
|
|
@ -39,12 +39,14 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
|||
model.radioConfig.observe(viewLifecycleOwner, { _ ->
|
||||
binding.positionBroadcastPeriodEditText.setText(model.positionBroadcastSecs.toString())
|
||||
binding.lsSleepEditText.setText(model.lsSleepSecs.toString())
|
||||
binding.isAlwaysPoweredCheckbox.isChecked = model.isAlwaysPowered?: false
|
||||
})
|
||||
|
||||
model.isConnected.observe(viewLifecycleOwner, Observer { connectionState ->
|
||||
val connected = connectionState == MeshService.ConnectionState.CONNECTED
|
||||
binding.positionBroadcastPeriodView.isEnabled = connected
|
||||
binding.lsSleepView.isEnabled = connected
|
||||
binding.isAlwaysPoweredCheckbox.isEnabled = connected
|
||||
})
|
||||
|
||||
binding.positionBroadcastPeriodEditText.on(EditorInfo.IME_ACTION_DONE) {
|
||||
|
|
@ -84,5 +86,12 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
|||
}
|
||||
requireActivity().hideKeyboard()
|
||||
}
|
||||
|
||||
binding.isAlwaysPoweredCheckbox.setOnCheckedChangeListener { view, isChecked ->
|
||||
if (view.isPressed) {
|
||||
model.isAlwaysPowered = isChecked
|
||||
debug("User changed isAlwaysPowered to $isChecked")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue