From df735af2526d78337ed194974d82fd20ad659fd1 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 17 Feb 2024 13:43:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9F=AD=E5=89=A7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=BC=80=E6=92=AD=E6=8F=90=E9=86=92=E6=B5=AE?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/MainHomeCommunityActivity.java | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/com/yunbao/main/activity/MainHomeCommunityActivity.java b/main/src/main/java/com/yunbao/main/activity/MainHomeCommunityActivity.java index ab211b57e..4820b1b65 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainHomeCommunityActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainHomeCommunityActivity.java @@ -10,25 +10,35 @@ import androidx.fragment.app.FragmentTransaction; import com.alibaba.android.arouter.facade.annotation.Route; import com.lzf.easyfloat.EasyFloat; import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.AnchorStartLiveBean; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.L; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.main.R; +import com.yunbao.main.dialog.AnchorStartLiveNotifyDialog; import com.yunbao.main.fragment.MainHomeCommunityVideoFragment; +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + +import java.util.ArrayList; +import java.util.List; + /** * 短剧 */ @Route(path = RouteUtil.PATH_COMMUNITY_Activity) public class MainHomeCommunityActivity extends AbsActivity { - + private List startListNotifyList = new ArrayList<>(); @Override protected int getLayoutId() { return R.layout.activity_main_home_community; } - @Override protected void main() { + EventBus.getDefault().register(this); Window window = getWindow(); window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); @@ -49,6 +59,28 @@ public class MainHomeCommunityActivity extends AbsActivity { @Override public void onDestroy() { super.onDestroy(); + EventBus.getDefault().unregister(this); } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onNotifyAnchorLive(AnchorStartLiveBean bean) { + if (!IMLoginManager.get(mContext).isLiveNotifySettings()) return; + if (startListNotifyList.isEmpty()) { + startListNotifyList.add(bean); + notifyLiveFlot(); + } else { + startListNotifyList.add(bean); + } + } + private void notifyLiveFlot() { + if (startListNotifyList.iterator().hasNext()) { + AnchorStartLiveBean bean = startListNotifyList.iterator().next(); + new AnchorStartLiveNotifyDialog(mContext, bean).setOnDismissListener(dialog -> { + startListNotifyList.remove(bean); + if (startListNotifyList.iterator().hasNext()) { + notifyLiveFlot(); + } + }).showDialog(); + } + } }