mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Passed the respective Video/Channel/Playlist name to ShareDialog
This commit is contained in:
parent
34e0f8673e
commit
3b69e1d501
@ -17,6 +17,7 @@ import com.github.libretube.databinding.FragmentChannelBinding
|
||||
import com.github.libretube.extensions.TAG
|
||||
import com.github.libretube.extensions.formatShort
|
||||
import com.github.libretube.extensions.toID
|
||||
import com.github.libretube.obj.ShareData
|
||||
import com.github.libretube.ui.adapters.ChannelAdapter
|
||||
import com.github.libretube.ui.base.BaseFragment
|
||||
import com.github.libretube.ui.dialogs.ShareDialog
|
||||
@ -29,7 +30,7 @@ class ChannelFragment : BaseFragment() {
|
||||
|
||||
private var channelId: String? = null
|
||||
private var channelName: String? = null
|
||||
|
||||
private lateinit var shareData: ShareData
|
||||
private var nextPage: String? = null
|
||||
private var channelAdapter: ChannelAdapter? = null
|
||||
private var isLoading = true
|
||||
@ -102,7 +103,7 @@ class ChannelFragment : BaseFragment() {
|
||||
}
|
||||
// needed if the channel gets loaded by the ID
|
||||
channelId = response.id
|
||||
|
||||
shareData = ShareData(currentChannel = response.name)
|
||||
// fetch and update the subscription status
|
||||
isSubscribed = SubscriptionHelper.isSubscribed(channelId!!)
|
||||
if (isSubscribed == null) return@launchWhenCreated
|
||||
@ -125,7 +126,7 @@ class ChannelFragment : BaseFragment() {
|
||||
}
|
||||
|
||||
binding.channelShare.setOnClickListener {
|
||||
val shareDialog = ShareDialog(response.id!!.toID(), ShareObjectType.CHANNEL)
|
||||
val shareDialog = ShareDialog(response.id!!.toID(), ShareObjectType.CHANNEL, shareData)
|
||||
shareDialog.show(childFragmentManager, ShareDialog::class.java.name)
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ import com.github.libretube.extensions.toID
|
||||
import com.github.libretube.extensions.toStreamItem
|
||||
import com.github.libretube.models.PlayerViewModel
|
||||
import com.github.libretube.models.interfaces.PlayerOptionsInterface
|
||||
import com.github.libretube.obj.ShareData
|
||||
import com.github.libretube.services.BackgroundMode
|
||||
import com.github.libretube.services.DownloadService
|
||||
import com.github.libretube.ui.activities.MainActivity
|
||||
@ -159,6 +160,8 @@ class PlayerFragment : BaseFragment() {
|
||||
*/
|
||||
private lateinit var nowPlayingNotification: NowPlayingNotification
|
||||
|
||||
private lateinit var shareData: ShareData
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
arguments?.let {
|
||||
@ -428,7 +431,7 @@ class PlayerFragment : BaseFragment() {
|
||||
// share button
|
||||
binding.relPlayerShare.setOnClickListener {
|
||||
val shareDialog =
|
||||
ShareDialog(videoId!!, ShareObjectType.VIDEO, exoPlayer.currentPosition / 1000)
|
||||
ShareDialog(videoId!!, ShareObjectType.VIDEO, shareData, exoPlayer.currentPosition / 1000)
|
||||
shareDialog.show(childFragmentManager, ShareDialog::class.java.name)
|
||||
}
|
||||
|
||||
@ -824,6 +827,7 @@ class PlayerFragment : BaseFragment() {
|
||||
titleTextView.text = response.title
|
||||
|
||||
playerTitle.text = response.title
|
||||
shareData = ShareData(currentVideo = response.title)
|
||||
playerDescription.text = response.description
|
||||
|
||||
playerChannelSubCount.text = context?.getString(
|
||||
|
@ -25,6 +25,7 @@ class PlaylistFragment : BaseFragment() {
|
||||
private lateinit var binding: FragmentPlaylistBinding
|
||||
|
||||
private var playlistId: String? = null
|
||||
private var playlistName: String? = null
|
||||
private var isOwner: Boolean = false
|
||||
private var nextPage: String? = null
|
||||
private var playlistAdapter: PlaylistAdapter? = null
|
||||
@ -75,6 +76,7 @@ class PlaylistFragment : BaseFragment() {
|
||||
return@launchWhenCreated
|
||||
}
|
||||
nextPage = response.nextpage
|
||||
playlistName = response.name
|
||||
isLoading = false
|
||||
runOnUiThread {
|
||||
binding.playlistProgress.visibility = View.GONE
|
||||
@ -86,7 +88,7 @@ class PlaylistFragment : BaseFragment() {
|
||||
// show playlist options
|
||||
binding.optionsMenu.setOnClickListener {
|
||||
val optionsDialog =
|
||||
PlaylistOptionsBottomSheet(playlistId!!, isOwner)
|
||||
PlaylistOptionsBottomSheet(playlistId!!, playlistName!!, isOwner)
|
||||
optionsDialog.show(
|
||||
childFragmentManager,
|
||||
PlaylistOptionsBottomSheet::class.java.name
|
||||
|
Loading…
x
Reference in New Issue
Block a user