Skip to content

Commit f77e3db

Browse files
committed
Add download long press menu action
1 parent e3b0de1 commit f77e3db

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/src/main/java/org/schabi/newpipe/ui/components/menu/LongPressAction.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
2121
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
2222
import org.schabi.newpipe.R
2323
import org.schabi.newpipe.database.stream.model.StreamEntity
24+
import org.schabi.newpipe.download.DownloadDialog
2425
import org.schabi.newpipe.extractor.InfoItem
2526
import org.schabi.newpipe.extractor.stream.StreamInfoItem
2627
import org.schabi.newpipe.ktx.findFragmentActivity
@@ -107,7 +108,16 @@ data class LongPressAction(
107108
return buildPlayerActionList { SinglePlayQueue(item) } +
108109
buildShareActionList(item) +
109110
listOf(
110-
Type.Download.buildAction { context -> /* TODO */ },
111+
Type.Download.buildAction { context ->
112+
SparseItemUtil.fetchStreamInfoAndSaveToDatabase(
113+
context, item.serviceId, item.url
114+
) { info ->
115+
val downloadDialog = DownloadDialog(context, info)
116+
val fragmentManager = context.findFragmentActivity()
117+
.supportFragmentManager
118+
downloadDialog.show(fragmentManager, "downloadDialog")
119+
}
120+
},
111121
Type.AddToPlaylist.buildAction { context ->
112122
PlaylistDialog.createCorrespondingDialog(
113123
context,

0 commit comments

Comments
 (0)