diff --git a/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java new file mode 100644 index 000000000..27727b151 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java @@ -0,0 +1,27 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class CustomDrawerPopupEvent extends BaseModel { + //是否关闭弹窗 + private boolean isDisMiss = false; + private String rightsInterests = ""; + + public String getRightsInterests() { + return rightsInterests; + } + + public CustomDrawerPopupEvent setRightsInterests(String rightsInterests) { + this.rightsInterests = rightsInterests; + return this; + } + + public boolean isDisMiss() { + return isDisMiss; + } + + public CustomDrawerPopupEvent setDisMiss(boolean disMiss) { + isDisMiss = disMiss; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java index 1b8132a5d..393b61a04 100644 --- a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java +++ b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java @@ -11,9 +11,14 @@ import com.yunbao.common.R; import com.yunbao.common.adapter.CustomDrawerPopupAdapter; import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.CustomSidebarInfoModel; +import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + import java.util.ArrayList; import java.util.List; @@ -41,13 +46,18 @@ public class CustomDrawerPopupView extends DrawerPopupView { @Override protected void onCreate() { + Bus.getOn(this); super.onCreate(); - initView(); initData(); } + @Override + public void dismiss() { + Bus.getOff(this); + super.dismiss(); + } private void initView() { drawerList = findViewById(R.id.drawerList); @@ -89,5 +99,18 @@ public class CustomDrawerPopupView extends DrawerPopupView { public interface CustomDrawerPopupCallBack { void goToLive(AnchorRecommendItemModel model); + + void informationTransfer(CustomDrawerPopupEvent event); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void OnCustomDrawerPopupEvent(CustomDrawerPopupEvent event) { + if (callBack != null) { + callBack.informationTransfer(event); + } + //是否关闭弹窗 + if (event.isDisMiss()) { + dismiss(); + } } } \ No newline at end of file diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java index 7ada96f47..7b55f82b9 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java @@ -9,7 +9,10 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.views.weight.ViewClicksAntiShake; public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { private ImageView funGamePic; @@ -30,5 +33,16 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { funGameName.setText(model.getTitle()); + + ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + + if (!rigts) { + Bus.get().post(new CustomDrawerPopupEvent() + .setDisMiss(true).setRightsInterests(model.getTitle())); + } + } + }); } } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 537559ed9..68b4d1b98 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -54,6 +54,7 @@ import com.yunbao.common.dialog.EffectsSettingsDialog; import com.yunbao.common.dialog.FloatSettingsDialog; import com.yunbao.common.dialog.LiveChargeDialogFragment; import com.yunbao.common.dialog.SlideSettingsDialog; +import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; @@ -699,6 +700,23 @@ public class LiveAudienceActivity extends LiveActivity { LiveHttpUtil.getLiveInfo(model.getUid(), liveInfo); customDrawerPopupView.dismiss(); } + + @Override + public void informationTransfer(CustomDrawerPopupEvent event) { + //跳转贵族 + if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.noble))) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.NOBLE)); + //跳转守护 + } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.guard_guard))) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.GUARD)); + //跳转粉丝团 + } else if (TextUtils.equals(event.getRightsInterests(), getString(com.yunbao.common.R.string.fan_club))) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.FAN_CLUB)); + } + } }); switch (event.getType()) { case SIDEBAR: