趣味活动
This commit is contained in:
parent
e2f8e52583
commit
752fae680c
@ -2,6 +2,7 @@ package com.yunbao.common.adapter;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -34,6 +35,7 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
|||||||
private final int FUN_GAMES = 3;
|
private final int FUN_GAMES = 3;
|
||||||
private final int RIGHTS_INTERESTS = 4;
|
private final int RIGHTS_INTERESTS = 4;
|
||||||
private final int RECOMMEND = 5;
|
private final int RECOMMEND = 5;
|
||||||
|
private String liveId;
|
||||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||||
|
|
||||||
private List<CustomSidebarInfoModel> infoModels = new ArrayList<>();
|
private List<CustomSidebarInfoModel> infoModels = new ArrayList<>();
|
||||||
@ -42,6 +44,12 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
|||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public CustomDrawerPopupAdapter setLiveId(String liveId) {
|
||||||
|
this.liveId = liveId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public CustomDrawerPopupAdapter setList(List<AnchorRecommendItemModel> list) {
|
public CustomDrawerPopupAdapter setList(List<AnchorRecommendItemModel> list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
return this;
|
return this;
|
||||||
@ -98,7 +106,15 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
|||||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||||
|
|
||||||
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
|
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
|
||||||
|
int userIndex = -1;
|
||||||
|
for (int i = 0; i < models.size(); i++) {
|
||||||
|
if (TextUtils.equals(models.get(i).getUid(), liveId)) {
|
||||||
|
userIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (userIndex != -1) {
|
||||||
|
models.remove(userIndex);
|
||||||
|
}
|
||||||
recommendViewHolder.updateData(models);
|
recommendViewHolder.updateData(models);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,17 @@ public class CustomSidebarChildModel extends BaseModel {
|
|||||||
private String needNum;
|
private String needNum;
|
||||||
@SerializedName("now_num")
|
@SerializedName("now_num")
|
||||||
private String nowNum;
|
private String nowNum;
|
||||||
|
@SerializedName("activity_id")
|
||||||
|
private String activityId;
|
||||||
|
|
||||||
|
public String getActivityId() {
|
||||||
|
return activityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSidebarChildModel setActivityId(String activityId) {
|
||||||
|
this.activityId = activityId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private int resIcon;
|
private int resIcon;
|
||||||
|
|
||||||
|
@ -10,14 +10,18 @@ import java.util.List;
|
|||||||
public class CustomSidebarInfoModel extends BaseModel {
|
public class CustomSidebarInfoModel extends BaseModel {
|
||||||
@SerializedName("id")
|
@SerializedName("id")
|
||||||
private String id;
|
private String id;
|
||||||
|
//一级标题
|
||||||
@SerializedName("title")
|
@SerializedName("title")
|
||||||
private String title;
|
private String title;
|
||||||
|
//二级标题
|
||||||
@SerializedName("subtitle")
|
@SerializedName("subtitle")
|
||||||
private String subtitle;
|
private String subtitle;
|
||||||
@SerializedName("sort")
|
@SerializedName("sort")
|
||||||
private String sort;
|
private String sort;
|
||||||
|
//1全屏 2半屏
|
||||||
@SerializedName("show_type")
|
@SerializedName("show_type")
|
||||||
private String showType;
|
private String showType;
|
||||||
|
//跳转链接
|
||||||
@SerializedName("src")
|
@SerializedName("src")
|
||||||
private String src;
|
private String src;
|
||||||
@SerializedName("type")
|
@SerializedName("type")
|
||||||
|
@ -5,7 +5,41 @@ import com.yunbao.common.bean.BaseModel;
|
|||||||
public class CustomDrawerPopupEvent extends BaseModel {
|
public class CustomDrawerPopupEvent extends BaseModel {
|
||||||
//是否关闭弹窗
|
//是否关闭弹窗
|
||||||
private boolean isDisMiss = false;
|
private boolean isDisMiss = false;
|
||||||
|
//权益的名字
|
||||||
private String rightsInterests = "";
|
private String rightsInterests = "";
|
||||||
|
//活动的id
|
||||||
|
private int activityId = -1;
|
||||||
|
//跳转网页地址
|
||||||
|
private String htmlUrl;
|
||||||
|
//是否半屏展示
|
||||||
|
private boolean screen = false;
|
||||||
|
|
||||||
|
public String getHtmlUrl() {
|
||||||
|
return htmlUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomDrawerPopupEvent setHtmlUrl(String htmlUrl) {
|
||||||
|
this.htmlUrl = htmlUrl;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isScreen() {
|
||||||
|
return screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomDrawerPopupEvent setScreen(boolean screen) {
|
||||||
|
this.screen = screen;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getActivityId() {
|
||||||
|
return activityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomDrawerPopupEvent setActivityId(int activityId) {
|
||||||
|
this.activityId = activityId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRightsInterests() {
|
public String getRightsInterests() {
|
||||||
return rightsInterests;
|
return rightsInterests;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.yunbao.common.views;
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
@ -28,6 +29,12 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
|||||||
private RecyclerView drawerList;
|
private RecyclerView drawerList;
|
||||||
private CustomDrawerPopupAdapter adapter;
|
private CustomDrawerPopupAdapter adapter;
|
||||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||||
|
private String liveId;
|
||||||
|
|
||||||
|
public CustomDrawerPopupView setLiveId(String liveId) {
|
||||||
|
this.liveId = liveId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public CustomDrawerPopupView setList(List<AnchorRecommendItemModel> list) {
|
public CustomDrawerPopupView setList(List<AnchorRecommendItemModel> list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
@ -62,7 +69,7 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
|||||||
private void initView() {
|
private void initView() {
|
||||||
drawerList = findViewById(R.id.drawerList);
|
drawerList = findViewById(R.id.drawerList);
|
||||||
adapter = new CustomDrawerPopupAdapter(mContext);
|
adapter = new CustomDrawerPopupAdapter(mContext);
|
||||||
adapter.setList(list);
|
adapter.setList(list).setLiveId(liveId);
|
||||||
drawerList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
drawerList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||||
drawerList.setAdapter(adapter);
|
drawerList.setAdapter(adapter);
|
||||||
adapter.setListener(new CustomDrawerPopupAdapter.CustomDrawerListener() {
|
adapter.setListener(new CustomDrawerPopupAdapter.CustomDrawerListener() {
|
||||||
@ -101,12 +108,20 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
|||||||
void goToLive(AnchorRecommendItemModel model);
|
void goToLive(AnchorRecommendItemModel model);
|
||||||
|
|
||||||
void informationTransfer(CustomDrawerPopupEvent event);
|
void informationTransfer(CustomDrawerPopupEvent event);
|
||||||
|
|
||||||
|
void funGamesID(int zfunGamesID);
|
||||||
|
|
||||||
|
void showerHtml(String htmlUrl, boolean screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void OnCustomDrawerPopupEvent(CustomDrawerPopupEvent event) {
|
public void OnCustomDrawerPopupEvent(CustomDrawerPopupEvent event) {
|
||||||
if (callBack != null) {
|
if (callBack != null) {
|
||||||
callBack.informationTransfer(event);
|
callBack.informationTransfer(event);
|
||||||
|
callBack.funGamesID(event.getActivityId());
|
||||||
|
if (!TextUtils.isEmpty(event.getHtmlUrl())) {
|
||||||
|
callBack.showerHtml(event.getHtmlUrl(), event.isScreen());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//是否关闭弹窗
|
//是否关闭弹窗
|
||||||
if (event.isDisMiss()) {
|
if (event.isDisMiss()) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.yunbao.common.views;
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -41,6 +42,10 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder {
|
|||||||
if (!rigts) {
|
if (!rigts) {
|
||||||
Bus.get().post(new CustomDrawerPopupEvent()
|
Bus.get().post(new CustomDrawerPopupEvent()
|
||||||
.setDisMiss(true).setRightsInterests(model.getTitle()));
|
.setDisMiss(true).setRightsInterests(model.getTitle()));
|
||||||
|
} else {
|
||||||
|
int activityID = TextUtils.isEmpty(model.getActivityId()) ? -1 : Integer.parseInt(model.getActivityId());
|
||||||
|
Bus.get().post(new CustomDrawerPopupEvent()
|
||||||
|
.setDisMiss(true).setActivityId(activityID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.yunbao.common.views;
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -7,9 +9,16 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.adapter.FunGamesAdapter;
|
import com.yunbao.common.adapter.FunGamesAdapter;
|
||||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||||
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
|
import com.yunbao.common.event.CustomDrawerPopupEvent;
|
||||||
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
|
import com.yunbao.common.utils.Bus;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
||||||
private FunGamesAdapter funGamesAdapter;
|
private FunGamesAdapter funGamesAdapter;
|
||||||
@ -24,11 +33,36 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
|||||||
funGamesAdapter = new FunGamesAdapter(itemView.getContext(), true);
|
funGamesAdapter = new FunGamesAdapter(itemView.getContext(), true);
|
||||||
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4));
|
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4));
|
||||||
childList.setAdapter(funGamesAdapter);
|
childList.setAdapter(funGamesAdapter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(CustomSidebarInfoModel model) {
|
public void setData(CustomSidebarInfoModel model) {
|
||||||
sendGoodGift.setText(model.getTitle());
|
sendGoodGift.setText(model.getTitle());
|
||||||
subtitle.setText(model.getSubtitle());
|
subtitle.setText(model.getSubtitle());
|
||||||
funGamesAdapter.updateData(model.getChild());
|
funGamesAdapter.updateData(model.getChild());
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(subtitle, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
if (TextUtils.isEmpty(model.getSrc())) {
|
||||||
|
ToastUtil.show("SHOWER_ERROR");
|
||||||
|
} else {
|
||||||
|
IMLoginModel userInfo = IMLoginManager.get(itemView.getContext()).getUserInfo();
|
||||||
|
StringBuffer htmlUrl = new StringBuffer();
|
||||||
|
htmlUrl.append(CommonAppConfig.HOST)
|
||||||
|
.append("/")
|
||||||
|
.append(model.getSrc())
|
||||||
|
.append("&uid=")
|
||||||
|
.append(userInfo.getId())
|
||||||
|
.append("&token=")
|
||||||
|
.append(userInfo.getToken());
|
||||||
|
Bus.get().post(new CustomDrawerPopupEvent()
|
||||||
|
.setDisMiss(true)
|
||||||
|
.setHtmlUrl(htmlUrl.toString())
|
||||||
|
.setScreen(TextUtils.equals(model.getShowType(), "2")));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ import com.yunbao.live.dialog.LiveGameDialogFragment;
|
|||||||
import com.yunbao.live.dialog.LiveGiftDialogFragment;
|
import com.yunbao.live.dialog.LiveGiftDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveMicUserDialogFragment;
|
import com.yunbao.live.dialog.LiveMicUserDialogFragment;
|
||||||
|
import com.yunbao.live.dialog.LiveTotalDialog;
|
||||||
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
||||||
import com.yunbao.live.dialog.SignDialogFragment;
|
import com.yunbao.live.dialog.SignDialogFragment;
|
||||||
import com.yunbao.live.event.LinkMicTxAccEvent;
|
import com.yunbao.live.event.LinkMicTxAccEvent;
|
||||||
@ -692,8 +693,41 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
Log.i("SocketRyClient", "onOpenDrawer: " + event.getType() + " " + event);
|
Log.i("SocketRyClient", "onOpenDrawer: " + event.getType() + " " + event);
|
||||||
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
|
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
|
||||||
CustomDrawerPopupView customDrawerPopupView = new CustomDrawerPopupView(mContext).setList(list);
|
|
||||||
|
switch (event.getType()) {
|
||||||
|
case SIDEBAR:
|
||||||
|
case BOTTOM_COLLECTION:
|
||||||
|
if (event.isActivity()) {
|
||||||
|
LiveTotalDialog liveTotalDialog = new LiveTotalDialog();
|
||||||
|
liveTotalDialog.setAnchorBean(mLiveBean);
|
||||||
|
Bundle liveBundle = new Bundle();
|
||||||
|
liveBundle.putBoolean("isActivity", event.isActivity());
|
||||||
|
liveTotalDialog.setArguments(liveBundle);
|
||||||
|
liveTotalDialog.show(getSupportFragmentManager(), "LiveTotalDialog");
|
||||||
|
} else {
|
||||||
|
int userIndex = -1;
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) {
|
||||||
|
userIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (userIndex != -1) {
|
||||||
|
list.remove(userIndex);
|
||||||
|
}
|
||||||
|
CustomDrawerPopupView customDrawerPopupView = new CustomDrawerPopupView(mContext).setList(list).setLiveId(mLiveBean.getUid());
|
||||||
customDrawerPopupView.setCallBack(new CustomDrawerPopupView.CustomDrawerPopupCallBack() {
|
customDrawerPopupView.setCallBack(new CustomDrawerPopupView.CustomDrawerPopupCallBack() {
|
||||||
|
@Override
|
||||||
|
public void funGamesID(int zfunGamesID) {
|
||||||
|
if (zfunGamesID != 0) {
|
||||||
|
LiveGameDialogFragment fragment = new LiveGameDialogFragment();
|
||||||
|
fragment.setActivityId(zfunGamesID);
|
||||||
|
fragment.setRoomId(mLiveUid);
|
||||||
|
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void goToLive(AnchorRecommendItemModel model) {
|
public void goToLive(AnchorRecommendItemModel model) {
|
||||||
//获取直播间状态
|
//获取直播间状态
|
||||||
@ -717,10 +751,20 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
.setType(LiveAudienceEvent.LiveAudienceType.FAN_CLUB));
|
.setType(LiveAudienceEvent.LiveAudienceType.FAN_CLUB));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showerHtml(String htmlUrl, boolean screen) {
|
||||||
|
if (!screen) {
|
||||||
|
ZhuangBanActivity.forward(mContext, htmlUrl, false);
|
||||||
|
} else {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString("url", htmlUrl);
|
||||||
|
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
switch (event.getType()) {
|
|
||||||
case SIDEBAR:
|
|
||||||
case BOTTOM_COLLECTION:
|
|
||||||
new XPopup.Builder(mContext)
|
new XPopup.Builder(mContext)
|
||||||
.hasShadowBg(false)
|
.hasShadowBg(false)
|
||||||
.isDestroyOnDismiss(true)
|
.isDestroyOnDismiss(true)
|
||||||
@ -775,8 +819,12 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
})
|
})
|
||||||
.asCustom(customDrawerPopupView)
|
.asCustom(customDrawerPopupView)
|
||||||
.show();
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIFT_POPUP:
|
case GIFT_POPUP:
|
||||||
|
|
||||||
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
|
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1102,7 +1150,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
slideInfoModels.clear();
|
slideInfoModels.clear();
|
||||||
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
|
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
|
||||||
|
|
||||||
models.add(0, new AnchorRecommendItemModel());
|
|
||||||
list.addAll(models);
|
list.addAll(models);
|
||||||
slideInfoModels = anchorRecommendModel.getSlide();
|
slideInfoModels = anchorRecommendModel.getSlide();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user