From 38ed07caa76e9f464a481316621d391fc2c98480 Mon Sep 17 00:00:00 2001 From: ix5 Date: Mon, 22 Feb 2021 20:17:12 +0100 Subject: [PATCH] Downloader: Deleter: Dismiss previous Snackbars Bug: In Downloader view, while deleting items, Snackbars at the bottom of the UI keep queuing up. You need to wait for all of them to dismiss themselves for files to actually be deleted. If you close NewPipe before all snackbars are dismissed, your files will not be deleted and show up again next time you start NewPipe. Fix: When running append(), trigger the commit() action immediately and cancel all delayed callbacks for commit(). This prevents Snackbars from stacking up in reverse order. Fixes: https://github.com/TeamNewPipe/NewPipe/issues/5660 --- app/src/main/java/us/shandian/giga/ui/common/Deleter.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/us/shandian/giga/ui/common/Deleter.java b/app/src/main/java/us/shandian/giga/ui/common/Deleter.java index b42ebbeb4..c554766ff 100644 --- a/app/src/main/java/us/shandian/giga/ui/common/Deleter.java +++ b/app/src/main/java/us/shandian/giga/ui/common/Deleter.java @@ -55,6 +55,14 @@ public class Deleter { } public void append(Mission item) { + + /* If a mission is removed from the list while the Snackbar for a previously + * removed item is still showing, commit the action for the previous item + * immediately. This prevents Snackbars from stacking up in reverse order. + */ + mHandler.removeCallbacks(rCommit); + commit(); + mIterator.hide(item); items.add(0, item);