kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
firmware update wip
rodzic
c1388d6bad
commit
5044c5393f
|
@ -319,8 +319,11 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
val info = model.myNodeInfo.value
|
||||
if (connected == MeshService.ConnectionState.CONNECTED && info != null && info.couldUpdate) {
|
||||
updateFirmwareButton.visibility = View.VISIBLE
|
||||
updateFirmwareButton.text =
|
||||
getString(R.string.update_to).format(getString(R.string.cur_firmware_version))
|
||||
} else {
|
||||
updateFirmwareButton.visibility = View.GONE
|
||||
updateProgressBar.visibility = View.GONE
|
||||
}
|
||||
|
||||
when (connected) {
|
||||
|
@ -338,6 +341,10 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
|
||||
updateFirmwareButton.setOnClickListener {
|
||||
debug("User started firmware update")
|
||||
updateFirmwareButton.isEnabled = false // Disable until things complete
|
||||
updateProgressBar.visibility = View.VISIBLE
|
||||
model.meshService?.startFirmwareUpdate()
|
||||
scanStatusText.text = "Updating firmware, wait up to eight minutes..."
|
||||
}
|
||||
|
||||
usernameEditText.on(EditorInfo.IME_ACTION_DONE) {
|
||||
|
|
|
@ -126,5 +126,15 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/scanStatusText" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/updateProgressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@+id/updateFirmwareButton"
|
||||
app:layout_constraintStart_toStartOf="@+id/updateFirmwareButton"
|
||||
app:layout_constraintTop_toBottomOf="@+id/updateFirmwareButton" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -58,4 +58,5 @@
|
|||
<string name="connected_to">Connected to radio (%s)</string>
|
||||
<string name="not_connected">Not connected, select radio below</string>
|
||||
<string name="connected_sleeping">Connected to radio, but it is sleeping</string>
|
||||
<string name="update_to">Update to %s</string>
|
||||
</resources>
|
||||
|
|
Ładowanie…
Reference in New Issue