Merge pull request #9502 from Jared234/8585_download_in_queue

Added option to download items in the queue
pull/8769/head
Stypox 2022-12-31 19:34:07 +01:00 zatwierdzone przez GitHub
commit 27f6c3b634
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 13 dodań i 0 usunięć

Wyświetl plik

@ -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;
}); });

Wyświetl plik

@ -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>