kopia lustrzana https://github.com/TeamNewPipe/NewPipe
Merge pull request #9502 from Jared234/8585_download_in_queue
Added option to download items in the queuepull/8769/head
commit
27f6c3b634
|
@ -1,5 +1,6 @@
|
||||||
package org.schabi.newpipe;
|
package org.schabi.newpipe;
|
||||||
|
|
||||||
|
import static org.schabi.newpipe.util.SparseItemUtil.fetchStreamInfoAndSaveToDatabase;
|
||||||
import static org.schabi.newpipe.util.external_communication.ShareUtils.shareText;
|
import static org.schabi.newpipe.util.external_communication.ShareUtils.shareText;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -10,6 +11,7 @@ import android.widget.PopupMenu;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import org.schabi.newpipe.database.stream.model.StreamEntity;
|
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.local.dialog.PlaylistDialog;
|
||||||
import org.schabi.newpipe.player.playqueue.PlayQueue;
|
import org.schabi.newpipe.player.playqueue.PlayQueue;
|
||||||
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
|
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
|
||||||
|
@ -75,6 +77,14 @@ public final class QueueItemMenuUtil {
|
||||||
shareText(context, item.getTitle(), item.getUrl(),
|
shareText(context, item.getTitle(), item.getUrl(),
|
||||||
item.getThumbnailUrl());
|
item.getThumbnailUrl());
|
||||||
return true;
|
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;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,4 +16,7 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_item_share"
|
android:id="@+id/menu_item_share"
|
||||||
android:title="@string/share" />
|
android:title="@string/share" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_item_download"
|
||||||
|
android:title="@string/download" />
|
||||||
</menu>
|
</menu>
|
Ładowanie…
Reference in New Issue