mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #1985 from Bnyro/master
enable save button at player fragment for local playlists
This commit is contained in:
commit
8a764b0397
@ -11,7 +11,6 @@ import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.api.PlaylistsHelper
|
||||
import com.github.libretube.constants.IntentData
|
||||
import com.github.libretube.databinding.DialogAddtoplaylistBinding
|
||||
import com.github.libretube.extensions.TAG
|
||||
import com.github.libretube.extensions.toastFromMainThread
|
||||
@ -22,14 +21,13 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class AddToPlaylistDialog : DialogFragment() {
|
||||
class AddToPlaylistDialog(
|
||||
private val videoId: String
|
||||
) : DialogFragment() {
|
||||
private lateinit var binding: DialogAddtoplaylistBinding
|
||||
private val viewModel: PlaylistViewModel by activityViewModels()
|
||||
|
||||
private lateinit var videoId: String
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
videoId = arguments?.getString(IntentData.videoId)!!
|
||||
binding = DialogAddtoplaylistBinding.inflate(layoutInflater)
|
||||
binding.title.text = ThemeHelper.getStyledAppName(requireContext())
|
||||
|
||||
|
@ -942,18 +942,11 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
streams.uploader
|
||||
)
|
||||
|
||||
if (token != "") {
|
||||
binding.relPlayerSave.setOnClickListener {
|
||||
val newFragment = AddToPlaylistDialog()
|
||||
val bundle = Bundle()
|
||||
bundle.putString(IntentData.videoId, videoId)
|
||||
newFragment.arguments = bundle
|
||||
newFragment.show(childFragmentManager, AddToPlaylistDialog::class.java.name)
|
||||
}
|
||||
} else {
|
||||
binding.relPlayerSave.setOnClickListener {
|
||||
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
AddToPlaylistDialog(videoId!!).show(
|
||||
childFragmentManager,
|
||||
AddToPlaylistDialog::class.java.name
|
||||
)
|
||||
}
|
||||
|
||||
// next and previous buttons
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.github.libretube.ui.sheets
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.core.os.bundleOf
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.api.RetrofitInstance
|
||||
import com.github.libretube.constants.IntentData
|
||||
import com.github.libretube.enums.ShareObjectType
|
||||
import com.github.libretube.extensions.toStreamItem
|
||||
import com.github.libretube.obj.ShareData
|
||||
@ -52,9 +50,7 @@ class VideoOptionsBottomSheet(
|
||||
}
|
||||
// Add Video to Playlist Dialog
|
||||
context?.getString(R.string.addToPlaylist) -> {
|
||||
AddToPlaylistDialog().apply {
|
||||
arguments = bundleOf(IntentData.videoId to videoId)
|
||||
}.show(
|
||||
AddToPlaylistDialog(videoId).show(
|
||||
parentFragmentManager,
|
||||
AddToPlaylistDialog::class.java.name
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user