mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Add more options to the download options bottom sheet
This commit is contained in:
parent
338e3dafa9
commit
a35ff72f21
@ -8,7 +8,11 @@ import com.github.libretube.constants.IntentData
|
||||
import com.github.libretube.db.DatabaseHolder
|
||||
import com.github.libretube.db.obj.Download
|
||||
import com.github.libretube.db.obj.DownloadItem
|
||||
import com.github.libretube.enums.ShareObjectType
|
||||
import com.github.libretube.helpers.NavigationHelper
|
||||
import com.github.libretube.obj.ShareData
|
||||
import com.github.libretube.services.OfflinePlayerService
|
||||
import com.github.libretube.ui.dialogs.ShareDialog
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import kotlin.io.path.deleteIfExists
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@ -20,7 +24,12 @@ class DownloadOptionsBottomSheet(
|
||||
private val onDelete: () -> Unit
|
||||
) : BaseBottomSheet() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val options = listOf(R.string.playOnBackground, R.string.delete).map { getString(it) }
|
||||
val options = listOf(
|
||||
R.string.playOnBackground,
|
||||
R.string.go_to_video,
|
||||
R.string.share,
|
||||
R.string.delete
|
||||
).map { getString(it) }
|
||||
setSimpleItems(options) { selectedIndex ->
|
||||
when (selectedIndex) {
|
||||
0 -> {
|
||||
@ -29,6 +38,14 @@ class DownloadOptionsBottomSheet(
|
||||
ContextCompat.startForegroundService(requireContext(), playerIntent)
|
||||
}
|
||||
1 -> {
|
||||
NavigationHelper.navigateVideo(requireContext(), videoId = download.videoId)
|
||||
}
|
||||
2 -> {
|
||||
val shareData = ShareData(currentVideo = download.uploader)
|
||||
ShareDialog(download.videoId, ShareObjectType.VIDEO, shareData)
|
||||
.show(parentFragmentManager, null)
|
||||
}
|
||||
3 -> {
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(R.string.delete)
|
||||
.setMessage(R.string.irreversible)
|
||||
|
@ -463,6 +463,7 @@
|
||||
<string name="play_automatically">Play automatically</string>
|
||||
<string name="play_automatically_summary">Start playing video automatically when selecting</string>
|
||||
<string name="fullscreen_gestures">Enter/exit fullscreen gestures</string>
|
||||
<string name="go_to_video">Go to video</string>
|
||||
|
||||
<!-- Notification channel strings -->
|
||||
<string name="download_channel_name">Download Service</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user