|
2 | 2 |
|
3 | 3 | import static org.schabi.newpipe.util.NavigationHelper.openChannelFragment; |
4 | 4 | import static org.schabi.newpipe.util.SparseItemUtil.fetchItemInfoIfSparse; |
| 5 | +import static org.schabi.newpipe.util.SparseItemUtil.fetchStreamInfoAndSaveToDatabase; |
5 | 6 | import static org.schabi.newpipe.util.SparseItemUtil.fetchUploaderUrlIfSparse; |
6 | 7 |
|
7 | 8 | import android.net.Uri; |
|
11 | 12 |
|
12 | 13 | import org.schabi.newpipe.R; |
13 | 14 | import org.schabi.newpipe.database.stream.model.StreamEntity; |
| 15 | +import org.schabi.newpipe.download.DownloadDialog; |
14 | 16 | import org.schabi.newpipe.local.dialog.PlaylistAppendDialog; |
15 | 17 | import org.schabi.newpipe.local.dialog.PlaylistDialog; |
16 | 18 | import org.schabi.newpipe.local.history.HistoryRecordManager; |
@@ -110,6 +112,15 @@ public enum StreamDialogDefaultEntry { |
110 | 112 | ShareUtils.shareText(fragment.requireContext(), item.getName(), item.getUrl(), |
111 | 113 | item.getThumbnailUrl())), |
112 | 114 |
|
| 115 | + DOWNLOAD(R.string.download, (fragment, item) -> |
| 116 | + fetchStreamInfoAndSaveToDatabase(fragment.requireContext(), item.getServiceId(), |
| 117 | + item.getUrl(), info -> { |
| 118 | + final DownloadDialog downloadDialog |
| 119 | + = DownloadDialog.newInstance(fragment.requireContext(), info); |
| 120 | + downloadDialog.show(fragment.getChildFragmentManager(), "downloadDialog"); |
| 121 | + }) |
| 122 | + ), |
| 123 | + |
113 | 124 | OPEN_IN_BROWSER(R.string.open_in_browser, (fragment, item) -> |
114 | 125 | ShareUtils.openUrlInBrowser(fragment.requireContext(), item.getUrl())), |
115 | 126 |
|
|
0 commit comments