Skip to content

Commit

Permalink
Merge pull request #7355 from petlyh/append-remote-playlist
Browse files Browse the repository at this point in the history
Add a "Add to playlist" item to the remote playlist menu
  • Loading branch information
Stypox authored May 12, 2022
2 parents a4037a8 + fcaa787 commit b4615f7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.schabi.newpipe.NewPipeDatabase;
import org.schabi.newpipe.R;
import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity;
import org.schabi.newpipe.database.stream.model.StreamEntity;
import org.schabi.newpipe.databinding.PlaylistControlBinding;
import org.schabi.newpipe.databinding.PlaylistHeaderBinding;
import org.schabi.newpipe.error.ErrorInfo;
Expand All @@ -41,6 +42,7 @@
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.info_list.dialog.InfoItemDialog;
import org.schabi.newpipe.local.dialog.PlaylistDialog;
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
import org.schabi.newpipe.player.MainPlayer.PlayerType;
import org.schabi.newpipe.player.playqueue.PlayQueue;
Expand All @@ -56,6 +58,7 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import java.util.stream.Collectors;

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Flowable;
Expand Down Expand Up @@ -237,6 +240,17 @@ public boolean onOptionsItemSelected(final MenuItem item) {
case R.id.menu_item_bookmark:
onBookmarkClicked();
break;
case R.id.menu_item_append_playlist:
disposables.add(PlaylistDialog.createCorrespondingDialog(
getContext(),
getPlayQueue()
.getStreams()
.stream()
.map(StreamEntity::new)
.collect(Collectors.toList()),
dialog -> dialog.show(getFM(), TAG)
));
break;
default:
return super.onOptionsItemSelected(item);
}
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/menu/menu_playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@
android:orderInCategory="2"
android:title="@string/open_in_browser"
app:showAsAction="never" />

<item
android:id="@+id/menu_item_append_playlist"
android:orderInCategory="3"
android:title="@string/add_to_playlist"
app:showAsAction="never" />
</menu>

0 comments on commit b4615f7

Please sign in to comment.