Localized some firmware update texts and added some toasts on finish

This commit is contained in:
cpfeiffer 2015-08-30 21:56:45 +02:00
parent 41d8bcf634
commit 50960277dd
2 changed files with 12 additions and 6 deletions

View File

@ -93,7 +93,7 @@ public class UpdateFirmwareOperation extends AbstractBTLEOperation<MiBandSupport
rebootWhenBandReady = true;
} else {
//TODO: the firmware transfer failed, but the miband should be still functional with the old firmware. What should we do?
GB.toast("Problem with the firmware transfer. DO NOT REBOOT YOUR MIBAND!!!", Toast.LENGTH_LONG, GB.ERROR);
GB.toast(getContext().getString(R.string.updatefirmwareoperation_updateproblem_do_not_reboot), Toast.LENGTH_LONG, GB.ERROR);
done();
}
firmwareInfoSent = false;
@ -101,23 +101,24 @@ public class UpdateFirmwareOperation extends AbstractBTLEOperation<MiBandSupport
}
break;
case MiBandService.NOTIFY_FW_CHECK_FAILED:
GB.toast("Problem with the firmware metadata transfer", Toast.LENGTH_LONG, GB.ERROR);
GB.toast(getContext().getString(R.string.updatefirmwareoperation_metadata_updateproblem), Toast.LENGTH_LONG, GB.ERROR);
firmwareInfoSent = false;
newFirmware = null;
done();
break;
case MiBandService.NOTIFY_FIRMWARE_UPDATE_SUCCESS:
if (rebootWhenBandReady) {
GB.updateInstallNotification("Firmware installation complete", false, 100, getContext());
GB.toast(getContext(), getContext().getString(R.string.updatefirmwareoperation_update_complete_rebooting), Toast.LENGTH_LONG, GB.INFO);
GB.updateInstallNotification(getContext().getString(R.string.updatefirmwareoperation_update_complete), false, 100, getContext());
getSupport().onReboot();
rebootWhenBandReady = false;
}
rebootWhenBandReady = false;
done();
break;
case MiBandService.NOTIFY_FIRMWARE_UPDATE_FAILED:
//TODO: the firmware transfer failed, but the miband should be still functional with the old firmware. What should we do?
GB.toast("Problem with the firmware transfer. DO NOT REBOOT YOUR MIBAND!!!", Toast.LENGTH_LONG, GB.ERROR);
GB.updateInstallNotification("Firmware write failed", false, 0, getContext());
GB.toast(getContext().getString(R.string.updatefirmwareoperation_updateproblem_do_not_reboot), Toast.LENGTH_LONG, GB.ERROR);
GB.updateInstallNotification(getContext().getString(R.string.updatefirmwareoperation_write_failed), false, 0, getContext());
rebootWhenBandReady = false;
done();
break;

View File

@ -179,4 +179,9 @@
<string name="pbwinstallhandler_correct_hw_revision">Correct hardware revision</string>
<string name="pbwinstallhandler_incorrect_hw_revision">Hardware revision mismatch!</string>
<string name="pbwinstallhandler_app_item">%1$s (%2$s)</string>
<string name="updatefirmwareoperation_updateproblem_do_not_reboot">Problem with the firmware transfer. DO NOT REBOOT your Mi Band!</string>
<string name="updatefirmwareoperation_metadata_updateproblem">Problem with the firmware metadata transfer</string>
<string name="updatefirmwareoperation_update_complete">Firmware installation complete</string>
<string name="updatefirmwareoperation_update_complete_rebooting">Firmware installation complete, rebooting device…</string>
<string name="updatefirmwareoperation_write_failed">Firmware write failed</string>
</resources>