diff --git a/app/build.gradle b/app/build.gradle index 6a5cb886f..4a5890d4b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -166,23 +166,23 @@ android { } } variant.outputs.all { - def isGoogle = "link" + def isGoogle = "链接" if (rootProject.ext.manifestPlaceholders.isGooglePlay == 1) { - isGoogle = "Google" + isGoogle = "谷歌" } else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) { isGoogle = "Huawei" }else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) { isGoogle = "Samsung" } - def isPlugin = "all" + def isPlugin = "完整" if (rootProject.ext.manifestPlaceholders.isPluginModel) { - isPlugin = "plugin" + isPlugin = "插件" } def isTest = "测试服" if (rootProject.ext.manifestPlaceholders.serverHost == "https://napi.yaoulive.com") { isTest = "正式服" } - outputFileName = "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk" + outputFileName = "[${new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk" } } diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 9e926bd0a..6d42c5495 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -23,6 +23,7 @@ import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.Utils; import com.facebook.appevents.AppEventsLogger; import com.fm.openinstall.OpenInstall; +import com.google.gson.Gson; import com.shayu.phonelive.utils.LogUtils; import com.tencent.imsdk.v2.V2TIMGroupMemberInfo; import com.tencent.imsdk.v2.V2TIMManager; @@ -36,12 +37,14 @@ import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AnchorStartLiveBean; import com.yunbao.common.bean.CrashSaveBean; +import com.yunbao.common.event.SudGameSocketImEvent; import com.yunbao.common.manager.imrongcloud.InstructorSendReward; import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.AppManager; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.GoogleUtils; import com.yunbao.common.utils.L; import com.yunbao.common.utils.SpUtil; @@ -210,6 +213,11 @@ public class AppContext extends CommonAppContext { SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class); JSONObject map = received.getMsg().getJSONObject(0); sendStartAnchorLive(map); + } else if (message.getTargetId().contains("v")) { + String contentJson = ((TextMessage) message.getContent()).getContent(); + Log.e("wewe", contentJson); + SudGameSocketImEvent sudGameSocketImEvent = new Gson().fromJson(contentJson, SudGameSocketImEvent.class); + Bus.get().post(sudGameSocketImEvent); } //主播页面 if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketRyClient.mSocketHandler != null) { diff --git a/common/build.gradle b/common/build.gradle index 6a33267a5..b9ff40117 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -191,7 +191,7 @@ dependencies { api 'com.github.princekin-f:EasyFloat:2.0.4' api files('libs/Msc.jar') - api 'com.github.li-xiaojun:XPopup:2.9.1' + api 'com.github.li-xiaojun:XPopup:2.10.0' api 'com.github.shenbengit:PagerGridLayoutManager:1.1.7' //选择器 @@ -209,6 +209,8 @@ dependencies { // 多语言语音识别扩展库(可选) api 'tech.sud.mgp:SudASR:1.3.3.1158' + //侧滑删除 + api 'com.yanzhenjie.recyclerview:x:1.3.2' //华为支付插件包 //api project(':lib_huawei') diff --git a/common/src/main/AndroidManifest.xml b/common/src/main/AndroidManifest.xml index d9bf690aa..5b9ff7982 100644 --- a/common/src/main/AndroidManifest.xml +++ b/common/src/main/AndroidManifest.xml @@ -56,9 +56,7 @@ - + mUserItemList;//个人中心功能列表 - private SparseArray mLevelMap; - private SparseArray mAnchorLevelMap; private SparseArray mAnchorFansMedalMap; private String mGiftListJson; private String mWrapListJson; @@ -521,46 +517,6 @@ public class CommonAppConfig { } - /** - * 保存用户等级信息 - */ - public void setLevel(String levelJson) { - if (TextUtils.isEmpty(levelJson)) { - return; - } - List list = JSON.parseArray(levelJson, LevelBean.class); - if (list == null || list.size() == 0) { - return; - } - if (mLevelMap == null) { - mLevelMap = new SparseArray<>(); - } - mLevelMap.clear(); - for (LevelBean bean : list) { - mLevelMap.put(bean.getLevel(), bean); - } - } - - /** - * 保存主播等级信息 - */ - public void setAnchorLevel(String anchorLevelJson) { - if (TextUtils.isEmpty(anchorLevelJson)) { - return; - } - List list = JSON.parseArray(anchorLevelJson, LevelBean.class); - if (list == null || list.size() == 0) { - return; - } - if (mAnchorLevelMap == null) { - mAnchorLevelMap = new SparseArray<>(); - } - mAnchorLevelMap.clear(); - for (LevelBean bean : list) { - mAnchorLevelMap.put(bean.getLevel(), bean); - } - } - /** * 保存主播粉丝徽章信息 */ @@ -599,40 +555,6 @@ public class CommonAppConfig { } - /** - * 获取用户等级 - */ - public LevelBean getLevel(int level) { - if (mLevelMap == null) { - String configString = SpUtil.getInstance().getStringValue(SpUtil.CONFIG); - if (!TextUtils.isEmpty(configString)) { - JSONObject obj = JSON.parseObject(configString); - setLevel(obj.getString("level")); - } - } - if (mLevelMap == null || mLevelMap.size() == 0) { - return null; - } - return mLevelMap.get(level); - } - - /** - * 获取主播等级 - */ - public LevelBean getAnchorLevel(int level) { - if (mAnchorLevelMap == null) { - String configString = SpUtil.getInstance().getStringValue(SpUtil.CONFIG); - if (!TextUtils.isEmpty(configString)) { - JSONObject obj = JSON.parseObject(configString); - setAnchorLevel(obj.getString("levelanchor")); - } - } - if (mAnchorLevelMap == null || mAnchorLevelMap.size() == 0) { - return null; - } - return mAnchorLevelMap.get(level); - } - public String getGiftListJson() { return mGiftListJson; } diff --git a/common/src/main/java/com/yunbao/common/Constants.java b/common/src/main/java/com/yunbao/common/Constants.java index 6f9ed2090..a0ea5df91 100644 --- a/common/src/main/java/com/yunbao/common/Constants.java +++ b/common/src/main/java/com/yunbao/common/Constants.java @@ -263,6 +263,8 @@ public class Constants { public static final String LIVE_SDK = "liveSdk"; public static final String LIVE_KSY_CONFIG = "liveKsyConfig"; + + public static final String LIVE_PK_RANDOM_START="RankingStartRandomPK"; public static final int LIVE_SDK_KSY = 0;//金山推流 public static final int LIVE_SDK_TX = 1;//腾讯推流 diff --git a/common/src/main/java/com/yunbao/common/activity/SudGameActivity.java b/common/src/main/java/com/yunbao/common/activity/SudGameActivity.java deleted file mode 100644 index 93544495f..000000000 --- a/common/src/main/java/com/yunbao/common/activity/SudGameActivity.java +++ /dev/null @@ -1,214 +0,0 @@ -package com.yunbao.common.activity; - -import android.app.Activity; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.TextView; - -import androidx.lifecycle.Observer; - -import com.google.gson.Gson; -import com.lxj.xpopup.XPopup; -import com.makeramen.roundedimageview.RoundedImageView; -import com.yunbao.common.R; -import com.yunbao.common.bean.CheckRemainingBalance; -import com.yunbao.common.bean.CreateSudRoomModel; -import com.yunbao.common.bean.CustomSidebarChildModel; -import com.yunbao.common.bean.CustomSidebarInfoModel; -import com.yunbao.common.event.CheckRemainingBalanceEvent; -import com.yunbao.common.glide.ImgLoader; -import com.yunbao.common.http.base.HttpCallback; -import com.yunbao.common.http.live.LiveNetManager; -import com.yunbao.common.manager.IMLoginManager; -import com.yunbao.common.sud.QuickStartGameViewModel; -import com.yunbao.common.sud.model.GameConfigModel; -import com.yunbao.common.sud.state.SudMGPMGState; -import com.yunbao.common.utils.Bus; -import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.views.LiveSudGameHistoryPopup; -import com.yunbao.common.views.weight.ViewClicksAntiShake; - -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -public class SudGameActivity extends AbsActivity { - private FrameLayout gameContainer; - private long mInteractionID; - private String mLiveUid; - private final QuickStartGameViewModel gameViewModel = new QuickStartGameViewModel(); // 创建ViewModel - - private CreateSudRoomModel mCreateSudRoomModel; - private TextView gameTitle, roomName, roomNumber; - private RoundedImageView mAvatar; - @Override - protected int getLayoutId() { - return R.layout.activity_sud_game; - } - - @Override - protected void main() { - Bus.getOn(this); - super.main(); - initView(); - initDate(); - } - private List customSidebarChildModels = new ArrayList<>(); - private void initDate() { - LiveNetManager.get(mContext) - .getCustomSidebarInfo("1", new HttpCallback>() { - @Override - public void onSuccess(List data) { - for (CustomSidebarInfoModel datum : data) { - if (datum.getType().equals("6")) { - customSidebarChildModels = datum.getChild(); - return; - } - } - } - - @Override - public void onError(String error) { - - } - }); - } - @Override - protected void onDestroy() { - Bus.getOff(this); - super.onDestroy(); - } - - private void initView() { - String createSudRoomJson = getIntent().getStringExtra("CreateSudRoom"); - mCreateSudRoomModel = new Gson().fromJson(createSudRoomJson, CreateSudRoomModel.class); - mInteractionID = mCreateSudRoomModel.getLongSudGameId(); - mLiveUid = mCreateSudRoomModel.getSudGameRoomId(); - - gameContainer = findViewById(R.id.game_container); - gameTitle = findViewById(R.id.game_title); - roomName = findViewById(R.id.room_name); - roomNumber = findViewById(R.id.room_number); - mAvatar = findViewById(R.id.avatar); - if (mCreateSudRoomModel != null) { - gameTitle.setText(mCreateSudRoomModel.getSudGameName()); - roomName.setText(mCreateSudRoomModel.getRoomName()); - roomNumber.setText(mCreateSudRoomModel.getSudGameRoomId()); - ImgLoader.display(mContext, mCreateSudRoomModel.getAvatar(), mAvatar); - } - ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exit), new ViewClicksAntiShake.ViewClicksCallBack() { - @Override - public void onViewClicks() { - gameViewModel.onDestroy(); - finish(); - } - }); - ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_history), new ViewClicksAntiShake.ViewClicksCallBack() { - @Override - public void onViewClicks() { - - new XPopup.Builder(mContext) - .enableDrag(false) - .asCustom(new LiveSudGameHistoryPopup(mContext, customSidebarChildModels)).show(); - } - }); - gameViewModel.gameViewLiveData.observe(this, new Observer() { - @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()方法注释 - // 游戏配置 - GameConfigModel gameConfigModel = gameViewModel.getGameConfigModel(); - gameConfigModel.ui.ping.hide = true; // 配置不隐藏ping值 - gameConfigModel.ui.level.hide = true; // 配置不隐藏ping值 - gameConfigModel.ui.lobby_game_setting.hide = true; // 配置不隐藏ping值 - - gameConfigModel.ui.lobby_players.custom = true; - gameConfigModel.ui.join_btn.custom = true; - gameConfigModel.ui.game_settle_again_btn.custom = true; - gameConfigModel.ui.start_btn.custom = true; - - // SudMGP平台64bit游戏ID - gameViewModel.switchGame((Activity) mContext, mLiveUid, mInteractionID); -// gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, -1, true, 1); -// gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfCaptain(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId())); -// ViewClicksAntiShake.clicksAntiShake(gameTitle, new ViewClicksAntiShake.ViewClicksCallBack() { -// @Override -// public void onViewClicks() { -// -// } -// }); - - - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) { - switch (event.getSudMGPMGState()) { - case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN: - case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN: - LiveNetManager.get(mContext).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback() { - @Override - public void onSuccess(CheckRemainingBalance data) { - if (data.getGoldenBeanRemainingBalance() == 1) { - gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1); - } else { - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - ToastUtil.show("貨幣数量不足 "); - } else { - ToastUtil.show("Shortage of money"); - } - - } - } - - @Override - public void onError(String error) { - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - ToastUtil.show("貨幣数量不足 "); - } else { - ToastUtil.show("Shortage of money"); - } - } - }); - break; - case SudMGPMGState.MG_COMMON_GAME_SETTLE: - gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1); - break; - case SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN: - LiveNetManager.get(mContext).gameStartCheckRemainingBalance(mCreateSudRoomModel.getSudGameId(), - mCreateSudRoomModel.getSudGameRoomId(), new - HttpCallback() { - @Override - public void onSuccess(CheckRemainingBalance data) { - if (data.getStatus()==1){ - gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfPlaying(true); - }else { - - } - - } - - @Override - public void onError(String error) { - ToastUtil.show(error); - } - }); - break; - case SudMGPMGState.MG_COMMON_GAME_STATE: - LiveNetManager.get(mContext).deductMoney( mCreateSudRoomModel.getSudGameRoomId()); - break; - } - - } - -} diff --git a/common/src/main/java/com/yunbao/common/adapter/RefreshAdapter.java b/common/src/main/java/com/yunbao/common/adapter/RefreshAdapter.java index 5e28ba8f6..a0d174681 100644 --- a/common/src/main/java/com/yunbao/common/adapter/RefreshAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/RefreshAdapter.java @@ -67,6 +67,13 @@ public abstract class RefreshAdapter extends RecyclerView.Adapter { } } + public void refreshDel(){ + if (mRecyclerView != null) { + notifyDataSetChanged(); + } + } + + public void refreshData(List list) { if (mRecyclerView != null && list != null) { mList.clear(); diff --git a/common/src/main/java/com/yunbao/common/adapter/SudGameChatAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudGameChatAdapter.java new file mode 100644 index 000000000..0cc916894 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/SudGameChatAdapter.java @@ -0,0 +1,122 @@ +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.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.bean.SudGameChatImModel; +import com.yunbao.common.views.SudGameChatViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class SudGameChatAdapter extends RecyclerView.Adapter { + private boolean isBottom = false; + List sudGameChatImModels = new ArrayList<>(); + private RecyclerView mRecyclerView; + private LinearLayoutManager mLayoutManager; + private int mRecyclerViewScrolledDy; + private Context mContext; + + public SudGameChatAdapter(Context mContext) { + this.mContext = mContext; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_sud_game_chat_item_holder, parent, false); + return new SudGameChatViewHolder(herdView); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + if (holder instanceof SudGameChatViewHolder) { + SudGameChatViewHolder itemViewHolder = (SudGameChatViewHolder) holder; + itemViewHolder.sudGameChat(sudGameChatImModels.get(position)); + + } + } + + @Override + public int getItemCount() { + return sudGameChatImModels.size(); + } + + @Override + public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) { + mRecyclerView = recyclerView; + mLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); + mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + if (isBottom && dy >= 0) return; + mRecyclerViewScrolledDy = dy; + isBottom = false; + + } + + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + if (newState == 0 && isSlideToBottom(recyclerView)) { + mRecyclerViewScrolledDy = 0; + scrollToBottom(); + isBottom = true; + } else if (newState == 0) { + isBottom = false; + } + } + }); + } + + public synchronized void insertItem(SudGameChatImModel bean) { + if (bean == null) { + return; + } + int size = sudGameChatImModels.size(); + //设置最大展示99条消息 + if (size >= 100 && (isBottom || mRecyclerViewScrolledDy == 0)) { + + sudGameChatImModels.subList(0, 50).clear(); + notifyItemRangeRemoved(0, 50); + } + sudGameChatImModels.add(bean); + if (getItemCount() == 1) { + notifyDataSetChanged(); + } else { + notifyItemInserted(getItemCount()); + } + if (isBottom || mRecyclerViewScrolledDy == 0) { + scrollToBottom(); + } + } + + /** + * 判断是否滚到底部 + * + * @param recyclerView + * @return + */ + public boolean isSlideToBottom(RecyclerView recyclerView) { + if (recyclerView == null) return false; + if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() >= recyclerView.computeVerticalScrollRange()) + return true; + return false; + } + + public void scrollToBottom() { + if (sudGameChatImModels.size() > 0) { + mRecyclerView.smoothScrollToPosition(getItemCount()); + } + mRecyclerViewScrolledDy = 0; + } + +} diff --git a/common/src/main/java/com/yunbao/common/adapter/SudGameUserListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudGameUserListAdapter.java new file mode 100644 index 000000000..e8893b9f1 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/SudGameUserListAdapter.java @@ -0,0 +1,135 @@ +package com.yunbao.common.adapter; + +import android.text.TextUtils; +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.SudGameUserModel; +import com.yunbao.common.views.SudGameUserListViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class SudGameUserListAdapter extends RecyclerView.Adapter { + private List gameUserModels = new ArrayList<>(); + private boolean micMax = false; + + public SudGameUserListAdapter(List gameUserModels) { + + if (gameUserModels.size() < 7) { + this.gameUserModels.addAll(gameUserModels); + for (int i = 0; i < this.gameUserModels.size(); i++) { + this.gameUserModels.get(i).setNullUser(false); + } + int size = 7 - gameUserModels.size(); + for (int i = 0; i < size; i++) { + this.gameUserModels.add(new SudGameUserModel().setNullUser(true)); + } + } else if (gameUserModels.size() == 7) { + this.gameUserModels.addAll(gameUserModels); + for (int i = 0; i < this.gameUserModels.size(); i++) { + this.gameUserModels.get(i).setNullUser(false); + } + } else { + for (int i = 0; i < 7; i++) { + this.gameUserModels.add(gameUserModels.get(i).setNullUser(false)); + } + } + + } + + public void refreshSudGameUserList(List gameUserModels, List muteUser) { + this.gameUserModels.clear(); + if (gameUserModels.size() < 7) { + micMax = false; + this.gameUserModels.addAll(gameUserModels); + for (int i = 0; i < this.gameUserModels.size(); i++) { + for (String userID : muteUser) { + if (TextUtils.equals(userID, String.valueOf(this.gameUserModels.get(i).getId()))) { + this.gameUserModels.get(i).setMute(true); + } + + } + this.gameUserModels.get(i).setNullUser(false); + } + int size = 7 - gameUserModels.size(); + for (int i = 0; i < size; i++) { + this.gameUserModels.add(new SudGameUserModel().setNullUser(true)); + } + } else if (gameUserModels.size() == 7) { + micMax = true; + this.gameUserModels.addAll(gameUserModels); + for (int i = 0; i < this.gameUserModels.size(); i++) { + this.gameUserModels.get(i).setNullUser(false); + } + } else { + micMax = true; + + for (int i = 0; i < 7; i++) { + for (String userID : muteUser) { + if (TextUtils.equals(userID, String.valueOf(this.gameUserModels.get(i).getId()))) { + this.gameUserModels.get(i).setMute(true); + } + + } + this.gameUserModels.add(gameUserModels.get(i).setNullUser(false)); + } + } + notifyDataSetChanged(); + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_sud_game_user_list_holder, parent, false); + return new SudGameUserListViewHolder(herdView); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + SudGameUserListViewHolder sudGameUserListViewHolder = (SudGameUserListViewHolder) holder; + sudGameUserListViewHolder.upData(gameUserModels.get(position), sudGameSmallCallBack, position); + } + + @Override + public int getItemCount() { + return gameUserModels.size(); + } + + public boolean isMicMax() { + return micMax; + } + + public void muteUser(String userID, boolean mute, int position) { + for (int i = 0; i < gameUserModels.size(); i++) { + SudGameUserModel sudGameUserModel = gameUserModels.get(i); + if (!sudGameUserModel.isNullUser()) { + if (TextUtils.equals(userID, String.valueOf(sudGameUserModel.getId()))) { + gameUserModels.get(i).setMute(mute); + + } + } + } + notifyItemChanged(position); + } + + private SudGameSmallCallBack sudGameSmallCallBack; + + public SudGameUserListAdapter setSudGameSmallCallBack(SudGameSmallCallBack sudGameSmallCallBack) { + this.sudGameSmallCallBack = sudGameSmallCallBack; + return this; + } + + public interface SudGameSmallCallBack { + void unMute(String userID, int position); + + void mute(String userID, int position); + + void viewInformation(SudGameUserModel sudGameUserModel); + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java index 80c69327c..8129692a6 100644 --- a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java +++ b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java @@ -20,6 +20,12 @@ public class AnchorRecommendModel extends BaseModel { @SerializedName("red_packet_show") private int showRedPacket = 0;//是否显示首页红包浮窗 //是否支持换一批0=不支持 1=支持 + + + @SerializedName("live_battle_pass_show_status") + private int showWarOrder = 0;//是否显示首页戰令 + //是否支持换一批0=不支持 1=支持 + @SerializedName("up_show") private int upShow = 0; @SerializedName("list") @@ -40,6 +46,14 @@ public class AnchorRecommendModel extends BaseModel { return this; } + public int getShowWarOrder() { + return showWarOrder; + } + + public void setShowWarOrder(int showWarOrder) { + this.showWarOrder = showWarOrder; + } + public int getListShow() { return listShow; } diff --git a/common/src/main/java/com/yunbao/common/bean/BattlePassPoints.java b/common/src/main/java/com/yunbao/common/bean/BattlePassPoints.java new file mode 100644 index 000000000..add65fdb2 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/BattlePassPoints.java @@ -0,0 +1,175 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class BattlePassPoints extends BaseModel{ + private int id; + private int type; + @SerializedName("rewards_name") + private String rewardsName; + @SerializedName("rewards_id") + private int rewardsId; + @SerializedName("image_url") + private String imageUrl; + @SerializedName("points_threshold") + private String pointsThreshold; + @SerializedName("points_threshold_text") + private String pointsThresholdText; + @SerializedName("rewards_value") + private String rewardsValue; + @SerializedName("battle_pass_level") + private int battlePassLevel; + @SerializedName("exchange_quantity") + private int exchangeQuantity; + @SerializedName("live_battle_pass_type_id") + private int liveBattlePassTypeId; + private String description; + @SerializedName("restrict_time") + private int restrictTime; + private int sort; + @SerializedName("exchange_status") + private int exchangeStatus; + @SerializedName("user_quinty_count") + private int userQuintyCount; + @SerializedName("exchange_status_remark") + private String exchangeMark; + + public BattlePassPoints() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getRewardsName() { + return rewardsName; + } + + public void setRewardsName(String rewardsName) { + this.rewardsName = rewardsName; + } + + public int getRewardsId() { + return rewardsId; + } + + public void setRewardsId(int rewardsId) { + this.rewardsId = rewardsId; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public String getPointsThreshold() { + return pointsThreshold; + } + + public void setPointsThreshold(String pointsThreshold) { + this.pointsThreshold = pointsThreshold; + } + + public String getRewardsValue() { + return rewardsValue; + } + + public void setRewardsValue(String rewardsValue) { + this.rewardsValue = rewardsValue; + } + + public int getBattlePassLevel() { + return battlePassLevel; + } + + public void setBattlePassLevel(int battlePassLevel) { + this.battlePassLevel = battlePassLevel; + } + + public int getExchangeQuantity() { + return exchangeQuantity; + } + + public void setExchangeQuantity(int exchangeQuantity) { + this.exchangeQuantity = exchangeQuantity; + } + + public int getLiveBattlePassTypeId() { + return liveBattlePassTypeId; + } + + public void setLiveBattlePassTypeId(int liveBattlePassTypeId) { + this.liveBattlePassTypeId = liveBattlePassTypeId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getRestrictTime() { + return restrictTime; + } + + public void setRestrictTime(int restrictTime) { + this.restrictTime = restrictTime; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public int getExchangeStatus() { + return exchangeStatus; + } + + public void setExchangeStatus(int exchangeStatus) { + this.exchangeStatus = exchangeStatus; + } + + public int getUserQuintyCount() { + return userQuintyCount; + } + + public void setUserQuintyCount(int userQuintyCount) { + this.userQuintyCount = userQuintyCount; + } + + public String getExchangeMark() { + return exchangeMark; + } + + public void setExchangeMark(String exchangeMark) { + this.exchangeMark = exchangeMark; + } + + public String getPointsThresholdText() { + return pointsThresholdText; + } + + public void setPointsThresholdText(String pointsThresholdText) { + this.pointsThresholdText = pointsThresholdText; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/BattlePassTask.java b/common/src/main/java/com/yunbao/common/bean/BattlePassTask.java new file mode 100644 index 000000000..ae19dfe6c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/BattlePassTask.java @@ -0,0 +1,157 @@ +package com.yunbao.common.bean; + +import android.content.Context; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.utils.WordUtil; + +import java.util.List; + +public class BattlePassTask extends BaseModel { + private List daily;// 每日任务 + private List season;// 每期任务 + + public BattlePassTask() { + } + + public List getDaily() { + return daily; + } + + public void setDaily(List daily) { + this.daily = daily; + } + + public List getSeason() { + return season; + } + + public void setSeason(List season) { + this.season = season; + } + + public static class Task { + private int id;// 任务ID + private String type;// 任务类型 + @SerializedName("task_success") + private int taskSuccess;// 任务可以重复的次数 + @SerializedName("name_en") + private String nameEn;// 任务名称英文 + @SerializedName("remark_en") + private String remarkEn;// 任务备注英文 + private String name;// 任务名称中文 + private String remark; // 任务备注中文 + @SerializedName("image_path") + private String imagePath;// 图标path + @SerializedName("user_task_success") + private int userTaskSuccess;// 用户完成的任务次数 + @SerializedName("received_task") + private int receivedTask;// 用户已经领取的任务数量 + @SerializedName("not_received_task") + private int notReceivedTask; // 用户未领取的任务数量 + public boolean isBuy(){ + return taskSuccess==0; + } + public String getNameText(){ + return WordUtil.isNewZh()?name:nameEn; + } + public String getRemarkText(){ + return WordUtil.isNewZh()?remark:remarkEn; + } + + public Task() { + } + + public Task(int id) { + this.id = id; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getTaskSuccess() { + return taskSuccess; + } + + public void setTaskSuccess(int taskSuccess) { + this.taskSuccess = taskSuccess; + } + + public String getNameEn() { + return nameEn; + } + + public void setNameEn(String nameEn) { + this.nameEn = nameEn; + } + + public String getRemarkEn() { + return remarkEn; + } + + public void setRemarkEn(String remarkEn) { + this.remarkEn = remarkEn; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getImagePath() { + return imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public int getUserTaskSuccess() { + return userTaskSuccess; + } + + public void setUserTaskSuccess(int userTaskSuccess) { + this.userTaskSuccess = userTaskSuccess; + } + + public int getReceivedTask() { + return receivedTask; + } + + public void setReceivedTask(int receivedTask) { + this.receivedTask = receivedTask; + } + + public int getNotReceivedTask() { + return notReceivedTask; + } + + public void setNotReceivedTask(int notReceivedTask) { + this.notReceivedTask = notReceivedTask; + } + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/BattlePassUserInfoBean.java b/common/src/main/java/com/yunbao/common/bean/BattlePassUserInfoBean.java new file mode 100644 index 000000000..12ef62d04 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/BattlePassUserInfoBean.java @@ -0,0 +1,199 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class BattlePassUserInfoBean extends BaseModel{ + private String uid; + private int points; + @SerializedName("battle_pass_exp") + private int battlePassExp; + @SerializedName("battle_pass_user_records_1") + private int battlePassUserRecords1; + @SerializedName("battle_pass_user_records_2") + private int battlePassUserRecords2; + @SerializedName("battle_pass_user_records_3") + private int battlePassUserRecords3; + private int level; + @SerializedName("last_level_exp") + private int lastLevelExp; + @SerializedName("next_level_exp") + private int nextLevelExp; + private String id; + @SerializedName("battle_pass_name") + private String battlePassName; + @SerializedName("start_time") + private String startTime; + @SerializedName("end_time") + private String endTime; + @SerializedName("battle_pass_status") + private boolean battlePassStatus; + @SerializedName("max_level_exp") + private long maxLevelExp; + @SerializedName("max_level") + private int maxLevel; + + private List live_battle_pass_type; + + public BattlePassUserInfoBean() { + } + public List getLive_battle_pass_type() { + return live_battle_pass_type; + } + + public void setLive_battle_pass_type(List live_battle_pass_type) { + this.live_battle_pass_type = live_battle_pass_type; + } + + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + public int getPoints() { + return points; + } + + public void setPoints(int points) { + this.points = points; + } + + public int getBattlePassExp() { + return battlePassExp; + } + + public void setBattlePassExp(int battlePassExp) { + this.battlePassExp = battlePassExp; + } + + public int getBattlePassUserRecords1() { + return battlePassUserRecords1; + } + + public void setBattlePassUserRecords1(int battlePassUserRecords1) { + this.battlePassUserRecords1 = battlePassUserRecords1; + } + + public int getBattlePassUserRecords2() { + return battlePassUserRecords2; + } + + public void setBattlePassUserRecords2(int battlePassUserRecords2) { + this.battlePassUserRecords2 = battlePassUserRecords2; + } + + public int getBattlePassUserRecords3() { + return battlePassUserRecords3; + } + + public void setBattlePassUserRecords3(int battlePassUserRecords3) { + this.battlePassUserRecords3 = battlePassUserRecords3; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getLastLevelExp() { + return lastLevelExp; + } + + public void setLastLevelExp(int lastLevelExp) { + this.lastLevelExp = lastLevelExp; + } + + public int getNextLevelExp() { + return nextLevelExp; + } + + public void setNextLevelExp(int nextLevelExp) { + this.nextLevelExp = nextLevelExp; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getBattlePassName() { + return battlePassName; + } + + public void setBattlePassName(String battlePassName) { + this.battlePassName = battlePassName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public boolean isBattlePassStatus() { + return battlePassStatus; + } + + public void setBattlePassStatus(boolean battlePassStatus) { + this.battlePassStatus = battlePassStatus; + } + + public long getMaxLevelExp() { + return maxLevelExp; + } + + public void setMaxLevelExp(long maxLevelExp) { + this.maxLevelExp = maxLevelExp; + } + + public int getMaxLevel() { + return maxLevel; + } + + public void setMaxLevel(int maxLevel) { + this.maxLevel = maxLevel; + } + + @Override + public String toString() { + return "BattlePassUserInfoBean{" + + "uid='" + uid + '\'' + + ", points=" + points + + ", battlePassExp=" + battlePassExp + + ", battlePassUserRecords1=" + battlePassUserRecords1 + + ", battlePassUserRecords2=" + battlePassUserRecords2 + + ", battlePassUserRecords3=" + battlePassUserRecords3 + + ", level=" + level + + ", lastLevelExp=" + lastLevelExp + + ", nextLevelExp=" + nextLevelExp + + ", id='" + id + '\'' + + ", battlePassName='" + battlePassName + '\'' + + ", startTime='" + startTime + '\'' + + ", endTime='" + endTime + '\'' + + ", battlePassStatus=" + battlePassStatus + + ", maxLevelExp=" + maxLevelExp + + ", maxLevel=" + maxLevel + + ", live_battle_pass_type=" + live_battle_pass_type + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/CheckRemainingBalance.java b/common/src/main/java/com/yunbao/common/bean/CheckRemainingBalance.java index 611c289ef..49d49043a 100644 --- a/common/src/main/java/com/yunbao/common/bean/CheckRemainingBalance.java +++ b/common/src/main/java/com/yunbao/common/bean/CheckRemainingBalance.java @@ -36,4 +36,13 @@ public class CheckRemainingBalance extends BaseModel { public void setGoldenBeanRemainingBalance(int goldenBeanRemainingBalance) { this.goldenBeanRemainingBalance = goldenBeanRemainingBalance; } + + @Override + public String toString() { + return "CheckRemainingBalance{" + + "goldenBeanRemainingBalance=" + goldenBeanRemainingBalance + + ", status=" + status + + ", deductMoneyKey='" + deductMoneyKey + '\'' + + '}'; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java b/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java new file mode 100644 index 000000000..3deed7e93 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java @@ -0,0 +1,175 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; +import java.util.Map; + +public class LiveBattlePassRewardsBean extends BaseModel{ + private int level; + private List live_battle_pass_type; + private Map> live_battle_pass_rewards; + + public LiveBattlePassRewardsBean() { + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public List getLive_battle_pass_type() { + return live_battle_pass_type; + } + + public void setLive_battle_pass_type(List live_battle_pass_type) { + this.live_battle_pass_type = live_battle_pass_type; + } + + public Map> getLive_battle_pass_rewards() { + return live_battle_pass_rewards; + } + + public void setLive_battle_pass_rewards(Map> live_battle_pass_rewards) { + this.live_battle_pass_rewards = live_battle_pass_rewards; + } + + public static class BattlePassType extends BaseModel{ + private int id; + private String battle_pass_name; + private int sort; + private int diamond_value; + private int lock; + + public BattlePassType() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getBattle_pass_name() { + return battle_pass_name; + } + + public void setBattle_pass_name(String battle_pass_name) { + this.battle_pass_name = battle_pass_name; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public int getDiamond_value() { + return diamond_value; + } + + public void setDiamond_value(int diamond_value) { + this.diamond_value = diamond_value; + } + + public int getLock() { + return lock; + } + + public void setLock(int lock) { + this.lock = lock; + } + } + public static class LiveBattlePassReward extends BaseModel{ + private int id; + @SerializedName("live_battle_pass_level") + private int liveBattlePassLevel; + @SerializedName("live_battle_pass_type_id") + private int liveBattlePassTypeId; + @SerializedName("reward_name") + private String rewardName; + @SerializedName("image_url") + private String imageUrl; + private int lock; + private int received; + + public LiveBattlePassReward() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getLiveBattlePassLevel() { + return liveBattlePassLevel; + } + + public void setLiveBattlePassLevel(int liveBattlePassLevel) { + this.liveBattlePassLevel = liveBattlePassLevel; + } + + public int getLiveBattlePassTypeId() { + return liveBattlePassTypeId; + } + + public void setLiveBattlePassTypeId(int liveBattlePassTypeId) { + this.liveBattlePassTypeId = liveBattlePassTypeId; + } + + public String getRewardName() { + return rewardName; + } + + public void setRewardName(String rewardName) { + this.rewardName = rewardName; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public int getLock() { + return lock; + } + + public void setLock(int lock) { + this.lock = lock; + } + + public int getReceived() { + return received; + } + + public void setReceived(int received) { + this.received = received; + } + + @Override + public String toString() { + return "LiveBattlePassReward{" + + "id=" + id + + ", liveBattlePassLevel=" + liveBattlePassLevel + + ", liveBattlePassTypeId=" + liveBattlePassTypeId + + ", rewardName='" + rewardName + '\'' + + ", imageUrl='" + imageUrl + '\'' + + ", lock=" + lock + + ", received=" + received + + '}'; + } + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveClassBean.java b/common/src/main/java/com/yunbao/common/bean/LiveClassBean.java index 3ff79aa6f..b83db90a2 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveClassBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveClassBean.java @@ -20,6 +20,14 @@ public class LiveClassBean { @SerializedName("channel_show") private int channel_show; + public LiveClassBean() { + } + + public LiveClassBean(String chinese, String english) { + this.chinese = chinese; + this.english = english; + } + public String getChinese() { return chinese; } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java index 31c65e757..ee8b51204 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java @@ -3,6 +3,7 @@ package com.yunbao.common.bean; import android.view.View; import com.alibaba.fastjson.annotation.JSONField; +import com.google.gson.annotations.SerializedName; /** * Created by cxf on 2018/10/12. @@ -18,6 +19,8 @@ public class LiveGiftBean { // public static final int MARK_LUCK = 3; private int id; + @SerializedName("gift_id") + private int gift_id;//包裹礼物id private int type;//0 普通礼物 1是贵族 2守护 3粉丝团 5盲盒礼物 private int mark;// 0 普通 1热门 2守护 3幸运 private String name; @@ -34,6 +37,7 @@ public class LiveGiftBean { private String isweek; private String end_time; private String tag; + private boolean isPageGift; @JSONField(name = "blind_box_type") private int blind_box_type = 0; //礼物角标 @@ -71,6 +75,14 @@ public class LiveGiftBean { @JSONField(name = "blind_box_ticket_id") private int blindBoxTicketId; + public boolean isPageGift() { + return isPageGift; + } + + public void setPageGift(boolean pageGift) { + isPageGift = pageGift; + } + public int getBlindBoxTicketId() { return blindBoxTicketId; } @@ -80,6 +92,14 @@ public class LiveGiftBean { return this; } + public int getGift_id() { + return gift_id; + } + + public void setGift_id(int gift_id) { + this.gift_id = gift_id; + } + public int getBlindBoxTicket() { return blindBoxTicket; } diff --git a/common/src/main/java/com/yunbao/common/bean/RoomMicStatusModel.java b/common/src/main/java/com/yunbao/common/bean/RoomMicStatusModel.java new file mode 100644 index 000000000..6292156a5 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/RoomMicStatusModel.java @@ -0,0 +1,27 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class RoomMicStatusModel extends BaseModel{ + + @SerializedName("mic_status") + private String micStatus; + @SerializedName("im_status") + private String imStatus; + + public String getMicStatus() { + return micStatus; + } + + public void setMicStatus(String micStatus) { + this.micStatus = micStatus; + } + + public String getImStatus() { + return imStatus; + } + + public void setImStatus(String imStatus) { + this.imStatus = imStatus; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/SudGameChatImModel.java b/common/src/main/java/com/yunbao/common/bean/SudGameChatImModel.java new file mode 100644 index 000000000..e55ee691d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/SudGameChatImModel.java @@ -0,0 +1,26 @@ +package com.yunbao.common.bean; + +public class SudGameChatImModel extends BaseModel { + //昵称 + private String nickname; + //文字消息 + private String textMessage; + + public String getNickname() { + return nickname; + } + + public SudGameChatImModel setNickname(String nickname) { + this.nickname = nickname; + return this; + } + + public String getTextMessage() { + return textMessage; + } + + public SudGameChatImModel setTextMessage(String textMessage) { + this.textMessage = textMessage; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/SudGameUserModel.java b/common/src/main/java/com/yunbao/common/bean/SudGameUserModel.java new file mode 100644 index 000000000..a614ee9d7 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/SudGameUserModel.java @@ -0,0 +1,82 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class SudGameUserModel extends BaseModel { + private boolean nullUser; + @SerializedName("user_nicename") + private String userNicename; + @SerializedName("avatar") + private String avatar; + @SerializedName("sex") + private int sex; + @SerializedName("id") + private int id; + @SerializedName("mic_status") + private int micStatus; //麦克风状态 2.打开麦克风 3.关闭麦克风 + + private boolean mute = false; + + public boolean isMute() { + return mute; + } + + public SudGameUserModel setMute(boolean mute) { + this.mute = mute; + return this; + } + + public boolean isNullUser() { + return nullUser; + } + + public SudGameUserModel setNullUser(boolean nullUser) { + this.nullUser = nullUser; + return this; + } + + public String getUserNicename() { + return userNicename; + } + + public SudGameUserModel setUserNicename(String userNicename) { + this.userNicename = userNicename; + return this; + } + + public String getAvatar() { + return avatar; + } + + public SudGameUserModel setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public int getSex() { + return sex; + } + + public SudGameUserModel setSex(int sex) { + this.sex = sex; + return this; + } + + public int getId() { + return id; + } + + public SudGameUserModel setId(int id) { + this.id = id; + return this; + } + + public int getMicStatus() { + return micStatus; + } + + public SudGameUserModel setMicStatus(int micStatus) { + this.micStatus = micStatus; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java new file mode 100644 index 000000000..cfe1e3c4e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java @@ -0,0 +1,88 @@ +package com.yunbao.common.dialog; + +import android.app.Activity; +import android.content.Context; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.ImageSpan; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class ActivateEliteBattleOrderPopupWindow extends CenterPopupView { + private boolean elites;//是否精英战令 + private String spendMoney;//花费钱 + private View buttonWarOrder; + private LiberalBattlePassPopupWindow.LiberalBattlePassCallback mPassCallback; + private String mBattlePassTypeId; + + public ActivateEliteBattleOrderPopupWindow(@NonNull Context context, String mSpendMoney, + boolean elites, + LiberalBattlePassPopupWindow.LiberalBattlePassCallback passCallback + , String battlePassTypeId) { + super(context); + this.elites = elites; + spendMoney = mSpendMoney; + mPassCallback=passCallback; + mBattlePassTypeId = battlePassTypeId; + } + + @Override + protected int getImplLayoutId() { + return R.layout.activate_elite_battle_order_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + buttonWarOrder = findViewById(R.id.button_war_order); + if (elites) { + findViewById(R.id.gift_overvalue).setVisibility(VISIBLE); + findViewById(R.id.gift_overvalue3).setVisibility(GONE); + findViewById(R.id.enjoy_image).setVisibility(GONE); + findViewById(R.id.elites_image).setVisibility(VISIBLE); + findViewById(R.id.gift_overvalue).setVisibility(VISIBLE); + ((TextView)findViewById(R.id.gift3_text)).setText(WordUtil.getNewString(R.string.unlock_more_gifts)); + } else { + findViewById(R.id.gift_overvalue).setVisibility(GONE); + findViewById(R.id.gift_overvalue3).setVisibility(VISIBLE); + findViewById(R.id.enjoy_image).setVisibility(VISIBLE); + findViewById(R.id.elites_image).setVisibility(GONE); + findViewById(R.id.gift_overvalue).setVisibility(GONE); + ((TextView)findViewById(R.id.gift3_text)).setText(WordUtil.getNewString(R.string.unlock_more_gifts2)); + } + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.war_order_close), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + //中文按钮文字 + + ((TextView)findViewById(R.id.button_war_order_text)).setText(spendMoney); + + ViewClicksAntiShake.clicksAntiShake(buttonWarOrder, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + new XPopup.Builder(getContext()) + .enableDrag(false) + .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) + .asCustom(new LiberalBattlePassPopupWindow(getContext(), spendMoney, elites,mPassCallback,mBattlePassTypeId)) + .show(); + } + }); + + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/ActivityEndPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/ActivityEndPopupWindow.java new file mode 100644 index 000000000..3993f2911 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/ActivityEndPopupWindow.java @@ -0,0 +1,35 @@ +package com.yunbao.common.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +/** + * 活动结束 + */ +public class ActivityEndPopupWindow extends CenterPopupView { + public ActivityEndPopupWindow(@NonNull Context context) { + super(context); + } + + @Override + protected int getImplLayoutId() { + return R.layout.activity_end_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.confirm), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java index 6b6026048..d265f74ea 100644 --- a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java @@ -21,7 +21,6 @@ import com.lxj.xpopup.XPopup; import com.lxj.xpopup.core.BottomPopupView; import com.lxj.xpopup.enums.PopupPosition; import com.yunbao.common.R; -import com.yunbao.common.activity.SudGameActivity; import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.event.CheckCurrencyModel; @@ -33,6 +32,7 @@ import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -279,9 +279,7 @@ public class CreateSudGamePopup extends BottomPopupView { public void onSuccess(CreateSudRoomModel data) { if (isHome) { dialog.dismiss(); - Intent intent = new Intent(getContext(), SudGameActivity.class); - intent.putExtra("CreateSudRoom", new Gson().toJson(data)); - getContext().startActivity(intent); + RouteUtil.forwardSudGameActivity(new Gson().toJson(data)); } else { Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data)); diff --git a/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java new file mode 100644 index 000000000..fb0a87a5e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java @@ -0,0 +1,101 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.graphics.Color; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.style.ForegroundColorSpan; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.http.ResponseModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class LiberalBattlePassPopupWindow extends CenterPopupView { + private String spendMoney;//花费钱 + private boolean mElites;//是否精英战令 + private TextView liberalBattlePass; + private LiberalBattlePassCallback mPassCallback; + private String mBattlePassTypeId; + + public LiberalBattlePassPopupWindow(@NonNull Context context, String mSpendMoney, boolean elites, LiberalBattlePassCallback passCallback, String battlePassTypeId) { + super(context); + spendMoney = mSpendMoney; + mElites = elites; + mPassCallback = passCallback; + mBattlePassTypeId = battlePassTypeId; + } + + protected int getImplLayoutId() { + return R.layout.liberal_battle_pass_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + liberalBattlePass = findViewById(R.id.liberal_battle_pass); + //中文版 + StringBuffer liberalBattlePassHint = new StringBuffer(); + liberalBattlePassHint.append(WordUtil.isNewZh()?"是否花費":"Did you spend "); + liberalBattlePassHint.append(spendMoney).append(mElites ? + WordUtil.isNewZh()?"鑽石開通精英戰令!":"diamonds to activate the Elite BattlePass": + WordUtil.isNewZh()?"鑽石開通尊享戰令!":"diamonds to activate the Luxury BattlePass"); + //英文版 + + //设置样式 + String liberalBattlePassStr = liberalBattlePassHint.toString(); + SpannableStringBuilder builder = new SpannableStringBuilder(); + builder.append(liberalBattlePassStr); + int spendMoneyIndex = liberalBattlePassStr.indexOf(spendMoney); + int spendMoneySize = spendMoneyIndex + spendMoney.length(); + builder.setSpan(new ForegroundColorSpan(Color.parseColor("#CE2BFF")), spendMoneyIndex, spendMoneySize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + liberalBattlePass.setText(builder); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cancel), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.liberal_battle_sure), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(getContext()). + upgradesBattlePass(mBattlePassTypeId, new HttpCallback>() { + @Override + public void onSuccess(ResponseModel data) { + + dialog.dismiss(); + if (mPassCallback != null) { + mPassCallback.onCallback(data.getData().getCode(), data.getData().getMsg()); + } + IMLoginManager.get(getContext()).upDataUserInfo(); + IMLoginManager.get(getContext()).updateUserCoin(); + } + + @Override + public void onError(String error) { + + dialog.dismiss(); + if (mPassCallback != null) { + mPassCallback.onCallback(102, error); + } + } + }); + + } + }); + + } + + public interface LiberalBattlePassCallback { + void onCallback(int code, String msg); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java b/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java index b4f0dc002..072ab97a8 100644 --- a/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java @@ -26,7 +26,7 @@ public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow { @Override public void buildDialog(XPopup.Builder builder) { - + builder.animationDuration(0); } @Override diff --git a/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java b/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java index 5e92f5f10..122cf2568 100644 --- a/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java @@ -1,6 +1,7 @@ package com.yunbao.common.dialog; import android.content.Context; +import android.util.Log; import android.widget.ImageView; import androidx.annotation.NonNull; @@ -21,6 +22,10 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow { private OpenAdModel model; private OnItemClickListener mListener; + public OpenAdCenterDialogPopup(@NonNull Context context) { + super(context); + } + public OpenAdCenterDialogPopup(@NonNull Context context, OpenAdModel model) { super(context); this.model = model; @@ -33,6 +38,8 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow { @Override public void buildDialog(XPopup.Builder builder) { + builder.hasShadowBg(false); + builder.animationDuration(0); } @Override @@ -53,6 +60,7 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow { @Override protected void onCreate() { super.onCreate(); + Log.e("-----弹窗-----", "onCreate: 创建弹窗" ); mImageView = findViewById(R.id.img); mClose = findViewById(R.id.close); findViewById(R.id.layout).setOnClickListener(v -> dismiss()); diff --git a/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java new file mode 100644 index 000000000..0d64fa8c4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java @@ -0,0 +1,143 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.view.View; +import android.widget.ProgressBar; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.alibaba.fastjson.JSONObject; +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.bean.BattlePassUserInfoBean; +import com.yunbao.common.http.ResponseModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +import java.math.BigDecimal; + +/** + * 战令等级 经验 + */ +public class OrderLevelPopupWindow extends CenterPopupView { + private TextView orderLevel, orderLevelDiamond, balanceDiamond, current, expText; + private int currentExperience, totalExperience;//当前经验,全部经验 + private String buyExp = "100", currentLevel, balance; + private ProgressBar progressBar; + private OrderLevelCallback orderLevelCallback; + private long maxExp; + private BattlePassUserInfoBean userInfoBean; + + public OrderLevelPopupWindow(@NonNull Context context, BattlePassUserInfoBean userInfoBean, + int mCurrentExperience, int mTotalExperience, + String mCurrentLevel, String mBalance, long maxExp, OrderLevelCallback mOrderLevelCallback) { + super(context); + this.userInfoBean = userInfoBean; + currentExperience = mCurrentExperience; + totalExperience = mTotalExperience; + currentLevel = mCurrentLevel; + balance = mBalance; + this.maxExp = maxExp; + orderLevelCallback = mOrderLevelCallback; + } + + @Override + protected int getImplLayoutId() { + return R.layout.order_level_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + orderLevel = findViewById(R.id.tickets_plus_minus); + orderLevelDiamond = findViewById(R.id.order_level_diamond); + balanceDiamond = findViewById(R.id.balance_diamond); + current = findViewById(R.id.current); + progressBar = findViewById(R.id.progressBar); + expText = findViewById(R.id.exp_text); + orderLevel.setText(buyExp); + progressBar.setMax(totalExperience); + progressBar.setProgress(currentExperience); + expText.setText(String.format("%s/%s", userInfoBean.getBattlePassExp(), userInfoBean.getNextLevelExp())); + current.setText(String.format("Lv%s", currentLevel)); + balanceDiamond.setText(balance); + findViewById(R.id.sub).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + float exp = new BigDecimal(buyExp).floatValue(); + if (exp > 100) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).subtract(new BigDecimal("100")); + buyExp = String.valueOf(buyExpBigDecimal.intValue()); + orderLevelDiamond.setText(String.valueOf(buyExpBigDecimal.floatValue())); + orderLevel.setText(buyExp); + } + } + }); + findViewById(R.id.add).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + float exp = new BigDecimal(buyExp).floatValue(); + if (exp < maxExp && exp < 10000) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("100")); + buyExp = String.valueOf(buyExpBigDecimal.intValue()); + orderLevelDiamond.setText(String.valueOf(buyExpBigDecimal.floatValue())); + orderLevel.setText(buyExp); + } else if (exp >= maxExp) { + ToastUtil.show(WordUtil.isNewZh() ? "经验已滿" : "Experience full"); + } + + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.war_order_close), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.buying_experience), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(getContext()) + .buyingExperiencePoint(buyExp, new HttpCallback>() { + @Override + public void onSuccess(ResponseModel data) { + + if (orderLevelCallback != null) { + orderLevelCallback.onCallback(data.getData().getCode(), data.getMsg()); + } + dialog.dismiss(); + } + + @Override + public void onError(String error) { + if (orderLevelCallback != null) { + orderLevelCallback.onCallback(102, error); + } + dialog.dismiss(); + } + }); + } + }); + IMLoginManager.get(getContext()) + .updateUserCoin(new OnItemClickListener() { + @Override + public void onItemClick(JSONObject bean, int position) { + if (bean != null) { + balance = bean.getString("coin"); + balanceDiamond.setText(balance); + } + } + }); + } + + public interface OrderLevelCallback { + void onCallback(int code, String msg); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java new file mode 100644 index 000000000..c16a17cfb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java @@ -0,0 +1,91 @@ +package com.yunbao.common.dialog; + +import android.app.Activity; +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.core.BasePopupView; +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.bean.BattlePassUserInfoBean; +import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +/** + * 升級精英/尊享戰令 + */ +public class PromotionElitePopupWindow extends CenterPopupView { + private String enjoySpendMoney, quintessenceSpendMoney;//花费钱 + private LiberalBattlePassPopupWindow.LiberalBattlePassCallback mPassCallback; + private String elitesTypeId,enjoyTypeId; + private BattlePassUserInfoBean data; + + public PromotionElitePopupWindow(@NonNull Context context, String mEnjoySpendMoney, + String mQuintessenceSpendMoney, LiberalBattlePassPopupWindow.LiberalBattlePassCallback passCallback, + String elitesTypeId, String enjoyTypeId) { + super(context); + enjoySpendMoney = mEnjoySpendMoney; + quintessenceSpendMoney = mQuintessenceSpendMoney; + mPassCallback = passCallback; + this.elitesTypeId = elitesTypeId; + this.enjoyTypeId = enjoyTypeId; + } + public PromotionElitePopupWindow setUserData(BattlePassUserInfoBean data) { + this.data=data; + return this; + } + + @Override + protected int getImplLayoutId() { + return R.layout.promotion_elite_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.close), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.button_quintessence), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if(data!=null && data.getBattlePassUserRecords2()==2){ + ToastUtil.show(WordUtil.getNewString(R.string.battlepass_buy_max)); + return; + } + dialog.dismiss(); + new XPopup.Builder(getContext()) + .enableDrag(false) + .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) + .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), quintessenceSpendMoney, true, mPassCallback, elitesTypeId)) + .show(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.button_enjoy), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if(data!=null && data.getBattlePassUserRecords3()==2){ + ToastUtil.show(WordUtil.getNewString(R.string.battlepass_buy_max)); + return; + } + dialog.dismiss(); + new XPopup.Builder(getContext()) + .enableDrag(false) + .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) + .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), enjoySpendMoney, false, mPassCallback, enjoyTypeId)) + .show(); + } + }); + } + + +} diff --git a/common/src/main/java/com/yunbao/common/dialog/RuleOfWarPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/RuleOfWarPopupWindow.java new file mode 100644 index 000000000..84321a2f9 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/RuleOfWarPopupWindow.java @@ -0,0 +1,51 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; + +public class RuleOfWarPopupWindow extends CenterPopupView { + public RuleOfWarPopupWindow(@NonNull Context context) { + super(context); + } + private TextView rule; + @Override + protected int getImplLayoutId() { + return R.layout.rule_of_war_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + rule=findViewById(R.id.rule); + findViewById(R.id.close).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + dismiss(); + } + }); + initData(); + } + private void initData(){ + LiveNetManager.get(getContext()) + .getBattlePassRule(new HttpCallback() { + @Override + public void onSuccess(String data) { + rule.setText(data.replace("\n","\n\n")); + } + + @Override + public void onError(String error) { + + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameInputPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/SudGameInputPopupWindow.java new file mode 100644 index 000000000..44444ea1e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameInputPopupWindow.java @@ -0,0 +1,82 @@ +package com.yunbao.common.dialog; + +import static android.content.Context.INPUT_METHOD_SERVICE; + +import android.content.Context; +import android.text.TextUtils; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.BottomPopupView; +import com.yunbao.common.R; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +/*** + * 游戏房字体输入 + */ +public class SudGameInputPopupWindow extends BottomPopupView { + private EditText textMessage; + private SudGameInputCallBack sudGameInputCallBack; + private InputMethodManager imm; + public SudGameInputPopupWindow(@NonNull Context context, SudGameInputCallBack sudGameInputCallBack) { + super(context); + this.sudGameInputCallBack = sudGameInputCallBack; + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.dialog_sud_game_input; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + initView(); + initDate(); + + } + + private void initView() { + imm = (InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE); + textMessage = findViewById(R.id.text_message); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.send), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + + if (sudGameInputCallBack != null) { + String textMessageStr = textMessage.getText().toString().trim(); + if (!TextUtils.isEmpty(textMessageStr)) { + if (textMessageStr.length() > 100) { + ToastUtil.show(WordUtil.isNewZh() ? "超出字數限制" : "Exceed word limit"); + } else { + sudGameInputCallBack.sendMessage(textMessageStr); + } + dialog.dismiss(); + } else { + ToastUtil.show(WordUtil.getNewString(R.string.cannot_be_empty)); + } + + } + } + }); + textMessage.postDelayed(() -> { + //软键盘弹出 + imm.showSoftInput(textMessage, InputMethodManager.SHOW_FORCED); + textMessage.requestFocus(); + }, 200); + } + + private void initDate() { + + } + + public interface SudGameInputCallBack { + void sendMessage(String textMessage); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameSmallPopupPindow.java b/common/src/main/java/com/yunbao/common/dialog/SudGameSmallPopupPindow.java new file mode 100644 index 000000000..e7bec0482 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameSmallPopupPindow.java @@ -0,0 +1,79 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.text.TextUtils; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.AttachPopupView; +import com.yunbao.common.R; +import com.yunbao.common.bean.SudGameUserModel; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class SudGameSmallPopupPindow extends AttachPopupView { + private TextView viewUnMute; + private boolean mute; + private SudGameUserModel sudGameUserModel; + private SudGameSmallCallBack sudGameSmallCallBack; + + public SudGameSmallPopupPindow(@NonNull Context context, SudGameUserModel sudGameUserModel, boolean mute, SudGameSmallCallBack sudGameSmallCallBack) { + super(context); + this.mute = mute; + this.sudGameUserModel = sudGameUserModel; + this.sudGameSmallCallBack = sudGameSmallCallBack; + } + + @Override + protected int getImplLayoutId() { + return R.layout.view_sud_game_small; + } + + @Override + protected void onCreate() { + viewUnMute = findViewById(R.id.view_un_mute); + if (mute) { + viewUnMute.setText(WordUtil.isNewZh() ? "取消靜音" : "Unmute"); + } else { + viewUnMute.setText(WordUtil.isNewZh() ? "靜音" : "Mute"); + } + ViewClicksAntiShake.clicksAntiShake(viewUnMute, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (TextUtils.equals(String.valueOf(IMLoginManager.get(getContext()).getUserInfo().getId()), String.valueOf(sudGameUserModel.getId()))) { + ToastUtil.show(WordUtil.isNewZh() ? "無法對本人靜音" : "Unable to mute myself"); + return; + } + if (sudGameUserModel.getMicStatus() == 3) { + ToastUtil.show(WordUtil.isNewZh() ? "對方未開麥!" : "The other side did not turn on the microphone"); + return; + } + if (!mute) { + sudGameSmallCallBack.mute(); + } else { + sudGameSmallCallBack.unMute(); + } + dismiss(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.view_information), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + sudGameSmallCallBack.viewInformation(sudGameUserModel); + dismiss(); + } + }); + + } + + public interface SudGameSmallCallBack { + void unMute(); + + void mute(); + + void viewInformation(SudGameUserModel sudGameUserModel); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/WarOrderExchangeDetailsPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/WarOrderExchangeDetailsPopupWindow.java new file mode 100644 index 000000000..75a49e067 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/WarOrderExchangeDetailsPopupWindow.java @@ -0,0 +1,134 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.ResponseModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +import java.math.BigDecimal; + +/** + * 战令兑换详情 + */ +public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView { + private TextView orderLevel, pointExchange; + private String buyExp = "1"; + private int mPoint, mLimitQuantity, mScale; + private String mImageUrl; + private ImageView exchangeParticulars; + private String battlePassPointsId; + private WarOrderExchangeDetailsCallback orderExchangeDetailsCallback; + + /*** + * + * @param context + * @param limitQuantity 最大限制数量 + * @param point 自己的积分 + * @param scale 兑换比例 + * @param imageUrl 物品图片的url + */ + public WarOrderExchangeDetailsPopupWindow(@NonNull Context context, int limitQuantity, + int point, int scale, String imageUrl, String battlePassPointsId, WarOrderExchangeDetailsCallback orderExchangeDetailsCallback) { + super(context); + mPoint = point; + mLimitQuantity = limitQuantity; + mScale = scale; + mImageUrl = imageUrl; + this.battlePassPointsId = battlePassPointsId; + this.orderExchangeDetailsCallback = orderExchangeDetailsCallback; + } + + @Override + protected int getImplLayoutId() { + return R.layout.war_order_exchange_details_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + orderLevel = findViewById(R.id.tickets_plus_minus); + exchangeParticulars = findViewById(R.id.exchange_particulars); + pointExchange = findViewById(R.id.point_exchange); + orderLevel.setText(buyExp); + BigDecimal needExpBigDecimal = new BigDecimal(buyExp).multiply(new BigDecimal(mScale)); + pointExchange.setText(String.format("%s",needExpBigDecimal)); + ImgLoader.display(getContext(), mImageUrl, exchangeParticulars); + findViewById(R.id.sub).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + float exp = new BigDecimal(buyExp).floatValue(); + if (exp > 1) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).subtract(new BigDecimal("1")); + buyExp = String.valueOf(buyExpBigDecimal.intValue()); + orderLevel.setText(buyExp); + BigDecimal needExpBigDecimal = buyExpBigDecimal.multiply(new BigDecimal(mScale)); + pointExchange.setText(String.format("%s",needExpBigDecimal)); + } + } + }); + findViewById(R.id.add).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + int number = new BigDecimal(mScale).multiply(new BigDecimal(buyExp)).intValue(); + int exp = new BigDecimal(buyExp).intValue(); + if (exp < mLimitQuantity && number < mPoint) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("1")); + buyExp = String.valueOf(buyExpBigDecimal.intValue()); + orderLevel.setText(buyExp); + BigDecimal needExpBigDecimal = buyExpBigDecimal.multiply(new BigDecimal(mScale)); + pointExchange.setText(String.format("%s",needExpBigDecimal)); + }else if(exp >= mLimitQuantity){ + ToastUtil.show(WordUtil.getNewString(R.string.battlepass_exchange_buy_max)); + }else { + ToastUtil.show(WordUtil.getNewString(R.string.battlepass_exchange_buy_integral)); + } + } + }); + findViewById(R.id.war_order_close).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + dismiss(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.point_exchange_linear), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(getContext()) + .pointsExchange(battlePassPointsId, buyExp, new HttpCallback>() { + @Override + public void onSuccess(ResponseModel data) { + dialog.dismiss(); + if (orderExchangeDetailsCallback != null) { + orderExchangeDetailsCallback.onCallback(data.getData().getCode(), data.getData().getMsg()); + } + } + + @Override + public void onError(String error) { + dialog.dismiss(); + if (orderExchangeDetailsCallback != null) { + orderExchangeDetailsCallback.onCallback(102, error); + } + } + }); + } + }); + } + + public interface WarOrderExchangeDetailsCallback { + void onCallback(int code, String msg); + } +} diff --git a/common/src/main/java/com/yunbao/common/event/SudGameSocketImEvent.java b/common/src/main/java/com/yunbao/common/event/SudGameSocketImEvent.java new file mode 100644 index 000000000..31d9ec28e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SudGameSocketImEvent.java @@ -0,0 +1,120 @@ +package com.yunbao.common.event; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +import java.util.List; + +public class SudGameSocketImEvent extends BaseModel { + + @SerializedName("msg") + private List msg; + @SerializedName("retcode") + private String retcode; + @SerializedName("retmsg") + private String retmsg; + + public List getMsg() { + return msg; + } + + public void setMsg(List msg) { + this.msg = msg; + } + + public String getRetcode() { + return retcode; + } + + public void setRetcode(String retcode) { + this.retcode = retcode; + } + + public String getRetmsg() { + return retmsg; + } + + public void setRetmsg(String retmsg) { + this.retmsg = retmsg; + } + + public static class MsgDTO { + @SerializedName("action") + private String action; + @SerializedName("uid") + private String uid; + @SerializedName("roomnum") + private String roomnum; + @SerializedName("ct") + private String ct; + @SerializedName("uname") + private String uname; + @SerializedName("_method_") + private String method; + @SerializedName("equipment") + private String equipment; + + public String getAction() { + return action; + } + + public MsgDTO setAction(String action) { + this.action = action; + return this; + } + + public String getUid() { + return uid; + } + + public MsgDTO setUid(String uid) { + this.uid = uid; + return this; + } + + public String getRoomnum() { + return roomnum; + } + + public MsgDTO setRoomnum(String roomnum) { + this.roomnum = roomnum; + return this; + } + + public String getCt() { + return ct; + } + + public MsgDTO setCt(String ct) { + this.ct = ct; + return this; + } + + public String getUname() { + return uname; + } + + public MsgDTO setUname(String uname) { + this.uname = uname; + return this; + } + + public String getMethod() { + return method; + } + + public MsgDTO setMethod(String method) { + this.method = method; + return this; + } + + public String getEquipment() { + return equipment; + } + + public MsgDTO setEquipment(String equipment) { + this.equipment = equipment; + return this; + } + } +} diff --git a/common/src/main/java/com/yunbao/common/event/SudGameUserEvent.java b/common/src/main/java/com/yunbao/common/event/SudGameUserEvent.java new file mode 100644 index 000000000..af9fae6f1 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SudGameUserEvent.java @@ -0,0 +1,17 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.SudGameUserModel; + +public class SudGameUserEvent extends BaseModel { + private SudGameUserModel sudGameUserModel; + + public SudGameUserModel getSudGameUserModel() { + return sudGameUserModel; + } + + public SudGameUserEvent setSudGameUserModel(SudGameUserModel sudGameUserModel) { + this.sudGameUserModel = sudGameUserModel; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/fragment/BaseFragment.java b/common/src/main/java/com/yunbao/common/fragment/BaseFragment.java index f2fefa3eb..63e419780 100644 --- a/common/src/main/java/com/yunbao/common/fragment/BaseFragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/BaseFragment.java @@ -70,6 +70,13 @@ public abstract class BaseFragment extends Fragment { * 请求数据 */ protected abstract void loadData(); + public void updateData(){ + + } + + protected T findViewById(int id){ + return contentView.findViewById(id); + } @Override public void onDestroy() { diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index 386c0e47d..444ce4b92 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -181,8 +181,6 @@ public class CommonHttpUtil { JSONObject obj = JSON.parseObject(info[0]); ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class); CommonAppConfig.getInstance().setConfig(bean); - CommonAppConfig.getInstance().setLevel(obj.getString("level")); - CommonAppConfig.getInstance().setAnchorLevel(obj.getString("levelanchor")); CommonAppConfig.getInstance().alert_time = obj.getInteger("alert_time"); CommonAppConfig.getInstance().alert_end_time = obj.getInteger("alert_end_time"); //解析粉丝徽章 diff --git a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java index e496f63c7..616a2d0f7 100644 --- a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java @@ -11,6 +11,7 @@ import com.yunbao.common.utils.L; import com.yunbao.common.utils.MD5Util; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.VersionUtil; +import com.yunbao.common.utils.WordUtil; import java.io.File; @@ -350,7 +351,11 @@ public class LiveHttpUtil { .params("p", p) .execute(callback); } - + public static void getContactMsg(int page, HttpCallback callback) { + HttpClient.getInstance().get("Live.getContactMsg", "getContactMsg") + .params("p", page) + .execute(callback); + } /** * 观众跟主播连麦时,获取自己的流地址 @@ -640,7 +645,40 @@ public class LiveHttpUtil { .params("appVersion", CommonAppConfig.getInstance().getVersion()) .execute(callback); } - + /** + * 观众给主播送礼物 - 包裹 + * + * @param isContactGift 是否为联系方式礼物 + */ + public static void sendGiftForPage(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, boolean isFansGroupGift, HttpCallback callback) { + HttpClient.getInstance().get("Live.sendPackGift", LiveHttpConsts.SEND_GIFT) + .params("liveuid", liveUid) + .params("stream", stream) + .params("giftid", giftId) + .params("isContactGift", isContactGift) + .params("giftcount", giftCount) + .params("isprank", by) + .params("fans_exclusive_pack", isFansGroupGift ? "1" : "0") + .params("appVersion", CommonAppConfig.getInstance().getVersion()) + .execute(callback); + } + /** + * 观众给主播送礼物 - 粉丝团 + * + * @param isContactGift 是否为联系方式礼物 + */ + public static void sendGiftForFansGroup(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, boolean isFansGroupGift, HttpCallback callback) { + HttpClient.getInstance().get("Live.fansExclusivePack", LiveHttpConsts.SEND_GIFT) + .params("liveuid", liveUid) + .params("stream", stream) + .params("giftid", giftId) + .params("isContactGift", isContactGift) + .params("giftcount", giftCount) + .params("isprank", by) + .params("fans_exclusive_pack", isFansGroupGift ? "1" : "0") + .params("appVersion", CommonAppConfig.getInstance().getVersion()) + .execute(callback); + } public static void sendBlindBoxTicket(String by, String liveUid, String stream, int giftId, HttpCallback callback) { HttpClient.getInstance().get("Live.sendBlindBoxTicket", LiveHttpConsts.SEND_GIFT) .params("liveuid", liveUid) @@ -999,5 +1037,13 @@ public class LiveHttpUtil { .execute(callback); } + /** + * 获取短剧Url + */ + public static void getCoolydrama(HttpCallback callback){ + HttpClient.getInstance().get("cool.register", "Home.getFollow") + .params("lang", WordUtil.isNewZh()?"zh_CN":"en") + .execute(callback); + } } diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index b0f7ca437..537b97f59 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -5,6 +5,9 @@ import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.BattlePassPoints; +import com.yunbao.common.bean.BattlePassTask; +import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.bean.BlindBoxInfoModel; import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckRemainingBalance; @@ -31,6 +34,7 @@ import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveAnchorCallMeModel; import com.yunbao.common.bean.LiveAnchorSayModel; +import com.yunbao.common.bean.LiveBattlePassRewardsBean; import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -54,10 +58,12 @@ import com.yunbao.common.bean.RedPacketDetailsBean; import com.yunbao.common.bean.RedPacketGiftModel; import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketListBean; +import com.yunbao.common.bean.RoomMicStatusModel; import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SlideInBannerModel; import com.yunbao.common.bean.StarChallengeStatusModel; +import com.yunbao.common.bean.SudGameUserModel; import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.SudgameCodeModel; import com.yunbao.common.bean.UserAreaBean; @@ -555,7 +561,7 @@ public interface PDLiveApi { /** * 机器人删除话术 */ - @GET("/api/public/?service=Live.delAiAutomaticSpeech ") + @GET("/api/public/?service=Live.delAiAutomaticSpeech") Observable>> delAiAutomaticSpeech( @Query("type") String type, @Query("id") String id @@ -663,7 +669,9 @@ public interface PDLiveApi { * 获取收件箱信息 */ @GET("/api/public/?service=Live.getContactMsg") - Observable>> getContactMsg(); + Observable>> getContactMsg( + @Query("p") int page + ); /** * 删除联系方式信件 @@ -1091,4 +1099,67 @@ public interface PDLiveApi { Observable> buyTicket( @Field("quantity") String quantity ); + + @GET("/api/public/?service=Livebattlepass.upgradesBattlePass") + Observable> upgradesBattlePass(@Query("battle_pass_type_id") String battlePassTypeId); + + @GET("/api/public/?service=Livebattlepass.buyingExperiencePoint") + Observable> buyingExperiencePoint(@Query("exp_count") String expCount); + + /** + * battle_pass_points_id => 兑换列表ID + * count => 兑换物品的数量 + * + * @return + */ + @GET("/api/public/?service=Livebattlepass.pointsExchange") + Observable> pointsExchange( + @Query("battle_pass_points_id") String battlePassPointsId, + @Query("count") String count + ); + + @GET("/api/public/?service=Livebattlepass.getBattlePassUserInfo") + Observable> getBattlePassUserInfo(); + + @GET("/api/public/?service=Livebattlepass.getLiveBattlePassRewards") + Observable> getLiveBattlePassRewards(); + + @GET("/api/public/?service=Livebattlepass.getRewards") + Observable>> getRewards( + @Query("live_battle_pass_level_id") String rewardLevelId, + @Query("live_battle_pass_rewards_id") String rewardId + ); + + @GET("/api/public/?service=Livebattlepass.getBattlePassTask") + Observable> getBattlePassTask(); + + @GET("/api/public/?service=Livebattlepass.getTask") + Observable>> getTask(@Query("task_id") String taskId); + + @GET("/api/public/?service=Livebattlepass.getBattlePassPoints") + Observable>> getBattlePassPoints(); + + @GET("/api/public/?service=Livebattlepass.battlePassRule") + Observable> battlePassRule(); + + @GET("/api/public/?service=Livebattlepass.addChatCount") + Observable>> addChatCount(@Query("stream") String stream); + + @GET("/api/public/?service=Sudgameserver.joinMic") + Observable>> joinMic(@Query("room_id") String roomId); + + @GET("/api/public/?service=Sudgameserver.onMic") + Observable>> onMic(@Query("room_id") String roomId); + + @GET("/api/public/?service=Sudgameserver.offMic") + Observable>> offMic(@Query("room_id") String roomId); + + @GET("/api/public/?service=Sudgameserver.leaveMic") + Observable>> leaveMic(@Query("room_id") String roomId); + + @GET("/api/public/?service=Sudgameserver.getRoomMicData") + Observable>> getRoomMicData(@Query("room_id") String roomId); + + @GET("/api/public/?service=Sudgameserver.getRoomMicStatus") + Observable> getRoomMicStatus(); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index b562973be..9b4321c7a 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -8,6 +8,9 @@ import com.yunbao.common.Constants; import com.yunbao.common.R; import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.BattlePassPoints; +import com.yunbao.common.bean.BattlePassTask; +import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.bean.BlindBoxInfoModel; import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckRemainingBalance; @@ -31,6 +34,7 @@ import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveAnchorCallMeModel; import com.yunbao.common.bean.LiveAnchorSayModel; +import com.yunbao.common.bean.LiveBattlePassRewardsBean; import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; @@ -52,8 +56,10 @@ import com.yunbao.common.bean.RedPacketDetailsBean; import com.yunbao.common.bean.RedPacketGiftModel; import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketListBean; +import com.yunbao.common.bean.RoomMicStatusModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.StarChallengeStatusModel; +import com.yunbao.common.bean.SudGameUserModel; import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.SudgameCodeModel; import com.yunbao.common.bean.UserAreaBean; @@ -481,7 +487,7 @@ public class LiveNetManager { * @param liveUid */ public void leaveRoomNew(String stream, String liveUid, HttpCallback callback) { - Log.e("观看时长","leaveRoomNew-----------------------"+liveUid); + Log.e("观看时长", "leaveRoomNew-----------------------" + liveUid); API.get().pdLiveApi(mContext) .leaveRoomNew("g" + liveUid, stream) .subscribeOn(Schedulers.io()) @@ -1264,20 +1270,25 @@ public class LiveNetManager { * * @param callback 回调 */ - public void getContactMsg(HttpCallback> callback) { - API.get().pdLiveApi(mContext) - .getContactMsg() + private Disposable contactMsgApi; + + public synchronized void getContactMsg(int page, HttpCallback> callback) { + contactMsgApi = API.get().pdLiveApi(mContext) + .getContactMsg(page) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(listResponseModel -> { if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); } + contactMsgApi = null; }, throwable -> { if (callback != null) { callback.onError(throwable.getMessage()); } - }).isDisposed(); + contactMsgApi = null; + }); } /** @@ -2461,6 +2472,72 @@ public class LiveNetManager { }).isDisposed(); } + public void pointsExchange(String battlePassPointsId, String count, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .pointsExchange(battlePassPointsId, count) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel objectResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(objectResponseModel); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void buyingExperiencePoint(String expCount, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .buyingExperiencePoint(expCount) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel objectResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(objectResponseModel); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void upgradesBattlePass(String battlePassTypeId, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .upgradesBattlePass(battlePassTypeId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + public void accept(ResponseModel objectResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(objectResponseModel); + } + + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void quickGiftSendGift(String quickGiftNumber, String liveUid, String stream, HttpCallback callback) { API.get().pdLiveApi(mContext) .quickGiftSendGift(quickGiftNumber, liveUid, stream) @@ -2551,6 +2628,309 @@ public class LiveNetManager { }).isDisposed(); } + public void getBattlePassUserInfo(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getBattlePassUserInfo() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(checkRemainingBalanceResponseModel -> { + if (callback != null) { + callback.onSuccess(checkRemainingBalanceResponseModel.getData().getInfo()); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getLiveBattlePassRewards(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getLiveBattlePassRewards() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(checkRemainingBalanceResponseModel -> { + if (callback != null) { + callback.onSuccess(checkRemainingBalanceResponseModel.getData().getInfo()); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getRewards(String rewardLevelId, String rewardId, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getRewards(rewardLevelId, rewardId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(responseModel -> { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg())); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getBattlePassTask(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getBattlePassTask() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(checkRemainingBalanceResponseModel -> { + if (callback != null) { + callback.onSuccess(checkRemainingBalanceResponseModel.getData().getInfo()); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getBattlePassTaskOver(String taskId, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getTask(taskId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(responseModel -> { + if (callback != null) { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg())); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getBattlePassPoints(HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getBattlePassPoints() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(checkRemainingBalanceResponseModel -> { + if (callback != null) { + callback.onSuccess(checkRemainingBalanceResponseModel.getData().getInfo()); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getBattlePassRule(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .battlePassRule() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(checkRemainingBalanceResponseModel -> { + if (callback != null) { + callback.onSuccess(checkRemainingBalanceResponseModel.getData().getInfo()); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void addChatCount(String stream,HttpCallback callback) { + API.get().pdLiveApi(mContext) + .addChatCount(stream) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(responseModel -> { + if (callback != null) { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg())); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void joinMic(String roomId, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .joinMic(roomId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg())); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void onMic(String roomId, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .onMic(roomId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg())); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void offMic(String roomId, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .offMic(roomId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg())); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void leaveMic(String roomId, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .leaveMic(roomId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg())); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getRoomMicData(String roomId, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getRoomMicData(roomId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + public void getRoomMicStatus(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getRoomMicStatus() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel roomMicStatusModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + + } + /** * 直播间取消网络请求 */ @@ -2564,5 +2944,8 @@ public class LiveNetManager { if (randomPkApi != null) { randomPkApi.dispose(); } + if (contactMsgApi != null) { + contactMsgApi.dispose(); + } } } diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 7920c8b1c..cb7684922 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -8,6 +8,7 @@ import android.text.TextUtils; import androidx.annotation.NonNull; +import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.lzf.easyfloat.EasyFloat; import com.umeng.analytics.MobclickAgent; @@ -16,6 +17,7 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.event.DataUserInfoEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.base.BaseCacheManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; @@ -509,5 +511,39 @@ public class IMLoginManager extends BaseCacheManager { } }); } - + public void updateUserCoin(){ + HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + JSONObject obj = JSONObject.parseObject(info[0]); + String golds = obj.getString("gold"); + String coins = obj.getString("coin"); + String yuanbaos = obj.getString("yuanbao"); + userInfo.setCoin(obj.getLong("coin")); + userInfo.setGold(obj.getLong("gold")); + userInfo.setYuanbao(yuanbaos); + } + } + }); + } + public void updateUserCoin(OnItemClickListener listener){ + HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + JSONObject obj = JSONObject.parseObject(info[0]); + listener.onItemClick(obj,0); + String golds = obj.getString("gold"); + String coins = obj.getString("coin"); + String yuanbaos = obj.getString("yuanbao"); + userInfo.setCoin(obj.getLong("coin")); + userInfo.setGold(obj.getLong("gold")); + userInfo.setYuanbao(yuanbaos); + } + } + }); + } } diff --git a/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java b/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java index 6856890dd..46242290d 100644 --- a/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java +++ b/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java @@ -83,12 +83,16 @@ public class OpenAdManager { }); } - + private static long showTime=0; public synchronized void show(int type, boolean isGuard) { if (list == null) { init(true); return; } + if(System.currentTimeMillis()-showTime<100){ + return; + } + showTime=System.currentTimeMillis(); showType = type; for (OpenAdModel model : list) { if (model.getType() == type) { @@ -179,6 +183,10 @@ public class OpenAdManager { if (model.getType() != showType) { return; } + if(isShow(model)){ + Log.i(TAG,"展示过:"+model); + return; + } showMap.put(model.getId(), true); if (model.getShowModel() == OpenAdModel.SHOW_DIY) { String nextTime= String.valueOf(System.currentTimeMillis() + (Long.parseLong(model.getSection()) * 60 * 1000)); diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java new file mode 100644 index 000000000..09da6f188 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java @@ -0,0 +1,535 @@ +package com.yunbao.common.manager.imrongcloud; + +import android.content.Context; +import android.text.TextUtils; +import android.util.Log; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.yunbao.common.CommonAppContext; +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.SudGameChatImModel; +import com.yunbao.common.bean.SudGameUserModel; +import com.yunbao.common.event.SudGameSocketImEvent; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; + +import java.util.ArrayList; +import java.util.List; + +import cn.rongcloud.rtc.api.RCRTCEngine; +import cn.rongcloud.rtc.api.RCRTCRemoteUser; +import cn.rongcloud.rtc.api.RCRTCRoom; +import cn.rongcloud.rtc.api.RCRTCRoomConfig; +import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; +import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback; +import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener; +import cn.rongcloud.rtc.api.stream.RCRTCInputStream; +import cn.rongcloud.rtc.base.RCRTCParamsType; +import cn.rongcloud.rtc.base.RCRTCRoomType; +import cn.rongcloud.rtc.base.RTCErrorCode; +import io.rong.imlib.IRongCallback; +import io.rong.imlib.IRongCoreCallback; +import io.rong.imlib.IRongCoreEnum; +import io.rong.imlib.RongIMClient; +import io.rong.imlib.chatroom.base.RongChatRoomClient; +import io.rong.imlib.model.Conversation; +import io.rong.imlib.model.Message; +import io.rong.message.TextMessage; + +public class GameMicManager { + MeetingCallback mMeetingCallback = null; + private RCRTCRoom mRtcRoom = null; + private String mRoomID = ""; + + + private final IRCRTCRoomEventsListener roomEventsListener = new IRCRTCRoomEventsListener() { + /** + * 房间内用户发布资源 + * + * @param rcrtcRemoteUser 远端用户 + * @param list 发布的资源 + */ + @Override + public void onRemoteUserPublishResource(RCRTCRemoteUser rcrtcRemoteUser, final List list) { +// subscribeAVStream(); + } + + @Override + public void onRemoteUserMuteAudio(RCRTCRemoteUser rcrtcRemoteUser, RCRTCInputStream rcrtcInputStream, boolean b) { + + } + + @Override + public void onRemoteUserMuteVideo(RCRTCRemoteUser rcrtcRemoteUser, RCRTCInputStream rcrtcInputStream, boolean b) { + } + + + @Override + public void onRemoteUserUnpublishResource(RCRTCRemoteUser rcrtcRemoteUser, List list) { + } + + /** + * 用户加入房间 + * + * @param rcrtcRemoteUser 远端用户 + */ + @Override + public void onUserJoined(final RCRTCRemoteUser rcrtcRemoteUser) { + try { + getView().onUserJoined(rcrtcRemoteUser); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + + /** + * 用户离开房间 + * + * @param rcrtcRemoteUser 远端用户 + */ + @Override + public void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser) { + try { + getView().onUserLeft(rcrtcRemoteUser); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + + @Override + public void onUserOffline(RCRTCRemoteUser rcrtcRemoteUser) { + } + + @Override + public void onPublishLiveStreams(List list) { + } + + @Override + public void onUnpublishLiveStreams(List list) { + } + + /** + * 自己退出房间。 例如断网退出等 + * @param i 状态码 + */ + @Override + public void onLeaveRoom(int i) { + } + }; + + protected MeetingCallback getView() { + if (mMeetingCallback == null) { + throw new IllegalStateException("view is not attached"); + } else { + return mMeetingCallback; + } + } + + public void attachView(MeetingCallback callback) { + mMeetingCallback = callback; + } + + public void detachView() { + mMeetingCallback = null; + } + + /** + * 主动订阅远端用户发布的流 + * 视频流需要用户设置用于显示载体的videoview + */ + public void subscribeAVStream() { + if (mRtcRoom == null || mRtcRoom.getRemoteUsers() == null) { + return; + } + final List inputStreams = new ArrayList<>(); + for (final RCRTCRemoteUser remoteUser : mRtcRoom.getRemoteUsers()) { + if (remoteUser.getStreams().size() == 0) { + continue; + } + + inputStreams.addAll(remoteUser.getStreams()); + + } + + if (inputStreams.size() == 0) { + return; + } + mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() { + @Override + public void onSuccess() { + + + try { + getView().onSubscribeSuccess(inputStreams); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + + @Override + public void onFailed(RTCErrorCode errorCode) { + try { + getView().onSubscribeFailed(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + }); + } + + + public void refreshStreams(List personList) { + + final List inputStreams = new ArrayList<>(); + + for (SudGameUserModel sudGameUserModel : personList) { + List rcrtcRemoteUsers = mRtcRoom.getRemoteUsers(); + + for (RCRTCRemoteUser rcrtcRemoteUser : rcrtcRemoteUsers) { + if (TextUtils.equals(rcrtcRemoteUser.getUserId(), String.valueOf(sudGameUserModel.getId()))) { + for (RCRTCInputStream rcrtcInputStream : rcrtcRemoteUser.getStreams()) { + rcrtcInputStream.mute(sudGameUserModel.getMicStatus() == 3); + } + inputStreams.addAll(rcrtcRemoteUser.getStreams()); + } + } + } + if (inputStreams.size() == 0) { + return; + } + mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() { + @Override + public void onSuccess() { + + + try { + getView().onSubscribeSuccess(inputStreams); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + + @Override + public void onFailed(RTCErrorCode errorCode) { + try { + getView().onSubscribeFailed(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + }); + } + + public void refreshStreams(String userID, boolean mute, int position) { + + final List inputStreams = new ArrayList<>(); + + List rcrtcRemoteUsers = mRtcRoom.getRemoteUsers(); + + for (RCRTCRemoteUser rcrtcRemoteUser : rcrtcRemoteUsers) { + if (TextUtils.equals(rcrtcRemoteUser.getUserId(), String.valueOf(userID))) { + for (RCRTCInputStream rcrtcInputStream : rcrtcRemoteUser.getStreams()) { + rcrtcInputStream.mute(mute); + } + inputStreams.addAll(rcrtcRemoteUser.getStreams()); + } + } + if (inputStreams.size() == 0) { + return; + } + mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() { + @Override + public void onSuccess() { + + + try { + getView().onSubscribeSuccess(userID, mute, position); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + + @Override + public void onFailed(RTCErrorCode errorCode) { + try { + getView().onSubscribeFailed(userID); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + }); + } + + public void unPublishStreams() { + if (mRtcRoom == null) { + return; + } + mRtcRoom.getLocalUser().unpublishStream(RCRTCEngine.getInstance().getDefaultAudioStream(), new IRCRTCResultCallback() { + @Override + public void onSuccess() { + try { + getView().onUnPublishStreamsSuccess(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + + @Override + public void onFailed(RTCErrorCode errorCode) { + try { + getView().onUnPublishStreamsFailed(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + }); + } + + /** + * 发布默认流 + */ + public void publishDefaultAVStream() { + if (mRtcRoom == null) { + return; + } + mRtcRoom.getLocalUser().publishStream(RCRTCEngine.getInstance().getDefaultAudioStream(), new IRCRTCResultCallback() { + @Override + public void onSuccess() { + try { + getView().onPublishSuccess(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + + @Override + public void onFailed(RTCErrorCode rtcErrorCode) { + try { + getView().onPublishFailed(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + }); + } + + + /** + * 配置rtc sdk + */ + public void config(Context context) { + +// RCRTCConfig.Builder configBuilder = RCRTCConfig.Builder.create(); +// // 是否硬解码 +// configBuilder.enableHardwareDecoder(true); +// // 是否硬编码 +// configBuilder.enableHardwareEncoder(true); +// +// // init 需结合 uninit 使用,否则有些配置无法重新初始化 +// RCRTCEngine.getInstance().unInit(); +// RCRTCEngine.getInstance().init(context, configBuilder.build()); + +// RCRTCVideoStreamConfig.Builder videoConfigBuilder = RCRTCVideoStreamConfig.Builder.create(); +// // 设置分辨率 +// videoConfigBuilder.setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280); +// // 设置帧率 +// videoConfigBuilder.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_30); +// /** +// * 设置最小码率,可根据分辨率RCRTCVideoResolution设置 +// * {@link RCRTCParamsType.RCRTCVideoResolution)} +// */ +// videoConfigBuilder.setMinRate(250); +// /** +// * 设置最大码率,可根据分辨率RCRTCVideoResolution设置 +// * {@link RCRTCParamsType.RCRTCVideoResolution)} +// */ +// videoConfigBuilder.setMaxRate(2200); +// RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(videoConfigBuilder.build()); + //打开扬声器。 + RCRTCEngine.getInstance().enableSpeaker(true); + // 启用耳返功能 + RCRTCEngine.getInstance().getDefaultAudioStream().enableEarMonitoring(true); + RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(false); + RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC_HIGH, RCRTCParamsType.AudioScenario.MUSIC_CHATROOM); + } + + public void joinRoom(String roomId, boolean imOff) { + mRoomID = roomId; + if (imOff) { + + RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create() + // 根据实际场景,选择音视频直播:LIVE_AUDIO_VIDEO 或音频直播:LIVE_AUDIO + .setRoomType(RCRTCRoomType.MEETING) + + .build(); + RCRTCEngine.getInstance().joinRoom("v" + roomId, roomConfig, new IRCRTCResultDataCallback() { + @Override + public void onSuccess(final RCRTCRoom rcrtcRoom) { + GameMicManager.this.mRtcRoom = rcrtcRoom; + // 注册房间回调 + rcrtcRoom.registerRoomListener(roomEventsListener); + try { + getView().onJoinRoomSuccess(rcrtcRoom); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + + @Override + public void onFailed(RTCErrorCode rtcErrorCode) { + try { + getView().onJoinRoomFailed(rtcErrorCode); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } + }); + } + + RongChatRoomClient.getInstance().joinChatRoom("v" + roomId, -1, new IRongCoreCallback.OperationCallback() { + @Override + public void onSuccess() { + Log.i("tx", "加入成功"); + + } + + @Override + public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { + Log.i("tx", "加入" + "失败" + coreErrorCode); + if (WordUtil.isNewZh()) { + ToastUtil.show("網絡不佳無法連接,請重新進入"); + } else { + ToastUtil.show("The network is not connected, please re-enter"); + } + } + }); + } + + public void leaveRoom() { + RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() { + @Override + public void onFailed(RTCErrorCode rtcErrorCode) { + } + + @Override + public void onSuccess() { + } + }); + RongChatRoomClient.getInstance().quitChatRoom("v" + mRoomID, new IRongCoreCallback.OperationCallback() { + @Override + public void onSuccess() { + Log.i("tx", "退出成功"); + } + + @Override + public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { + Log.i("tx", "退出" + "" + coreErrorCode); + } + }); + } + + /** + * 处理游戏房Im消息 + */ + public void processingMessage(SudGameSocketImEvent socketImModel) { + + List msgDTOS = socketImModel.getMsg(); + if (msgDTOS.isEmpty()) return; + SudGameSocketImEvent.MsgDTO msgDTO = msgDTOS.get(0); + //正常文字消息 + if (TextUtils.equals(msgDTO.getMethod(), "SendMsg")) { + getView().insertItem(new SudGameChatImModel().setNickname(msgDTO.getUname()).setTextMessage(msgDTO.getCt())); + } else if (TextUtils.equals(msgDTO.getMethod(), "sudGameRoomVoiceList")) { + List personList = new Gson().fromJson(msgDTO.getCt(), new TypeToken>() { + }.getType()); + getView().refreshSudGameUserList(personList); + + refreshStreams(personList); + + } + } + + /** + * 发送聊天信息 + * + * @param textMessage + */ + public void sendMessage(String textMessage) { + IMLoginModel loginModel = IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getUserInfo(); + SudGameSocketImEvent sudGameSocketImEvent = new SudGameSocketImEvent(); + sudGameSocketImEvent.setRetcode("000000"); + sudGameSocketImEvent.setRetmsg("ok"); + + SudGameSocketImEvent.MsgDTO msgDTO = new SudGameSocketImEvent.MsgDTO(); + msgDTO.setAction("0") + .setCt(textMessage) + .setEquipment("app") + .setUid(String.valueOf(loginModel.getId())) + .setMethod("SendMsg") + .setUname(loginModel.getUserNicename()) + .setRoomnum(mRoomID); + + List msgDTOS = new ArrayList<>(); + msgDTOS.add(msgDTO); + sudGameSocketImEvent.setMsg(msgDTOS); + Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; + TextMessage messageContent = TextMessage.obtain(new Gson().toJson(sudGameSocketImEvent)); + Message message = Message.obtain("v" + mRoomID, conversationType, messageContent); + RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + @Override + public void onAttached(Message message) { + + } + + @Override + public void onSuccess(Message message) { + Log.i("tx", "发送成功"); + String contentJson = ((TextMessage) message.getContent()).getContent(); + Log.e("wewe", contentJson); + SudGameSocketImEvent sudGameSocketImEvent = new Gson().fromJson(contentJson, SudGameSocketImEvent.class); + processingMessage(sudGameSocketImEvent); + } + + @Override + public void onError(Message message, RongIMClient.ErrorCode errorCode) { + Log.i("tx", "发送成功"+errorCode.toString()); + } + }); + } + + /** + * activity相关回调 + */ + public interface MeetingCallback { + void onJoinRoomSuccess(RCRTCRoom rcrtcRoom); + + void onJoinRoomFailed(RTCErrorCode rtcErrorCode); + + void onPublishSuccess(); + + + void onPublishFailed(); + + void onUnPublishStreamsSuccess(); + + void onUnPublishStreamsFailed(); + + void onSubscribeSuccess(List inputStreamList); + + void onSubscribeFailed(); + + void onSubscribeSuccess(String userID, boolean mute, int position); + + void onSubscribeFailed(String userID); + + void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser); + + void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser); + + void insertItem(SudGameChatImModel sudGameChatImModel); + + void refreshSudGameUserList(List personList); + } +} diff --git a/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java b/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java index d0dd12dc1..4a98859bd 100644 --- a/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java +++ b/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java @@ -52,6 +52,10 @@ public class QuickStartGameViewModel extends BaseGameViewModel { */ public GameViewInfoModel.GameViewRectModel gameViewRectModel; + public GameViewInfoModel.GameViewRectModel getGameViewRectModel() { + return gameViewRectModel; + } + /** * 游戏的语言代码 */ diff --git a/common/src/main/java/com/yunbao/common/sud/audio/AudioEngineUpdateType.java b/common/src/main/java/com/yunbao/common/sud/audio/AudioEngineUpdateType.java new file mode 100644 index 000000000..11b5f8fda --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/audio/AudioEngineUpdateType.java @@ -0,0 +1,6 @@ +package com.yunbao.common.sud.audio; + +public enum AudioEngineUpdateType { + ADD, + DELETE +} diff --git a/common/src/main/java/com/yunbao/common/sud/audio/AudioPCMData.java b/common/src/main/java/com/yunbao/common/sud/audio/AudioPCMData.java new file mode 100644 index 000000000..2873dceb4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/audio/AudioPCMData.java @@ -0,0 +1,8 @@ +package com.yunbao.common.sud.audio; + +import java.nio.ByteBuffer; + +public class AudioPCMData { + public ByteBuffer data; + public int dataLength; +} diff --git a/common/src/main/java/com/yunbao/common/sud/audio/AudioRoomState.java b/common/src/main/java/com/yunbao/common/sud/audio/AudioRoomState.java new file mode 100644 index 000000000..d6c0da466 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/audio/AudioRoomState.java @@ -0,0 +1,34 @@ +package com.yunbao.common.sud.audio; + +/** + * 语聊房房间状态 + */ +public enum AudioRoomState { + DISCONNECTED(0), + CONNECTING(1), + CONNECTED(2); + + private int value; + + private AudioRoomState(int value) { + this.value = value; + } + + public int value() { + return this.value; + } + + public static AudioRoomState getZegoRoomState(int value) { + try { + if (DISCONNECTED.value == value) { + return DISCONNECTED; + } else if (CONNECTING.value == value) { + return CONNECTING; + } else { + return CONNECTED.value == value ? CONNECTED : null; + } + } catch (Exception var2) { + throw new RuntimeException("The enumeration cannot be found"); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/sud/audio/AudioStream.java b/common/src/main/java/com/yunbao/common/sud/audio/AudioStream.java new file mode 100644 index 000000000..af265e8ee --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/audio/AudioStream.java @@ -0,0 +1,7 @@ +package com.yunbao.common.sud.audio; + +public class AudioStream { + public String userID; + public String streamID; + public String extraInfo; +} diff --git a/common/src/main/java/com/yunbao/common/sud/audio/ISudAudioEngine.java b/common/src/main/java/com/yunbao/common/sud/audio/ISudAudioEngine.java new file mode 100644 index 000000000..5653c8a57 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/audio/ISudAudioEngine.java @@ -0,0 +1,121 @@ +package com.yunbao.common.sud.audio; + +import android.view.View; + +import com.yunbao.common.sud.model.AudioJoinRoomModel; + +public interface ISudAudioEngine { + // region 1. 初始化、销毁SDK, 设置IAudioEventHandler回调 + + /** + * 设置事件处理器 + * + * @param listener 事件处理实例 + */ + void setEventListener(ISudAudioEventListener listener); + + + /** + * 销毁引擎SDK + */ + void destroy(); + // endregion + + // region 2. 登录房间、退出房间 + + /** + * 加入房间, 登录成功后, 默认不推流, 默认拉流 + * + * @param model roomId + */ + void joinRoom(AudioJoinRoomModel model); + + /** + * 离开房间 + */ + void leaveRoom(); + // endregion + + // region 3. 开启推流、停止推流 + + /** + * 开启推流 + */ + void startPublishStream(); + + /** + * 停止推流 + */ + void stopPublishStream(); + // endregion + + // region 4. 开启拉流、停止拉流 + + /** + * 开启拉流,进入房间,默认订阅拉流 + */ + void startSubscribingStream(); + + /** + * 停止拉流 + */ + void stopSubscribingStream(); + // endregion + + // region 5. 开始音频流监听、关闭音频流监听 + + /** + * 开始音频流监听 + */ + void startPCMCapture(); + + /** + * 关闭音频流监听 + */ + void stopPCMCapture(); + // endregion + + // region 6. 是否使用扬声器作为音频通道 + + /** + * 切换扬声器作为音频通道 + */ + void setAudioRouteToSpeaker(boolean enabled); + // endregion + + // region 7. 发送信令 + + /** + * 发送信令 + * + * @param command 信令内容 + * @param listener 回调 + */ + void sendCommand(String command, SendCommandListener listener); + + /** + * 发送指令回调接口 + */ + interface SendCommandListener { + void onResult(int value); + } + // endregion + + // region 8. 直播接口 + + /** + * 观众开始拉流 + * + * @param streamID + * @param view + * @param mediaViewMode 图像拉伸 + */ + void startPlayingStream(String streamID, MediaViewMode mediaViewMode, View view); + + /** + * 观众停止拉流 + * + * @param streamID + */ + void stopPlayingStream(String streamID); +} diff --git a/common/src/main/java/com/yunbao/common/sud/audio/ISudAudioEventListener.java b/common/src/main/java/com/yunbao/common/sud/audio/ISudAudioEventListener.java new file mode 100644 index 000000000..e68a17a47 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/audio/ISudAudioEventListener.java @@ -0,0 +1,95 @@ +package com.yunbao.common.sud.audio; + +import com.alibaba.fastjson.JSONObject; + +import java.util.HashMap; +import java.util.List; + +public interface ISudAudioEventListener { + /** + * 捕获本地音量变化, 可用于展示自己说话音浪大小 + * + * @param soundLevel 本地音量级别,取值范围[0, 100] + */ + void onCapturedSoundLevelUpdate(float soundLevel); + + /** + * 捕获远程音流音量变化, 可用于展示远端说话音浪大小 + * + * @param soundLevels [userId: 音量],音量取值范围[0, 100] + */ + void onRemoteSoundLevelUpdate(HashMap soundLevels); + + /** + * 房间流更新 增、减。可用于知道当前推流人数 + * + * @param roomId 房间id + * @param type 流更新类型 增,减 + * @param streamList 变动流列表 + * @param extendedData 扩展信息 + */ + void onRoomStreamUpdate(String roomId, AudioEngineUpdateType type, List streamList, JSONObject extendedData); + + /** + * 接收自定义指令信息回调 + * + * @param fromUserID 用户 + * @param command 指令内容 + */ + void onRecvCommand(String fromUserID, String command); + + /** + * 接收跨房指令信息回调 + * + * @param fromRoomID 消息的房间 ID + * @param fromUserID 消息的用户 ID + * @param command 指令内容 + */ + void onRecvXRoomCommand(String fromRoomID, String fromUserID, String command); + + /** + * 房间内当前在线用户数量回调 + * + * @param count 人数 + */ + void onRoomOnlineUserCountUpdate(int count); + + /** + * 房间状态变化 + * + * @param state 状态 + * @param errorCode 错误码 + * @param extendedData 扩展信息 + */ + void onRoomStateUpdate(AudioRoomState state, int errorCode, JSONObject extendedData); + + /** + * 监听音频PCM流回调 + * + * @param audioPCMData 音频流数据 + */ + void onCapturedPCMData(AudioPCMData audioPCMData); + + /** + * 观众拉流成功通知 + * + * @param streamID + */ + void onPlayingStreamingAdd(String streamID); + + /** + * 观众拉流结束通知 + * + * @param streamID + */ + void onPlayingStreamingDelete(String streamID); + + /** + * 拉流分辨率变更通知。 + * + * @param streamID 流id + * @param width 宽 + * @param height 高 + */ + void onPlayerVideoSizeChanged(String streamID, int width, int height); +} diff --git a/common/src/main/java/com/yunbao/common/sud/audio/MediaViewMode.java b/common/src/main/java/com/yunbao/common/sud/audio/MediaViewMode.java new file mode 100644 index 000000000..f28264417 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/audio/MediaViewMode.java @@ -0,0 +1,7 @@ +package com.yunbao.common.sud.audio; + +public enum MediaViewMode { + ASPECT_FIT, // 等比缩放,可能有黑边 + ASPECT_FILL, // 等比缩放填充整个 View,可能有部分被裁减 + SCALE_TO_FILL; // 填充整个 View,图像可能被拉伸 +} diff --git a/common/src/main/java/com/yunbao/common/sud/model/AudioJoinRoomModel.java b/common/src/main/java/com/yunbao/common/sud/model/AudioJoinRoomModel.java new file mode 100644 index 000000000..4407efe35 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/model/AudioJoinRoomModel.java @@ -0,0 +1,16 @@ +package com.yunbao.common.sud.model; + +public class AudioJoinRoomModel { + + public String userID; + + public String userName; + + public String roomID; + + public String token; + + public long timestamp; + + public String appId; +} diff --git a/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java b/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java index a52dc7781..bcc191cad 100644 --- a/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java +++ b/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java @@ -1,9 +1,12 @@ package com.yunbao.common.utils; import android.app.Activity; +import android.content.Context; import android.graphics.Rect; import android.view.View; +import android.view.ViewGroup; import android.view.ViewTreeObserver; +import android.view.inputmethod.InputMethodManager; import android.widget.FrameLayout; /** @@ -15,12 +18,13 @@ public class AndroidBug5497Workaround { // For more information, see https://issuetracker.google.com/issues/36911528 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. - public static void assistActivity (Activity activity) { + public static void assistActivity(Activity activity) { new AndroidBug5497Workaround(activity); } private View mChildOfContent; private int usableHeightPrevious; + private int defHeight = ViewGroup.LayoutParams.MATCH_PARENT; private FrameLayout.LayoutParams frameLayoutParams; private AndroidBug5497Workaround(Activity activity) { @@ -29,8 +33,14 @@ public class AndroidBug5497Workaround { mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); + int heightDiff = mChildOfContent.getRootView().getHeight() - mChildOfContent.getHeight(); + if (heightDiff < 100) { + frameLayoutParams.height = defHeight; + mChildOfContent.requestLayout(); + } } }); + frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams(); } @@ -39,7 +49,7 @@ public class AndroidBug5497Workaround { if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboard - usableHeightNow; - if (heightDifference > (usableHeightSansKeyboard/4)) { + if (heightDifference > (usableHeightSansKeyboard / 4)) { // keyboard probably just became visible frameLayoutParams.height = usableHeightSansKeyboard - heightDifference; } else { diff --git a/common/src/main/java/com/yunbao/common/utils/DateFormatUtil.java b/common/src/main/java/com/yunbao/common/utils/DateFormatUtil.java index 006366acf..853e0e0ef 100644 --- a/common/src/main/java/com/yunbao/common/utils/DateFormatUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/DateFormatUtil.java @@ -1,5 +1,7 @@ package com.yunbao.common.utils; +import com.yunbao.common.http.Data; + import java.text.SimpleDateFormat; import java.util.Date; @@ -13,10 +15,13 @@ public class DateFormatUtil { private static SimpleDateFormat sFormat2; private static SimpleDateFormat sFormat3; + private static SimpleDateFormat sFormat4; + static { sFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); sFormat2 = new SimpleDateFormat("yyyyMMdd_HHmmss_SSS"); sFormat3 = new SimpleDateFormat("MM.dd-HH:mm:ss"); + sFormat4 = new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); } @@ -24,6 +29,14 @@ public class DateFormatUtil { return sFormat.format(new Date()); } + public static String getTimeString(long time) { + Date date = new Date(time); // 创建Date对象并传入时间戳参数 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 设置日期格式 + String formattedDate = sdf.format(date); // 格式化日期字符串 + return formattedDate; + } + + public static String getVideoCurTimeString() { return sFormat2.format(new Date()); } diff --git a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java index 347023335..a297704d7 100644 --- a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java +++ b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java @@ -69,7 +69,8 @@ public class DialogUitl { } return dialog; } - public static void showToast(Context context,String content,long delayMillis){ + + public static void showToast(Context context, String content, long delayMillis) { Dialog dialog = new Dialog(context, R.style.dialog); dialog.setContentView(R.layout.dialog_toast); dialog.setCancelable(false); @@ -82,7 +83,7 @@ public class DialogUitl { } } dialog.show(); - new Handler(Looper.getMainLooper()).postDelayed(dialog::dismiss,delayMillis); + new Handler(Looper.getMainLooper()).postDelayed(dialog::dismiss, delayMillis); } @@ -121,6 +122,38 @@ public class DialogUitl { dialog.show(); } + + public static void showDelSysMsg(Context context, String content, SimpleCallback simpleCallback) { + if (context instanceof Activity) { + if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) { + return; + } + } + final Dialog dialog = new Dialog(context, R.style.dialog2); + dialog.setContentView(R.layout.dialog_del_sys_msg); + dialog.setCancelable(true); + dialog.setCanceledOnTouchOutside(true); + if (!TextUtils.isEmpty(content)) { + TextView contentTextView = (TextView) dialog.findViewById(R.id.content); + contentTextView.setText(content); + } + dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dialog.dismiss(); + } + }); + dialog.findViewById(R.id.btn_confirm).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + simpleCallback.onConfirmClick(dialog, ""); + dialog.dismiss(); + } + }); + dialog.show(); + } + + public static void showSimpleDialog(Context context, String content, SimpleCallback callback) { showSimpleDialog(context, content, false, callback); } @@ -135,13 +168,7 @@ public class DialogUitl { return; } } - new Builder(context) - .setTitle(title) - .setContent(content) - .setCancelable(cancelable) - .setClickCallback(callback) - .build() - .show(); + new Builder(context).setTitle(title).setContent(content).setCancelable(cancelable).setClickCallback(callback).build().show(); } public static void showSimpleDialog(Context context, String title, String content, boolean cancelable, SimpleCallback3 callback) { @@ -150,13 +177,7 @@ public class DialogUitl { return; } } - new Builder(context) - .setTitle(title) - .setContent(content) - .setCancelable(cancelable) - .setClickCallback3(callback) - .build() - .show(); + new Builder(context).setTitle(title).setContent(content).setCancelable(cancelable).setClickCallback3(callback).build().show(); } public static void showSimpleInputDialog(Context context, String title, String hint, int inputType, int length, SimpleCallback callback) { @@ -165,15 +186,7 @@ public class DialogUitl { return; } } - new Builder(context).setTitle(title) - .setCancelable(true) - .setInput(true) - .setHint(hint) - .setInputType(inputType) - .setLength(length) - .setClickCallback(callback) - .build() - .show(); + new Builder(context).setTitle(title).setCancelable(true).setInput(true).setHint(hint).setInputType(inputType).setLength(length).setClickCallback(callback).build().show(); } @@ -483,8 +496,8 @@ public class DialogUitl { mClickCallback3.onConfirmClick(dialog); } if (mSimpleCallbackView != null) { - mSimpleCallbackView.onConfirmClick(dialog,titleView, content, btnConfirm, btnCancel); - }else{ + mSimpleCallbackView.onConfirmClick(dialog, titleView, content, btnConfirm, btnCancel); + } else { dialog.dismiss(); } @@ -501,8 +514,8 @@ public class DialogUitl { ((SimpleCallback2) mClickCallback).onCancelClick(); } if (mSimpleCallbackView != null) { - mSimpleCallbackView.onCancel(dialog,titleView, content, btnConfirm, btnCancel); - }else{ + mSimpleCallbackView.onCancel(dialog, titleView, content, btnConfirm, btnCancel); + } else { dialog.dismiss(); } } @@ -510,17 +523,17 @@ public class DialogUitl { } } }; - if(btnConfirm!=null) { + if (btnConfirm != null) { btnConfirm.setOnClickListener(listener); } - if(btnCancel!=null) { + if (btnCancel != null) { btnCancel.setOnClickListener(listener); } dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialogInterface) { if (mSimpleCallbackView != null) { - mSimpleCallbackView.onShow(dialog,titleView, content, btnConfirm, btnCancel); + mSimpleCallbackView.onShow(dialog, titleView, content, btnConfirm, btnCancel); } } }); @@ -563,8 +576,7 @@ public class DialogUitl { /** * 城市选择 */ - public static void showCityChooseDialog(Activity activity, ArrayList list, - String province, String city, String district, AddressPicker.OnAddressPickListener listener) { + public static void showCityChooseDialog(Activity activity, ArrayList list, String province, String city, String district, AddressPicker.OnAddressPickListener listener) { AddressPicker picker = new AddressPicker(activity, list); picker.setTextColor(0xff323232); picker.setDividerColor(0xffdcdcdc); diff --git a/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java b/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java index 079fcecda..5fadf48e3 100644 --- a/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java @@ -44,7 +44,7 @@ public class GoogleUtils { public boolean getGoogleService() { - boolean flag; + boolean flag =false; try { Class clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleBillingManage"); googlePay = clz.getConstructor(Activity.class).newInstance(mActivity); diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index 8918e70e0..8f013b898 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -607,7 +607,7 @@ public class JavascriptInterfaceUtils { public void androidClickToTaskPage() { ARouter.getInstance().build(PATH_REWARD).withString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=task&a=index" + "&uid=" + CommonAppConfig.getInstance().getUid() - + "&token=" + CommonAppConfig.getInstance().getToken() + "&tabIndex=1"+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0")).navigation(); + + "&token=" + CommonAppConfig.getInstance().getToken() + "&tabIndex=1" + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0")).navigation(); } @JavascriptInterface @@ -678,4 +678,8 @@ public class JavascriptInterfaceUtils { }); } + @JavascriptInterface + public void androidGotoCustomerService(String url) { + RouteUtil.forwardCustomerService(url); + } } diff --git a/common/src/main/java/com/yunbao/common/utils/LoadDian9TuUtilSud.java b/common/src/main/java/com/yunbao/common/utils/LoadDian9TuUtilSud.java new file mode 100644 index 000000000..cad240b93 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/LoadDian9TuUtilSud.java @@ -0,0 +1,108 @@ +package com.yunbao.common.utils; + +import android.app.Activity; +import android.content.Context; +import android.content.res.AssetManager; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.NinePatch; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.NinePatchDrawable; +import android.os.Build; +import android.text.TextUtils; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.request.target.CustomTarget; +import com.bumptech.glide.request.transition.Transition; +import com.yunbao.common.manager.IMLoginManager; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +public class LoadDian9TuUtilSud { + private static final List BITMAP_CACHE = new ArrayList<>();//.9图Bitmap缓存 + + public void loadDian9TuAssets(Context context, View imageView, int position) { + if (TextUtils.isEmpty(IMLoginManager.get(context).getKeyDefaultBubbleUrl())) { + Bitmap bitmap = getImageFromAssetsFile(context, "chat_message_bg.png"); + BITMAP_CACHE.add(bitmap); + setNinePathImage(context, imageView, bitmap, position); + } else { + String url = IMLoginManager.get(context).getKeyDefaultBubbleUrl(); + LoadDian9Tu(context, imageView, url, 1); + } + + } + + public void setNinePathImage(Context context, View imageView, Bitmap bitmap, int position) { + if (bitmap == null) + return; + byte[] chunk = bitmap.getNinePatchChunk(); + if (NinePatch.isNinePatchChunk(chunk)) { + NinePatchDrawable patchy = new NinePatchDrawable(context.getResources(), bitmap, chunk, NinePatchChunk.deserialize(chunk, position).mPaddings, null); + imageView.setBackground(patchy); + } + } + + public void LoadDian9Tu(Context context, View imageView, String imgUrl, int position) { + if (context == null) { + return; + } + if (context instanceof Activity) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + if (((Activity) context).isDestroyed()) { + return; + } + } + } + Glide.with(context) + .asFile() + .load(imgUrl) + .into(new CustomTarget() { + @Override + public void onResourceReady(@NonNull File resource, @Nullable Transition transition) { + try { + FileInputStream is = new FileInputStream(resource); + Bitmap bitmap = BitmapFactory.decodeStream(is); + BITMAP_CACHE.add(bitmap); + setNinePathImage(context, imageView, bitmap, position); + is.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onLoadCleared(@Nullable Drawable placeholder) { + + } + }); + } + + /** + * 从Assets中读取图片 + * + * @param fileName + * @return + */ + private Bitmap getImageFromAssetsFile(Context context, String fileName) { + Bitmap image = null; + AssetManager am = context.getResources().getAssets(); + try { + InputStream is = am.open(fileName); + image = BitmapFactory.decodeStream(is); + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return image; + } +} diff --git a/live/src/main/java/com/yunbao/live/utils/NinePatchChunk.java b/common/src/main/java/com/yunbao/common/utils/NinePatchChunk.java similarity index 98% rename from live/src/main/java/com/yunbao/live/utils/NinePatchChunk.java rename to common/src/main/java/com/yunbao/common/utils/NinePatchChunk.java index 1a275d321..6ebd8c7e4 100644 --- a/live/src/main/java/com/yunbao/live/utils/NinePatchChunk.java +++ b/common/src/main/java/com/yunbao/common/utils/NinePatchChunk.java @@ -1,4 +1,4 @@ -package com.yunbao.live.utils; +package com.yunbao.common.utils; import android.graphics.Rect; diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index 203f2448a..b81b0855f 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -1,5 +1,6 @@ package com.yunbao.common.utils; +import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -30,6 +31,7 @@ public class RouteUtil { public static final String PATH_LIVEREPORT = "/live/LiveReportActivity"; public static final String PATH_MYWEBVIEWACTIVTITY = "/main/MyWebViewActivity"; public static final String PATH_ZHUANGBANACTIVITY = "/main/ZhuangBanActivity"; + public static final String PATH_COMPENSATE_ACTIVITY = "/live/CompensateActivity"; public static final String PATH_LiveZHUANGBANACTIVITY = "/live/ZhuangBanActivity"; public static final String PATH_FACEBOOKACTIVITY = "/baidu/FacebookLoginActivity"; public static final String PATH_MAIN = "/main/MainActivity"; @@ -45,12 +47,19 @@ public class RouteUtil { public static final String PATH_RED_PACKET_INFO = "/main/RedPacketInfoActivity"; public static final String PATH_RED_PACKET_USER = "/main/RedPacketUsersActivity"; public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity"; + public static final String PATH_BattlePassActivity="/main/BattlePassActivity"; + public static final String PATH_SudGameActivity="/live/SudGameActivity"; public static void forwardFansActivity(String uid) { ARouter.getInstance().build(PATH_FANSACTIVITY) .withString(Constants.TO_UID, uid) .navigation(); } + public static void forwardSudGameActivity(String CreateSudRoom) { + ARouter.getInstance().build(PATH_SudGameActivity) + .withString("CreateSudRoom", CreateSudRoom) + .navigation(); + } public static void forwardMyWebViewActivity2(String url) { ARouter.getInstance().build(PATH_MYWEBVIEWACTIVTITY2) @@ -127,6 +136,23 @@ public class RouteUtil { .navigation(); } + + /** + * 跳转到 + */ + public static void forwardLiveCompensateActivity(Context context, String msgid, String banner, String title, String content, String time, String link, boolean receive) { + ARouter.getInstance().build(PATH_COMPENSATE_ACTIVITY) + .withString("msgid", msgid) + .withString("banner", banner) + .withString("title", title) + .withString("content", content) + .withString("time", time) + .withString("link", link) + .withBoolean("receive", receive) + .navigation(); + } + + /** * 跳转到装扮 */ @@ -311,8 +337,16 @@ public class RouteUtil { /** * 系统头像选择 */ - public static void forwardUserAvatarSelect(){ + public static void forwardUserAvatarSelect() { ARouter.getInstance().build(PATH_SELECT_AVATAR) .navigation(); } + + /** + * 战令 + */ + public static void forwardBattlePass(){ + ARouter.getInstance().build(PATH_BattlePassActivity) + .navigation(); + } } diff --git a/common/src/main/java/com/yunbao/common/utils/SpUtil.java b/common/src/main/java/com/yunbao/common/utils/SpUtil.java index 40604a237..11184c438 100644 --- a/common/src/main/java/com/yunbao/common/utils/SpUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/SpUtil.java @@ -33,10 +33,12 @@ public class SpUtil { public static final String BEAUTY_SDK_TYPE = "beautySdkType"; public static final String TURNTABLE_ENABLE = "turntableEnable"; public static final String BEAUTY_360_TIEZHI_URL = "beauty360TiezhiUrl"; - public static final String BEAUTY_360_TIEZHI_EXIST = "beauty360TiezhiExist"; - public static final String ANCHOR_PK_TIME = "anchorPkTime"; + public static final String BEAUTY_360_TIEZHI_EXIST = "beauty360TiezhiExist"; + public static final String ANCHOR_PK_TIME = "anchorPkTime"; //播放短视频上下滑动引导页 - public static final String READ_VIDEO_GUIDE = "readVideoGuide"; + public static final String READ_VIDEO_GUIDE = "readVideoGuide"; + + public static final String MESSAGE_SYS_DEL = "FIRST_DEL"; public SpUtil() { @@ -73,8 +75,8 @@ public class SpUtil { /** * 判断一个值是否存在 */ - public boolean isExists(String key){ - return mSharedPreferences.contains(key); + public boolean isExists(String key) { + return mSharedPreferences.contains(key); } /** diff --git a/common/src/main/java/com/yunbao/common/utils/WordUtil.java b/common/src/main/java/com/yunbao/common/utils/WordUtil.java index 2c48546a4..52f651070 100644 --- a/common/src/main/java/com/yunbao/common/utils/WordUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/WordUtil.java @@ -34,7 +34,8 @@ public class WordUtil { } public static boolean isNewZh() { - return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE; + return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE + || IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.TRADITIONAL_CHINESE ; } public static String getNewString(int res) { diff --git a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java index 1b69c3fe6..01776f158 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java @@ -98,8 +98,10 @@ public class LiveSudGamePopup extends BottomPopupView { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exit), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { + gameViewModel.onDestroy(); Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(2)); + dismiss(); } }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_history), new ViewClicksAntiShake.ViewClicksCallBack() { diff --git a/common/src/main/java/com/yunbao/common/views/MsgSysDelPopupView.java b/common/src/main/java/com/yunbao/common/views/MsgSysDelPopupView.java new file mode 100644 index 000000000..bb4a9de5d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/MsgSysDelPopupView.java @@ -0,0 +1,42 @@ +package com.yunbao.common.views; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.AttachPopupView; +import com.yunbao.common.R; +import com.yunbao.common.event.CustomDrawerPopupEvent; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class MsgSysDelPopupView extends AttachPopupView { + + ItemDelListener itemDelListener; + + public MsgSysDelPopupView(@NonNull Context context, ItemDelListener itemDelListener) { + super(context); + this.itemDelListener = itemDelListener; + } + + @Override + protected int getImplLayoutId() { + return R.layout.view_msg_sys_del; + } + + @Override + protected void onCreate() { + //特效设置 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.del), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + itemDelListener.onItemDel(); + } + }); + } + + public interface ItemDelListener { + void onItemDel(); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/SudGameChatViewHolder.java b/common/src/main/java/com/yunbao/common/views/SudGameChatViewHolder.java new file mode 100644 index 000000000..a76cbc058 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/SudGameChatViewHolder.java @@ -0,0 +1,49 @@ +package com.yunbao.common.views; + +import android.graphics.Color; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.style.ForegroundColorSpan; +import android.view.View; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.bean.SudGameChatImModel; +import com.yunbao.common.utils.LoadDian9TuUtilSud; + +public class SudGameChatViewHolder extends RecyclerView.ViewHolder { + private LinearLayout mBg; + private TextView chatMessage; + + public SudGameChatViewHolder(@NonNull View itemView) { + super(itemView); + mBg = (LinearLayout) itemView.findViewById(R.id.bg); + chatMessage = itemView.findViewById(R.id.chat_message); + + } + + /** + * 幸运100%活动 + */ + public void sudGameChat(SudGameChatImModel msgModel) { + new LoadDian9TuUtilSud().loadDian9TuAssets(itemView.getContext(), mBg, 1); + StringBuffer buffer = new StringBuffer(); + String userName = msgModel.getNickname() + ":"; + buffer.append(userName) + .append(" ") + .append(msgModel.getTextMessage()); + + String msg = buffer.toString(); + + int unameIndexOf = msg.indexOf(userName); + int unameSize = userName.length(); + SpannableStringBuilder builder = new SpannableStringBuilder(); + builder.append(msg); + builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFBD0D")), unameIndexOf, unameIndexOf + unameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + chatMessage.setText(builder); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java index f5832bad5..c87f93e08 100644 --- a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java @@ -15,7 +15,6 @@ import com.google.gson.Gson; import com.lxj.xpopup.XPopup; import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.R; -import com.yunbao.common.activity.SudGameActivity; import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.SudRoomListModel; @@ -107,9 +106,8 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder { createSudRoomModel.setSudGameName(model.getSudGameName()); if (isHome) { if (TextUtils.equals(model.getLiveUid(), "0")) { - Intent intent = new Intent(itemView.getContext(), SudGameActivity.class); - intent.putExtra("CreateSudRoom", new Gson().toJson(createSudRoomModel)); - itemView.getContext().startActivity(intent); + RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel)); + } else { String yes = "是"; if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { @@ -158,9 +156,7 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder { @Override public void onCancel() { - Intent intent = new Intent(itemView.getContext(), SudGameActivity.class); - intent.putExtra("CreateSudRoom", new Gson().toJson(createSudRoomModel)); - itemView.getContext().startActivity(intent); + RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel)); } })).show(); diff --git a/common/src/main/java/com/yunbao/common/views/SudGameUserListViewHolder.java b/common/src/main/java/com/yunbao/common/views/SudGameUserListViewHolder.java new file mode 100644 index 000000000..98ba77a66 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/SudGameUserListViewHolder.java @@ -0,0 +1,101 @@ +package com.yunbao.common.views; + +import android.app.Activity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.LinearLayout; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.enums.PopupPosition; +import com.makeramen.roundedimageview.RoundedImageView; +import com.yunbao.common.R; +import com.yunbao.common.adapter.SudGameUserListAdapter; +import com.yunbao.common.bean.SudGameUserModel; +import com.yunbao.common.dialog.SudGameSmallPopupPindow; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.DeviceUtils; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class SudGameUserListViewHolder extends RecyclerView.ViewHolder { + private ImageView vacancy_sud_game, mic_status; + private FrameLayout user_layout; + private RoundedImageView sud_game_user; + private LinearLayout layout; + + public SudGameUserListViewHolder(@NonNull View itemView) { + super(itemView); + vacancy_sud_game = itemView.findViewById(R.id.vacancy_sud_game); + sud_game_user = itemView.findViewById(R.id.sud_game_user); + user_layout = itemView.findViewById(R.id.user_layout); + mic_status = itemView.findViewById(R.id.mic_status); + layout = itemView.findViewById(R.id.layout); + } + + public void upData(SudGameUserModel sudGameUserModel, SudGameUserListAdapter.SudGameSmallCallBack sudGameSmallCallBack, int position) { +// layout.post(new Runnable() { +// @Override +// public void run() { +// RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); +// params.width = DeviceUtils.getScreenWidth((Activity) itemView.getContext()) / 7; +// layout.setLayoutParams(params); +// } +// }); + if (sudGameUserModel.isNullUser()) { + vacancy_sud_game.setVisibility(View.VISIBLE); + user_layout.setVisibility(View.GONE); + ViewClicksAntiShake.clicksAntiShake(vacancy_sud_game, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + Bus.get().post(sudGameUserModel); + } + }); + } else { + vacancy_sud_game.setVisibility(View.GONE); + user_layout.setVisibility(View.VISIBLE); + ImgLoader.display2(itemView.getContext(), sudGameUserModel.getAvatar(), sud_game_user); + if (sudGameUserModel.getMicStatus() == 2) { + ImgLoader.display2(itemView.getContext(), R.mipmap.icon_game_open_wheat, mic_status); + } else if (sudGameUserModel.getMicStatus() == 3) { + ImgLoader.display2(itemView.getContext(), R.mipmap.icon_game_close_wheat, mic_status); + } + if (sudGameUserModel.isMute()) { + ImgLoader.display2(itemView.getContext(), R.mipmap.icon_game_close_wheat_mute, mic_status); + } + ViewClicksAntiShake.clicksAntiShake(user_layout, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + XPopup.Builder builder = new XPopup.Builder(itemView.getContext()).atView(user_layout); + builder.hasShadowBg(false) + .isDestroyOnDismiss(true) + .isLightStatusBar(false) + .popupPosition(PopupPosition.Bottom) + .asCustom(new SudGameSmallPopupPindow(itemView.getContext(), + sudGameUserModel, + sudGameUserModel.isMute(), + new SudGameSmallPopupPindow.SudGameSmallCallBack() { + @Override + public void unMute() { + sudGameSmallCallBack.unMute(sudGameUserModel.getId() + "", position); + } + + @Override + public void mute() { + sudGameSmallCallBack.mute(sudGameUserModel.getId() + "", position); + } + + @Override + public void viewInformation(SudGameUserModel sudGameUserModel) { + sudGameSmallCallBack.viewInformation(sudGameUserModel); + } + })).show(); + } + }); + } + } +} diff --git a/live/src/main/java/com/yunbao/live/custom/TopGradual.java b/common/src/main/java/com/yunbao/common/views/TopGradual.java similarity index 97% rename from live/src/main/java/com/yunbao/live/custom/TopGradual.java rename to common/src/main/java/com/yunbao/common/views/TopGradual.java index 7cc8d818f..8e1d3d422 100644 --- a/live/src/main/java/com/yunbao/live/custom/TopGradual.java +++ b/common/src/main/java/com/yunbao/common/views/TopGradual.java @@ -1,4 +1,4 @@ -package com.yunbao.live.custom; +package com.yunbao.common.views; import android.graphics.Canvas; import android.graphics.Color; diff --git a/common/src/main/res/drawable/background_order_dialog.xml b/common/src/main/res/drawable/background_order_dialog.xml new file mode 100644 index 000000000..51b11b8ab --- /dev/null +++ b/common/src/main/res/drawable/background_order_dialog.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/background_order_dialog_out_layout.png b/common/src/main/res/drawable/background_order_dialog_out_layout.png new file mode 100644 index 000000000..571cb8b81 Binary files /dev/null and b/common/src/main/res/drawable/background_order_dialog_out_layout.png differ diff --git a/common/src/main/res/drawable/background_sud_game_input.xml b/common/src/main/res/drawable/background_sud_game_input.xml new file mode 100644 index 000000000..bdbe71942 --- /dev/null +++ b/common/src/main/res/drawable/background_sud_game_input.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/background_sud_game_input_edit_text.xml b/common/src/main/res/drawable/background_sud_game_input_edit_text.xml new file mode 100644 index 000000000..de7f97453 --- /dev/null +++ b/common/src/main/res/drawable/background_sud_game_input_edit_text.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_game_back_new.png b/common/src/main/res/drawable/bg_live_sud_game_back_new.png new file mode 100644 index 000000000..217fffa49 Binary files /dev/null and b/common/src/main/res/drawable/bg_live_sud_game_back_new.png differ diff --git a/common/src/main/res/drawable/bg_live_sud_game_bottom_input.xml b/common/src/main/res/drawable/bg_live_sud_game_bottom_input.xml new file mode 100644 index 000000000..4f5623992 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_game_bottom_input.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_game_bottom_input_right.xml b/common/src/main/res/drawable/bg_live_sud_game_bottom_input_right.xml new file mode 100644 index 000000000..75e3be568 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_game_bottom_input_right.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_game_top_new.xml b/common/src/main/res/drawable/bg_live_sud_game_top_new.xml new file mode 100644 index 000000000..6f5dd06ca --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_game_top_new.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_list_select_item2.xml b/common/src/main/res/drawable/bg_live_sud_list_select_item2.xml new file mode 100644 index 000000000..b18c8a2d6 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_list_select_item2.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/order_level_progress_bg.xml b/common/src/main/res/drawable/order_level_progress_bg.xml new file mode 100644 index 000000000..587aa4c17 --- /dev/null +++ b/common/src/main/res/drawable/order_level_progress_bg.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/activate_elite_battle_order_popup.xml b/common/src/main/res/layout/activate_elite_battle_order_popup.xml new file mode 100644 index 000000000..19e1e0051 --- /dev/null +++ b/common/src/main/res/layout/activate_elite_battle_order_popup.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/activity_end_popup.xml b/common/src/main/res/layout/activity_end_popup.xml new file mode 100644 index 000000000..09a2d5882 --- /dev/null +++ b/common/src/main/res/layout/activity_end_popup.xml @@ -0,0 +1,40 @@ + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/activity_sud_game.xml b/common/src/main/res/layout/activity_sud_game.xml index 6f6ae2637..e358ac494 100644 --- a/common/src/main/res/layout/activity_sud_game.xml +++ b/common/src/main/res/layout/activity_sud_game.xml @@ -1,57 +1,10 @@ - - - - - - - - - - - - - - @@ -61,73 +14,149 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_del_sys_msg.xml b/common/src/main/res/layout/dialog_del_sys_msg.xml new file mode 100644 index 000000000..691d65d14 --- /dev/null +++ b/common/src/main/res/layout/dialog_del_sys_msg.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_open_center_ad.xml b/common/src/main/res/layout/dialog_open_center_ad.xml index d32b5e485..dd60e83a6 100644 --- a/common/src/main/res/layout/dialog_open_center_ad.xml +++ b/common/src/main/res/layout/dialog_open_center_ad.xml @@ -13,7 +13,7 @@ android:layout_marginStart="20dp" android:layout_marginEnd="20dp" android:layout_marginBottom="12dp" - android:scaleType="fitEnd" + android:scaleType="fitCenter" app:layout_constraintBottom_toTopOf="@+id/close" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> diff --git a/common/src/main/res/layout/dialog_sud_game_input.xml b/common/src/main/res/layout/dialog_sud_game_input.xml new file mode 100644 index 000000000..68236956b --- /dev/null +++ b/common/src/main/res/layout/dialog_sud_game_input.xml @@ -0,0 +1,30 @@ + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/liberal_battle_pass_popup.xml b/common/src/main/res/layout/liberal_battle_pass_popup.xml new file mode 100644 index 000000000..222928af4 --- /dev/null +++ b/common/src/main/res/layout/liberal_battle_pass_popup.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/order_level_popup.xml b/common/src/main/res/layout/order_level_popup.xml new file mode 100644 index 000000000..987c2ae67 --- /dev/null +++ b/common/src/main/res/layout/order_level_popup.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/promotion_elite_popup.xml b/common/src/main/res/layout/promotion_elite_popup.xml new file mode 100644 index 000000000..7165f16bd --- /dev/null +++ b/common/src/main/res/layout/promotion_elite_popup.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + +