Changed queue behaviour to be more like VLC.

This commit is contained in:
Koen 2023-09-27 10:44:30 +02:00
parent a51cdcd6ec
commit bc83f9b274
6 changed files with 16 additions and 3 deletions

View file

@ -170,6 +170,7 @@ class ChannelFragment : MainFragment() {
adapter.onChannelClicked.subscribe { c -> fragment.navigate<ChannelFragment>(c) }
adapter.onContentClicked.subscribe { v, _ ->
if(v is IPlatformVideo) {
StatePlayer.instance.clearQueue();
fragment.navigate<VideoDetailFragment>(v).maximizeVideoDetail();
} else if (v is IPlatformPlaylist) {
fragment.navigate<PlaylistFragment>(v);
@ -192,7 +193,10 @@ class ChannelFragment : MainFragment() {
}
adapter.onContentUrlClicked.subscribe { url, contentType ->
when(contentType) {
ContentType.MEDIA -> fragment.navigate<VideoDetailFragment>(url).maximizeVideoDetail();
ContentType.MEDIA -> {
StatePlayer.instance.clearQueue();
fragment.navigate<VideoDetailFragment>(url).maximizeVideoDetail();
};
ContentType.URL -> fragment.navigate<BrowserFragment>(url);
else -> {};
}

View file

@ -125,6 +125,7 @@ abstract class ContentFeedView<TFragment> : FeedView<TFragment, IPlatformContent
protected open fun onContentClicked(content: IPlatformContent, time: Long) {
if(content is IPlatformVideo) {
StatePlayer.instance.clearQueue();
if (Settings.instance.playback.shouldResumePreview(time))
fragment.navigate<VideoDetailFragment>(content.withTimestamp(time)).maximizeVideoDetail();
else
@ -137,7 +138,10 @@ abstract class ContentFeedView<TFragment> : FeedView<TFragment, IPlatformContent
}
protected open fun onContentUrlClicked(url: String, contentType: ContentType) {
when(contentType) {
ContentType.MEDIA -> fragment.navigate<VideoDetailFragment>(url).maximizeVideoDetail();
ContentType.MEDIA -> {
StatePlayer.instance.clearQueue();
fragment.navigate<VideoDetailFragment>(url).maximizeVideoDetail();
};
ContentType.PLAYLIST -> fragment.navigate<PlaylistFragment>(url);
ContentType.URL -> fragment.navigate<BrowserFragment>(url);
else -> {};

View file

@ -13,6 +13,7 @@ import com.futo.platformplayer.downloads.VideoDownload
import com.futo.platformplayer.downloads.VideoLocal
import com.futo.platformplayer.logging.Logger
import com.futo.platformplayer.states.StateDownloads
import com.futo.platformplayer.states.StatePlayer
import com.futo.platformplayer.views.AnyInsertedAdapterView
import com.futo.platformplayer.views.AnyInsertedAdapterView.Companion.asAnyWithTop
import com.futo.platformplayer.views.others.ProgressBar
@ -123,6 +124,7 @@ class DownloadsFragment : MainFragment() {
_listDownloaded = findViewById<RecyclerView>(R.id.list_downloaded)
.asAnyWithTop(findViewById(R.id.downloads_top)) {
it.onClick.subscribe {
StatePlayer.instance.clearQueue();
_frag.navigate<VideoDetailFragment>(it).maximizeVideoDetail();
}
};

View file

@ -12,6 +12,7 @@ import androidx.core.widget.addTextChangedListener
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.futo.platformplayer.*
import com.futo.platformplayer.states.StatePlayer
import com.futo.platformplayer.states.StatePlaylists
import com.futo.platformplayer.views.others.TagsView
import com.futo.platformplayer.views.adapters.HistoryListAdapter
@ -44,6 +45,7 @@ class HistoryFragment : MainFragment() {
adapter.onClick.subscribe { v ->
val diff = v.video.duration - v.position;
val vid: Any = if (diff > 5) { v.video.withTimestamp(v.position) } else { v.video };
StatePlayer.instance.clearQueue();
navigate<VideoDetailFragment>(vid).maximizeVideoDetail();
editSearch.clearFocus();
inputMethodManager.hideSoftInputFromWindow(editSearch.windowToken, 0);

View file

@ -301,6 +301,7 @@ class VideoDetailView : ConstraintLayout {
_player.attachPlayer();
_container_content_liveChat.onRaidNow.subscribe {
StatePlayer.instance.clearQueue();
fragment.navigate<VideoDetailFragment>(it.targetUrl);
};

View file

@ -136,7 +136,7 @@ class StatePlayer {
fun setQueueType(queueType : String) {
when(queueType) {
TYPE_QUEUE -> {
_queueRemoveOnFinish = true;
_queueRemoveOnFinish = false;
}
TYPE_WATCHLATER -> {
_queueRemoveOnFinish = true;