From 6f004830ff48b995299f96a41d62369751dee23f Mon Sep 17 00:00:00 2001 From: Kelvin Date: Mon, 2 Dec 2024 16:23:30 +0100 Subject: [PATCH] Fix directly opening playlists urls in wrong ui, causing wrong thread --- .../com/futo/platformplayer/activities/MainActivity.kt | 2 +- .../fragment/mainactivity/main/PlaylistFragment.kt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt b/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt index 492b7c39..a9bee418 100644 --- a/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt +++ b/app/src/main/java/com/futo/platformplayer/activities/MainActivity.kt @@ -834,7 +834,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher { } else if (StatePlatform.instance.hasEnabledPlaylistClient(url)) { Logger.i(TAG, "handleUrl(url=$url) found playlist client"); lifecycleScope.launch(Dispatchers.Main) { - navigate(_fragMainPlaylist, url); + navigate(_fragMainRemotePlaylist, url); delay(100); _fragVideoDetail.minimizeVideoDetail(); }; diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/PlaylistFragment.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/PlaylistFragment.kt index 25e96e1b..59575bda 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/PlaylistFragment.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/PlaylistFragment.kt @@ -70,7 +70,7 @@ class PlaylistFragment : MainFragment() { private var _editPlaylistOverlay: SlideUpMenuOverlay? = null; private var _url: String? = null; - private val _taskLoadPlaylist: TaskHandler; + private val _taskLoadPlaylist: TaskHandler; constructor(fragment: PlaylistFragment, inflater: LayoutInflater) : super(inflater) { _fragment = fragment; @@ -137,16 +137,16 @@ class PlaylistFragment : MainFragment() { ); }; - _taskLoadPlaylist = TaskHandler( + _taskLoadPlaylist = TaskHandler( StateApp.instance.scopeGetter, { - return@TaskHandler StatePlatform.instance.getPlaylist(it); + return@TaskHandler StatePlatform.instance.getPlaylist(it).toPlaylist(); }) .success { setName(it.name); //TODO: Implement support for pagination - setVideos(it.toPlaylist().videos, false); - setVideoCount(it.videoCount); + setVideos(it.videos, false); + setVideoCount(it.videos.size); setLoading(false); } .exception {