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
This commit is contained in:
ix5 2021-02-22 20:17:12 +01:00 committed by TobiGr
parent 72ee4be495
commit 38ed07caa7
1 changed files with 8 additions and 0 deletions

View File

@ -55,6 +55,14 @@ public class Deleter {
} }
public void append(Mission item) { 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); mIterator.hide(item);
items.add(0, item); items.add(0, item);