游戏房入口对接

This commit is contained in:
18401019693 2023-09-21 17:58:53 +08:00
parent fed6289f67
commit 0756dd9560
37 changed files with 1559 additions and 56 deletions

View File

@ -19,6 +19,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.DrawerRecommendViewHolder; import com.yunbao.common.views.DrawerRecommendViewHolder;
import com.yunbao.common.views.DrawerTaskViewHolder; import com.yunbao.common.views.DrawerTaskViewHolder;
import com.yunbao.common.views.FunGamesViewHolder; import com.yunbao.common.views.FunGamesViewHolder;
import com.yunbao.common.views.InteractionGamesViewHolder;
import com.yunbao.common.views.RecommendViewHolder; import com.yunbao.common.views.RecommendViewHolder;
import com.yunbao.common.views.RigtsInterestsViewHolder; import com.yunbao.common.views.RigtsInterestsViewHolder;
@ -72,9 +73,12 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
case RIGHTS_INTERESTS: case RIGHTS_INTERESTS:
View rightsInterestsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_rights_interests, parent, false); View rightsInterestsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_rights_interests, parent, false);
return new RigtsInterestsViewHolder(rightsInterestsView); return new RigtsInterestsViewHolder(rightsInterestsView);
default: case RECOMMEND:
View recommendView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_recommend, parent, false); View recommendView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_recommend, parent, false);
return new RecommendViewHolder(recommendView); return new RecommendViewHolder(recommendView);
default:
View gamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_interaction_games_view, parent, false);
return new InteractionGamesViewHolder(gamesView);
} }
} }
@ -92,6 +96,9 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
} else if (holder instanceof RigtsInterestsViewHolder) { } else if (holder instanceof RigtsInterestsViewHolder) {
RigtsInterestsViewHolder rigtsInterestsViewHolder = (RigtsInterestsViewHolder) holder; RigtsInterestsViewHolder rigtsInterestsViewHolder = (RigtsInterestsViewHolder) holder;
rigtsInterestsViewHolder.setData(infoModels.get(position)); rigtsInterestsViewHolder.setData(infoModels.get(position));
} else if (holder instanceof InteractionGamesViewHolder) {
InteractionGamesViewHolder interactionGamesViewHolder = (InteractionGamesViewHolder) holder;
interactionGamesViewHolder.setData(infoModels.get(position));
} else if (holder instanceof RecommendViewHolder) { } else if (holder instanceof RecommendViewHolder) {
RecommendViewHolder recommendViewHolder = (RecommendViewHolder) holder; RecommendViewHolder recommendViewHolder = (RecommendViewHolder) holder;

View File

@ -0,0 +1,64 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.views.FunGamesChildViewHolder;
import com.yunbao.common.views.InteractionGamesChildViewHolder;
import java.util.ArrayList;
import java.util.List;
public class InteractionGamesAdapter extends RecyclerView.Adapter {
private Context mContext;
private boolean rigts;
private List<CustomSidebarChildModel> child = new ArrayList<>();
public InteractionGamesAdapter(Context mContext, boolean rigts) {
this.mContext = mContext;
this.rigts = rigts;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_fun_games_child_view, parent, false);
return new InteractionGamesChildViewHolder(runGamesView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
InteractionGamesChildViewHolder childViewHolder = (InteractionGamesChildViewHolder) holder;
childViewHolder.setData(child.get(position), rigts);
}
@Override
public int getItemCount() {
return child.size();
}
public void updateData(List<CustomSidebarChildModel> mChild) {
child.clear();
if (mChild.size() > 8) {
for (int i = 0; i < 8; i++) {
child.add(mChild.get(i));
}
} else {
child.addAll(mChild);
}
notifyDataSetChanged();
}
public void selectAll(List<CustomSidebarChildModel> mChild){
child.clear();
child.addAll(mChild);
notifyDataSetChanged();
}
}

View File

@ -0,0 +1,64 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.views.FunGamesChildViewHolder;
import com.yunbao.common.views.NewRoleFunGamesChildViewHolder;
import java.util.ArrayList;
import java.util.List;
public class LiveNewRoleFunGamesAdapter extends RecyclerView.Adapter {
private Context mContext;
private boolean rigts;
private List<CustomSidebarChildModel> child = new ArrayList<>();
public LiveNewRoleFunGamesAdapter(Context mContext, boolean rigts) {
this.mContext = mContext;
this.rigts = rigts;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view, parent, false);
return new NewRoleFunGamesChildViewHolder(runGamesView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
NewRoleFunGamesChildViewHolder childViewHolder = (NewRoleFunGamesChildViewHolder) holder;
childViewHolder.setData(child.get(position), rigts);
}
@Override
public int getItemCount() {
return child.size();
}
public void updateData(List<CustomSidebarChildModel> mChild) {
child.clear();
if (mChild.size() > 8) {
for (int i = 0; i < 8; i++) {
child.add(mChild.get(i));
}
} else {
child.addAll(mChild);
}
notifyDataSetChanged();
}
public void selectAll(List<CustomSidebarChildModel> mChild) {
child.clear();
child.addAll(mChild);
notifyDataSetChanged();
}
}

View File

@ -0,0 +1,63 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.views.InteractionGamesChildViewHolder;
import java.util.ArrayList;
import java.util.List;
public class LiveNewRoleInteractionGamesAdapter extends RecyclerView.Adapter {
private Context mContext;
private boolean rigts;
private List<CustomSidebarChildModel> child = new ArrayList<>();
public LiveNewRoleInteractionGamesAdapter(Context mContext, boolean rigts) {
this.mContext = mContext;
this.rigts = rigts;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view, parent, false);
return new InteractionGamesChildViewHolder(runGamesView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
InteractionGamesChildViewHolder childViewHolder = (InteractionGamesChildViewHolder) holder;
childViewHolder.setData(child.get(position), rigts);
}
@Override
public int getItemCount() {
return child.size();
}
public void updateData(List<CustomSidebarChildModel> mChild) {
child.clear();
if (mChild.size() > 8) {
for (int i = 0; i < 8; i++) {
child.add(mChild.get(i));
}
} else {
child.addAll(mChild);
}
notifyDataSetChanged();
}
public void selectAll(List<CustomSidebarChildModel> mChild){
child.clear();
child.addAll(mChild);
notifyDataSetChanged();
}
}

View File

@ -0,0 +1,101 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.views.LiveNewRoleFunGamesViewHolder;
import com.yunbao.common.views.LiveNewRoleInteractionGamesViewHolder;
import com.yunbao.common.views.LiveNewRoleRigtsInterestsViewHolder;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class LiveNewRolerPopupAdapter extends RecyclerView.Adapter {
private Context mContext;
// "type": 1,//模块类型 1 充值送好礼类型2 任务中心类型 3趣味游戏类4 权益 ,5为你推荐
private final int FUN_GAMES = 3;
private final int RIGHTS_INTERESTS = 4;
private List<CustomSidebarInfoModel> infoModels = new ArrayList<>();
public LiveNewRolerPopupAdapter(Context mContext) {
this.mContext = mContext;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
switch (viewType) {
case FUN_GAMES:
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_new_roler_fun_games_view, parent, false);
return new LiveNewRoleFunGamesViewHolder(runGamesView);
case RIGHTS_INTERESTS:
View rightsInterestsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_roler_ights_interests, parent, false);
return new LiveNewRoleRigtsInterestsViewHolder(rightsInterestsView);
default:
View gamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_interaction_games_view, parent, false);
return new LiveNewRoleInteractionGamesViewHolder(gamesView);
}
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof LiveNewRoleFunGamesViewHolder) {
LiveNewRoleFunGamesViewHolder funGamesViewHolder = (LiveNewRoleFunGamesViewHolder) holder;
funGamesViewHolder.setData(infoModels.get(position));
} else if (holder instanceof LiveNewRoleRigtsInterestsViewHolder) {
LiveNewRoleRigtsInterestsViewHolder rigtsInterestsViewHolder = (LiveNewRoleRigtsInterestsViewHolder) holder;
rigtsInterestsViewHolder.setData(infoModels.get(position));
} else if (holder instanceof LiveNewRoleInteractionGamesViewHolder) {
LiveNewRoleInteractionGamesViewHolder interactionGamesViewHolder = (LiveNewRoleInteractionGamesViewHolder) holder;
interactionGamesViewHolder.setData(infoModels.get(position));
}
}
@Override
public int getItemCount() {
return infoModels.size();
}
@Override
public int getItemViewType(int position) {
CustomSidebarInfoModel model = infoModels.get(position);
switch (model.getType()) {
case "3":
return FUN_GAMES;
case "4":
return RIGHTS_INTERESTS;
}
return super.getItemViewType(position);
}
public void updateData(List<CustomSidebarInfoModel> mInfoModels) {
infoModels.clear();
infoModels.addAll(mInfoModels);
notifyDataSetChanged();
}
private CustomDrawerListener listener;
public LiveNewRolerPopupAdapter setListener(CustomDrawerListener listener) {
this.listener = listener;
return this;
}
public interface CustomDrawerListener {
void goToLive(AnchorRecommendItemModel model);
}
}

