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