mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix autobug with setting channels - for now allow only while device is awake
This commit is contained in:
parent
d32d47287a
commit
069c0646f4
1 changed files with 12 additions and 2 deletions
|
|
@ -18,6 +18,7 @@ import com.geeksville.android.Logging
|
|||
import com.geeksville.android.hideKeyboard
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.model.UIViewModel
|
||||
import com.geeksville.mesh.service.MeshService
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import kotlinx.android.synthetic.main.channel_fragment.*
|
||||
|
||||
|
|
@ -70,7 +71,11 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
qrView.visibility = View.VISIBLE
|
||||
channelNameEdit.visibility = View.VISIBLE
|
||||
channelNameEdit.setText(channel.name)
|
||||
editableCheckbox.isEnabled = true
|
||||
|
||||
// For now, we only let the user edit/save channels while the radio is awake - because the service
|
||||
// doesn't cache radioconfig writes.
|
||||
val connected = model.isConnected.value == MeshService.ConnectionState.CONNECTED
|
||||
editableCheckbox.isEnabled = connected
|
||||
|
||||
qrView.setImageBitmap(channel.getChannelQR())
|
||||
} else {
|
||||
|
|
@ -156,7 +161,12 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
shareChannel()
|
||||
}
|
||||
|
||||
model.radioConfig.observe(viewLifecycleOwner, Observer { config ->
|
||||
model.radioConfig.observe(viewLifecycleOwner, Observer {
|
||||
setGUIfromModel()
|
||||
})
|
||||
|
||||
// If connection state changes, we might need to enable/disable buttons
|
||||
model.isConnected.observe(viewLifecycleOwner, Observer {
|
||||
setGUIfromModel()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue