Check if already running before removing watched

This commit is contained in:
Stypox 2020-04-03 20:34:01 +02:00
parent 6571fdbaa2
commit 92ca1e6e09
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23

View file

@ -369,12 +369,11 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
} }
public void removeWatchedStreams() { public void removeWatchedStreams() {
showLoading(); if (removeWatchedDisposable != null && !removeWatchedDisposable.isDisposed()) {
// already running
if (removeWatchedDisposable != null) { return;
// In case this is called twice
removeWatchedDisposable.dispose();
} }
showLoading();
removeWatchedDisposable = Flowable.just( removeWatchedDisposable = Flowable.just(
playlistManager.getPlaylistStreams(playlistId).blockingFirst()) playlistManager.getPlaylistStreams(playlistId).blockingFirst())
@ -431,8 +430,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
} }
hideLoading(); hideLoading();
}, this::onError }, this::onError);
);
} }
@Override @Override