语音房bug修改
This commit is contained in:
parent
a036e5eff6
commit
5ca13b770c
@ -43,12 +43,18 @@ public class SudGameUserListAdapter extends RecyclerView.Adapter {
|
||||
|
||||
}
|
||||
|
||||
public void refreshSudGameUserList(List<SudGameUserModel> gameUserModels) {
|
||||
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();
|
||||
@ -65,6 +71,12 @@ public class SudGameUserListAdapter extends RecyclerView.Adapter {
|
||||
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));
|
||||
}
|
||||
}
|
||||
@ -81,7 +93,7 @@ public class SudGameUserListAdapter extends RecyclerView.Adapter {
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
SudGameUserListViewHolder sudGameUserListViewHolder = (SudGameUserListViewHolder) holder;
|
||||
sudGameUserListViewHolder.upData(gameUserModels.get(position), sudGameSmallCallBack,position);
|
||||
sudGameUserListViewHolder.upData(gameUserModels.get(position), sudGameSmallCallBack, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -98,7 +110,7 @@ public class SudGameUserListAdapter extends RecyclerView.Adapter {
|
||||
SudGameUserModel sudGameUserModel = gameUserModels.get(i);
|
||||
if (!sudGameUserModel.isNullUser()) {
|
||||
if (TextUtils.equals(userID, String.valueOf(sudGameUserModel.getId()))) {
|
||||
gameUserModels.get(i).setMicStatus(mute ? 1 : 3);
|
||||
gameUserModels.get(i).setMute(mute);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,17 @@ public class SudGameUserModel extends BaseModel {
|
||||
@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;
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
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;
|
||||
@ -18,7 +21,7 @@ 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;
|
||||
@ -40,6 +43,7 @@ public class SudGameInputPopupWindow extends BottomPopupView {
|
||||
}
|
||||
|
||||
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
|
||||
@ -60,7 +64,11 @@ public class SudGameInputPopupWindow extends BottomPopupView {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
textMessage.postDelayed(() -> {
|
||||
//软键盘弹出
|
||||
imm.showSoftInput(textMessage, InputMethodManager.SHOW_FORCED);
|
||||
textMessage.requestFocus();
|
||||
}, 200);
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -8,6 +9,7 @@ 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;
|
||||
@ -41,6 +43,10 @@ public class SudGameSmallPopupPindow extends AttachPopupView {
|
||||
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;
|
||||
|
@ -181,6 +181,7 @@ public class GameMicManager {
|
||||
|
||||
|
||||
public void refreshStreams(List<SudGameUserModel> personList) {
|
||||
|
||||
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
|
||||
|
||||
for (SudGameUserModel sudGameUserModel : personList) {
|
||||
|
@ -1,8 +1,11 @@
|
||||
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;
|
||||
@ -16,12 +19,14 @@ 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);
|
||||
@ -29,9 +34,18 @@ public class SudGameUserListViewHolder extends RecyclerView.ViewHolder {
|
||||
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);
|
||||
@ -49,7 +63,8 @@ public class SudGameUserListViewHolder extends RecyclerView.ViewHolder {
|
||||
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);
|
||||
} else if (sudGameUserModel.getMicStatus() == 1) {
|
||||
}
|
||||
if (sudGameUserModel.isMute()) {
|
||||
ImgLoader.display2(itemView.getContext(), R.mipmap.icon_game_close_wheat_mute, mic_status);
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(user_layout, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@ -62,16 +77,16 @@ public class SudGameUserListViewHolder extends RecyclerView.ViewHolder {
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameSmallPopupPindow(itemView.getContext(),
|
||||
sudGameUserModel,
|
||||
sudGameUserModel.getMicStatus() == 1,
|
||||
sudGameUserModel.isMute(),
|
||||
new SudGameSmallPopupPindow.SudGameSmallCallBack() {
|
||||
@Override
|
||||
public void unMute() {
|
||||
sudGameSmallCallBack.unMute(sudGameUserModel.getId() + "",position);
|
||||
sudGameSmallCallBack.unMute(sudGameUserModel.getId() + "", position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mute() {
|
||||
sudGameSmallCallBack.mute(sudGameUserModel.getId() + "",position);
|
||||
sudGameSmallCallBack.mute(sudGameUserModel.getId() + "", position);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?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"
|
||||
|
BIN
common/src/main/res/mipmap-b+en+us/icon_game_hang_up.png
Normal file
BIN
common/src/main/res/mipmap-b+en+us/icon_game_hang_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
BIN
common/src/main/res/mipmap-b+en+us/icon_game_seat.png
Normal file
BIN
common/src/main/res/mipmap-b+en+us/icon_game_seat.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
@ -1426,4 +1426,8 @@ 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">See Information</string>
|
||||
<string name="game_review_view_unmute">Unmute</string>
|
||||
<string name="game_review_view_sound_off">Mute</string>
|
||||
</resources>
|
||||
|
@ -1423,4 +1423,8 @@
|
||||
<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>
|
||||
</resources>
|
||||
|
@ -1422,4 +1422,8 @@
|
||||
<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>
|
||||
</resources>
|
||||
|
@ -1421,4 +1421,8 @@
|
||||
<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>
|
||||
</resources>
|
||||
|
@ -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>
|
||||
@ -1428,8 +1428,8 @@ 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">評論</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="game_review_input">Comment</string>
|
||||
<string name="game_review_view_information">See Information</string>
|
||||
<string name="game_review_view_unmute">Unmute</string>
|
||||
<string name="game_review_view_sound_off">Mute</string>
|
||||
</resources>
|
||||
|
@ -32,7 +32,6 @@ 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.event.SudGameUserEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
@ -53,7 +52,6 @@ import com.yunbao.common.views.TopGradual;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.dialog.LiveUserDialogFragment;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
@ -66,6 +64,7 @@ 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;
|
||||
@ -83,6 +82,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
||||
private SudGameChatAdapter mLiveChatAdapter;
|
||||
private SudGameUserListAdapter sudGameUserListAdapter;
|
||||
private ProcessResultUtil mProcessResultUtil;
|
||||
private List<String> muteUser = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -126,18 +126,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
||||
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(disable);
|
||||
ImgLoader.display(mContext, R.mipmap.icon_game_close_wheat, gameCloseWheat);
|
||||
gameCloseWheat.setVisibility(View.INVISIBLE);
|
||||
LiveNetManager.get(mContext).getRoomMicData(mLiveUid, new HttpCallback<List<SudGameUserModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SudGameUserModel> data) {
|
||||
gameMicManager.refreshStreams(data);
|
||||
sudGameUserListAdapter.refreshSudGameUserList(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -215,11 +204,12 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
||||
} 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 {
|
||||
@ -245,6 +235,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
||||
roomName.setText(mCreateSudRoomModel.getRoomName());
|
||||
roomNumber.setText(mCreateSudRoomModel.getSudGameRoomId());
|
||||
}
|
||||
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exit), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
@ -312,6 +303,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
||||
|
||||
}
|
||||
});
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "麥克風已開啟" : "Microphone turned on");
|
||||
} else {
|
||||
disable = true;
|
||||
// 设置禁用麦克风采集
|
||||
@ -329,6 +321,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
||||
|
||||
}
|
||||
});
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "麥克風已關閉" : "Microphone turned off");
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -466,7 +459,18 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
||||
|
||||
@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();
|
||||
}
|
||||
@ -525,6 +529,11 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
||||
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);
|
||||
}
|
||||
});
|
||||
@ -553,7 +562,7 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
|
||||
|
||||
@Override
|
||||
public void refreshSudGameUserList(List<SudGameUserModel> personList) {
|
||||
sudGameUserListAdapter.refreshSudGameUserList(personList);
|
||||
sudGameUserListAdapter.refreshSudGameUserList(personList, muteUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user