mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00:00
-Fixed playlist bookmark button not showing out when activity / playlist fragment is created by external share.
This commit is contained in:
parent
490b250db6
commit
c5ec8d04c1
@ -111,6 +111,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||
headerPopupButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_popup_button);
|
||||
headerBackgroundButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_bg_button);
|
||||
|
||||
|
||||
return headerRootLayout;
|
||||
}
|
||||
|
||||
@ -175,6 +176,8 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||
|
||||
playlistBookmarkButton = menu.findItem(R.id.menu_item_bookmark);
|
||||
playlistUnbookmarkButton = menu.findItem(R.id.menu_item_unbookmark);
|
||||
|
||||
updateBookmarkButtonsVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -338,11 +341,8 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||
|
||||
@Override
|
||||
public void onNext(List<PlaylistRemoteEntity> playlist) {
|
||||
if (playlistBookmarkButton == null || playlistUnbookmarkButton == null) return;
|
||||
|
||||
playlistBookmarkButton.setVisible(playlist.isEmpty());
|
||||
playlistUnbookmarkButton.setVisible(!playlist.isEmpty());
|
||||
playlistEntity = playlist.isEmpty() ? null : playlist.get(0);
|
||||
updateBookmarkButtonsVisibility();
|
||||
|
||||
if (bookmarkReactor != null) bookmarkReactor.request(1);
|
||||
}
|
||||
@ -387,4 +387,11 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||
.doFinally(() -> playlistEntity = null)
|
||||
.subscribe(ignored -> {/* Do nothing */}, this::onError);
|
||||
}
|
||||
|
||||
private void updateBookmarkButtonsVisibility() {
|
||||
if (playlistBookmarkButton == null || playlistUnbookmarkButton == null) return;
|
||||
|
||||
playlistBookmarkButton.setVisible(playlistEntity == null);
|
||||
playlistUnbookmarkButton.setVisible(playlistEntity != null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user