diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java
index 499fa2607..8d2e7884e 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/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 @@
-
+
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/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/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/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/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/SudGameInputPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/SudGameInputPopupWindow.java
new file mode 100644
index 000000000..08c1f08d5
--- /dev/null
+++ b/common/src/main/java/com/yunbao/common/dialog/SudGameInputPopupWindow.java
@@ -0,0 +1,81 @@
+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() {
+ dialog.dismiss();
+ if (sudGameInputCallBack != null) {
+ String textMessageStr = textMessage.getText().toString();
+ if (!TextUtils.isEmpty(textMessageStr)) {
+ if (textMessageStr.length() > 100) {
+ ToastUtil.show(WordUtil.isNewZh() ? "超出字數限制" : "Exceed word limit");
+ } else {
+ sudGameInputCallBack.sendMessage(textMessageStr);
+ }
+ } 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..5c2d527d8
--- /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("对方未开麦!");
+ 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/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/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java
index b6e092d7e..6d0c57c72 100644
--- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java
+++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java
@@ -62,6 +62,7 @@ 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;
@@ -1115,24 +1116,42 @@ public interface PDLiveApi {
@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
+ @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);
+ 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();
+
+ @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);
}
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 ba14573fa..2a27a2328 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
@@ -58,6 +58,7 @@ import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketListBean;
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;
@@ -485,7 +486,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())
@@ -2769,6 +2770,7 @@ public class LiveNetManager {
}
}).isDisposed();
}
+
public void addChatCount(HttpCallback callback) {
API.get().pdLiveApi(mContext)
.addChatCount()
@@ -2790,6 +2792,122 @@ public class LiveNetManager {
}
}).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();
+ }
+
/**
* 直播间取消网络请求
*/
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..efd2497e3
--- /dev/null
+++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java
@@ -0,0 +1,529 @@
+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) {
+ mRoomID = roomId;
+ 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) {
+
+ }
+ });
+ }
+
+ /**
+ * 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/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 super File> 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 c0a8de699..b81b0855f 100644
--- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java
+++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java
@@ -48,12 +48,18 @@ public class RouteUtil {
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)
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_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/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_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/view_sud_game_chat_item_holder.xml b/common/src/main/res/layout/view_sud_game_chat_item_holder.xml
new file mode 100644
index 000000000..d697f53ab
--- /dev/null
+++ b/common/src/main/res/layout/view_sud_game_chat_item_holder.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/res/layout/view_sud_game_small.xml b/common/src/main/res/layout/view_sud_game_small.xml
new file mode 100644
index 000000000..8c8d2aae6
--- /dev/null
+++ b/common/src/main/res/layout/view_sud_game_small.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/res/layout/view_sud_game_user_list_holder.xml b/common/src/main/res/layout/view_sud_game_user_list_holder.xml
new file mode 100644
index 000000000..2d86b7c83
--- /dev/null
+++ b/common/src/main/res/layout/view_sud_game_user_list_holder.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/common/src/main/res/mipmap-xxhdpi/backgroud_sud_game_small_window.png b/common/src/main/res/mipmap-xxhdpi/backgroud_sud_game_small_window.png
new file mode 100644
index 000000000..fed69cb32
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/backgroud_sud_game_small_window.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_game_close_wheat.png b/common/src/main/res/mipmap-xxhdpi/icon_game_close_wheat.png
new file mode 100644
index 000000000..363e0e380
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_game_close_wheat.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_game_close_wheat_mute.png b/common/src/main/res/mipmap-xxhdpi/icon_game_close_wheat_mute.png
new file mode 100644
index 000000000..8f78bc3f8
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_game_close_wheat_mute.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_game_hang_up.png b/common/src/main/res/mipmap-xxhdpi/icon_game_hang_up.png
new file mode 100644
index 000000000..ab9ffbdf7
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_game_hang_up.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_game_hang_up_en.png b/common/src/main/res/mipmap-xxhdpi/icon_game_hang_up_en.png
new file mode 100644
index 000000000..011cc27fe
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_game_hang_up_en.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_game_open_wheat.png b/common/src/main/res/mipmap-xxhdpi/icon_game_open_wheat.png
new file mode 100644
index 000000000..19a8c1b97
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_game_open_wheat.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_game_seat.png b/common/src/main/res/mipmap-xxhdpi/icon_game_seat.png
new file mode 100644
index 000000000..f3dca07f2
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_game_seat.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_game_seat_en.png b/common/src/main/res/mipmap-xxhdpi/icon_game_seat_en.png
new file mode 100644
index 000000000..104cde7c1
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_game_seat_en.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_send_game.png b/common/src/main/res/mipmap-xxhdpi/icon_send_game.png
new file mode 100644
index 000000000..13b06a190
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_send_game.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_sud_history_live_new.png b/common/src/main/res/mipmap-xxhdpi/icon_sud_history_live_new.png
new file mode 100644
index 000000000..f9c550e28
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_sud_history_live_new.png differ
diff --git a/common/src/main/res/mipmap-xxhdpi/icon_vacancy_sud_game.png b/common/src/main/res/mipmap-xxhdpi/icon_vacancy_sud_game.png
new file mode 100644
index 000000000..d2475e35d
Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_vacancy_sud_game.png differ
diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml
index e805c95c8..52ccbcbbf 100644
--- a/common/src/main/res/values-en-rUS/string.xml
+++ b/common/src/main/res/values-en-rUS/string.xml
@@ -666,7 +666,7 @@
ReceiveAwards
One free gift privilege!
- Send out
+ Send
I am sorry
video
myname.pdlive.shayu.fileprovider
@@ -1441,4 +1441,8 @@ Limited ride And limited avatar frame
BattlePass
+ Comment
+ Information
+ Unmute
+ Mute
diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml
index aa40007ff..46ff1fc27 100644
--- a/common/src/main/res/values-zh-rHK/strings.xml
+++ b/common/src/main/res/values-zh-rHK/strings.xml
@@ -1427,6 +1427,10 @@
商品兌換數量已達到上限
開通成功
您已購買該戰令
+ 評論
+ 查看信息
+ 取消靜音
+ 靜音
領取成功
領取
diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml
index 095f493f6..e17bbbf4f 100644
--- a/common/src/main/res/values-zh-rTW/strings.xml
+++ b/common/src/main/res/values-zh-rTW/strings.xml
@@ -1426,6 +1426,10 @@
商品兌換數量已達到上限
開通成功
您已購買該戰令
+ 評論
+ 查看信息
+ 取消靜音
+ 靜音
領取成功
領取
diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml
index acde5ffef..472ac39c6 100644
--- a/common/src/main/res/values-zh/strings.xml
+++ b/common/src/main/res/values-zh/strings.xml
@@ -1421,6 +1421,10 @@
商品兌換數量已達到上限
開通成功
您已購買該戰令
+ 評論
+ 查看信息
+ 取消靜音
+ 靜音
內含物品還未領取,是否確定刪除消息?
是否確定刪除消息?
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index 560a55abb..1b5e11e88 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -666,7 +666,7 @@
ReceiveAwards
One free gift privilege!
- Send out
+ Send
I am sorry
video
myname.pdlive.shayu.fileprovider
@@ -1432,6 +1432,10 @@ Limited ride And limited avatar frame
The quantity of goods exchanged has reached the upper limit
Successfully opened
You have purchased the BattlePass
+ Comment
+ Information
+ Unmute
+ Mute
Successfully claimed
Receive
diff --git a/live/src/main/AndroidManifest.xml b/live/src/main/AndroidManifest.xml
index 696d132c1..1af89a691 100644
--- a/live/src/main/AndroidManifest.xml
+++ b/live/src/main/AndroidManifest.xml
@@ -84,6 +84,9 @@
+
diff --git a/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java
new file mode 100644
index 000000000..9c9f5d7ea
--- /dev/null
+++ b/live/src/main/java/com/yunbao/live/activity/SudGameActivity.java
@@ -0,0 +1,633 @@
+package com.yunbao.live.activity;
+
+import android.Manifest;
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.Handler;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.lifecycle.Observer;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.google.gson.Gson;
+import com.lxj.xpopup.XPopup;
+import com.yunbao.common.Constants;
+import com.yunbao.common.R;
+import com.yunbao.common.activity.AbsActivity;
+import com.yunbao.common.adapter.SudGameChatAdapter;
+import com.yunbao.common.adapter.SudGameUserListAdapter;
+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.bean.HttpCallbackModel;
+import com.yunbao.common.bean.SudGameChatImModel;
+import com.yunbao.common.bean.SudGameUserModel;
+import com.yunbao.common.dialog.SudGameInputPopupWindow;
+import com.yunbao.common.event.CheckRemainingBalanceEvent;
+import com.yunbao.common.event.SudGameSocketImEvent;
+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.manager.imrongcloud.GameMicManager;
+import com.yunbao.common.sud.QuickStartGameViewModel;
+import com.yunbao.common.sud.model.GameConfigModel;
+import com.yunbao.common.sud.model.GameViewInfoModel;
+import com.yunbao.common.sud.state.SudMGPMGState;
+import com.yunbao.common.utils.Bus;
+import com.yunbao.common.utils.DpUtil;
+import com.yunbao.common.utils.ProcessResultUtil;
+import com.yunbao.common.utils.RouteUtil;
+import com.yunbao.common.utils.ToastUtil;
+import com.yunbao.common.utils.WordUtil;
+import com.yunbao.common.views.LiveSudGameHistoryPopup;
+import com.yunbao.common.views.TopGradual;
+import com.yunbao.common.views.weight.ViewClicksAntiShake;
+import com.yunbao.live.dialog.LiveUserDialogFragment;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import cn.rongcloud.rtc.api.RCRTCEngine;
+import cn.rongcloud.rtc.api.RCRTCRemoteUser;
+import cn.rongcloud.rtc.api.RCRTCRoom;
+import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
+import cn.rongcloud.rtc.base.RTCErrorCode;
+
+@Route(path = RouteUtil.PATH_SudGameActivity)
+public class SudGameActivity extends AbsActivity implements GameMicManager.MeetingCallback {
+ private FrameLayout gameContainer;
+ private long mInteractionID;
+ private String mLiveUid;
+ private final QuickStartGameViewModel gameViewModel = new QuickStartGameViewModel(); // 创建ViewModel
+
+ private CreateSudRoomModel mCreateSudRoomModel;
+ private TextView roomName, roomNumber;
+ private GameMicManager gameMicManager;
+ private ImageView gameCloseWheat, gameSeat;
+ private boolean disable = true, publishDefault = false;
+
+ private RecyclerView chatList, userList;
+ private SudGameChatAdapter mLiveChatAdapter;
+ private SudGameUserListAdapter sudGameUserListAdapter;
+ private ProcessResultUtil mProcessResultUtil;
+ private List muteUser = new ArrayList<>();
+
+ @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) {
+
+ }
+ });
+ gameMicManager = new GameMicManager();
+ gameMicManager.attachView(this);
+ gameMicManager.config(this);
+ gameMicManager.joinRoom(mLiveUid);
+ // 设置禁用麦克风采集
+ RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
+ ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
+ gameCloseWheat.setVisibility(View.INVISIBLE);
+
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ if (!mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) {
+ ToastUtil.show("拒绝权限将无法使用上麦功能");
+ mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() {
+ @Override
+ public void run() {
+
+ }
+ });
+ }
+ }
+ }, 1500);
+ mProcessResultUtil = new ProcessResultUtil(this);
+
+
+ }
+
+ @Override
+ protected void onDestroy() {
+ LiveNetManager.get(mContext)
+ .leaveMic(mLiveUid, new HttpCallback() {
+ @Override
+ public void onSuccess(HttpCallbackModel data) {
+
+ }
+
+ @Override
+ public void onError(String error) {
+
+ }
+ });
+ Bus.getOff(this);
+ gameMicManager.leaveRoom();
+ gameMicManager.detachView();
+ 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);
+ roomName = findViewById(R.id.room_name);
+ roomNumber = findViewById(R.id.room_number);
+ gameCloseWheat = findViewById(R.id.game_close_wheat);
+ gameSeat = findViewById(R.id.game_seat);
+ chatList = findViewById(R.id.chat_list);
+ userList = findViewById(R.id.user_list);
+ //聊天栏
+ FrameLayout.LayoutParams params1 = (FrameLayout.LayoutParams)
+ chatList.getLayoutParams();
+ params1.topMargin = DpUtil.dp2px(65);
+ chatList.setLayoutParams(params1);
+
+ chatList.setHasFixedSize(true);
+ LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
+ layoutManager.setOrientation(RecyclerView.VERTICAL);
+ layoutManager.setStackFromEnd(true);
+ chatList.setLayoutManager(layoutManager);
+ chatList.addItemDecoration(new TopGradual());
+ chatList.setItemViewCacheSize(10);
+ mLiveChatAdapter = new SudGameChatAdapter(mContext);
+ chatList.setAdapter(mLiveChatAdapter);
+ sudGameUserListAdapter = new SudGameUserListAdapter(new ArrayList<>());
+ ImgLoader.display(mContext, WordUtil.isNewZh() ? R.mipmap.icon_game_seat : R.mipmap.icon_game_seat_en, gameSeat);
+ sudGameUserListAdapter.setSudGameSmallCallBack(new SudGameUserListAdapter.SudGameSmallCallBack() {
+ @Override
+ public void unMute(String userID, int position) {
+ if (!TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), userID)) {
+ gameMicManager.refreshStreams(userID, false, position);
+ } else {
+ ToastUtil.show(WordUtil.isNewZh() ? "無法對本人靜音" : "Unable to mute myself");
+ }
+ muteUser.remove(userID);
+ }
+
+ @Override
+ public void mute(String userID, int position) {
+ muteUser.add(userID);
+ if (!TextUtils.equals(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()), userID)) {
+ gameMicManager.refreshStreams(userID, true, position);
+ } else {
+ ToastUtil.show(WordUtil.isNewZh() ? "無法對本人靜音" : "Unable to mute myself");
+ }
+
+ }
+
+ @Override
+ public void viewInformation(SudGameUserModel sudGameUserModel) {
+ LiveUserDialogFragment fragment = new LiveUserDialogFragment();
+ Bundle bundle = new Bundle();
+ bundle.putString(Constants.LIVE_UID, "uid");
+ bundle.putString(Constants.STREAM, "");
+ bundle.putString(Constants.TO_UID, sudGameUserModel.getId() + "");
+ fragment.setArguments(bundle);
+ fragment.show(((SudGameActivity) mContext).getSupportFragmentManager(), "LiveUserDialogFragment");
+ }
+ });
+ userList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
+ userList.setAdapter(sudGameUserListAdapter);
+ if (mCreateSudRoomModel != null) {
+ roomName.setText(mCreateSudRoomModel.getRoomName());
+ roomNumber.setText(mCreateSudRoomModel.getSudGameRoomId());
+ }
+
+ 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();
+ }
+ });
+ ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.game_seat), new ViewClicksAntiShake.ViewClicksCallBack() {
+ @Override
+ public void onViewClicks() {
+ if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) {
+ if (publishDefault) {
+ disable = true;
+ // 设置禁用麦克风采集
+ RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
+ ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
+ gameMicManager.unPublishStreams();
+ } else {
+ if (sudGameUserListAdapter.isMicMax()) {
+ ToastUtil.show(WordUtil.isNewZh() ? "上麥人數最大7人" : "The maximum number of people on the microphone is 7");
+ } else {
+ gameMicManager.publishDefaultAVStream();
+ }
+
+ }
+ } else {
+ mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() {
+ @Override
+ public void run() {
+
+ }
+ });
+ }
+
+
+ }
+ });
+ ViewClicksAntiShake.clicksAntiShake(gameCloseWheat, new ViewClicksAntiShake.ViewClicksCallBack() {
+ @Override
+ public void onViewClicks() {
+ if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) {
+ if (disable) {
+ disable = false;
+ // 设置禁用麦克风采集
+ RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
+ ImgLoader.display(mContext, R.mipmap.icon_game_open_wheat, gameCloseWheat);
+ LiveNetManager.get(mContext)
+ .onMic(mLiveUid, new HttpCallback() {
+ @Override
+ public void onSuccess(HttpCallbackModel data) {
+
+ }
+
+ @Override
+ public void onError(String error) {
+
+ }
+ });
+ ToastUtil.show(WordUtil.isNewZh() ? "麥克風已開啟" : "Microphone turned on");
+ } else {
+ disable = true;
+ // 设置禁用麦克风采集
+ RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
+ ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
+ LiveNetManager.get(mContext)
+ .offMic(mLiveUid, new HttpCallback() {
+ @Override
+ public void onSuccess(HttpCallbackModel data) {
+
+ }
+
+ @Override
+ public void onError(String error) {
+
+ }
+ });
+ ToastUtil.show(WordUtil.isNewZh() ? "麥克風已關閉" : "Microphone turned off");
+ }
+
+ } else {
+ mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() {
+ @Override
+ public void run() {
+
+ }
+ });
+ }
+
+ }
+ });
+ ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.game_review_input), new ViewClicksAntiShake.ViewClicksCallBack() {
+ @Override
+ public void onViewClicks() {
+ new XPopup.Builder(mContext)
+ .enableDrag(false)
+ .asCustom(new SudGameInputPopupWindow(mContext, new SudGameInputPopupWindow.SudGameInputCallBack() {
+ @Override
+ public void sendMessage(String textMessage) {
+ gameMicManager.sendMessage(textMessage);
+ }
+ }))
+ .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() {
+//
+// }
+// });
+ // 设置游戏安全操作区域
+ GameViewInfoModel.GameViewRectModel gameViewRectModel = new GameViewInfoModel.GameViewRectModel();
+ gameViewRectModel.left = 0;
+ gameViewRectModel.top = DpUtil.dp2px(155);
+ gameViewRectModel.right = 0;
+ gameViewRectModel.bottom = DpUtil.dp2px(155);
+ gameViewModel.gameViewRectModel = gameViewRectModel;
+
+
+ }
+
+ @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 (TextUtils.equals(String.valueOf(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");
+ }
+
+ }
+// ToastUtil.show(data.toString());
+
+ }
+
+ @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;
+ }
+
+ }
+
+ @Override
+ public void onJoinRoomSuccess(RCRTCRoom rcrtcRoom) {
+ LiveNetManager.get(mContext).getRoomMicData(mLiveUid, new HttpCallback>() {
+ @Override
+ public void onSuccess(List data) {
+ gameMicManager.refreshStreams(data);
+ sudGameUserListAdapter.refreshSudGameUserList(data, muteUser);
+ }
+
+ @Override
+ public void onError(String error) {
+ ToastUtil.show(error);
+ }
+ });
+ // 主动订阅远端用户发布的资源
+// gameMicManager.subscribeAVStream();
+ }
+
+ @Override
+ public void onJoinRoomFailed(RTCErrorCode rtcErrorCode) {
+ ToastUtil.show("加入失败 "+rtcErrorCode.toString());
+ }
+
+ @Override
+ public void onPublishSuccess() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ ImgLoader.display(mContext, WordUtil.isNewZh() ? R.mipmap.icon_game_hang_up : R.mipmap.icon_game_hang_up_en, gameSeat);
+ publishDefault = true;
+ gameCloseWheat.setVisibility(View.VISIBLE);
+ disable = false;
+ // 设置禁用麦克风采集
+ RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
+ ImgLoader.display(mContext, R.mipmap.icon_game_open_wheat, gameCloseWheat);
+ }
+ });
+
+ LiveNetManager.get(mContext)
+ .joinMic(mLiveUid, new HttpCallback() {
+ @Override
+ public void onSuccess(HttpCallbackModel data) {
+
+ }
+
+ @Override
+ public void onError(String error) {
+
+ }
+ });
+ }
+
+ @Override
+ public void onPublishFailed() {
+ ToastUtil.show(WordUtil.isNewZh() ? "語音加入失敗" : "Voice joining failed");
+ }
+
+ @Override
+ public void onSubscribeSuccess(List inputStreamList) {
+// ToastUtil.show("订阅成功 ");
+ }
+
+ @Override
+ public void onSubscribeFailed() {
+ ToastUtil.show("订阅失败 ");
+ }
+
+ @Override
+ public void onSubscribeSuccess(String userID, boolean mute, int position) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ if (mute) {
+ ToastUtil.show(WordUtil.isNewZh() ? "已靜音該用戶" : "The user has been muted");
+ } else {
+ ToastUtil.show(WordUtil.isNewZh() ? "已取消該用戶靜音" : "The user has been unmuted");
+ }
+ sudGameUserListAdapter.muteUser(userID, mute, position);
+ }
+ });
+
+ }
+
+ @Override
+ public void onSubscribeFailed(String userID) {
+ ToastUtil.show("订阅失败 ");
+ }
+
+ @Override
+ public void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser) {
+
+ }
+
+ @Override
+ public void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser) {
+
+ }
+
+ @Override
+ public void insertItem(SudGameChatImModel sudGameChatImModel) {
+ mLiveChatAdapter.insertItem(sudGameChatImModel);
+ }
+
+ @Override
+ public void refreshSudGameUserList(List personList) {
+ sudGameUserListAdapter.refreshSudGameUserList(personList, muteUser);
+ }
+
+ @Override
+ public void onUnPublishStreamsSuccess() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ ImgLoader.display(mContext, WordUtil.isNewZh() ? R.mipmap.icon_game_seat : R.mipmap.icon_game_seat_en, gameSeat);
+ publishDefault = false;
+ gameCloseWheat.setVisibility(View.INVISIBLE);
+ }
+ });
+ LiveNetManager.get(mContext)
+ .leaveMic(mLiveUid, new HttpCallback() {
+ @Override
+ public void onSuccess(HttpCallbackModel data) {
+
+ }
+
+ @Override
+ public void onError(String error) {
+
+ }
+ });
+
+ }
+
+ @Override
+ public void onUnPublishStreamsFailed() {
+
+ }
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onSudGameSocketImEvent(SudGameSocketImEvent event) {
+ gameMicManager.processingMessage(event);
+ }
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onSudGameUserModel(SudGameUserModel model) {
+ if (model.isNullUser()) {
+ if (!publishDefault) {
+ if (mProcessResultUtil.checkPermissions(new String[]{Manifest.permission.RECORD_AUDIO})) {
+ if (sudGameUserListAdapter.isMicMax()) {
+ ToastUtil.show(WordUtil.isNewZh() ? "上麥人數最大7人" : "The maximum number of people on the microphone is 7");
+ } else {
+ gameMicManager.publishDefaultAVStream();
+ }
+
+ } else {
+ mProcessResultUtil.requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, new Runnable() {
+ @Override
+ public void run() {
+
+ }
+ });
+ }
+
+ } else {
+ ToastUtil.show(WordUtil.isNewZh() ? "已經是上麥狀態" : "It is already in the wheat state");
+ }
+
+ }
+ }
+}
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java
index 84b75209c..0e748b6e6 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java
@@ -24,9 +24,7 @@ import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
-import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
-import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
@@ -36,7 +34,7 @@ import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.bean.HotBean;
-import com.yunbao.live.custom.TopGradual;
+import com.yunbao.common.views.TopGradual;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.live.utils.LiveTextRender;
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
index 800802944..8c1c4ed6f 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
@@ -554,6 +554,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.ai_te), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
if (!TextUtils.isEmpty(mUserBean.getId()) && !TextUtils.isEmpty(mUserBean.getUserNiceName())) {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.INPUT_DIALOG)
@@ -630,7 +631,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 跳转到个人主页
*/
private void forwardHomePage() {
-
+ if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
Constants.mStream = mStream;
RouteUtil.forwardUserHome(mContext, mToUid, true, mLiveUid, 0);
@@ -640,11 +641,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 举报
*/
private void report() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
LiveReportActivity.forward(mContext, mToUid);
}
private void gotoLive(String live_id) {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.party_studio), new DialogUitl.SimpleCallback() {
@Override
@@ -698,6 +701,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
}
setAttention();
} else if (i == R.id.btn_home_page) {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
if (isAnchor) {
MobclickAgent.onEvent(mContext, "anchor_avatar_index", "点主播主页");
} else {
@@ -705,18 +709,22 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
}
forwardHomePage();
} else if (i == R.id.btn_report) {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
report();
} else if (i == R.id.avatar) {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
if (isAnchor) {
MobclickAgent.onEvent(mContext, "anchor_avatar_btn", "点主播头像");
}
forwardHomePage();
} else if (i == R.id.btn_guard) {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
MobclickAgent.onEvent(mContext, "anchor_avatar_guard", "守护按钮");
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity, mToUid);
} else if (i == R.id.btn_live) {
gotoLive(mToUid);
} else if (i == R.id.noble_icon_layout) {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
if (isAnchor) {
dismiss();
((LiveActivity) mContext).openFansWindow(mToUid);
@@ -726,6 +734,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
.setType(LiveAudienceEvent.LiveAudienceType.NOBLE));
}
} else if (i == R.id.btn_setting) {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
setting();
}
}
@@ -782,6 +791,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private DialogUitl.StringArrayDialogCallback mArrayDialogCallback = new DialogUitl.StringArrayDialogCallback() {
@Override
public void onItemClick(String text, int tag) {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
if (tag == R.string.live_setting_kick) {
kick();
@@ -815,6 +825,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 查看管理员列表
*/
private void adminList() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
((LiveActivity) mContext).openAdminListWindow();
}
@@ -823,6 +834,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 踢人
*/
private void kick() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
LiveHttpUtil.kicking(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@@ -839,6 +851,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 永久禁言->改成三天禁言
*/
private void setShutUp() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
LiveHttpUtil.setShutUp(mLiveUid, "0", 0, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@@ -855,6 +868,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 本场禁言
*/
private void setShutUp2() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@@ -872,6 +886,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 设置或取消管理员
*/
private void setAdmin() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
LiveHttpUtil.setAdmin(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@@ -893,6 +908,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 超管关闭直播间
*/
private void closeLive() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 0, mSuperCloseRoomCallback);
}
@@ -901,11 +917,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 超管关闭直播间并禁止主播直播
*/
private void closeLive2() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 1, mSuperCloseRoomCallback);
}
private void setShutUp3() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
new LiveSettingSilenceDialog(mContext)
.setItemClickListener((bean, position) -> {
LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, bean + "", new HttpCallback() {
@@ -927,6 +945,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 超管关闭直播间并禁用主播账户
*/
private void forbidAccount() {
+ if (TextUtils.equals(mLiveUid, "uid")) return;
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 2, mSuperCloseRoomCallback);
}
diff --git a/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java b/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java
index 634f805c9..90c95bb03 100644
--- a/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java
+++ b/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java
@@ -19,6 +19,7 @@ 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 com.yunbao.common.utils.NinePatchChunk;
import com.yunbao.live.activity.LiveActivity;
import java.io.File;
diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
index 43ea192f2..2661b23f2 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -160,7 +160,7 @@ import com.yunbao.live.bean.LiveWishlistBean;
import com.yunbao.live.bean.WishlistItemModel;
import com.yunbao.live.custom.LiveLightView;
import com.yunbao.live.custom.RightGradual;
-import com.yunbao.live.custom.TopGradual;
+import com.yunbao.common.views.TopGradual;
import com.yunbao.live.dialog.GiftWallDialog;
import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog;
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
diff --git a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java
index 2b2ac9158..dfd9e55c9 100644
--- a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java
@@ -76,7 +76,7 @@ import com.yunbao.live.adapter.YouLikeMessageAdapter;
import com.yunbao.live.bean.SearchUserBean;
import com.yunbao.live.bean.SystemMessageBean;
import com.yunbao.live.bean.YouLikeBean;
-import com.yunbao.live.custom.TopGradual;
+import com.yunbao.common.views.TopGradual;
import com.yunbao.live.http.ImHttpConsts;
import com.yunbao.live.http.ImHttpUtil;
diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
index d4853a951..85c690a12 100644
--- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
@@ -74,6 +74,7 @@ import com.yunbao.common.event.MainHomeCommunityToChatEvent;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.NoviceInstructorEvent;
import com.yunbao.common.event.RongIMConnectionStatusEvent;
+import com.yunbao.common.event.SudGameUserEvent;
import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
@@ -103,7 +104,9 @@ import com.yunbao.common.views.APKUpdateCustomPopup;
import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.common.views.floatingview.APPEasyFloat;
import com.yunbao.common.views.weight.LiveFloatView;
+import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
+import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.utils.LiveStorge;
import com.yunbao.main.R;
import com.yunbao.main.adapter.FullAdToBannerTransition;
@@ -1455,6 +1458,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
}
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onSudGameUserEvent(SudGameUserEvent event) {
+
+ }
+
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveFloatEvent(LiveFloatEvent event) {
if (event != null && event.getmLiveBean() != null && !TextUtils.isEmpty(event.getmLiveBean().getPull())) {
@@ -1473,5 +1481,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
MobclickAgent.onEvent(mContext, "home_page_to_redpk", "首页点击右下角去红包专区");
mainHomeViewHolder.setCurPosition(3);
});
+
}
+
+
}
diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java
index 11bf76eb6..97345b408 100644
--- a/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java
+++ b/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java
@@ -17,7 +17,7 @@ import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupPosition;
import com.yunbao.common.activity.AbsActivity;
-import com.yunbao.common.activity.SudGameActivity;
+import com.yunbao.live.activity.SudGameActivity;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.adapter.SudGameListAdapter;
import com.yunbao.common.bean.CreateSudRoomModel;