use of sugar.free.sightremote.dialogs.ConfirmationDialog in project SightRemote by TebbeUbben.
the class ChangeActiveBRProfileActivity method onProfileChange.
@Override
public void onProfileChange(int profile) {
ActiveProfileBlock block = new ActiveProfileBlock();
block.setActiveProfile(ActiveProfileBlock.ActiveProfile.values()[profile]);
ArrayList<ConfigurationBlock> blocks = new ArrayList<>();
blocks.add(block);
WriteConfigurationTaskRunner taskRunner = new WriteConfigurationTaskRunner(getServiceConnector(), blocks);
(confirmationDialog = new ConfirmationDialog(this, HTMLUtil.getHTML(R.string.change_br_profile_confirmation), () -> {
taskRunner.fetch(this);
adapter.setActiveProfile(profile);
adapter.notifyDataSetChanged();
}, () -> adapter.notifyDataSetChanged())).show();
}
use of sugar.free.sightremote.dialogs.ConfirmationDialog in project SightRemote by TebbeUbben.
the class StatusActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item == startPump) {
if (getServiceConnector().getStatus() == Status.CONNECTED) {
SetPumpStatusMessage message = new SetPumpStatusMessage();
message.setPumpStatus(PumpStatus.STARTED);
SingleMessageTaskRunner taskRunner = new SingleMessageTaskRunner(getServiceConnector(), message);
(confirmationDialog = new ConfirmationDialog(this, HTMLUtil.getHTML(R.string.start_pump_confirmation), () -> {
startPump.setVisible(false);
if (StatusActivity.this.taskRunner != null)
StatusActivity.this.taskRunner.cancel();
taskRunner.fetch(errorToastResultCallback);
handler.removeCallbacks(taskRunnerRunnable);
handler.postDelayed(taskRunnerRunnable, 500);
})).show();
}
return true;
} else if (item == stopPump) {
if (getServiceConnector().getStatus() == Status.CONNECTED) {
SetPumpStatusMessage message = new SetPumpStatusMessage();
message.setPumpStatus(PumpStatus.STOPPED);
SingleMessageTaskRunner taskRunner = new SingleMessageTaskRunner(getServiceConnector(), message);
(confirmationDialog = new ConfirmationDialog(this, HTMLUtil.getHTML(R.string.stop_pump_confirmation), () -> {
stopPump.setVisible(false);
if (StatusActivity.this.taskRunner != null)
StatusActivity.this.taskRunner.cancel();
taskRunner.fetch(errorToastResultCallback);
handler.removeCallbacks(taskRunnerRunnable);
handler.postDelayed(taskRunnerRunnable, 500);
})).show();
}
return true;
}
return super.onOptionsItemSelected(item);
}
use of sugar.free.sightremote.dialogs.ConfirmationDialog in project SightRemote by TebbeUbben.
the class ExtendedBolusActivity method onClick.
@Override
public void onClick(View view) {
ExtendedBolusMessage message = new ExtendedBolusMessage();
message.setAmount(bolusAmountPicker.getPickerValue());
message.setDuration(durationPicker.getPickerValue());
SingleMessageTaskRunner taskRunner = new SingleMessageTaskRunner(getServiceConnector(), message);
(confirmationDialog = new ConfirmationDialog(this, HTMLUtil.getHTML(R.string.extended_bolus_confirmation, UnitFormatter.formatUnits(bolusAmountPicker.getPickerValue()), UnitFormatter.formatDuration(durationPicker.getPickerValue())), () -> {
showLoadingIndicator();
taskRunner.fetch(ExtendedBolusActivity.this);
})).show();
}
use of sugar.free.sightremote.dialogs.ConfirmationDialog in project SightRemote by TebbeUbben.
the class MultiwaveBolusActivity method onClick.
@Override
public void onClick(View view) {
MultiwaveBolusMessage message = new MultiwaveBolusMessage();
message.setAmount(immediateBolusAmountPicker.getPickerValue());
message.setDelayedAmount(delayedBolusAmountPicker.getPickerValue());
message.setDuration(durationPicker.getPickerValue());
SingleMessageTaskRunner taskRunner = new SingleMessageTaskRunner(getServiceConnector(), message);
(confirmationDialog = new ConfirmationDialog(this, HTMLUtil.getHTML(R.string.multiwave_bolus_confirmation, UnitFormatter.formatUnits(immediateBolusAmountPicker.getPickerValue()), UnitFormatter.formatUnits(delayedBolusAmountPicker.getPickerValue()), UnitFormatter.formatDuration(durationPicker.getPickerValue())), () -> {
showLoadingIndicator();
taskRunner.fetch(MultiwaveBolusActivity.this);
})).show();
}
use of sugar.free.sightremote.dialogs.ConfirmationDialog in project SightRemote by TebbeUbben.
the class TemporaryBasalRateActivity method onClick.
@Override
public void onClick(View v) {
int duration = durationPicker.getPickerValue();
int amount = percentage.getValue() * 10;
SetTBRTaskRunner taskRunner = new SetTBRTaskRunner(getServiceConnector(), amount, duration);
(confirmationDialog = new ConfirmationDialog(this, HTMLUtil.getHTML(R.string.tbr_confirmation, amount, UnitFormatter.formatDuration(duration)), () -> {
showManualOverlay();
showLoadingIndicator();
taskRunner.fetch(TemporaryBasalRateActivity.this);
})).show();
}
Aggregations