From 8ab491afa7560547929d8c1cbe55e190b300729c Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 6 Jan 2024 21:19:11 +0100 Subject: [PATCH] fix: can't open channel from player fragment --- .../java/com/github/libretube/ui/fragments/PlayerFragment.kt | 2 +- .../java/com/github/libretube/ui/fragments/PlaylistFragment.kt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt index fa6955fa7..6320b270d 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt @@ -653,7 +653,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { if (!this::streams.isInitialized) return@setOnClickListener val activity = view?.context as MainActivity - activity.navController.navigate(NavDirections.openChannel(streams.uploaderUrl)) + NavigationHelper.navigateChannel(requireContext(), streams.uploaderUrl) activity.binding.mainMotionLayout.transitionToEnd() binding.playerMotionLayout.transitionToEnd() } diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt index 5cc1ee13b..e351e99cf 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt @@ -146,8 +146,7 @@ class PlaylistFragment : DynamicLayoutManagerFragment() { binding.playlistInfo.text = getChannelAndVideoString(response, response.videos) binding.playlistInfo.setOnClickListener { - (context as MainActivity).navController - .navigate(NavDirections.openChannel(response.uploaderUrl)) + NavigationHelper.navigateChannel(requireContext(), response.uploaderUrl) } binding.playlistDescription.text = response.description?.parseAsHtml()