Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 1aed661a authored by Michael W's avatar Michael W Committed by Michael Bestas
Browse files

Recorder: Fix cancelling the share notification

* After the restructuring in the previous commits, the share notification
  wouldn't vanish anymore after the deletion of the last item

Change-Id: I4c3d7910faf8fc79e20f25e3946c8f0fab20381e
parent 2aa3acfa
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import androidx.appcompat.app.AlertDialog;
import org.lineageos.recorder.task.DeleteRecordingTask;
import org.lineageos.recorder.task.TaskExecutor;
import org.lineageos.recorder.utils.LastRecordHelper;
import org.lineageos.recorder.utils.Utils;

public class DeleteLastActivity extends ComponentActivity {
    private TaskExecutor mTaskExecutor;
@@ -46,8 +47,11 @@ public class DeleteLastActivity extends ComponentActivity {
                    .setTitle(R.string.delete_title)
                    .setMessage(getString(R.string.delete_recording_message))
                    .setPositiveButton(R.string.delete, (d, which) -> mTaskExecutor.runTask(
                            new DeleteRecordingTask(getContentResolver(), uri),
                            d::dismiss))
                            new DeleteRecordingTask(getContentResolver(), uri), () -> {
                                d.dismiss();
                                Utils.cancelShareNotification(this);
                                LastRecordHelper.setLastItem(this, null);
                            }))
                    .setNegativeButton(R.string.cancel, null)
                    .setOnDismissListener(d -> finish())
                    .show();
+8 −3
Original line number Diff line number Diff line
@@ -127,8 +127,10 @@ public class ListActivity extends AppCompatActivity implements RecordingListCall
                .setTitle(R.string.delete_title)
                .setMessage(getString(R.string.delete_recording_message))
                .setPositiveButton(R.string.delete, (d, which) -> mTaskExecutor.runTask(
                        new DeleteRecordingTask(getContentResolver(), uri),
                        () -> mAdapter.onDelete(index)))
                        new DeleteRecordingTask(getContentResolver(), uri), () -> {
                            mAdapter.onDelete(index);
                            Utils.cancelShareNotification(this);
                        }))
                .setNegativeButton(R.string.cancel, null)
                .show();
    }
@@ -233,7 +235,10 @@ public class ListActivity extends AppCompatActivity implements RecordingListCall

    private void deleteRecording(@NonNull RecordingData item) {
        mTaskExecutor.runTask(new DeleteRecordingTask(getContentResolver(), item.getUri()),
                () -> mAdapter.onDelete(item));
                () -> {
                    mAdapter.onDelete(item);
                    Utils.cancelShareNotification(this);
                });
    }

    private void deleteAllRecordings() {