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