Skip to content

Commit 0923594

Browse files
committed
Added option to download items in the queue
1 parent 3bb5187 commit 0923594

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

app/src/main/java/org/schabi/newpipe/QueueItemMenuUtil.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
package org.schabi.newpipe;
22

3+
import static org.schabi.newpipe.util.SparseItemUtil.fetchStreamInfoAndSaveToDatabase;
34
import static org.schabi.newpipe.util.external_communication.ShareUtils.shareText;
45

56
import android.content.Context;
67
import android.view.ContextThemeWrapper;
78
import android.view.View;
89
import android.widget.PopupMenu;
910

11+
import androidx.appcompat.app.AppCompatActivity;
1012
import androidx.fragment.app.FragmentManager;
1113

1214
import org.schabi.newpipe.database.stream.model.StreamEntity;
15+
import org.schabi.newpipe.download.DownloadDialog;
1316
import org.schabi.newpipe.local.dialog.PlaylistDialog;
1417
import org.schabi.newpipe.player.playqueue.PlayQueue;
1518
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
@@ -75,6 +78,15 @@ public static void openPopupMenu(final PlayQueue playQueue,
7578
shareText(context, item.getTitle(), item.getUrl(),
7679
item.getThumbnailUrl());
7780
return true;
81+
case R.id.menu_item_download:
82+
fetchStreamInfoAndSaveToDatabase(context, item.getServiceId(),
83+
item.getUrl(), info -> {
84+
final DownloadDialog downloadDialog = new DownloadDialog(context,
85+
info);
86+
downloadDialog.show(((AppCompatActivity) context)
87+
.getSupportFragmentManager(), "downloadDialog");
88+
});
89+
return true;
7890
}
7991
return false;
8092
});

app/src/main/res/menu/menu_play_queue_item.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@
1616
<item
1717
android:id="@+id/menu_item_share"
1818
android:title="@string/share" />
19+
<item
20+
android:id="@+id/menu_item_download"
21+
android:title="@string/download" />
1922
</menu>

0 commit comments

Comments
 (0)