Skip to content

Commit

Permalink
Downloader: Deleter: Dismiss previous Snackbars
Browse files Browse the repository at this point in the history
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: #5660
  • Loading branch information
ix5 authored and TobiGr committed May 4, 2021
1 parent 72ee4be commit 38ed07c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/main/java/us/shandian/giga/ui/common/Deleter.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public Deleter(View v, Context c, MissionAdapter a, DownloadManager d, MissionIt
}

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);

Expand Down

0 comments on commit 38ed07c

Please sign in to comment.