Merge pull request #9502 from Jared234/8585_download_in_queue

Added option to download items in the queue
This commit is contained in:
Stypox 2022-12-31 19:34:07 +01:00 committed by GitHub
commit 27f6c3b634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package org.schabi.newpipe;
import static org.schabi.newpipe.util.SparseItemUtil.fetchStreamInfoAndSaveToDatabase;
import static org.schabi.newpipe.util.external_communication.ShareUtils.shareText;
import android.content.Context;
@ -10,6 +11,7 @@ import android.widget.PopupMenu;
import androidx.fragment.app.FragmentManager;
import org.schabi.newpipe.database.stream.model.StreamEntity;
import org.schabi.newpipe.download.DownloadDialog;
import org.schabi.newpipe.local.dialog.PlaylistDialog;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
@ -75,6 +77,14 @@ public final class QueueItemMenuUtil {
shareText(context, item.getTitle(), item.getUrl(),
item.getThumbnailUrl());
return true;
case R.id.menu_item_download:
fetchStreamInfoAndSaveToDatabase(context, item.getServiceId(), item.getUrl(),
info -> {
final DownloadDialog downloadDialog = new DownloadDialog(context,
info);
downloadDialog.show(fragmentManager, "downloadDialog");
});
return true;
}
return false;
});

View File

@ -16,4 +16,7 @@
<item
android:id="@+id/menu_item_share"
android:title="@string/share" />
<item
android:id="@+id/menu_item_download"
android:title="@string/download" />
</menu>