use of sugar.free.sightparser.applayer.messages.remote_control.CancelBolusMessage in project SightRemote by TebbeUbben.
the class StatusActivity method onClick.
@Override
public void onClick(View v) {
if (StatusActivity.this.taskRunner != null)
StatusActivity.this.taskRunner.cancel();
handler.removeCallbacks(taskRunnerRunnable);
AppLayerMessage message = null;
if (v == tbrCancel) {
tbrCancel.setVisibility(View.GONE);
message = new CancelTBRMessage();
Answers.getInstance().logCustom(new CustomEvent("TBR Cancelled"));
} else if (v == bolus1Cancel) {
bolus1Cancel.setVisibility(View.INVISIBLE);
CancelBolusMessage cancelBolusMessage = new CancelBolusMessage();
cancelBolusMessage.setBolusId(statusResult.getActiveBolusesMessage().getBolus1().getBolusID());
message = cancelBolusMessage;
Answers.getInstance().logCustom(new CustomEvent("Bolus Cancelled"));
} else if (v == bolus2Cancel) {
bolus2Cancel.setVisibility(View.INVISIBLE);
CancelBolusMessage cancelBolusMessage = new CancelBolusMessage();
cancelBolusMessage.setBolusId(statusResult.getActiveBolusesMessage().getBolus2().getBolusID());
message = cancelBolusMessage;
Answers.getInstance().logCustom(new CustomEvent("Bolus Cancelled"));
} else if (v == bolus3Cancel) {
bolus3Cancel.setVisibility(View.INVISIBLE);
CancelBolusMessage cancelBolusMessage = new CancelBolusMessage();
cancelBolusMessage.setBolusId(statusResult.getActiveBolusesMessage().getBolus3().getBolusID());
message = cancelBolusMessage;
Answers.getInstance().logCustom(new CustomEvent("Bolus Cancelled"));
}
SingleMessageTaskRunner taskRunner = new SingleMessageTaskRunner(getServiceConnector(), message);
taskRunner.fetch(errorToastResultCallback);
handler.postDelayed(taskRunnerRunnable, 500);
}
Aggregations