Fix activity indicator during on-connect-checks.

This commit is contained in:
Johannes Mockenhaupt 2018-01-31 00:09:38 +01:00
parent c7cccf3220
commit 3db7aedb06
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -735,17 +735,15 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
/**
* Runs a command, sets an activity if provided, retries if requested and updates fields
* concerned with last connection.
* NO history, reservoir level fields are updated, this make be done separately if desired.
* Local cache (history, reservoir level, pump state) are updated via #updateLocalData()
* if returned by a command.
*/
private synchronized CommandResult runCommand(String activity, int retries, CommandExecution commandExecution) {
CommandResult commandResult;
try {
if (activity != null) {
pump.activity = activity;
MainApp.bus().post(new EventComboPumpUpdateGUI());
}
if (!ruffyScripter.isConnected()) {
pump.activity = MainApp.gs(R.string.combo_activity_checking_pump_state);
MainApp.bus().post(new EventComboPumpUpdateGUI());
CommandResult preCheckError = runOnConnectChecks();
if (preCheckError != null) {
updateLocalData(preCheckError);
@ -753,6 +751,11 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
}
}
if (activity != null) {
pump.activity = activity;
MainApp.bus().post(new EventComboPumpUpdateGUI());
}
commandResult = commandExecution.execute();
if (!commandResult.success && retries > 0) {