View File

@ -0,0 +1,64 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.views.NewRoleFunGamesChildViewHolder;
import java.util.ArrayList;
import java.util.List;
public class NewRoleFunGamesAdapter extends RecyclerView.Adapter {
private Context mContext;
private List<CustomSidebarChildModel> child = new ArrayList<>();
private boolean rigts;
public NewRoleFunGamesAdapter(Context mContext, boolean rigts) {
this.mContext = mContext;
this.rigts = rigts;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view2, parent, false);
return new NewRoleFunGamesChildViewHolder(runGamesView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
NewRoleFunGamesChildViewHolder childViewHolder = (NewRoleFunGamesChildViewHolder) holder;
childViewHolder.setData(child.get(position), rigts);
}
@Override
public int getItemCount() {
return child.size();
}
public void updateData(List<CustomSidebarChildModel> mChild) {
child.clear();
if (mChild.size() > 8) {
for (int i = 0; i < 8; i++) {
child.add(mChild.get(i));
}
} else {
child.addAll(mChild);
}
notifyDataSetChanged();
}
public void selectAll(List<CustomSidebarChildModel> mChild) {
child.clear();
child.addAll(mChild);
notifyDataSetChanged();
}
}

View File

@ -0,0 +1,83 @@
package com.yunbao.common.dialog;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.core.BottomPopupView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.LiveNewRolerPopupAdapter;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.event.LiveNewRoleEvent;
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.List;
public class LiveNewRolePopup extends BottomPopupView {
public LiveNewRolePopup(@NonNull Context context) {
super(context);
mContext = context;
}
private RecyclerView drawerList;
private LiveNewRolerPopupAdapter adapter;
private Context mContext;
// 返回自定义弹窗的布局
@Override
protected int getImplLayoutId() {
return R.layout.dialog_live_new_role;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
Bus.getOn(this);
initView();
initDate();
}
private void initDate() {
LiveNetManager.get(mContext)
.getCustomSidebarInfo("1", new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
@Override
public void onSuccess(List<CustomSidebarInfoModel> data) {
adapter.updateData(data);
}
@Override
public void onError(String error) {
ToastUtil.show(R.string.net_error);
}
});
}
private void initView() {
drawerList = findViewById(R.id.drawerList);
adapter = new LiveNewRolerPopupAdapter(mContext);
drawerList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
drawerList.setAdapter(adapter);
}
@Override
protected void onDismiss() {
Bus.getOff(this);
super.onDismiss();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveNewRoleEvent(LiveNewRoleEvent event) {
dismiss();
}
}

