From 94b795213a5b032adae9da2e737cf6b3f7940743 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 10 Aug 2022 22:51:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98,shouye=20ytuijian?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/yunbao/common/event/CloseEvent.java | 6 ++++++ .../java/com/yunbao/live/views/LiveEndViewHolder.java | 6 +++++- .../java/com/yunbao/main/activity/SearchActivity.java | 11 ++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/event/CloseEvent.java diff --git a/common/src/main/java/com/yunbao/common/event/CloseEvent.java b/common/src/main/java/com/yunbao/common/event/CloseEvent.java new file mode 100644 index 000000000..05d6737bf --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/CloseEvent.java @@ -0,0 +1,6 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class CloseEvent extends BaseModel { +} diff --git a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java index 68abd3a29..fa105b125 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java @@ -18,6 +18,7 @@ import com.alibaba.fastjson.JSON; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.SetAttentsModel; +import com.yunbao.common.event.CloseEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; @@ -158,6 +159,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList ((LiveRyAnchorActivity) mContext).superBackPressed(); } + Bus.get().post(new CloseEvent()); } }); GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 3); @@ -189,6 +191,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList ((LiveRyAnchorActivity) mContext).superBackPressed(); } + Bus.get().post(new CloseEvent()); } }); } @@ -258,6 +261,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList ((LiveRyAnchorActivity) mContext).superBackPressed(); } + Bus.get().post(new CloseEvent()); } @Override @@ -324,6 +328,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList ((LiveRyAnchorActivity) mContext).superBackPressed(); } + } }); @@ -337,7 +342,6 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList ((LiveAudienceActivity) mContext).exitLiveRoom(); } else if (mContext instanceof LiveRyAnchorActivity) { ((LiveRyAnchorActivity) mContext).superBackPressed(); - } } } diff --git a/main/src/main/java/com/yunbao/main/activity/SearchActivity.java b/main/src/main/java/com/yunbao/main/activity/SearchActivity.java index 2a48406ce..def94578b 100644 --- a/main/src/main/java/com/yunbao/main/activity/SearchActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/SearchActivity.java @@ -27,6 +27,7 @@ import com.yunbao.live.bean.LiveBean; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; +import com.yunbao.common.event.CloseEvent; import com.yunbao.main.event.JumpUserHomeEvent; import com.yunbao.main.fragment.SearchRecommendFragment; import com.yunbao.main.fragment.SearchResultsFragment; @@ -168,7 +169,7 @@ public class SearchActivity extends AbsActivity { */ @Subscribe(threadMode = ThreadMode.MAIN) public void onJumpUserHome(JumpUserHomeEvent event) { - LiveHttpUtil.getLiveInfo(event.getModel().getId()+ "", new HttpCallback() { + LiveHttpUtil.getLiveInfo(event.getModel().getId() + "", new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { @@ -214,4 +215,12 @@ public class SearchActivity extends AbsActivity { transaction.commit(); } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onClose(CloseEvent event) { + if (!isFinishing()) { + finish(); + } + + } + }