Merge pull request #1000 from MilosKozak/bolusprogress-dismiss
IDEA: dismiss bolus progress dialog when Queue is empty
This commit is contained in:
commit
f511b9ed39
|
@ -70,6 +70,9 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
if(!ConfigBuilderPlugin.getCommandQueue().bolusInQueue()) {
|
||||||
|
bolusEnded = true;
|
||||||
|
}
|
||||||
if (bolusEnded) {
|
if (bolusEnded) {
|
||||||
dismiss();
|
dismiss();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -162,8 +162,18 @@ public class CommandQueue {
|
||||||
tempCommandQueue.readStatus(reason, callback);
|
tempCommandQueue.readStatus(reason, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized boolean bolusInQueue(){
|
||||||
|
if(isRunning(Command.CommandType.BOLUS)) return true;
|
||||||
|
for (int i = 0; i < queue.size(); i++) {
|
||||||
|
if (queue.get(i).commandType == Command.CommandType.BOLUS) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// returns true if command is queued
|
// returns true if command is queued
|
||||||
public boolean bolus(DetailedBolusInfo detailedBolusInfo, Callback callback) {
|
public synchronized boolean bolus(DetailedBolusInfo detailedBolusInfo, Callback callback) {
|
||||||
Command.CommandType type = detailedBolusInfo.isSMB ? Command.CommandType.SMB_BOLUS : Command.CommandType.BOLUS;
|
Command.CommandType type = detailedBolusInfo.isSMB ? Command.CommandType.SMB_BOLUS : Command.CommandType.BOLUS;
|
||||||
|
|
||||||
if(type.equals(Command.CommandType.BOLUS) && detailedBolusInfo.carbs > 0 && detailedBolusInfo.insulin == 0){
|
if(type.equals(Command.CommandType.BOLUS) && detailedBolusInfo.carbs > 0 && detailedBolusInfo.insulin == 0){
|
||||||
|
|
Loading…
Reference in a new issue