Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2022-11-10 15:04:59 +08:00
commit 4d573767f7
4 changed files with 83 additions and 1 deletions

View File

@ -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;
}
}

View File

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

View File

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

View File

@ -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: