wear event for bolus requests to show card early on
This commit is contained in:
parent
5cff42cd92
commit
650111d1b7
4 changed files with 43 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
||||||
|
package info.nightscout.androidaps.events;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adrian on 07/02/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EventBolusRequested {
|
||||||
|
private double amount;
|
||||||
|
|
||||||
|
public EventBolusRequested (double amount){
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(double amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,6 +26,7 @@ import info.nightscout.androidaps.Services.Intents;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.db.TempBasal;
|
import info.nightscout.androidaps.db.TempBasal;
|
||||||
import info.nightscout.androidaps.db.Treatment;
|
import info.nightscout.androidaps.db.Treatment;
|
||||||
|
import info.nightscout.androidaps.events.EventBolusRequested;
|
||||||
import info.nightscout.androidaps.events.EventNewBG;
|
import info.nightscout.androidaps.events.EventNewBG;
|
||||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||||
|
@ -424,6 +425,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress");
|
bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainApp.bus().post(new EventBolusRequested(insulin));
|
||||||
|
|
||||||
PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context);
|
PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context);
|
||||||
|
|
||||||
BolusProgressDialog.bolusEnded = true;
|
BolusProgressDialog.bolusEnded = true;
|
||||||
|
@ -469,6 +472,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress");
|
bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainApp.bus().post(new EventBolusRequested(insulin));
|
||||||
|
|
||||||
PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context);
|
PumpEnactResult result = activePump.deliverTreatment(insulin, carbs, context);
|
||||||
|
|
||||||
BolusProgressDialog.bolusEnded = true;
|
BolusProgressDialog.bolusEnded = true;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.events.EventBolusRequested;
|
||||||
import info.nightscout.androidaps.events.EventNewBG;
|
import info.nightscout.androidaps.events.EventNewBG;
|
||||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
|
@ -17,6 +18,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
|
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||||
import info.nightscout.androidaps.plugins.Wear.wearintegration.WatchUpdaterService;
|
import info.nightscout.androidaps.plugins.Wear.wearintegration.WatchUpdaterService;
|
||||||
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by adrian on 17/11/16.
|
* Created by adrian on 17/11/16.
|
||||||
|
@ -151,6 +153,20 @@ public class WearPlugin implements PluginBase {
|
||||||
ctx.startService(intent);
|
ctx.startService(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onStatusEvent(final EventBolusRequested ev) {
|
||||||
|
ToastUtils.showToastInUiThread(ctx, "EventBolusRequested !!!");
|
||||||
|
String status = String.format(MainApp.sResources.getString(R.string.bolusrequested), ev.getAmount());
|
||||||
|
|
||||||
|
Intent intent = new Intent(ctx, WatchUpdaterService.class).setAction(WatchUpdaterService.ACTION_SEND_BOLUSPROGRESS);
|
||||||
|
intent.putExtra("progresspercent", 0);
|
||||||
|
intent.putExtra("progressstatus", status);
|
||||||
|
ToastUtils.showToastInUiThread(ctx, "before startService");
|
||||||
|
ctx.startService(intent);
|
||||||
|
ToastUtils.showToastInUiThread(ctx, "after startService");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isEnabled() {
|
public static boolean isEnabled() {
|
||||||
return fragmentEnabled;
|
return fragmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,6 +252,7 @@
|
||||||
<string name="smscommunicator_bolusreplywithcode" formatted="false">To deliver bolus %.2fU reply with code %s</string>
|
<string name="smscommunicator_bolusreplywithcode" formatted="false">To deliver bolus %.2fU reply with code %s</string>
|
||||||
<string name="smscommunicator_bolusfailed">Bolus failed</string>
|
<string name="smscommunicator_bolusfailed">Bolus failed</string>
|
||||||
<string name="bolusdelivered" formatted="false">Bolus %.2fU delivered successfully</string>
|
<string name="bolusdelivered" formatted="false">Bolus %.2fU delivered successfully</string>
|
||||||
|
<string name="bolusrequested" formatted="false">Going to deliver %.2fU</string>
|
||||||
<string name="smscommunicator_bolusdelivered" formatted="false">Bolus %.2fU delivered successfully</string>
|
<string name="smscommunicator_bolusdelivered" formatted="false">Bolus %.2fU delivered successfully</string>
|
||||||
<string name="bolusdelivering" formatted="false">Delivering %.2fU</string>
|
<string name="bolusdelivering" formatted="false">Delivering %.2fU</string>
|
||||||
<string name="smscommunicator_remotecommandsallowed">Allow remote commands via SMS</string>
|
<string name="smscommunicator_remotecommandsallowed">Allow remote commands via SMS</string>
|
||||||
|
|
Loading…
Reference in a new issue