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(); + } + + } + }