Skip to content

Commit

Permalink
Delete alert confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
Navid200 committed May 10, 2024
1 parent 645e8b4 commit f043049
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
26 changes: 14 additions & 12 deletions app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.eveningoutpost.dexdrip.models.AlertType;
import com.eveningoutpost.dexdrip.models.JoH;
import com.eveningoutpost.dexdrip.models.UserError.Log;
import com.eveningoutpost.dexdrip.ui.dialog.GenericConfirmDialog;
import com.eveningoutpost.dexdrip.utilitymodels.AlertPlayer;
import com.eveningoutpost.dexdrip.utilitymodels.BgGraphBuilder;
import com.eveningoutpost.dexdrip.utilitymodels.Constants;
Expand Down Expand Up @@ -565,19 +566,20 @@ public void onClick(View v) {

buttonRemove.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {


if (uuid == null) {
Log.wtf(TAG, "Error remove pressed, while we were adding an alert");
} else {
AlertType.remove_alert(uuid);
startWatchUpdaterService(mContext, WatchUpdaterService.ACTION_SYNC_ALERTTYPE, TAG);
}
Intent returnIntent = new Intent();
setResult(RESULT_OK,returnIntent);
finish();
GenericConfirmDialog.show(EditAlertActivity.this, gs(R.string.are_you_sure), gs(R.string.you_cannot_undo_delete_alert),
() -> { // This, which deletes the alert, will only be executed after confirmation
if (uuid == null) {
Log.wtf(TAG, "Error remove pressed, while we were adding an alert");
} else {
AlertType.remove_alert(uuid);
startWatchUpdaterService(mContext, WatchUpdaterService.ACTION_SYNC_ALERTTYPE, TAG);
}
Intent returnIntent = new Intent();
setResult(RESULT_OK, returnIntent);
finish();
}
);
}

});

buttonTest.setOnClickListener(new View.OnClickListener() {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,7 @@
<string name="cloud_backup">Cloud Backup</string>
<string name="select_automatic_or_select_alternate">Select Automatic for xDrip to manage files in Google Drive or select an alternate specific file to use if you need to restore from elsewhere.</string>
<string name="restoring_backup_will_erase_warning">Restoring a backup will erase your current settings and data with that from the backup.\n\nAre you absolutely sure you wish to do this?</string>
<string name="you_cannot_undo_delete_alert">You will not be able to undo this!\n\nAre you sure you want to delete this alert?</string>
<string name="this_backup_looks_like_came_from_different_format_string">This backup looks like it came from a different device:\n%s\nAre you sure you wish to restore from this backup?</string>
<string name="megabyte_format_string">%.1f MB</string>
<string name="manual_selection_google_drive_file_warning">You have selected a file from Google Drive, but this is not automatically managed by xDrip so it can only be used for manual backups and restoring.\n\nNo automatic backing up will occur with this file.\n\nContinue?</string>
Expand Down

0 comments on commit f043049

Please sign in to comment.