View File

@ -28,6 +28,26 @@ public class CustomDrawerPopupEvent extends BaseModel {
//畫質選擇 //畫質選擇
private boolean qualitySelection = false; private boolean qualitySelection = false;
private boolean fontSize = false; private boolean fontSize = false;
private boolean interaction = false;
private long interactionID;
public boolean isInteraction() {
return interaction;
}
public CustomDrawerPopupEvent setInteraction(boolean interaction) {
this.interaction = interaction;
return this;
}
public long getInteractionID() {
return interactionID;
}
public CustomDrawerPopupEvent setInteractionID(long interactionID) {
this.interactionID = interactionID;
return this;
}
public boolean isSmallWindow() { public boolean isSmallWindow() {
return smallWindow; return smallWindow;

View File

@ -0,0 +1,4 @@
package com.yunbao.common.event;
public class LiveNewRoleEvent {
}

View File

@ -0,0 +1,168 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.BaseModel;
public class NewRoleCustomDrawerPopupEvent extends BaseModel {
//是否关闭弹窗
private boolean isDisMiss = false;
//权益的名字
private String rightsInterests = "";
//活动的id
private int activityId = 0;
//跳转网页地址
private String htmlUrl;
//是否半屏展示
private boolean screen = false;
//系统消息
private boolean systemNotice = false;
//在线客服
private boolean online = false;
//举报
private boolean reportLayout = false;
//刷新
private boolean refresh = false;
//特效設置
private boolean effects = false;
//小窗播放
private boolean smallWindow = false;
//畫質選擇
private boolean qualitySelection = false;
private boolean fontSize = false;
private boolean interaction = false;
private long interactionID;
public boolean isInteraction() {
return interaction;
}
public NewRoleCustomDrawerPopupEvent setInteraction(boolean interaction) {
this.interaction = interaction;
return this;
}
public long getInteractionID() {
return interactionID;
}
public NewRoleCustomDrawerPopupEvent setInteractionID(long interactionID) {
this.interactionID = interactionID;
return this;
}
public boolean isSmallWindow() {
return smallWindow;
}
public NewRoleCustomDrawerPopupEvent setSmallWindow(boolean smallWindow) {
this.smallWindow = smallWindow;
return this;
}
public boolean isQualitySelection() {
return qualitySelection;
}
public NewRoleCustomDrawerPopupEvent setQualitySelection(boolean qualitySelection) {
this.qualitySelection = qualitySelection;
return this;
}
public boolean isRefresh() {
return refresh;
}
public NewRoleCustomDrawerPopupEvent setRefresh(boolean refresh) {
this.refresh = refresh;
return this;
}
public boolean isSystemNotice() {
return systemNotice;
}
public NewRoleCustomDrawerPopupEvent setSystemNotice(boolean systemNotice) {
this.systemNotice = systemNotice;
return this;
}
public boolean isOnline() {
return online;
}
public NewRoleCustomDrawerPopupEvent setOnline(boolean online) {
this.online = online;
return this;
}
public boolean isReportLayout() {
return reportLayout;
}
public NewRoleCustomDrawerPopupEvent setReportLayout(boolean reportLayout) {
this.reportLayout = reportLayout;
return this;
}
public String getHtmlUrl() {
return htmlUrl;
}
public NewRoleCustomDrawerPopupEvent setHtmlUrl(String htmlUrl) {
this.htmlUrl = htmlUrl;
return this;
}
public boolean isScreen() {
return screen;
}
public NewRoleCustomDrawerPopupEvent setScreen(boolean screen) {
this.screen = screen;
return this;
}
public int getActivityId() {
return activityId;
}
public NewRoleCustomDrawerPopupEvent setActivityId(int activityId) {
this.activityId = activityId;
return this;
}
public String getRightsInterests() {
return rightsInterests;
}
public NewRoleCustomDrawerPopupEvent setRightsInterests(String rightsInterests) {
this.rightsInterests = rightsInterests;
return this;
}
public boolean isDisMiss() {
return isDisMiss;
}
public NewRoleCustomDrawerPopupEvent setDisMiss(boolean disMiss) {
isDisMiss = disMiss;
return this;
}
public boolean isEffects() {
return effects;
}
public NewRoleCustomDrawerPopupEvent setEffects(boolean effects) {
this.effects = effects;
return this;
}
public boolean isFontSize() {
return fontSize;
}
public NewRoleCustomDrawerPopupEvent setFontSize(boolean fontSize) {
this.fontSize = fontSize;
return this;
}
}

View File

@ -297,7 +297,7 @@ public interface PDLiveApi {
* 新侧边栏请求 * 新侧边栏请求
*/ */
@GET("/api/public/?service=Live.getCustomSidebarInfo") @GET("/api/public/?service=Live.getCustomSidebarInfo")
Observable<ResponseModel<List<CustomSidebarInfoModel>>> getCustomSidebarInfo(); Observable<ResponseModel<List<CustomSidebarInfoModel>>> getCustomSidebarInfo(@Query("type") String type);
/** /**
* 任务领取接口 * 任务领取接口

View File

@ -29,7 +29,6 @@ import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel; import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.LiveRoomVoteModel; import com.yunbao.common.bean.LiveRoomVoteModel;
@ -50,6 +49,7 @@ import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.RedPacketListBean;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.SudgameCodeModel;
import com.yunbao.common.bean.UserAreaBean; import com.yunbao.common.bean.UserAreaBean;
import com.yunbao.common.bean.UserAvatarSelectBean; import com.yunbao.common.bean.UserAvatarSelectBean;
import com.yunbao.common.bean.VipModel; import com.yunbao.common.bean.VipModel;
@ -314,9 +314,9 @@ public class LiveNetManager {
* *
* @param callback * @param callback
*/ */
public void getCustomSidebarInfo(HttpCallback<List<CustomSidebarInfoModel>> callback) { public void getCustomSidebarInfo(String type,HttpCallback<List<CustomSidebarInfoModel>> callback) {
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
.getCustomSidebarInfo() .getCustomSidebarInfo(type)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> callback.onSuccess(listResponseModel.getData().getInfo()), throwable -> { .subscribe(listResponseModel -> callback.onSuccess(listResponseModel.getData().getInfo()), throwable -> {
@ -2194,6 +2194,28 @@ public class LiveNetManager {
}).isDisposed(); }).isDisposed();
} }
public void getCode(HttpCallback<List<SudgameCodeModel>> callback) {
API.get().pdLiveApi(mContext)
.getCode()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<SudgameCodeModel>>>() {
@Override
public void accept(ResponseModel<List<SudgameCodeModel>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
/** /**
* 直播间取消网络请求 * 直播间取消网络请求
*/ */

View File

@ -5,23 +5,15 @@ import android.view.View;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.bean.SudgameCodeModel;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.sud.model.GameConfigModel; import com.yunbao.common.sud.model.GameConfigModel;
import com.yunbao.common.sud.model.GameViewInfoModel; import com.yunbao.common.sud.model.GameViewInfoModel;
import com.yunbao.common.sud.state.MGStateResponse;
import com.yunbao.common.sud.state.SudMGPMGState; import com.yunbao.common.sud.state.SudMGPMGState;
import org.json.JSONObject; import java.util.List;
import java.io.IOException;
import java.util.Objects;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import tech.sud.mgp.core.ISudFSMMG; import tech.sud.mgp.core.ISudFSMMG;
import tech.sud.mgp.core.ISudFSMStateHandle; import tech.sud.mgp.core.ISudFSMStateHandle;
@ -34,29 +26,57 @@ import tech.sud.mgp.core.ISudFSMStateHandle;
*/ */
public class QuickStartGameViewModel extends BaseGameViewModel { public class QuickStartGameViewModel extends BaseGameViewModel {
/** Sud平台申请的appId */ /**
* Sud平台申请的appId
*/
public static String SudMGP_APP_ID = "1701178631292395522"; public static String SudMGP_APP_ID = "1701178631292395522";
/** Sud平台申请的appKey */ /**
* Sud平台申请的appKey
*/
public static String SudMGP_APP_KEY = "E3Eokfq58ZklwR8fM7iKWYGzarbIOkyh"; public static String SudMGP_APP_KEY = "E3Eokfq58ZklwR8fM7iKWYGzarbIOkyh";
/** true 加载游戏时为测试环境 false 加载游戏时为生产环境 */ /**
* true 加载游戏时为测试环境 false 加载游戏时为生产环境
*/
public static final boolean GAME_IS_TEST_ENV = true; public static final boolean GAME_IS_TEST_ENV = true;
/** 使用的UserId。这里随机生成作演示开发者将其修改为业务使用的唯一userId */ /**
public static String userId = QuickStartUtils.genUserID(); * 使用的UserId这里随机生成作演示开发者将其修改为业务使用的唯一userId
*/
public static String userId = QuickStartUtils.genUserID(CommonAppContext.sInstance.getApplicationContext());
/** 游戏自定义安全操作区域 */ /**
* 游戏自定义安全操作区域
*/
public GameViewInfoModel.GameViewRectModel gameViewRectModel; public GameViewInfoModel.GameViewRectModel gameViewRectModel;
/** 游戏的语言代码 */ /**
* 游戏的语言代码
*/
public String languageCode = "zh-CN"; public String languageCode = "zh-CN";
public final MutableLiveData<View> gameViewLiveData = new MutableLiveData<>(); // 游戏View回调 public final MutableLiveData<View> gameViewLiveData = new MutableLiveData<>(); // 游戏View回调
/** 向接入方服务器获取code */ /**
* 向接入方服务器获取code
*/
@Override @Override
protected void getCode(Activity activity, String userId, String appId, GameGetCodeListener listener) { protected void getCode(Activity activity, String userId, String appId, GameGetCodeListener listener) {
// TODO: 2022/6/10 注意这里是演示使用OkHttpClient请求hello-sud服务 // TODO: 2022/6/10 注意这里是演示使用OkHttpClient请求hello-sud服务
// TODO: 2022/6/10 开发者在与后端联调时需将其改成自己的网络请求方式向自己的服务器获取code // TODO: 2022/6/10 开发者在与后端联调时需将其改成自己的网络请求方式向自己的服务器获取code
LiveNetManager.get(activity)
.getCode(new HttpCallback<List<SudgameCodeModel>>() {
@Override
public void onSuccess(List<SudgameCodeModel> data) {
listener.onSuccess(data.get(0).getCode());
}
@Override
public void onError(String error) {
listener.onFailed();
}
});
// OkHttpClient client = new OkHttpClient(); // OkHttpClient client = new OkHttpClient();
// String req; // String req;
// try { // try {
@ -115,25 +135,33 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
// }); // });
} }
/** 设置当前用户id(接入方定义) */ /**
* 设置当前用户id(接入方定义)
*/
@Override @Override
protected String getUserId() { protected String getUserId() {
return userId; return userId;
} }
/** 设置Sud平台申请的appId */ /**
* 设置Sud平台申请的appId
*/
@Override @Override
protected String getAppId() { protected String getAppId() {
return SudMGP_APP_ID; return SudMGP_APP_ID;
} }
/** 设置Sud平台申请的appKey */ /**
* 设置Sud平台申请的appKey
*/
@Override @Override
protected String getAppKey() { protected String getAppKey() {
return SudMGP_APP_KEY; return SudMGP_APP_KEY;
} }
/** 设置游戏的语言代码 */ /**
* 设置游戏的语言代码
*/
@Override @Override
protected String getLanguageCode() { protected String getLanguageCode() {
return languageCode; return languageCode;
@ -175,13 +203,17 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
return GAME_IS_TEST_ENV; return GAME_IS_TEST_ENV;
} }
/** 将游戏View添加到页面中 */ /**
* 将游戏View添加到页面中
*/
@Override @Override
protected void onAddGameView(View gameView) { protected void onAddGameView(View gameView) {
gameViewLiveData.setValue(gameView); gameViewLiveData.setValue(gameView);
} }
/** 将页面中的游戏View移除 */ /**
* 将页面中的游戏View移除
*/
@Override @Override
protected void onRemoveGameView() { protected void onRemoveGameView() {
gameViewLiveData.setValue(null); gameViewLiveData.setValue(null);

View File

@ -1,15 +1,20 @@
package com.yunbao.common.sud; package com.yunbao.common.sud;
import android.content.Context;
import com.yunbao.common.manager.IMLoginManager;
import java.math.BigInteger; import java.math.BigInteger;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.UUID;
public class QuickStartUtils { public class QuickStartUtils {
/** 随机生成一个userId用于演示 */ /**
public static String genUserID() { * 随机生成一个userId用于演示
return md5Hex8(UUID.randomUUID().toString()); */
public static String genUserID(Context mContext) {
return md5Hex8(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
} }
public static String md5Hex8(String plainText) { public static String md5Hex8(String plainText) {

View File

@ -170,7 +170,7 @@ public class CustomDrawerPopupView extends DrawerPopupView {
adapter.updateData(data); adapter.updateData(data);
} else { } else {
LiveNetManager.get(mContext) LiveNetManager.get(mContext)
.getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() { .getCustomSidebarInfo("0",new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
@Override @Override
public void onSuccess(List<CustomSidebarInfoModel> data) { public void onSuccess(List<CustomSidebarInfoModel> data) {
adapter.updateData(data); adapter.updateData(data);
@ -221,6 +221,8 @@ public class CustomDrawerPopupView extends DrawerPopupView {
void share(); void share();
void changeFontSize(); void changeFontSize();
void interaction(long interactionID);
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
@ -267,6 +269,9 @@ public class CustomDrawerPopupView extends DrawerPopupView {
dismiss(); dismiss();
callBack.changeFontSize(); callBack.changeFontSize();
} }
if (event.isInteraction()){
callBack.interaction(event.getInteractionID());
}
} }
if (event.isRefresh()) { if (event.isRefresh()) {

View File

@ -0,0 +1,56 @@
package com.yunbao.common.views;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
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 InteractionGamesChildViewHolder extends RecyclerView.ViewHolder {
private ImageView funGamePic;
private TextView funGameName;
public InteractionGamesChildViewHolder(@NonNull View itemView) {
super(itemView);
funGamePic = itemView.findViewById(R.id.fun_game_pic);
funGameName = itemView.findViewById(R.id.fun_game_name);
}
public void setData(CustomSidebarChildModel model, boolean rigts) {
if (rigts) {
ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic);
} else {
ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic);
}
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()));
} else {
long activityID = TextUtils.isEmpty(model.getSrc()) ? 0 : Long.parseLong(model.getSrc());
if (activityID != 0) {
Bus.get().post(new CustomDrawerPopupEvent()
.setDisMiss(true).setInteractionID(activityID).setInteraction(true));
}
}
}
});
}
}

View File

@ -0,0 +1,63 @@
package com.yunbao.common.views;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.FunGamesAdapter;
import com.yunbao.common.adapter.InteractionGamesAdapter;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import java.util.List;
public class InteractionGamesViewHolder extends RecyclerView.ViewHolder {
private InteractionGamesAdapter funGamesAdapter;
private TextView sendGoodGift, selectMore;
private RecyclerView childList;
private ImageView selectMoreIcon;
boolean isShowMore = true;
public InteractionGamesViewHolder(@NonNull View itemView) {
super(itemView);
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
childList = itemView.findViewById(R.id.child_list);
selectMoreIcon = itemView.findViewById(R.id.select_more_icon);
selectMore = itemView.findViewById(R.id.select_more);
funGamesAdapter = new InteractionGamesAdapter(itemView.getContext(), true);
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4));
childList.setAdapter(funGamesAdapter);
}
public void setData(CustomSidebarInfoModel model) {
List<CustomSidebarChildModel> sidebarChildModels = model.getChild();
itemView.findViewById(R.id.select_more_layout).setVisibility(sidebarChildModels.size() >= 8 ? View.VISIBLE : View.GONE);
sendGoodGift.setText(model.getTitle());
funGamesAdapter.updateData(sidebarChildModels);
ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.select_more_layout), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (isShowMore) {
funGamesAdapter.selectAll(sidebarChildModels);
selectMore.setText(R.string.video_comment_collapsed);
ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_up, selectMoreIcon);
} else {
funGamesAdapter.updateData(sidebarChildModels);
selectMore.setText(R.string.moer);
ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_down, selectMoreIcon);
}
isShowMore = !isShowMore;
}
});
}
}

View File

@ -0,0 +1,65 @@
package com.yunbao.common.views;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.FunGamesAdapter;
import com.yunbao.common.adapter.NewRoleFunGamesAdapter;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import java.util.List;
public class LiveNewRoleFunGamesViewHolder extends RecyclerView.ViewHolder {
private NewRoleFunGamesAdapter funGamesAdapter;
private TextView sendGoodGift, selectMore;
private RecyclerView childList;
private ImageView selectMoreIcon;
boolean isShowMore = true;
public LiveNewRoleFunGamesViewHolder(@NonNull View itemView) {
super(itemView);
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
childList = itemView.findViewById(R.id.child_list);
selectMoreIcon = itemView.findViewById(R.id.select_more_icon);
selectMore = itemView.findViewById(R.id.select_more);
funGamesAdapter = new NewRoleFunGamesAdapter(itemView.getContext(),true);
childList.setLayoutManager(new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.HORIZONTAL, false));
childList.setAdapter(funGamesAdapter);
}
public void setData(CustomSidebarInfoModel model) {
List<CustomSidebarChildModel> sidebarChildModels = model.getChild();
itemView.findViewById(R.id.select_more_layout).setVisibility(sidebarChildModels.size() >= 8 ? View.VISIBLE : View.GONE);
sendGoodGift.setText(model.getTitle());
funGamesAdapter.updateData(sidebarChildModels);
ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.select_more_layout), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (isShowMore) {
funGamesAdapter.selectAll(sidebarChildModels);
selectMore.setText(R.string.video_comment_collapsed);
ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_up, selectMoreIcon);
} else {
funGamesAdapter.updateData(sidebarChildModels);
selectMore.setText(R.string.moer);
ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_down, selectMoreIcon);
}
isShowMore = !isShowMore;
}
});
}
}

View File

@ -0,0 +1,44 @@
package com.yunbao.common.views;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.InteractionGamesAdapter;
import com.yunbao.common.adapter.LiveNewRoleInteractionGamesAdapter;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import java.util.List;
public class LiveNewRoleInteractionGamesViewHolder extends RecyclerView.ViewHolder {
private LiveNewRoleInteractionGamesAdapter funGamesAdapter;
private TextView sendGoodGift;
private RecyclerView childList;
private ImageView selectMoreIcon;
boolean isShowMore = true;
public LiveNewRoleInteractionGamesViewHolder(@NonNull View itemView) {
super(itemView);
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
childList = itemView.findViewById(R.id.child_list);
selectMoreIcon = itemView.findViewById(R.id.select_more_icon);
funGamesAdapter = new LiveNewRoleInteractionGamesAdapter(itemView.getContext(), true);
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4));
childList.setAdapter(funGamesAdapter);
}
public void setData(CustomSidebarInfoModel model) {
List<CustomSidebarChildModel> sidebarChildModels = model.getChild();
sendGoodGift.setText(model.getTitle());
funGamesAdapter.updateData(sidebarChildModels);
}
}

View File

@ -0,0 +1,56 @@
package com.yunbao.common.views;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.FunGamesAdapter;
import com.yunbao.common.adapter.LiveNewRoleFunGamesAdapter;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import java.util.ArrayList;
import java.util.List;
public class LiveNewRoleRigtsInterestsViewHolder extends RecyclerView.ViewHolder {
private LiveNewRoleFunGamesAdapter funGamesAdapter;
private TextView sendGoodGift;
private RecyclerView childList;
public LiveNewRoleRigtsInterestsViewHolder(@NonNull View itemView) {
super(itemView);
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
childList = itemView.findViewById(R.id.child_list);
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
childList = itemView.findViewById(R.id.child_list);
funGamesAdapter = new LiveNewRoleFunGamesAdapter(itemView.getContext(), false);
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4));
childList.setAdapter(funGamesAdapter);
}
public void setData(CustomSidebarInfoModel model) {
sendGoodGift.setText(model.getTitle());
funGamesAdapter.updateData(generateData());
}
private List<CustomSidebarChildModel> generateData() {
List<CustomSidebarChildModel> child = new ArrayList<>();
child.add(new CustomSidebarChildModel()
.setTitle(itemView.getContext().getString(R.string.noble))
.setResIcon(R.mipmap.live_more_icon_aristocrat));
child.add(new CustomSidebarChildModel()
.setTitle(itemView.getContext().getString(R.string.guard_guard))
.setResIcon(R.mipmap.live_more_icon_guard));
child.add(new CustomSidebarChildModel()
.setTitle(itemView.getContext().getString(R.string.fan_club))
.setResIcon(R.mipmap.live_more_icon_fans));
return child;
}
}

