语音房bug修改

This commit is contained in:
18401019693
2024-01-12 09:34:29 +08:00
parent a036e5eff6
commit 5ca13b770c
15 changed files with 108 additions and 29 deletions

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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() {

View File

@@ -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;

View File

@@ -181,6 +181,7 @@ public class GameMicManager {
public void refreshStreams(List<SudGameUserModel> personList) {
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
for (SudGameUserModel sudGameUserModel : personList) {

View File

@@ -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

View File

@@ -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"

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>