1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-02 23:13:12 +01:00

Added option to download items in the queue

This commit is contained in:
Jared Fantaye 2022-12-04 20:35:06 +01:00
parent 3bb51875bc
commit 0923594e51
2 changed files with 15 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;
@ -7,9 +8,11 @@ import android.view.ContextThemeWrapper;
import android.view.View;
import android.widget.PopupMenu;
import androidx.appcompat.app.AppCompatActivity;
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 +78,15 @@ 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(((AppCompatActivity) context)
.getSupportFragmentManager(), "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>