View File

@ -0,0 +1,85 @@
package com.yunbao.common.views;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.lifecycle.Observer;
import com.lxj.xpopup.core.BottomPopupView;
import com.yunbao.common.R;
import com.yunbao.common.event.LiveNewWishListEvent;
import com.yunbao.common.sud.QuickStartGameViewModel;
import com.yunbao.common.utils.Bus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
/**
* sub半屏游戏弹窗
*/
public class LiveSudGamePopup extends BottomPopupView {
private FrameLayout gameContainer;
private long mInteractionID;
private String mLiveUid;
private final QuickStartGameViewModel gameViewModel = new QuickStartGameViewModel(); // 创建ViewModel
public LiveSudGamePopup(@NonNull Context context, long interactionID,String liveUid) {
super(context);
mInteractionID = interactionID;
mLiveUid = liveUid;
}
// 返回自定义弹窗的布局
@Override
protected int getImplLayoutId() {
return R.layout.dialog_live_sud_game;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
Bus.getOn(this);
initView();
initDate();
}
private void initView() {
gameContainer = findViewById(R.id.game_container);
gameViewModel.gameViewLiveData.observe(this, new Observer<View>() {
@Override
public void onChanged(View view) {
if (view == null) { // 在关闭游戏时把游戏View给移除
gameContainer.removeAllViews();
} else { // 把游戏View添加到容器内
gameContainer.addView(view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
}
}
});
// 加载游戏参数定义可查看BaseGameViewModel.switchGame()方法注释
// SudMGP平台64bit游戏ID
gameViewModel.switchGame((Activity) getContext(), mLiveUid, mInteractionID);
}
private void initDate() {
}
@Override
protected void onDismiss() {
Bus.getOff(this);
super.onDismiss();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveNewWishListEvent(LiveNewWishListEvent event) {
}
}

View File

@ -0,0 +1,87 @@
package com.yunbao.common.views;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.event.CustomDrawerPopupEvent;
import com.yunbao.common.event.LiveNewRoleEvent;
import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
private ImageView funGamePic;
private TextView funGameName;
public NewRoleFunGamesChildViewHolder(@NonNull View itemView) {
super(itemView);
funGamePic = itemView.findViewById(R.id.fun_game_pic);
funGameName = itemView.findViewById(R.id.fun_game_name);
}
public void setData(CustomSidebarChildModel model, boolean rigts) {
if (rigts) {
ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic);
} else {
ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic);
}
funGameName.setText(model.getTitle());
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (!rigts) {
Bus.get().post(new NewRoleCustomDrawerPopupEvent()
.setDisMiss(true).setRightsInterests(model.getTitle()));
} else {
int activityID = TextUtils.isEmpty(model.getActivityId()) ? 0 : Integer.parseInt(model.getActivityId());
if (activityID != 0) {
Bus.get().post(new NewRoleCustomDrawerPopupEvent()
.setDisMiss(true).setActivityId(activityID));
} else {
IMLoginModel userInfo = IMLoginManager.get(itemView.getContext()).getUserInfo();
StringBuffer htmlUrl = new StringBuffer();
if (model.getSrc().contains("?")) {
htmlUrl.append(CommonAppConfig.HOST).append("/").append(model.getSrc())
.append("&uid=")
.append(userInfo.getId())
.append("&token=")
.append(userInfo.getToken());
} else {
htmlUrl.append(CommonAppConfig.HOST)
.append("/")
.append(model.getSrc())
.append("?uid=")
.append(userInfo.getId())
.append("&token=")
.append(userInfo.getToken());
}
Bus.get().post(new NewRoleCustomDrawerPopupEvent()
.setHtmlUrl(htmlUrl.toString())
.setDisMiss(true)
.setScreen(TextUtils.equals(model.getShowType(), "2")));
}
}
Bus.get().post(new LiveNewRoleEvent());
}
});
}
}

