mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
firmware update button is kinda in
This commit is contained in:
parent
a3aa6dc5b6
commit
c1388d6bad
7 changed files with 71 additions and 22 deletions
|
|
@ -311,11 +311,35 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
usernameEditText.setText(name)
|
||||
})
|
||||
|
||||
// Only let user edit their name while connected to a radio
|
||||
// Only let user edit their name or set software update while connected to a radio
|
||||
model.isConnected.observe(viewLifecycleOwner, Observer { connected ->
|
||||
usernameView.isEnabled = connected == MeshService.ConnectionState.CONNECTED
|
||||
|
||||
// If actively connected possibly let the user update firmware
|
||||
val info = model.myNodeInfo.value
|
||||
if (connected == MeshService.ConnectionState.CONNECTED && info != null && info.couldUpdate) {
|
||||
updateFirmwareButton.visibility = View.VISIBLE
|
||||
} else {
|
||||
updateFirmwareButton.visibility = View.GONE
|
||||
}
|
||||
|
||||
when (connected) {
|
||||
MeshService.ConnectionState.CONNECTED -> {
|
||||
val fwStr = info?.firmwareString ?: ""
|
||||
scanStatusText.text = getString(R.string.connected_to).format(fwStr)
|
||||
}
|
||||
MeshService.ConnectionState.DISCONNECTED ->
|
||||
scanStatusText.text = getString(R.string.not_connected)
|
||||
MeshService.ConnectionState.DEVICE_SLEEP ->
|
||||
scanStatusText.text = getString(R.string.connected_sleeping)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
updateFirmwareButton.setOnClickListener {
|
||||
debug("User started firmware update")
|
||||
}
|
||||
|
||||
usernameEditText.on(EditorInfo.IME_ACTION_DONE) {
|
||||
debug("did IME action")
|
||||
val n = usernameEditText.text.toString().trim()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue