From d819397d167c82424ea5ff6fd46e305888a5c131 Mon Sep 17 00:00:00 2001 From: Yuriy Liskov Date: Fri, 16 May 2025 18:54:25 +0300 Subject: [PATCH] video card: playback preview: upd 8 --- .../common/app/views/ViewManager.java | 19 +++++++++++++++++++ .../widgets/embedplayer/EmbedPlayerView.java | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/views/ViewManager.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/views/ViewManager.java index 730b37637..75784cc4b 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/views/ViewManager.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/views/ViewManager.java @@ -16,9 +16,12 @@ import com.liskovsoft.sharedutils.mylogger.Log; import com.liskovsoft.sharedutils.rx.RxHelper; import com.liskovsoft.smartyoutubetv2.common.app.presenters.AppDialogPresenter; import com.liskovsoft.smartyoutubetv2.common.app.presenters.BrowsePresenter; +import com.liskovsoft.smartyoutubetv2.common.app.presenters.ChannelPresenter; import com.liskovsoft.smartyoutubetv2.common.app.presenters.ChannelUploadsPresenter; import com.liskovsoft.smartyoutubetv2.common.app.presenters.PlaybackPresenter; +import com.liskovsoft.smartyoutubetv2.common.app.presenters.SearchPresenter; import com.liskovsoft.smartyoutubetv2.common.app.presenters.SplashPresenter; +import com.liskovsoft.smartyoutubetv2.common.app.presenters.base.BasePresenter; import com.liskovsoft.smartyoutubetv2.common.app.presenters.dialogs.AppUpdatePresenter; import com.liskovsoft.smartyoutubetv2.common.misc.MotherActivity; import com.liskovsoft.smartyoutubetv2.common.utils.Utils; @@ -468,4 +471,20 @@ public class ViewManager { startView(PlaybackView.class); } } + + public BasePresenter getCurrentPresenter() { + Class topView = getTopView(); + + if (topView == BrowseView.class) { + return BrowsePresenter.instance(mContext); + } else if (topView == SearchView.class) { + return SearchPresenter.instance(mContext); + } else if (topView == ChannelView.class) { + return ChannelPresenter.instance(mContext); + } else if (topView == ChannelUploadsView.class) { + return ChannelUploadsPresenter.instance(mContext); + } + + return null; + } } diff --git a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/embedplayer/EmbedPlayerView.java b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/embedplayer/EmbedPlayerView.java index 6135c6c1d..f7547b322 100644 --- a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/embedplayer/EmbedPlayerView.java +++ b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/embedplayer/EmbedPlayerView.java @@ -17,7 +17,9 @@ import com.liskovsoft.smartyoutubetv2.common.app.models.data.VideoGroup; import com.liskovsoft.smartyoutubetv2.common.app.models.playback.ui.ChatReceiver; import com.liskovsoft.smartyoutubetv2.common.app.models.playback.ui.SeekBarSegment; import com.liskovsoft.smartyoutubetv2.common.app.presenters.PlaybackPresenter; +import com.liskovsoft.smartyoutubetv2.common.app.presenters.base.BasePresenter; import com.liskovsoft.smartyoutubetv2.common.app.views.PlaybackView; +import com.liskovsoft.smartyoutubetv2.common.app.views.ViewManager; import com.liskovsoft.smartyoutubetv2.common.exoplayer.controller.ExoPlayerController; import com.liskovsoft.smartyoutubetv2.common.exoplayer.controller.PlayerController; import com.liskovsoft.smartyoutubetv2.common.exoplayer.other.ExoPlayerInitializer; @@ -561,6 +563,10 @@ public class EmbedPlayerView extends PlayerView implements PlaybackView { hideView(); if (mVideo != null) { mVideo.embedPlayer = false; + BasePresenter presenter = ViewManager.instance(getContext()).getCurrentPresenter(); + if (presenter != null) { + presenter.syncItem(mVideo); + } } } }