View File

@ -245,6 +245,38 @@
</LinearLayout> </LinearLayout>
</HorizontalScrollView> </HorizontalScrollView>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="20dp">
<LinearLayout
android:id="@+id/live_tool_game"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/icon_live_qa" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="游戏房间"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="360dp"
android:background="@drawable/bg_live_tota"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/drawerList"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="384dp" />
</LinearLayout>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="580dp"
android:orientation="vertical">
<FrameLayout
android:id="@+id/game_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_drawer_popup"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp">
<TextView
android:id="@+id/send_good_gift"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="任務中心"
android:textColor="#F6F7FB"
android:textSize="14sp" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/child_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp" />
<LinearLayout
android:id="@+id/select_more_layout"
android:layout_width="wrap_content"
android:padding="14dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_vertical">
<TextView
android:id="@+id/select_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/moer"
android:textColor="#EEF1FF"
android:textSize="12sp" />
<ImageView
android:id="@+id/select_more_icon"
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_marginStart="3dp"
android:src="@mipmap/icon_more_down" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="7dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/fun_game_pic"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@mipmap/live_more_icon_guard" />
<TextView
android:id="@+id/fun_game_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:layout_marginTop="2dp"
android:text="@string/guard_guard"
android:textColor="#9A9A9A"
android:textSize="14sp" />
</LinearLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingEnd="30dp"
android:clickable="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/fun_game_pic"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@mipmap/live_more_icon_guard" />
<TextView
android:id="@+id/fun_game_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/guard_guard"
android:textColor="#9A9A9A"
android:textSize="14sp" />
</LinearLayout>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="14dp">
<TextView
android:id="@+id/send_good_gift"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="任務中心"
android:textColor="#fff"
android:textSize="16sp" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/child_list"
android:layout_width="match_parent"
android:overScrollMode="never"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="14dp">
<TextView
android:id="@+id/send_good_gift"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="任務中心"
android:textColor="#fff"
android:textSize="16sp" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/child_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="14dp">
<TextView
android:id="@+id/send_good_gift"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="任務中心"
android:textColor="#fff"
android:textSize="16sp" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/child_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/select_more_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_vertical"
android:padding="14dp">
<TextView
android:id="@+id/select_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/moer"
android:textColor="#EEF1FF"
android:textSize="12sp" />
<ImageView
android:id="@+id/select_more_icon"
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_marginStart="3dp"
android:src="@mipmap/icon_more_down" />
</LinearLayout>
</LinearLayout>

