Search in sources :

Example 1 with CancelBolusMessage

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);
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) AppLayerMessage(sugar.free.sightparser.applayer.messages.AppLayerMessage) CancelTBRMessage(sugar.free.sightparser.applayer.messages.remote_control.CancelTBRMessage) CancelBolusMessage(sugar.free.sightparser.applayer.messages.remote_control.CancelBolusMessage) SingleMessageTaskRunner(sugar.free.sightparser.handling.SingleMessageTaskRunner)

Aggregations

CustomEvent (com.crashlytics.android.answers.CustomEvent)1 AppLayerMessage (sugar.free.sightparser.applayer.messages.AppLayerMessage)1 CancelBolusMessage (sugar.free.sightparser.applayer.messages.remote_control.CancelBolusMessage)1 CancelTBRMessage (sugar.free.sightparser.applayer.messages.remote_control.CancelTBRMessage)1 SingleMessageTaskRunner (sugar.free.sightparser.handling.SingleMessageTaskRunner)1