Merge remote-tracking branch 'origin/语音房_6.6.4_'
# Conflicts: # common/src/main/res/values-en-rUS/string.xml # common/src/main/res/values-zh-rHK/strings.xml # common/src/main/res/values-zh-rTW/strings.xml # common/src/main/res/values-zh/strings.xml # common/src/main/res/values/strings.xml
@ -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) {
|
||||
|
@ -56,9 +56,7 @@
|
||||
<activity
|
||||
android:name="com.yunbao.common.activity.SelectImageActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name="com.yunbao.common.activity.SudGameActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
|
||||
<activity
|
||||
android:name="com.yunbao.common.activity.PreviewImageActivity"
|
||||
|
BIN
common/src/main/assets/chat_message_bg.png
Normal file
After Width: | Height: | Size: 712 B |
@ -1,214 +0,0 @@
|
||||
package com.yunbao.common.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.sud.QuickStartGameViewModel;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.LiveSudGameHistoryPopup;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class SudGameActivity extends AbsActivity {
|
||||
private FrameLayout gameContainer;
|
||||
private long mInteractionID;
|
||||
private String mLiveUid;
|
||||
private final QuickStartGameViewModel gameViewModel = new QuickStartGameViewModel(); // 创建ViewModel
|
||||
|
||||
private CreateSudRoomModel mCreateSudRoomModel;
|
||||
private TextView gameTitle, roomName, roomNumber;
|
||||
private RoundedImageView mAvatar;
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_sud_game;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
Bus.getOn(this);
|
||||
super.main();
|
||||
initView();
|
||||
initDate();
|
||||
}
|
||||
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
|
||||
private void initDate() {
|
||||
LiveNetManager.get(mContext)
|
||||
.getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<CustomSidebarInfoModel> 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<View>() {
|
||||
@Override
|
||||
public void onChanged(View view) {
|
||||
if (view == null) { // 在关闭游戏时,把游戏View给移除
|
||||
gameContainer.removeAllViews();
|
||||
} else { // 把游戏View添加到容器内
|
||||
gameContainer.addView(view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
||||
}
|
||||
}
|
||||
});
|
||||
// 加载游戏,参数定义可查看BaseGameViewModel.switchGame()方法注释
|
||||
// 游戏配置
|
||||
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<CheckRemainingBalance>() {
|
||||
@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<CheckRemainingBalance>() {
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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<SudGameChatImModel> 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;
|
||||
}
|
||||
|
||||
}
|
@ -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<SudGameUserModel> gameUserModels = new ArrayList<>();
|
||||
private boolean micMax = false;
|
||||
|
||||
public SudGameUserListAdapter(List<SudGameUserModel> 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<SudGameUserModel> gameUserModels, List<String> 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);
|
||||
}
|
||||
}
|
@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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));
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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<MsgDTO> msg;
|
||||
@SerializedName("retcode")
|
||||
private String retcode;
|
||||
@SerializedName("retmsg")
|
||||
private String retmsg;
|
||||
|
||||
public List<MsgDTO> getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(List<MsgDTO> 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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<ResponseModel<BattlePassUserInfoBean>> getBattlePassUserInfo();
|
||||
|
||||
@GET("/api/public/?service=Livebattlepass.getLiveBattlePassRewards")
|
||||
Observable<ResponseModel<LiveBattlePassRewardsBean>> getLiveBattlePassRewards();
|
||||
|
||||
@GET("/api/public/?service=Livebattlepass.getRewards")
|
||||
Observable<ResponseModel<List<BaseModel>>> getRewards(
|
||||
@Query("live_battle_pass_level_id") String rewardLevelId,
|
||||
@Query("live_battle_pass_rewards_id") String rewardId
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Livebattlepass.getBattlePassTask")
|
||||
Observable<ResponseModel<BattlePassTask>> getBattlePassTask();
|
||||
|
||||
@GET("/api/public/?service=Livebattlepass.getTask")
|
||||
Observable<ResponseModel<List<BaseModel>>> getTask(@Query("task_id") String taskId);
|
||||
|
||||
@GET("/api/public/?service=Livebattlepass.getBattlePassPoints")
|
||||
Observable<ResponseModel<List<BattlePassPoints>>> getBattlePassPoints();
|
||||
|
||||
@GET("/api/public/?service=Livebattlepass.battlePassRule")
|
||||
Observable<ResponseModel<String>> battlePassRule();
|
||||
|
||||
@GET("/api/public/?service=Livebattlepass.addChatCount")
|
||||
Observable<ResponseModel<List<BaseModel>>> addChatCount();
|
||||
|
||||
@GET("/api/public/?service=Sudgameserver.joinMic")
|
||||
Observable<ResponseModel<List<BaseModel>>> joinMic(@Query("room_id") String roomId);
|
||||
@GET("/api/public/?service=Sudgameserver.onMic")
|
||||
Observable<ResponseModel<List<BaseModel>>> onMic(@Query("room_id") String roomId);
|
||||
@GET("/api/public/?service=Sudgameserver.offMic")
|
||||
Observable<ResponseModel<List<BaseModel>>> offMic(@Query("room_id") String roomId);
|
||||
@GET("/api/public/?service=Sudgameserver.leaveMic")
|
||||
Observable<ResponseModel<List<BaseModel>>> leaveMic(@Query("room_id") String roomId);
|
||||
@GET("/api/public/?service=Sudgameserver.getRoomMicData")
|
||||
Observable<ResponseModel<List<SudGameUserModel>>> getRoomMicData(@Query("room_id") String roomId);
|
||||
}
|
||||
|
@ -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;
|
||||
@ -2769,6 +2770,7 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void addChatCount(HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.addChatCount()
|
||||
@ -2790,6 +2792,122 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void joinMic(String roomId, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.joinMic(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@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<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.onMic(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@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<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.offMic(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@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<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.leaveMic(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@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<List<SudGameUserModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRoomMicData(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<SudGameUserModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<SudGameUserModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -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<RCRTCInputStream> 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<RCRTCInputStream> 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<RCRTCInputStream> list) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnpublishLiveStreams(List<RCRTCInputStream> 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<RCRTCInputStream> 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<SudGameUserModel> personList) {
|
||||
|
||||
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
|
||||
|
||||
for (SudGameUserModel sudGameUserModel : personList) {
|
||||
List<RCRTCRemoteUser> 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<RCRTCInputStream> inputStreams = new ArrayList<>();
|
||||
|
||||
List<RCRTCRemoteUser> 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<RCRTCRoom>() {
|
||||
@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<SudGameSocketImEvent.MsgDTO> 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<SudGameUserModel> personList = new Gson().fromJson(msgDTO.getCt(), new TypeToken<List<SudGameUserModel>>() {
|
||||
}.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<SudGameSocketImEvent.MsgDTO> 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<RCRTCInputStream> 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<SudGameUserModel> personList);
|
||||
}
|
||||
}
|
@ -52,6 +52,10 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
*/
|
||||
public GameViewInfoModel.GameViewRectModel gameViewRectModel;
|
||||
|
||||
public GameViewInfoModel.GameViewRectModel getGameViewRectModel() {
|
||||
return gameViewRectModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏的语言代码
|
||||
*/
|
||||
|
@ -0,0 +1,6 @@
|
||||
package com.yunbao.common.sud.audio;
|
||||
|
||||
public enum AudioEngineUpdateType {
|
||||
ADD,
|
||||
DELETE
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.yunbao.common.sud.audio;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class AudioPCMData {
|
||||
public ByteBuffer data;
|
||||
public int dataLength;
|
||||
}
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.yunbao.common.sud.audio;
|
||||
|
||||
public class AudioStream {
|
||||
public String userID;
|
||||
public String streamID;
|
||||
public String extraInfo;
|
||||
}
|
@ -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);
|
||||
}
|
@ -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<String, Float> soundLevels);
|
||||
|
||||
/**
|
||||
* 房间流更新 增、减。可用于知道当前推流人数
|
||||
*
|
||||
* @param roomId 房间id
|
||||
* @param type 流更新类型 增,减
|
||||
* @param streamList 变动流列表
|
||||
* @param extendedData 扩展信息
|
||||
*/
|
||||
void onRoomStreamUpdate(String roomId, AudioEngineUpdateType type, List<AudioStream> 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);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.yunbao.common.sud.audio;
|
||||
|
||||
public enum MediaViewMode {
|
||||
ASPECT_FIT, // 等比缩放,可能有黑边
|
||||
ASPECT_FILL, // 等比缩放填充整个 View,可能有部分被裁减
|
||||
SCALE_TO_FILL; // 填充整个 View,图像可能被拉伸
|
||||
}
|
@ -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;
|
||||
}
|
@ -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> 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<File>() {
|
||||
@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;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.yunbao.live.utils;
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.yunbao.live.custom;
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:topRightRadius="12dp" android:topLeftRadius="12dp"/>
|
||||
<solid android:color="#E6E9E9E9" />
|
||||
</shape>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="6dp"/>
|
||||
<solid android:color="#fff" />
|
||||
</shape>
|
BIN
common/src/main/res/drawable/bg_live_sud_game_back_new.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="#CC414141" />
|
||||
</shape>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:bottomRightRadius="20dp"
|
||||
android:topRightRadius="20dp" />
|
||||
<solid android:color="#333333" />
|
||||
</shape>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="19dp" />
|
||||
<solid android:color="#B3414141" />
|
||||
</shape>
|
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_selected="false">
|
||||
<shape>
|
||||
<solid android:color="#0000" />
|
||||
</shape>
|
||||
|
||||
</item>
|
||||
<item android:state_selected="true">
|
||||
<shape>
|
||||
<solid android:color="#252525" />
|
||||
</shape>
|
||||
|
||||
</item>
|
||||
</selector>
|
@ -1,57 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#201E1A"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="44dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="@string/interactive_game_create_room"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@mipmap/icon_interactive_game_create_room_seats"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sud_history"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:src="@mipmap/icon_sud_history_live" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exit"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:background="@drawable/bg_live_sud_game_back"
|
||||
android:gravity="center"
|
||||
android:text="@string/video_exit"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="8sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -61,60 +14,45 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="175dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_live_sud_game_top"
|
||||
android:gravity="center_vertical">
|
||||
android:layout_marginStart="23dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:background="@drawable/bg_live_sud_game_top_new"
|
||||
android:gravity="center">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="gone"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/interactive_game_create_room_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/room_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="@string/interactive_game_create_room_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/interactive_game_create_room_number"
|
||||
android:text="ID:"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
@ -122,12 +60,103 @@
|
||||
android:id="@+id/room_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/interactive_game_create_room_number"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="29dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sud_history"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:src="@mipmap/icon_sud_history_live_new" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exit"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:background="@drawable/bg_live_sud_game_back_new"
|
||||
android:gravity="center"
|
||||
android:text="@string/video_exit"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="8sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="137dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginBottom="35dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_review_input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_live_sud_game_bottom_input"
|
||||
android:gravity="center"
|
||||
android:text="@string/game_review_input"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/game_close_wheat"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:src="@mipmap/icon_game_close_wheat" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/game_seat"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
|
||||
android:src="@mipmap/icon_game_seat" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/chat_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="75dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:gravity="center">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/user_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
30
common/src/main/res/layout/dialog_sud_game_input.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="51dp"
|
||||
android:background="@drawable/background_sud_game_input">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/text_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:paddingStart="8dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@drawable/background_sud_game_input_edit_text"
|
||||
android:hint="@string/live_say_something"
|
||||
android:textColorHint="@color/gray3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/send"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@mipmap/icon_send_game"
|
||||
android:gravity="center"
|
||||
android:text="@string/send"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
</FrameLayout>
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="283dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chat_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
29
common/src/main/res/layout/view_sud_game_small.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="110dp"
|
||||
android:background="@mipmap/backgroud_sud_game_small_window"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_information"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/bg_live_sud_list_select_item2"
|
||||
android:gravity="center"
|
||||
android:text="@string/game_review_view_information"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/view_un_mute"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:background="@drawable/bg_live_sud_list_select_item2"
|
||||
android:gravity="center"
|
||||
android:text="@string/game_review_view_unmute"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/layout"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/vacancy_sud_game"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@mipmap/icon_vacancy_sud_game"
|
||||
android:visibility="visible" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/user_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:visibility="visible">
|
||||
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/sud_game_user"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/icon_vacancy_sud_game"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mic_status"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:src="@mipmap/icon_game_close_wheat_mute" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
After Width: | Height: | Size: 4.3 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_game_close_wheat.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_game_close_wheat_mute.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_game_hang_up.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_game_hang_up_en.png
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_game_open_wheat.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_game_seat.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_game_seat_en.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_send_game.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_sud_history_live_new.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_vacancy_sud_game.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
@ -666,7 +666,7 @@
|
||||
<string name="receive_awards">ReceiveAwards</string>
|
||||
<string name="one_free">One free gift privilege!</string>
|
||||
|
||||
<string name="send">Send out</string>
|
||||
<string name="send">Send</string>
|
||||
<string name="sorry">I am sorry</string>
|
||||
<string name="video">video</string>
|
||||
<string name="FILE_PROVIDER">myname.pdlive.shayu.fileprovider</string>
|
||||
@ -1441,4 +1441,8 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="sys_msg_day"></string>
|
||||
|
||||
<string name="main_suspension_war_order">BattlePass</string>
|
||||
<string name="game_review_input">Comment</string>
|
||||
<string name="game_review_view_information">Information</string>
|
||||
<string name="game_review_view_unmute">Unmute</string>
|
||||
<string name="game_review_view_sound_off">Mute</string>
|
||||
</resources>
|
||||
|
@ -1427,6 +1427,10 @@
|
||||
<string name="battlepass_exchange_buy_max">商品兌換數量已達到上限</string>
|
||||
<string name="battlepass_zl_get">開通成功</string>
|
||||
<string name="battlepass_buy_max">您已購買該戰令</string>
|
||||
<string name="game_review_input">評論</string>
|
||||
<string name="game_review_view_information">查看信息</string>
|
||||
<string name="game_review_view_unmute">取消靜音</string>
|
||||
<string name="game_review_view_sound_off">靜音</string>
|
||||
|
||||
<string name="receive_success">領取成功</string>
|
||||
<string name="receive1">領取</string>
|
||||
|
@ -1426,6 +1426,10 @@
|
||||
<string name="battlepass_exchange_buy_max">商品兌換數量已達到上限</string>
|
||||
<string name="battlepass_zl_get">開通成功</string>
|
||||
<string name="battlepass_buy_max">您已購買該戰令</string>
|
||||
<string name="game_review_input">評論</string>
|
||||
<string name="game_review_view_information">查看信息</string>
|
||||
<string name="game_review_view_unmute">取消靜音</string>
|
||||
<string name="game_review_view_sound_off">靜音</string>
|
||||
|
||||
<string name="receive_success">領取成功</string>
|
||||
<string name="receive1">領取</string>
|
||||
|
@ -1421,6 +1421,10 @@
|
||||
<string name="battlepass_exchange_buy_max">商品兌換數量已達到上限</string>
|
||||
<string name="battlepass_zl_get">開通成功</string>
|
||||
<string name="battlepass_buy_max">您已購買該戰令</string>
|
||||
<string name="game_review_input">評論</string>
|
||||
<string name="game_review_view_information">查看信息</string>
|
||||
<string name="game_review_view_unmute">取消靜音</string>
|
||||
<string name="game_review_view_sound_off">靜音</string>
|
||||
<string name="msg_del_sys01">內含物品還未領取,是否確定刪除消息?</string>
|
||||
<string name="msg_del_sys02">是否確定刪除消息?</string>
|
||||
|
||||
|
@ -666,7 +666,7 @@
|
||||
<string name="receive_awards">ReceiveAwards</string>
|
||||
<string name="one_free">One free gift privilege!</string>
|
||||
|
||||
<string name="send">Send out</string>
|
||||
<string name="send">Send</string>
|
||||
<string name="sorry">I am sorry</string>
|
||||
<string name="video">video</string>
|
||||
<string name="FILE_PROVIDER">myname.pdlive.shayu.fileprovider</string>
|
||||
@ -1432,6 +1432,10 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="battlepass_exchange_buy_max">The quantity of goods exchanged has reached the upper limit</string>
|
||||
<string name="battlepass_zl_get">Successfully opened</string>
|
||||
<string name="battlepass_buy_max">You have purchased the BattlePass</string>
|
||||
<string name="game_review_input">Comment</string>
|
||||
<string name="game_review_view_information">Information</string>
|
||||
<string name="game_review_view_unmute">Unmute</string>
|
||||
<string name="game_review_view_sound_off">Mute</string>
|
||||
|
||||
<string name="receive_success">Successfully claimed</string>
|
||||
<string name="receive1">Receive</string>
|
||||
|
@ -84,6 +84,9 @@
|
||||
<activity
|
||||
android:name=".activity.WebViewActivityMedal"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.SudGameActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.MedalQuestionWebViewActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
633
live/src/main/java/com/yunbao/live/activity/SudGameActivity.java
Normal file
@ -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<String> 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<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
|
||||
|
||||
private void initDate() {
|
||||
|
||||
LiveNetManager.get(mContext)
|
||||
.getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<CustomSidebarInfoModel> 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<HttpCallbackModel>() {
|
||||
@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<HttpCallbackModel>() {
|
||||
@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<HttpCallbackModel>() {
|
||||
@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<View>() {
|
||||
@Override
|
||||
public void onChanged(View view) {
|
||||
if (view == null) { // 在关闭游戏时,把游戏View给移除
|
||||
gameContainer.removeAllViews();
|
||||
} else { // 把游戏View添加到容器内
|
||||
gameContainer.addView(view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
// 加载游戏,参数定义可查看BaseGameViewModel.switchGame()方法注释
|
||||
// 游戏配置
|
||||
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<CheckRemainingBalance>() {
|
||||
@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<CheckRemainingBalance>() {
|
||||
@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<List<SudGameUserModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SudGameUserModel> 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<HttpCallbackModel>() {
|
||||
@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<RCRTCInputStream> 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<SudGameUserModel> 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<HttpCallbackModel>() {
|
||||
@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");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|