Fix checkstyle errors

This commit is contained in:
Stypox 2020-04-03 20:13:56 +02:00
parent 9c3f138b8e
commit 6571fdbaa2
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 21 additions and 12 deletions

View File

@ -79,7 +79,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
private View headerPlayAllButton; private View headerPlayAllButton;
private View headerPopupButton; private View headerPopupButton;
private View headerBackgroundButton; private View headerBackgroundButton;
private ItemTouchHelper itemTouchHelper; private ItemTouchHelper itemTouchHelper;
private LocalPlaylistManager playlistManager; private LocalPlaylistManager playlistManager;
@ -255,9 +255,11 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
} }
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
if (DEBUG) Log.d(TAG, "onCreateOptionsMenu() called with: menu = [" + menu + if (DEBUG) {
"], inflater = [" + inflater + "]"); Log.d(TAG, "onCreateOptionsMenu() called with: menu = [" + menu
+ "], inflater = [" + inflater + "]");
}
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_local_playlist, menu); inflater.inflate(R.menu.menu_local_playlist, menu);
} }
@ -300,7 +302,9 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
disposables.dispose(); disposables.dispose();
} }
if (removeWatchedDisposable != null) removeWatchedDisposable.dispose(); if (removeWatchedDisposable != null) {
removeWatchedDisposable.dispose();
}
debouncedSaveSignal = null; debouncedSaveSignal = null;
playlistManager = null; playlistManager = null;
@ -353,7 +357,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.menu_item_removeWatched: case R.id.menu_item_removeWatched:
removeWatchedStreams(); removeWatchedStreams();
@ -372,7 +376,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
removeWatchedDisposable.dispose(); removeWatchedDisposable.dispose();
} }
removeWatchedDisposable = Flowable.just(playlistManager.getPlaylistStreams(playlistId).blockingFirst()) removeWatchedDisposable = Flowable.just(
playlistManager.getPlaylistStreams(playlistId).blockingFirst())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.newThread())
.map((@NonNull List<PlaylistStreamEntry> playlist) -> { .map((@NonNull List<PlaylistStreamEntry> playlist) -> {
HistoryRecordManager recordManager = new HistoryRecordManager(getContext()); HistoryRecordManager recordManager = new HistoryRecordManager(getContext());
@ -382,19 +387,22 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
// already sorted by ^ getStreamHistorySortedById(), binary search can be used // already sorted by ^ getStreamHistorySortedById(), binary search can be used
ArrayList<Long> historyStreamIds = new ArrayList<>(); ArrayList<Long> historyStreamIds = new ArrayList<>();
while(historyIter.hasNext()) { while (historyIter.hasNext()) {
historyStreamIds.add(historyIter.next().getStreamId()); historyStreamIds.add(historyIter.next().getStreamId());
} }
List<PlaylistStreamEntry> notWatchedItems = new ArrayList<>(); List<PlaylistStreamEntry> notWatchedItems = new ArrayList<>();
boolean thumbnailVideoRemoved = false; boolean thumbnailVideoRemoved = false;
while(playlistIter.hasNext()) { while (playlistIter.hasNext()) {
PlaylistStreamEntry playlistItem = playlistIter.next(); PlaylistStreamEntry playlistItem = playlistIter.next();
int indexInHistory = Collections.binarySearch(historyStreamIds, playlistItem.getStreamId()); int indexInHistory = Collections.binarySearch(historyStreamIds,
playlistItem.getStreamId());
if (indexInHistory < 0) { if (indexInHistory < 0) {
notWatchedItems.add(playlistItem); notWatchedItems.add(playlistItem);
} else if (!thumbnailVideoRemoved && playlistManager.getPlaylistThumbnail(playlistId).equals(playlistItem.getStreamEntity().getThumbnailUrl())) { } else if (!thumbnailVideoRemoved
&& playlistManager.getPlaylistThumbnail(playlistId)
.equals(playlistItem.getStreamEntity().getThumbnailUrl())) {
thumbnailVideoRemoved = true; thumbnailVideoRemoved = true;
} }
} }
@ -403,7 +411,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
}) })
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(flow -> { .subscribe(flow -> {
List<PlaylistStreamEntry> notWatchedItems = (List<PlaylistStreamEntry>) flow.blockingFirst(); List<PlaylistStreamEntry> notWatchedItems =
(List<PlaylistStreamEntry>) flow.blockingFirst();
boolean thumbnailVideoRemoved = (Boolean) flow.blockingLast(); boolean thumbnailVideoRemoved = (Boolean) flow.blockingLast();
itemListAdapter.clearStreamItemList(); itemListAdapter.clearStreamItemList();