View File

@ -5,13 +5,13 @@ ext {
minSdkVersion : 21, minSdkVersion : 21,
targetSdkVersion : 33, targetSdkVersion : 33,
versionCode : 450, versionCode : 450,
versionName : "6.5.5" versionName : "6.5.6"
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : " https://ceshi.yaoulive.com", serverHost : " https://ceshi.yaoulive.com",

View File

@ -65,6 +65,7 @@ import com.yunbao.common.event.GiftWallIlluminateEvent;
import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.event.LiveErrorEvent; import com.yunbao.common.event.LiveErrorEvent;
import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
@ -89,6 +90,7 @@ import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.CustomDrawerPopupView; import com.yunbao.common.views.CustomDrawerPopupView;
import com.yunbao.common.views.LiveSudGamePopup;
import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.floatingview.APPEasyFloat;
import com.yunbao.common.views.weight.VerticalViewPager; import com.yunbao.common.views.weight.VerticalViewPager;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -121,10 +123,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import io.rong.imlib.IRongCoreCallback;
import io.rong.imlib.IRongCoreEnum;
import io.rong.imlib.chatroom.base.RongChatRoomClient;
/** /**
* Created by cxf on 2018/10/10. * Created by cxf on 2018/10/10.
* 看直播 * 看直播
@ -983,6 +981,18 @@ public class LiveAudienceActivity extends LiveActivity {
.setBean(mLiveBean) .setBean(mLiveBean)
.setType(LiveAudienceEvent.LiveAudienceType.FONT_SIZE)); .setType(LiveAudienceEvent.LiveAudienceType.FONT_SIZE));
} }
@Override
public void interaction(long interactionID) {
new XPopup.Builder(mContext)
.enableDrag(false)
.hasBlurBg(true)
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(new LiveSudGamePopup(mContext, interactionID, mLiveUid))
.show();
}
}); });
new XPopup.Builder(mContext) new XPopup.Builder(mContext)
.hasShadowBg(false) .hasShadowBg(false)
@ -1078,6 +1088,7 @@ public class LiveAudienceActivity extends LiveActivity {
fragment.setActivityId(6); fragment.setActivityId(6);
fragment.setRoomId(mLiveUid); fragment.setRoomId(mLiveUid);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment"); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
break; break;
case FAN_CLUB: case FAN_CLUB:
@ -1622,6 +1633,51 @@ public class LiveAudienceActivity extends LiveActivity {
}); });
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onNewRoleCustomDrawerPopupEvent(NewRoleCustomDrawerPopupEvent event) {
//是否关闭弹窗
if (!TextUtils.isEmpty(event.getHtmlUrl())) {
if (TextUtils.equals(event.getHtmlUrl(), "recharge")) {
RouteUtil.forwardMyCoin(mContext);
} else if (TextUtils.equals(event.getHtmlUrl(), "to_me_information")) {
RouteUtil.forwardEditProfileActivity();
} else {
if (!event.isScreen()) {
ZhuangBanActivity.forward(mContext, event.getHtmlUrl(), false, 1);
} else {
Bundle bundle = new Bundle();
bundle.putString("url", event.getHtmlUrl());
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "LiveHDDialogFragment");
}
}
}
if (event.getActivityId() != 0) {
LiveGameDialogFragment fragment = new LiveGameDialogFragment();
fragment.setActivityId(event.getActivityId());
fragment.setRoomId(mLiveUid);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGameDialogFragment");
}
if (!TextUtils.isEmpty(event.getRightsInterests())) {
//跳转贵族
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));
}
}
}
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
public void showMsgRed(int num) { public void showMsgRed(int num) {
if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPoint == null) { if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPoint == null) {

View File

@ -29,6 +29,7 @@ import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.dialog.LiveNewRolePopup;
import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API; import com.yunbao.common.http.API;
@ -38,7 +39,6 @@ import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.dialog.LiveGiftPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
@ -47,7 +47,6 @@ import com.yunbao.live.bean.LiveChatBean;
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.LivePromotionDialogFragment; import com.yunbao.live.dialog.LivePromotionDialogFragment;
import com.yunbao.live.dialog.LiveRoleDialogFragment;
import com.yunbao.live.dialog.TextHintDialog; import com.yunbao.live.dialog.TextHintDialog;
import com.yunbao.live.dialog.VoiceDialog; import com.yunbao.live.dialog.VoiceDialog;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
@ -461,11 +460,16 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
* 身份特权 * 身份特权
*/ */
public void openRoleDialog() { public void openRoleDialog() {
LiveRoleDialogFragment fragment = new LiveRoleDialogFragment(); // LiveRoleDialogFragment fragment = new LiveRoleDialogFragment();
Bundle bundle = new Bundle(); // Bundle bundle = new Bundle();
bundle.putBoolean("showRed", mRedPointPrivilege.getVisibility() == View.VISIBLE); // bundle.putBoolean("showRed", mRedPointPrivilege.getVisibility() == View.VISIBLE);
fragment.setArguments(bundle); // fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment"); // fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment");
new XPopup.Builder(mContext)
.enableDrag(false)
.hasBlurBg(true)
.asCustom(new LiveNewRolePopup(mContext))
.show();
} }

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="171dp" android:layout_height="354dp"
android:background="@mipmap/img_pop_bg"> android:background="@drawable/bg_live_tota">
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
@ -120,4 +120,4 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout>

View File

@ -345,6 +345,7 @@
<!--整蛊--> <!--整蛊-->
<ImageView <ImageView
android:id="@+id/live_cheat" android:id="@+id/live_cheat"
android:visibility="gone"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB