Compare commits

...

2 Commits

62 changed files with 619 additions and 262 deletions

View File

@@ -43,12 +43,14 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
private int type;//1:房间点击进入的2打赏进入的
private List<RoonGiftModel> giftList=new ArrayList<>();
private List<GiftPackBean> giftPackList=new ArrayList<>();
private String roomId;
public static GiftTwoDetailsFragment newInstance(String id,int type) {
public static GiftTwoDetailsFragment newInstance(String id,int type,String roomId) {
Bundle args = new Bundle();
args.putString("id", id);
args.putInt("type", type);
args.putString("roomId", roomId);
GiftTwoDetailsFragment fragment = new GiftTwoDetailsFragment();
fragment.setArguments(args);
return fragment;
@@ -59,6 +61,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
super.initArgs(arguments);
id = arguments.getString("id");
type = arguments.getInt("type");
roomId = arguments.getString("roomId");
}
@Override
@@ -78,9 +81,9 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
MvpPre.giftPack();
}else {
if (type==0) {
MvpPre.getGiftList("0", type);
MvpPre.getGiftList("0", type, roomId);
}else {
MvpPre.getGiftList(id, type);
MvpPre.getGiftList(id, type, roomId);
}
}

View File

@@ -21,6 +21,6 @@ public class GiftBean {
private int number;
private String createtime;
private String nickname;
private String count;
private int count;
private String user_id;
}

View File

@@ -1,5 +1,6 @@
package com.xscm.moduleutil.bean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.room.FriendInfo;
import com.xscm.moduleutil.bean.room.FriendUserBean;
import com.xscm.moduleutil.bean.room.RoomAuction;
@@ -86,6 +87,8 @@ public class RoomMessageEvent {
private long time_day;
private int online_number;//在线人数
private BlindBoxBean.XlhData xlh_Data;
}
@Data

View File

@@ -30,7 +30,7 @@ public class BlindBoxBean {
}
public boolean isXlhDataObject() {
return xlh_data instanceof JsonObject || xlh_data instanceof XlhData;
return xlh_data instanceof JsonObject || xlh_data instanceof Map || xlh_data instanceof XlhData;
}
public List<XlhData> getXlhDataAsList() {
@@ -43,7 +43,77 @@ public class BlindBoxBean {
public XlhData getXlhDataAsObject() {
if (isXlhDataObject()) {
return (XlhData) xlh_data;
// 如果已经是XlhData类型直接返回
if (xlh_data instanceof XlhData) {
return (XlhData) xlh_data;
}
// 如果是Map类型Gson解析后的LinkedTreeMap手动转换
else if (xlh_data instanceof Map) {
Map<String, Object> map = (Map<String, Object>) xlh_data;
XlhData xlhData = new XlhData();
// 安全地转换各个字段
Object waitingStartNum = map.get("waiting_start_num");
if (waitingStartNum != null) {
xlhData.setWaiting_start_num(waitingStartNum.toString());
}
Object startNum = map.get("start_num");
if (startNum != null) {
xlhData.setStart_num(startNum.toString());
}
Object currentNum = map.get("current_num");
if (currentNum != null) {
if (currentNum instanceof Number) {
xlhData.setCurrent_num(((Number) currentNum).intValue());
} else {
try {
xlhData.setCurrent_num(Integer.parseInt(currentNum.toString()));
} catch (NumberFormatException e) {
xlhData.setCurrent_num(0);
}
}
}
Object status = map.get("status");
if (status != null) {
if (status instanceof Number) {
xlhData.setStatus(((Number) status).intValue());
} else {
try {
xlhData.setStatus(Integer.parseInt(status.toString()));
} catch (NumberFormatException e) {
xlhData.setStatus(0);
}
}
}
return xlhData;
}
// 如果是JsonObject也需要转换
else if (xlh_data instanceof JsonObject) {
JsonObject jsonObject = (JsonObject) xlh_data;
XlhData xlhData = new XlhData();
if (jsonObject.has("waiting_start_num")) {
xlhData.setWaiting_start_num(jsonObject.get("waiting_start_num").getAsString());
}
if (jsonObject.has("start_num")) {
xlhData.setStart_num(jsonObject.get("start_num").getAsString());
}
if (jsonObject.has("current_num")) {
xlhData.setCurrent_num(jsonObject.get("current_num").getAsInt());
}
if (jsonObject.has("status")) {
xlhData.setStatus(jsonObject.get("status").getAsInt());
}
return xlhData;
}
}
return null;
}

View File

@@ -96,6 +96,10 @@ public class EMMessageInfo implements MultiItemEntity {
public static final int QXRoomMessageTypeHeartDidChanged = 1054;
/// 小黑屋有人退出房间
public static final int QXRoomMessageTypeHeartDid = 1055;
///盲盒抽奖进度条
public static final int QXRoomMessageTypeMangH = 1056;
///巡乐会
public static final int QXRoomMessageTypeXlh = 1057;
private RoomMessageEvent emMessage;
private int custom = 0;

View File

@@ -26,6 +26,7 @@ import com.xscm.moduleutil.R;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftBean;
import com.xscm.moduleutil.bean.RoomMessageEvent;
import com.xscm.moduleutil.bean.WalletBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
@@ -37,6 +38,10 @@ import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.widget.CircularProgressView;
import com.xscm.moduleutil.widget.GiftCardView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
@@ -62,7 +67,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
/// 距离4个的时候放慢
private int toSlowCount = 4;
private List<GiftCardView> allViewsArray ;//视图的集合
private List<GiftCardView> allViewsArray;//视图的集合
private int targetIndex;//目标的下标
private List<Integer> targetArrayIndex = new ArrayList<>();//中奖的下标
private List<Integer> finishTargetArrayIndex = new ArrayList<>();
@@ -85,7 +90,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
private LotteryEvent userIdType; // 新增枚举类型字段
private int type;//10:对应天空之境 11对应岁月之城 12对应时空之巅
private GiftLotteryDialogFragment giftLotteryDialogFragment;
private List<Integer> reslutListAll = new ArrayList<>();
private String blind_box_turntable_id = "";//本次抽奖标识id
@Override
protected GiftLotteryPresenter bindPresenter() {
@@ -108,9 +113,12 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCancelable(true);
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this);
return dialog;
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
@@ -133,13 +141,14 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
protected void initView() {
// 根据不同的用户类型显示不同的界面
setupUIBasedOnUserType();
}
@Override
protected void initDialogStyle(Window window) {
super.initDialogStyle(window);
window.setGravity(Gravity.BOTTOM);
}
@Override
public void onStart() {
super.onStart();
@@ -150,7 +159,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int screenHeight = displayMetrics.heightPixels;
// 设置高度为屏幕高度的100%(全屏)
int heightInPx = (int) (screenHeight * 0.8);;
int heightInPx = (int) (screenHeight * 0.9);
;
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
window.setBackgroundDrawableResource(android.R.color.transparent);
@@ -158,6 +168,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
window.setWindowAnimations(R.style.CommonShowDialogBottom);
}
}
private void setupUIBasedOnUserType() {
switch (userIdType) {
case MIRROR_SKY://天空之境
@@ -177,7 +188,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
/// 天空之境
private void setupSingleUserUI() {
allViewsArray= new ArrayList<>();
allViewsArray = new ArrayList<>();
mBinding.mirroeSky.getRoot().setVisibility(View.VISIBLE);
giftMaxCount = 12;
minRoundCount = 6;
@@ -203,6 +214,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
mBinding.mirroeSky.tvGz.setOnClickListener(this::onClisk);
mBinding.mirroeSky.tvJc.setOnClickListener(this::onClisk);
mBinding.mirroeSky.tvJl.setOnClickListener(this::onClisk);
mBinding.mirroeSky.tvStart.setOnClickListener(this::onClisk);
init(0);
mBinding.mirroeSky.swLockYx.setChecked(true);
mBinding.mirroeSky.swTex.setChecked(true);
@@ -214,10 +226,9 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
}
//岁月之城
private void setupMultiUserUI() {
allViewsArray= new ArrayList<>();
allViewsArray = new ArrayList<>();
mBinding.cityTime.getRoot().setVisibility(View.VISIBLE);
giftMaxCount = 10;
minRoundCount = 7;
@@ -241,6 +252,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
mBinding.cityTime.tvGz.setOnClickListener(this::onClisk);
mBinding.cityTime.tvJc.setOnClickListener(this::onClisk);
mBinding.cityTime.tvJl.setOnClickListener(this::onClisk);
mBinding.cityTime.tvStart.setOnClickListener(this::onClisk);
init2(0);
mBinding.cityTime.swLockYx.setChecked(true);
mBinding.cityTime.swTex.setChecked(true);
@@ -253,7 +265,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
//时空之巅
private void setupAllUsersUI() {
allViewsArray= new ArrayList<>();
allViewsArray = new ArrayList<>();
mBinding.pinnacleTime.getRoot().setVisibility(View.VISIBLE);
giftMaxCount = 10;
minRoundCount = 7;
@@ -277,6 +289,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
mBinding.pinnacleTime.tvGz.setOnClickListener(this::onClisk);
mBinding.pinnacleTime.tvJc.setOnClickListener(this::onClisk);
mBinding.pinnacleTime.tvJl.setOnClickListener(this::onClisk);
mBinding.pinnacleTime.tvStart.setOnClickListener(this::onClisk);
init3(0);
mBinding.pinnacleTime.swLockYx.setChecked(true);
mBinding.pinnacleTime.swTex.setChecked(true);
@@ -286,6 +299,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
circularProgress = mBinding.pinnacleTime.circularProgressView;
circularProgress.setProgress(0);
}
private void onClisk(View view) {
int id = view.getId();
if (id == R.id.ll_one) {
@@ -379,6 +393,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
mBinding.cityTime.llHundred.setBackground(getResources().getDrawable(R.mipmap.chou_w));
}
}
private void init3(int type) {
if (type == 1) {
mBinding.pinnacleTime.llOne.setBackground(getResources().getDrawable(R.mipmap.chou_x));
@@ -479,9 +494,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
}
delayTime = 0.03;
if (targetArrayIndex.isEmpty()) {
String result = TextUtils.join(",", reslutListAll);
MvpPre.giftSend(result);
MvpPre.giftSend(blind_box_turntable_id);
MvpPre.wallet();
stopFastAnimate();
return;
@@ -581,22 +595,73 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
for (int i = size; i < allViewsArray.size(); i++) {
allViewsArray.get(i).setVisibility(View.GONE);
}
BlindBoxBean.XlhData xlhData = blindBoxBean.getXlhDataAsObject();
if (xlhData != null ) {
if (giftBagId.equals("10")) {
circularProgress.setProgress(xlhData.getCurrent_num());
mBinding.mirroeSky.tvProgress.setText(xlhData.getCurrent_num() + "%");
}else if (giftBagId.equals("11")){
circularProgress.setProgress(xlhData.getCurrent_num());
mBinding.cityTime.tvProgress.setText(xlhData.getCurrent_num() + "%");
}else if (giftBagId.equals("12")){
circularProgress.setProgress(xlhData.getCurrent_num());
mBinding.pinnacleTime.tvProgress.setText(xlhData.getCurrent_num() + "%");
if (blindBoxBean.getIs_xlh() == 1) {
BlindBoxBean.XlhData xlhData = blindBoxBean.getXlhDataAsObject();
UpView(xlhData);
} else {
if (type == 10) {
mBinding.mirroeSky.llProgress.setVisibility(View.INVISIBLE);
mBinding.mirroeSky.tvStart.setVisibility(View.INVISIBLE);
} else if (type == 11) {
mBinding.cityTime.llProgress.setVisibility(View.INVISIBLE);
mBinding.cityTime.tvStart.setVisibility(View.INVISIBLE);
} else if (type == 12) {
mBinding.pinnacleTime.llProgress.setVisibility(View.INVISIBLE);
mBinding.pinnacleTime.tvStart.setVisibility(View.INVISIBLE);
}
}
}
}
private void UpView(BlindBoxBean.XlhData xlhData) {
if (xlhData != null) {
int currentNum = xlhData.getCurrent_num();
int startNum = Integer.parseInt(xlhData.getStart_num());
int waitingStartNum = Integer.parseInt(xlhData.getWaiting_start_num());
int progress = 0;
String progressText = "";
if (currentNum >= startNum) {
// 已经达到开启条件,显示完整进度或特殊状态
progress = 100;
progressText = "100%";
} else {
// 还未达到等待开始条件计算相对于waiting_start_num的进度
progress = (int) (((float) currentNum / startNum) * 100);
progressText = progress + "%";
}
if (giftBagId.equals("10")) {
circularProgress.setProgress(progress * 10);
mBinding.mirroeSky.tvProgress.setText(progressText);
} else if (giftBagId.equals("11")) {
circularProgress.setProgress(progress * 10);
mBinding.cityTime.tvProgress.setText(progressText);
} else if (giftBagId.equals("12")) {
circularProgress.setProgress(progress * 10);
mBinding.pinnacleTime.tvProgress.setText(progressText);
}
if (xlhData.getStatus() == 0) {
mBinding.mirroeSky.tvStart.setBackgroundResource(R.mipmap.dengt);
mBinding.cityTime.tvStart.setBackgroundResource(R.mipmap.dengt);
mBinding.pinnacleTime.tvStart.setBackgroundResource(R.mipmap.dengt);
} else if (xlhData.getStatus() == 1) {
mBinding.mirroeSky.tvStart.setBackgroundResource(R.mipmap.zhensgh);
mBinding.cityTime.tvStart.setBackgroundResource(R.mipmap.zhensgh);
mBinding.pinnacleTime.tvStart.setBackgroundResource(R.mipmap.zhensgh);
} else if (xlhData.getStatus() == 2) {
mBinding.mirroeSky.tvStart.setBackgroundResource(R.mipmap.jijang);
mBinding.cityTime.tvStart.setBackgroundResource(R.mipmap.zhensgh);
mBinding.pinnacleTime.tvStart.setBackgroundResource(R.mipmap.zhensgh);
}
}
}
@Override
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
@@ -606,10 +671,12 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
// 清空之前的数据
targetArrayIndex.clear();
finishTargetArrayIndex.clear();
if (blindReslutBean.getBlind_box_turntable_id() != null) {
blind_box_turntable_id = blindReslutBean.getBlind_box_turntable_id();
}
for (int i = 0; i < blindReslutBean.getReslut_list().size(); i++) {
BlindReslutBean.ReslutList reslutList = blindReslutBean.getReslut_list().get(i);
reslutListAll.add(reslutList.getGift_id());
for (int j = 0; j < giftLists.size(); j++) {
if (giftLists.get(j).getGift_id().equals(reslutList.getGift_id() + "")) {
@@ -617,7 +684,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
if (j < giftMaxCount) {
GiftCardView giftCardView = allViewsArray.get(j);
GiftBean giftBean = giftLists.get(j);
giftBean.setNumber(reslutList.getCount());
giftBean.setCount(reslutList.getCount());
if (!isOpenSpecial) {
giftCardView.setVisibilitymResultTextView(true);
@@ -625,9 +692,10 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
playSound("draw.mp3");
// 不要设置isDrawing=true这会影响动画控制
MvpPre.wallet();
String result = TextUtils.join(",", reslutListAll);
MvpPre.giftSend(result);
MvpPre.giftSend(blind_box_turntable_id);
}
giftCardView.bindGiftData(giftBean);
}
}
}
@@ -655,18 +723,26 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
@Override
public void wallet(WalletBean walletBean) {
if (walletBean != null){
if (type==10){
if (walletBean != null) {
if (type == 10) {
mBinding.mirroeSky.tvIcon.setText(walletBean.getCoin());
}else if (type==11){
} else if (type == 11) {
mBinding.cityTime.tvIcon.setText(walletBean.getCoin());
}else if (type==12){
} else if (type == 12) {
mBinding.pinnacleTime.tvIcon.setText(walletBean.getCoin());
}
}
}
// TODO: 2025/8/29 接收im推送过来的消息
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMusicPlay(RoomMessageEvent message) {
if (message.getMsgType() == 1056){
UpView(message.getText().getXlh_Data());
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
@@ -723,6 +799,9 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
player.release();
player = null;
}
if (!EventBus.getDefault().isRegistered( this)){
EventBus.getDefault().unregister(this);
}
// 建议进行垃圾回收
System.gc();
}

View File

@@ -328,7 +328,7 @@ public interface ApiServer {
@GET(Constants.GIFT_LIST)
//获取礼物列表
Observable<BaseModel<List<RoonGiftModel>>> getGiftList(@Query("label") int label);
Observable<BaseModel<List<RoonGiftModel>>> getGiftList(@Query("label") int label,@Query("room_id")String room_id);
@GET(Constants.TOPIC_LIST)
//获取话题

View File

@@ -917,8 +917,8 @@ public class RetrofitClient {
sApiServer.getGiftLabel(have_hot).compose(new DefaultTransformer<>()).subscribe(observer);
}
public void getGiftList(int type, BaseObserver<List<RoonGiftModel>> observer) {
sApiServer.getGiftList(type).compose(new DefaultTransformer<>()).subscribe(observer);
public void getGiftList(int type,String roomId, BaseObserver<List<RoonGiftModel>> observer) {
sApiServer.getGiftList(type,roomId).compose(new DefaultTransformer<>()).subscribe(observer);
}

View File

@@ -34,7 +34,7 @@ public class RewardGiftContacts {
void getGiftLabel(String have_hot);
void getGiftList(String id, int type);
void getGiftList(String id, int type,String roomId);
void giveGift(String user_id, String gid, String num, String to_uid, String gift_type);

View File

@@ -55,8 +55,8 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
}
@Override
public void getGiftList(String id, int type) {
api.getGiftList(Integer.parseInt(id), new BaseObserver<List<RoonGiftModel>>() {
public void getGiftList(String id, int type,String roomId) {
api.getGiftList(Integer.parseInt(id),roomId, new BaseObserver<List<RoonGiftModel>>() {
@Override
public void onSubscribe(Disposable d) {

View File

@@ -49,7 +49,7 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
private static int qos = 2;
// private static String HOST ="tcp://81.70.45.221";//正式
private static String HOST = "tcp://1.13.181.248";//测试
// private static String HOST = "tcp://47.120.21.132";//测试
// private static String HOST = "tcp://47.120.21.132";//测试
private static MqttAndroidClient mqttAndroidClient;
private MqttConnectOptions mMqttConnectOptions;
private static boolean b = true;
@@ -60,6 +60,8 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
private static MyEmqttSubscribeListener mMyEmqttSubscribeListener;
private static final String TOPIC_BOSS = "qx_room_topic";
private static final String TOPIC_XLH = "qx_xunlehui";
private static final int NOTIFICATION_ID = 1;
@@ -228,7 +230,8 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
@Override
public void onFailure(IMqttToken asyncActionToken,
Throwable exception) {
if (!TOPIC_BOSS.equals(topic) && mMyEmqttSubscribeListener != null) {
if ((!TOPIC_BOSS.equals(topic) && mMyEmqttSubscribeListener != null)
|| (!TOPIC_XLH.equals(topic) && mMyEmqttSubscribeListener != null)) {
mMyEmqttSubscribeListener.onSubscribeFailure();
}
Logger.e(TAG, "订阅失败:" + topic + ", error: " + exception.getMessage());
@@ -381,6 +384,7 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
}
Logger.e(TAG, "链接状态:", "链接成功");
subscribe(TOPIC_BOSS);
subscribe(TOPIC_XLH);
}
@Override
@@ -411,16 +415,19 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
try {
String messageStr = message.toString();
Logger.e(TAG, "收到的消息", "主题:" + topic + " 收到的消息:" + messageStr);
if (topic.equals(TOPIC_BOSS)) {
// 处理消息
receiveMessage(topic, messageStr);
// 处理消息
receiveMessage(topic, messageStr);
// 通知监听器
if (mMyEmqttMesgListener != null) {
// 切换到主线程通知
new Handler(Looper.getMainLooper()).post(() -> {
mMyEmqttMesgListener.messageArrived(topic, messageStr);
});
// 通知监听器
if (mMyEmqttMesgListener != null) {
// 切换到主线程通知
new Handler(Looper.getMainLooper()).post(() -> {
mMyEmqttMesgListener.messageArrived(topic, messageStr);
});
}
} else if (topic.equals(TOPIC_XLH)) {
receiveXlhMessage(messageStr);
}
} catch (Exception e) {
Log.e(TAG, "处理MQTT消息异常", e);
@@ -454,6 +461,25 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
}
};
private void receiveXlhMessage(String messageStr) {
try {
String newdata = messageStr;//TextLengthUtil.decode(data);
JSONObject jsonObject = JSON.parseObject(newdata);
int type = jsonObject.getIntValue("type");
String message = jsonObject.getString("msg");
// 将事件处理放到主线程执行
new Handler(Looper.getMainLooper()).post(() -> {
processMessageType(type, message);
});
} catch (Exception e) {
Log.e(TAG, "解析MQTT消息异常", e);
}
}
private void receiveMessage(String topic, String data) {
try {
String newdata = data;//TextLengthUtil.decode(data);
@@ -640,6 +666,7 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
}
cleanSubscribe(TOPIC_BOSS);
cleanSubscribe(TOPIC_XLH);
if (mqttAndroidClient != null) {
mqttAndroidClient.disconnect(); //断开连接
mqttAndroidClient.unregisterResources();
@@ -680,16 +707,16 @@ public class MyMqttService extends Service implements MyEmqttConnectListener, My
@Override
public void messageArrived(String topic, String mesg) {
LogUtils.e("lxj", "messageArrived:"+mesg);
}
@Override
public void onSubscribeSuccess(String topic) {
LogUtils.e("lxj", "onSubscribeSuccess:"+topic);
}
@Override
public void onSubscribeFailure() {
LogUtils.e("lxj", "onSubscribeFailure");
}
}

View File

@@ -367,7 +367,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
// 在主线程中播放动画
mainHandler.post(() -> {
if (isTxk) {
mBinding.playView.setLoop(20);
mBinding.playView.setLoop(1);
}
mBinding.playView.startPlay(downloadedFile);
});
@@ -381,7 +381,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
LogUtils.e("有缓存");
// 直接播放缓存文件
if (isTxk) {
mBinding.playView.setLoop(20);
mBinding.playView.setLoop(1);
}
mBinding.playView.startPlay(file);
}

View File

@@ -132,7 +132,7 @@ public class GiftCardView extends FrameLayout {
// 设置礼物数量
setCount(giftBean.getGift_price() != null ? giftBean.getGift_price() : "0");
setmResultTextView(giftBean.getNumber());
setmResultTextView(giftBean.getCount());
}
}

View File

@@ -191,7 +191,7 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
@Override
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans,fragmentList));
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans,fragmentList,""));
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
mBinding.slidingTabLayout.setCurrentTab(0);
}
@@ -291,17 +291,19 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
private List<GiftLabelBean> list;
private List<Fragment> fragmentList ;
private String roomId;
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list,List<Fragment> fragmentList) {
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list,List<Fragment> fragmentList,String roomId) {
super(fm);
this.list = list;
this.fragmentList = fragmentList;
this.roomId = roomId;
}
@Override
public Fragment getItem(int position) {
GiftLabelBean model = list.get(position);
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 2);
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 2, roomId);
fragmentList.add(fragment); // 保存 Fragment 实例
return fragment;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

View File

@@ -2,6 +2,7 @@ package com.example.moduleroom.activity;
import static android.app.PendingIntent.getActivity;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static com.liulishuo.okdownload.OkDownloadProvider.context;
@@ -57,6 +58,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.moduleroom.R;
import com.example.moduleroom.contacts.RoomContacts;
import com.example.moduleroom.databinding.ActivityRoomBinding;
import com.example.moduleroom.dialog.CardRelationshipFragment;
import com.example.moduleroom.dialog.ExitRoomBottomSheet;
import com.example.moduleroom.dialog.FriendsDialogFragment;
import com.example.moduleroom.dialog.PublishCommentDialogFragment;
@@ -83,6 +85,7 @@ import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
import com.xscm.moduleutil.bean.room.FriendInfo;
import com.xscm.moduleutil.bean.room.FriendUserBean;
import com.xscm.moduleutil.bean.room.RoomAuction;
import com.xscm.moduleutil.bean.room.RoomOnline;
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.databinding.RoomDialogMusicWindowOpenBinding;
@@ -190,6 +193,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
private PublicScreenEaseChatFragment publicScreenFragment; // 添加成员变量
// 添加成员变量
private boolean isLayoutAdjusted = false;
@Override
protected void onNewIntent(Intent intent) {
password = intent.getStringExtra("password");
@@ -645,22 +649,35 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
musicPlayBean.setPosition(text.getPosition());
EventBus.getDefault().post(musicPlayBean);
} else if (messageEvent.getMsgType() == 1003) {//上麦操作
//
// RoomWheatEvent roomWheatEvent = new RoomWheatEvent();
// roomWheatEvent.setRoomId(roomId);
// roomWheatEvent.setOccupied(true);
// EventBus.getDefault().post(roomWheatEvent);
if (messageEvent.getText().getPit_number().equals("9") && messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
mBinding.roomTop.rl.setVisibility(View.VISIBLE);
}
RoomPitBean pitBean = mRoomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(messageEvent.getText().getPit_number()) - 1);
pitBean.setUser_id(messageEvent.getText().getFromUserInfo().getUser_id() + "");
pitBean.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
pitBean.setCharm(messageEvent.getText().getFromUserInfo().getCharm());
pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
mRoomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(messageEvent.getText().getPit_number()) - 1, pitBean);
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
aBoolean = false;
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
setBoolean(aBoolean);
mRoomInfoResp.getUser_info().setPit_number(messageEvent.getText().getPit_number() != null ? Integer.parseInt(messageEvent.getText().getPit_number()) : 0);
setRoleType(3, Integer.parseInt(messageEvent.getText().getPit_number()));
switchMic(2);
}
if (mRoomInfoResp.getRoom_info().getType_id().equals("2")) {///拍卖房上麦操作
if (messageEvent.getText().getPit_number().equals("9")) {
mRoomInfoResp.getRoom_info().getPit_list().set(0, getPitBean(messageEvent));
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(messageEvent.getText().getPit_number()));
}
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
RoomPitBean pitBean = mRoomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(messageEvent.getText().getPit_number()) - 1);
pitBean.setUser_id(messageEvent.getText().getFromUserInfo().getUser_id() + "");
pitBean.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
pitBean.setCharm(messageEvent.getText().getFromUserInfo().getCharm());
pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
mRoomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(messageEvent.getText().getPit_number()) - 1, pitBean);
}
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
} else if (messageEvent.getMsgType() == 1004) {//下麦操作
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId() && messageEvent.getText().getPit_number().equals("9")) {
@@ -671,15 +688,75 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
mBinding.roomTop.rl.setVisibility(GONE);
}
}
RoomPitBean pitBean = mRoomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(messageEvent.getText().getPit_number()) - 1);
pitBean.setUser_id("");
pitBean.setAvatar("");
pitBean.setNickname("");
pitBean.setSex("");
pitBean.setCharm("");
pitBean.setDress("");
mRoomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(messageEvent.getText().getPit_number()) - 1, pitBean);
if (mRoomInfoResp.getRoom_info().getType_id().equals("2")) {
if (messageEvent.getText().getPit_number().equals("9")) {
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
mRoomInfoResp.getRoom_info().getPit_list().set(0, getPitBean2(messageEvent, "9"));
mRoomInfoResp.getUser_info().setPit_number(0);
}
} else if (messageEvent.getText().getPit_number().equals("888")) {
mRoomInfoResp.setRoom_auction(null);
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
setRoleType(0, 0);
switchMic(2);
}
}
} else {
RoomPitBean pitBean = mRoomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(messageEvent.getText().getPit_number()) - 1);
pitBean.setUser_id("");
pitBean.setAvatar("");
pitBean.setNickname("");
pitBean.setSex("");
pitBean.setCharm("");
pitBean.setDress("");
mRoomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(messageEvent.getText().getPit_number()) - 1, pitBean);
}
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
// mBinding.ivWheatFeeding.setImageResource(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
aBoolean = true;
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
setBoolean(aBoolean);
mRoomInfoResp.getUser_info().setPit_number(0);
setRoleType(0, 0);
switchMic(2);
}
} else if (messageEvent.getMsgType() == 1022) {
if (messageEvent.getText().getType() == 1) {//拍卖位上麦
if (messageEvent.getText().getPit_number().equals("888")) {
mRoomInfoResp.getRoom_auction().setAuction_user(getPitBean3(messageEvent));
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
setRoleType(3, 888);
switchMic(2);
// parentFragment.setRoleType(3, 888);
// parentFragment.switchMic(2);
}
}
int type = -1; // 或其他默认值
if (mRoomInfoResp.getRoom_info().getType_id().equals("2")) {
type = (mRoomInfoResp.getRoom_info().getLabel_id().equals("1")) ? 1 : 2;
}
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
CardRelationshipFragment.show(mRoomInfoResp.getRoom_info().getRoom_id(), SpUtil.getUserId() + "", type+"", getSupportFragmentManager());
}
} else if (messageEvent.getText().getType() == 2) {//拍卖位下麦
if (messageEvent.getText().getPit_number().equals("9")) {
mRoomInfoResp.getRoom_info().getPit_list().set(0, getPitBean2(messageEvent, "9"));
mRoomInfoResp.getUser_info().setPit_number(0);
setRoleType(0, 0);
switchMic(2);
} else if (messageEvent.getText().getPit_number().equals("888")) {
mRoomInfoResp.setRoom_auction(new RoomAuction());
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
setRoleType(0, 0);
switchMic(2);
}
}
}
} else if (messageEvent.getMsgType() == 1020) {
mRoomBean = messageEvent.getText().getRoomInfo();
EventBus.getDefault().post(mRoomBean);
@@ -801,6 +878,44 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
}
// TODO: 2025/6/30 上麦,麦位变化
private RoomPitBean getPitBean(RoomMessageEvent messageEvent) {
RoomPitBean pitBean = new RoomPitBean();
pitBean.setPit_number(messageEvent.getText().getPit_number());
pitBean.setUser_id(messageEvent.getText().getFromUserInfo().getUser_id() + "");
pitBean.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
pitBean.setCharm(messageEvent.getText().getFromUserInfo().getCharm());
return pitBean;
}
// TODO: 2025/6/30 下麦麦位变化
private RoomPitBean getPitBean2(RoomMessageEvent messageEvent, String number) {
RoomPitBean pitBean = new RoomPitBean();
pitBean.setPit_number(messageEvent != null ? messageEvent.getText().getPit_number() : number);
pitBean.setUser_id("");
pitBean.setAvatar("");
pitBean.setNickname("");
pitBean.setSex("");
pitBean.setCharm("");
pitBean.setIs_pm(1);
return pitBean;
}
// TODO: 2025/8/29 排麦位上麦
private RoomAuction.AuctionUserBean getPitBean3(RoomMessageEvent messageEvent) {
RoomAuction.AuctionUserBean roomAuction = new RoomAuction().getAuction_user();
roomAuction.setUser_id(messageEvent.getText().getFromUserInfo().getUser_id() + "");
roomAuction.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
roomAuction.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
roomAuction.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
roomAuction.setCharm(messageEvent.getText().getFromUserInfo().getCharm());
return roomAuction;
}
public void mus() {
if (mRoomInfoResp.getUser_info().getIs_mute().equals("1")) {
com.hjq.toast.ToastUtils.show("您已经被禁言");
@@ -1435,7 +1550,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
} else {
Log.e("Fragment", "Fragment transaction skipped due to state loss.");
}
LogUtils.e("加入",roomId);
LogUtils.e("加入", roomId);
MessageListenerSingleton.getInstance().joinGroup(roomId);
CommonAppContext.getInstance().isPlaying = true;
CommonAppContext.getInstance().playId = roomId;
@@ -1954,7 +2069,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
AgoraManager.getInstance(this).leaveRoom();
AgoraManager.getInstance(this).cleanup();
MyRoomSingleton.getInstance().onExitRoom();
LogUtils.e("退出im",roomId);
LogUtils.e("退出im", roomId);
MessageListenerSingleton.reset(roomId);
// if (publicScreenFragment != null) {
// getSupportFragmentManager().beginTransaction().remove(publicScreenFragment).commitAllowingStateLoss();
@@ -1966,7 +2081,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
/// 小黑屋退出房间后调用这个加入房间
public void jiaR() {
LogUtils.e("@@@","上一个房间的roonid"+AgoraManager.getInstance(context).getLastRoomId());
LogUtils.e("@@@", "上一个房间的roonid" + AgoraManager.getInstance(context).getLastRoomId());
MvpPre.getRoomIn(AgoraManager.getInstance(context).getLastRoomId(), "");
AgoraManager.getInstance(context).setLastRoomId("");
setviewyc(true);
@@ -2242,7 +2357,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}

View File

@@ -362,6 +362,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
mBinding.llGiftRule.setVisibility(View.GONE);
} else {
if (event.gift.getActivities_id() == 5) {
this.dismiss();
showGiftLotteryDialog(event.gift, roomId);
return;
// String userId = gifyuseradapter.getUserIdToString();
@@ -394,14 +395,26 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
return;
}
// 如果当前dialog存在且正在显示先关闭
if (currentDialog != null && currentDialog.isVisible()) {
currentDialog.dismiss();
}
FragmentManager fm = getParentFragmentManager();
GiftLotteryDialog newDialog = GiftLotteryDialog.newInstance(gift.getGift_bag()+"", roomId, userId);
newDialog.show(fm, "GiftLotteryDialog");
currentDialog = GiftLotteryDialog.newInstance(gift.getGift_bag()+"", roomId, userId);
currentDialog.show(getChildFragmentManager(), "GiftLotteryDialog");
fm.beginTransaction()
.replace(getId(), newDialog)
.addToBackStack(null)
.commit();
// 如果当前dialog存在且正在显示先关闭
// if (currentDialog != null && currentDialog.isVisible()) {
// currentDialog.dismiss();
// }
// currentDialog = GiftLotteryDialog.newInstance(gift.getGift_bag()+"", roomId, userId);
// currentDialog.show(getChildFragmentManager(), "GiftLotteryDialog");
}
public void setGiftDetail(RoonGiftModel giftDetailResp) {
if (giftDetailResp == null) {
return;
@@ -552,7 +565,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
giftLabelBean.setId("0");
giftLabelBean.setName("背包");
giftLabelBeans.add(0, giftLabelBean);
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans, fragmentList));
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans, fragmentList,roomId));
mBinding.viewPager.setOffscreenPageLimit(0);
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
mBinding.slidingTabLayout.setCurrentTab(1);
@@ -599,18 +612,19 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
private List<GiftLabelBean> list;
private List<Fragment> fragmentList;
private String roomId;
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list, List<Fragment> fragmentList) {
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list, List<Fragment> fragmentList,String roomId) {
super(fm);
this.list = list;
this.fragmentList = fragmentList;
this.roomId = roomId;
}
@Override
public Fragment getItem(int position) {
GiftLabelBean model = list.get(position);
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 1);
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 1, roomId);
fragmentList.add(fragment); // 保存 Fragment 实例
return fragment;
}

View File

@@ -24,6 +24,7 @@ import com.example.moduleroom.databinding.DialogRoomSettingFragmentBinding;
import com.example.moduleroom.fragment.RoomBackgroundDialogFragment;
import com.hjq.toast.ToastUtils;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.dialog.ConfirmDialog;
import com.xscm.moduleutil.event.EffectEvent;
import com.xscm.moduleutil.event.MusicEvent;
import com.xscm.moduleutil.event.RoomOutEvent;
@@ -83,10 +84,9 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
read = 1;
} else if (roomInfoResp.getUser_info().getIs_management() != 0) {
read = 2;
}
else if (roomInfoResp.getUser_info().getIs_host() != 0 ) {
} else if (roomInfoResp.getUser_info().getIs_host() != 0) {
read = 3;
}else {
} else {
read = 4;
}
if (roomInfoResp.getUser_info().getPit_number() != 0) {
@@ -145,7 +145,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
dataList.add(new RoomSettingBean("房间补贴", "ic_subsidy", null, null, RoomSettingBean.QXRoomSettingTypeRoomSubsidy, read, isSelected, false, false));
dataList.add(new RoomSettingBean("主持设置", "ic_compere", null, null, RoomSettingBean.QXRoomSettingTypeRoomCompere, read, isSelected, false, false));
dataList.add(new RoomSettingBean("清空消息", "ic_clear_message", null, null, RoomSettingBean.QXRoomSettingTypeRoomClearMessage, read, isSelected, false, false));
dataList.add(new RoomSettingBean("排麦模式", "ic_order_mic", null, null, QXRoomSettingTypeRoomOrderMic, read, isSelected,false, roomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1")));//等于1的时候是排麦模式等于2的时候是自由模式这里判断是否是拍卖模式
dataList.add(new RoomSettingBean("排麦模式", "ic_order_mic", null, null, QXRoomSettingTypeRoomOrderMic, read, isSelected, false, roomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1")));//等于1的时候是排麦模式等于2的时候是自由模式这里判断是否是拍卖模式
dataList.add(new RoomSettingBean("背景音乐", "ic_bg_music", null, null, RoomSettingBean.QXRoomSettingTypeRoomBgMusic, read, isSelected, false, false));
dataList.add(new RoomSettingBean("背景图片", "ic_bg_image", null, null, RoomSettingBean.QXRoomSettingTypeRoomBgImage, read, isSelected, false, false));
@@ -155,7 +155,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
dataList.add(new RoomSettingBean("调音台", "ic_my_dress", null, null, RoomSettingBean.QXRoomSettingTypeRoomMyDress, read, isSelected, false, false));
dataList.add(new RoomSettingBean("房间设置", "ic_room_setting", null, null, RoomSettingBean.QXRoomSettingTypeRoomSetting, read, isSelected, false, false));
// dataList.add(new RoomSettingBean("房间欢迎语", "ic_welcome", null, null, RoomSettingBean.QXRoomSettingTypeRoomWelcome,read,isSelected, false));
dataList.add(new RoomSettingBean("关闭特效", "ic_close_effects", null, null, RoomSettingBean.QXRoomSettingTypeRoomCloseEffects, read, isSelected, false,effectOn));
dataList.add(new RoomSettingBean("关闭特效", "ic_close_effects", null, null, RoomSettingBean.QXRoomSettingTypeRoomCloseEffects, read, isSelected, false, effectOn));
dataList.add(new RoomSettingBean("举报", "ic_report", null, null, RoomSettingBean.QXRoomSettingTypeRoomReport, read, isSelected, false, false));
List<RoomSettingBean> filteredList = new ArrayList<>();
// 更新 itemType
@@ -247,27 +247,47 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomLeave) {
EventBus.getDefault().post(new RoomOutEvent());
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeSing) {
MvpPre.changeRoomType(roomId, "1");
// MvpPre.changeRoomType(roomId, "1");
queren("1");
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction) {
MvpPre.changeRoomType(roomId, "2");
// MvpPre.changeRoomType(roomId, "2");
queren("2");
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy) {
MvpPre.changeRoomType(roomId, "3");
// MvpPre.changeRoomType(roomId, "3");
queren("3");
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl) {
MvpPre.changeRoomType(roomId, "4");
}
else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy) {
MvpPre.changeRoomType(roomId, "7");
}
else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomSetting) {
// MvpPre.changeRoomType(roomId, "4");
queren("4");
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy) {
// MvpPre.changeRoomType(roomId, "7");
queren("7");
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomSetting) {
ARouter.getInstance().build(ARouteConstants.CREATED_ROOM).withSerializable("roomInfoResp", roomInfoResp).navigation();
}else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomReport){
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + 2 + "&fromId=" + roomId).navigation();
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomReport) {
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + 2 + "&fromId=" + roomId).navigation();
}
}
});
}
// TODO: 2025/8/29 房间切换提示框
private void queren(String type) {
// 创建并显示确认对话框
new ConfirmDialog(getActivity(),
"提示",
"即将修改房间类型为" + (type.equals("1") ? "点唱" : (type.equals("2") ? "拍卖" : (type.equals("3") ? "男神" : (type.equals("4") ? "女神" : (type.equals("7") ? "交友" : ""))))),
"确认",
"取消",
v -> {
// 点击“确认”按钮时执行删除操作
MvpPre.changeRoomType(roomId, type);
},
v -> {
// 点击“取消”按钮时什么都不做
}, false, 0).show();
}
private void upAdapter() {
adapter.notifyDataSetChanged();
}
@@ -277,8 +297,8 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
int roleLevel = bean.getRead(); // 角色等级
boolean onMic = false; // 是否是特定房间
if (roomInfoResp.getRoom_info().getType_id().equals("1") && roomInfoResp.getRoom_info().getLabel_id().equals("2") ){
onMic=true;
if (roomInfoResp.getRoom_info().getType_id().equals("1") && roomInfoResp.getRoom_info().getLabel_id().equals("2")) {
onMic = true;
}
// 房主显示全部
@@ -289,13 +309,13 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
}
}
return true;
}else if (roleLevel == 2 || roleLevel == 3){
if (type== RoomSettingBean.QXRoomSettingTypeRoomTypeSing || type == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction ||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy || type == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl||
type== RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic
|| type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage||type == -1){
if (onMic ) {
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
} else if (roleLevel == 2 || roleLevel == 3) {
if (type == RoomSettingBean.QXRoomSettingTypeRoomTypeSing || type == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction ||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy || type == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl ||
type == RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic
|| type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage || type == -1) {
if (onMic) {
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) {
return false;
}
}
@@ -372,10 +392,10 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
@Override
public void changeRoomSuccess(String s, int position, RoomSettingBean bean) {
if (bean.isSelect()){
if (bean.isSelect()) {
bean.setSelect(false);
adapter.notifyItemChanged(position);
}else {
} else {
bean.setSelect(true);
adapter.notifyItemChanged(position);
}

View File

@@ -227,7 +227,7 @@ public class RoomWheatGiftSettingFragment extends BaseMvpDialogFragment<RewardGi
@Override
public Fragment getItem(int position) {
Fragment fragment = GiftTwoDetailsFragment.newInstance("1", 0);
Fragment fragment = GiftTwoDetailsFragment.newInstance("1", 0,"");
fragmentList.add(fragment); // 保存 Fragment 实例
return fragment;
}

View File

@@ -616,6 +616,9 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
} else if (message.getMsgType() == 1055) {
EventBus.getDefault().post(message);
return;
}else if (message.getMsgType()==1056 || message.getMsgType()==1057){
EventBus.getDefault().post(message);
return;
}
EventBus.getDefault().post(message);
// easeChatAdapter.addData(new EMMessageInfo(message));

View File

@@ -48,6 +48,7 @@ import com.xscm.moduleutil.dialog.ConfirmDialog;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.ImageUtils;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
import com.xscm.moduleutil.widget.RoomMakeWheatView;
import org.greenrobot.eventbus.EventBus;
@@ -82,56 +83,41 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
private int type;
RoomFragment parentFragment;
public static RoomAuctionFragment newInstance(RoomInfoResp roomInfoResp, int type) {
public static RoomAuctionFragment newInstance() {
Bundle args = new Bundle();
RoomAuctionFragment fragment = new RoomAuctionFragment();
args.putSerializable("roomInfo", roomInfoResp);
args.putInt("type", type);
fragment.setArguments(args);
return fragment;
}
// public static RoomAuctionFragment newInstance(RoomInfoResp roomInfoResp, int type) {
//
// Bundle args = new Bundle();
//
// RoomAuctionFragment fragment = new RoomAuctionFragment();
// args.putSerializable("roomInfo", roomInfoResp);
// args.putInt("type", type);
// fragment.setArguments(args);
// return fragment;
// }
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfo");
type = getArguments().getInt("type");
// roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfo");
// type = getArguments().getInt("type");
}
@Override
protected RoomAuctionPresenterTow bindPresenter() {
return new RoomAuctionPresenterTow(this, getActivity());
}
public void initOverlayButtons() {
// if (isButtonsInflated) return;
stub = requireActivity().findViewById(R.id.stub_buttons);
if (stub != null) {
View inflated = stub.inflate();
imActionJs = inflated.findViewById(R.id.im_action_ys);
imActionYs = inflated.findViewById(R.id.im_action_js);
if (imActionJs != null && imActionYs != null) {
// 设置点击事件
imActionJs.setOnClickListener(this::onChock);
imActionYs.setOnClickListener(this::onChock);
// isButtonsInflated = true;
} else {
// 报错提示:说明 top_overlay_buttons.xml 中没有定义这些 id
throw new IllegalStateException("im_action_js or im_action_ys not found in overlay layout");
}
///更新数据
public void roomInfoUpdate(RoomInfoResp resp) {
roomInfoResp = resp;
if (roomInfoResp.getRoom_info().getLabel_id().equals("1")){
type=1;
}else if (roomInfoResp.getRoom_info().getLabel_id().equals("2")){
type=2;
}
}
@Override
protected void initData() {
initOverlayButtons();
LogUtils.e("lxj", "展示room时间" + TimeUtils.date2String(new Date()));
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).setvisibTop(true);
}
@@ -141,6 +127,15 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
wheatView.setData(roomPitBean);
imActionJs.setVisibility(VISIBLE);
}else {
RoomPitBean pitBean =new RoomPitBean();
pitBean.setUser_id("");
pitBean.setPit_number("9");
pitBean.setAvatar("");
pitBean.setNickname("");
pitBean.setSex("");
pitBean.setCharm("");
wheatView.setData(pitBean);
}
parentFragment = (RoomFragment) getParentFragment();
@@ -213,6 +208,56 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
}
@Override
protected RoomAuctionPresenterTow bindPresenter() {
return new RoomAuctionPresenterTow(this, getActivity());
}
///主持上麦
public void auctionData(RoomMessageEvent messageEvent){
// wheatView.setData(getPitBean(messageEvent));
if (messageEvent.getText().getPit_number().equals("9")) {
wheatView.setData(getPitBean(messageEvent));
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
imActionJs.setVisibility(View.VISIBLE);
imActionYs.setVisibility(View.VISIBLE);
parentFragment.updateWheatStatus(getPitBean(messageEvent), 9, true, true);
} else {
getvjs();
imActionYs.setVisibility(INVISIBLE);
}
}
}
public void initOverlayButtons() {
// if (isButtonsInflated) return;
stub = requireActivity().findViewById(R.id.stub_buttons);
if (stub != null) {
View inflated = stub.inflate();
imActionJs = inflated.findViewById(R.id.im_action_ys);
imActionYs = inflated.findViewById(R.id.im_action_js);
if (imActionJs != null && imActionYs != null) {
// 设置点击事件
imActionJs.setOnClickListener(this::onChock);
imActionYs.setOnClickListener(this::onChock);
// isButtonsInflated = true;
} else {
// 报错提示:说明 top_overlay_buttons.xml 中没有定义这些 id
throw new IllegalStateException("im_action_js or im_action_ys not found in overlay layout");
}
}
}
@Override
protected void initData() {
}
private void getvjs() {
if (roomInfoResp.getUser_info().getIs_room_owner() == 1 || roomInfoResp.getUser_info().getIs_management() == 1 || roomInfoResp.getUser_info().getIs_host() == 1) {
imActionJs.setVisibility(VISIBLE);
@@ -351,18 +396,6 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
private void getTextView() {
// int defaultColor = ContextCompat.getColor(requireContext(), com.qxcm.moduleutil.R.color.color_0DFFB9); // 原亲密拍颜色
// int selectedColor = Color.WHITE; // 原真爱拍颜色
// float defaultSize = 24f; // 亲密拍默认字体大小
// float selectedSize = 16f; // 真爱拍默认字体大小
// if (type == 1) {
// toggleTextStyles(mBinding.qinmi, mBinding.zhenai, defaultColor, selectedColor, defaultSize, selectedSize, type);
// }else {
// toggleTextStyles(mBinding.qinmi, mBinding.zhenai, defaultColor, selectedColor, defaultSize, selectedSize, type);
// }
//
//
int defaultColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_0DFFB9); // 亲密拍默认颜色
int selectedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white); // 切换到真爱拍的颜色
float defaultSize = 24f; // 亲密拍默认字体大小
@@ -586,52 +619,29 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
// @Subscribe(threadMode = ThreadMode.MAIN)
public void roomInfoEvent(RoomMessageEvent messageEvent) {
boolean b = false;
if (messageEvent.getMsgType() == 1003) {//上麦
if (messageEvent.getText().getPit_number().equals("9")) {
wheatView.setData(getPitBean(messageEvent));
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
imActionJs.setVisibility(View.VISIBLE);
imActionYs.setVisibility(View.VISIBLE);
parentFragment.updateWheatStatus(getPitBean(messageEvent), 9, true, true);
// parentFragment.setRoleType(3, 9);
// parentFragment.switchMic(2);
} else {
getvjs();
imActionYs.setVisibility(INVISIBLE);
// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
// parentFragment.setRoleType(3, 0);
// parentFragment.switchMic(2);
// }
}
}
} else if (messageEvent.getMsgType() == 1004) {
// if (messageEvent.getMsgType() == 1003) {//上麦
// if (messageEvent.getText().getPit_number().equals("9")) {
// wheatView.setData(getPitBean(messageEvent));
// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
// imActionJs.setVisibility(View.VISIBLE);
// imActionYs.setVisibility(View.VISIBLE);
//
// parentFragment.updateWheatStatus(getPitBean(messageEvent), 9, true, true);
// } else {
// getvjs();
// imActionYs.setVisibility(INVISIBLE);
// }
// }
// } else
if (messageEvent.getMsgType() == 1004) {
if (messageEvent.getText().getPit_number().equals("9")) {
wheatView.setData(getPitBean2(messageEvent, "9"));
getvjs();
imActionYs.setVisibility(GONE);
// RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(messageEvent.getText().getPit_number()) - 1);
// pitBean.setUser_id("");
// pitBean.setAvatar("");
// pitBean.setNickname("");
// pitBean.setSex("");
// pitBean.setCharm("");
// roomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(messageEvent.getText().getPit_number()) - 1, pitBean);
// if (SpUtil.getUserId() == messageEvent.getText().getFromUserInfo().getUser_id()) {
//
// AgoraManager.getInstance(getActivity()).ClientRole(false);
// AgoraManager.getInstance(getActivity()).muteLocalAudioStream(true);
// } else {
// b = false;
// }
//// AgoraManager.getInstance(getActivity()).setEnableAudio(b);
// if (parentFragment != null) {
// parentFragment.updateWheatStatus(pitBean, Integer.parseInt(messageEvent.getText().getPit_number()), false, b);
// }
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
RoomPitBean pitBean = wheatView.pitBean;
@@ -1053,8 +1063,6 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
// TODO: 2025/6/30 上麦,麦位变化
private RoomPitBean getPitBean(RoomMessageEvent messageEvent) {
RoomFragment parentFragment = (RoomFragment) getParentFragment();
boolean b;
RoomPitBean pitBean = new RoomPitBean();
pitBean.setPit_number(messageEvent.getText().getPit_number());
pitBean.setUser_id(messageEvent.getText().getFromUserInfo().getUser_id() + "");
@@ -1063,17 +1071,6 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
pitBean.setCharm(messageEvent.getText().getFromUserInfo().getCharm());
// if (SpUtil.getUserId() == messageEvent.getText().getFromUserInfo().getUser_id()) {
// b = true;
// AgoraManager.getInstance(getActivity()).ClientRole(true);
// AgoraManager.getInstance(getActivity()).muteLocalAudioStream(false);
// } else {
// b = false;
// }
if (parentFragment != null) {
// parentFragment.updateWheatStatus(pitBean, Integer.parseInt(messageEvent.getText().getPit_number()), true, b);
}
return pitBean;
}
@@ -1093,18 +1090,18 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}
// if (!EventBus.getDefault().isRegistered(this)) {
// EventBus.getDefault().register(this);
// }
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
// if (EventBus.getDefault().isRegistered(this)) {
// EventBus.getDefault().unregister(this);
// }
}
/**
@@ -1134,4 +1131,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
}
///
}

View File

@@ -278,6 +278,13 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
}
}else if ("2".equals(typeId)){//拍卖房
RoomAuctionFragment auctionRoomFragment = (RoomAuctionFragment) getChildFragmentManager()
.findFragmentByTag(RoomAuctionFragment.class.getSimpleName());
if (auctionRoomFragment != null && auctionRoomFragment.isAdded()){
auctionRoomFragment.roomInfoUpdate(mRoomInfoResp);
}
}
}
});
@@ -376,9 +383,11 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
}
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("2")) {
if (mRoomInfoResp.getRoom_info().getLabel_id().equals("1")) {
replaceNestedFragment(RoomAuctionFragment.newInstance(mRoomInfoResp, 1), R.id.container);
replaceNestedFragment(RoomAuctionFragment.newInstance(), R.id.container);
// replaceNestedFragment(RoomAuctionFragment.newInstance(mRoomInfoResp, 1), R.id.container);
} else if (mRoomInfoResp.getRoom_info().getLabel_id().equals("2")) {
replaceNestedFragment(RoomAuctionFragment.newInstance(mRoomInfoResp, 2), R.id.container);
replaceNestedFragment(RoomAuctionFragment.newInstance(), R.id.container);
// replaceNestedFragment(RoomAuctionFragment.newInstance(mRoomInfoResp, 2), R.id.container);
}
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
replaceNestedFragment(RoomCabinFragment.newInstance(mRoomInfoResp), R.id.container);
@@ -398,12 +407,8 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
replaceNestedFragment(RoomKtvFragment.newInstance(mRoomInfoResp), R.id.container);
}
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
// if (getActivity() instanceof RoomActivity) {
// ((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj);
// }
replaceNestedFragment(FriendshipRoomFragment.newInstance(), R.id.container);
}
// mBinding.inputMenu1.performClick();
instView();
setview();
@@ -486,7 +491,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upRoomInfo(mRoomInfoResp);
}
updateSeatViewExchangedWithPitArray(mRoomInfoResp);
}
public void updateSeatViewExchangedWithPitArray(RoomInfoResp roomInfoResp) {
@@ -1139,7 +1144,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
);
}
@Subscribe(threadMode = ThreadMode.MAIN)
// @Subscribe(threadMode = ThreadMode.MAIN)
public void roomInfoEvent(RoomMessageEvent messageEvent) {
if (messageEvent.getMsgType() == 123) {
// // 获取 PublicScreenEaseChatFragment 实例
@@ -1150,28 +1155,31 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
// 调用 someMethod 方法
publicScreenEaseChatFragment.someMethod();
}
} else if (messageEvent.getMsgType() == 1003) {
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
// mBinding.ivWheatFeeding.setImageResource(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
aBoolean = false;
((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
((RoomActivity) getActivity()).setBoolean(aBoolean);
mRoomInfoResp.getUser_info().setPit_number(messageEvent.getText().getPit_number() != null ? Integer.parseInt(messageEvent.getText().getPit_number()) : 0);
((RoomActivity) getActivity()).setRoleType(3, Integer.parseInt(messageEvent.getText().getPit_number()));
((RoomActivity) getActivity()).switchMic(2);
}
} else if (messageEvent.getMsgType() == 1004) {
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
// mBinding.ivWheatFeeding.setImageResource(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
aBoolean = true;
((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
((RoomActivity) getActivity()).setBoolean(aBoolean);
mRoomInfoResp.getUser_info().setPit_number(0);
((RoomActivity) getActivity()).setRoleType(0, 0);
((RoomActivity) getActivity()).switchMic(2);
}
// setRoleType(messageEvent.getRoleType(), messageEvent.getPit_number());
} else if (messageEvent.getMsgType() == 1034) {
}
// else if (messageEvent.getMsgType() == 1003) {
// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
//// mBinding.ivWheatFeeding.setImageResource(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
// aBoolean = false;
// ((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
// ((RoomActivity) getActivity()).setBoolean(aBoolean);
// mRoomInfoResp.getUser_info().setPit_number(messageEvent.getText().getPit_number() != null ? Integer.parseInt(messageEvent.getText().getPit_number()) : 0);
// ((RoomActivity) getActivity()).setRoleType(3, Integer.parseInt(messageEvent.getText().getPit_number()));
// ((RoomActivity) getActivity()).switchMic(2);
// }
// }
// else if (messageEvent.getMsgType() == 1004) {
// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
//// mBinding.ivWheatFeeding.setImageResource(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
// aBoolean = true;
// ((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
// ((RoomActivity) getActivity()).setBoolean(aBoolean);
// mRoomInfoResp.getUser_info().setPit_number(0);
// ((RoomActivity) getActivity()).setRoleType(0, 0);
// ((RoomActivity) getActivity()).switchMic(2);
// }
//// setRoleType(messageEvent.getRoleType(), messageEvent.getPit_number());
// } else
if (messageEvent.getMsgType() == 1034) {
int count = messageEvent.getText().getCount();
if (count == 0) {
((RoomActivity) getActivity()).tvFirst(new SpannableStringBuilder("0人排队"));
@@ -1219,4 +1227,12 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
// }
///拍卖房上麦数据
public void auctionData(RoomMessageEvent messageEvent){
RoomAuctionFragment auctionFragment = (RoomAuctionFragment) getChildFragmentManager()
.findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
if (auctionFragment != null)
auctionFragment.auctionData(messageEvent);
}
}

View File

@@ -36,7 +36,7 @@ public class CardRelationshipPresenter extends BasePresenter<CardRelationshipCon
@Override
public void getGiftList(String id) {
api.getGiftList(Integer.parseInt(id), new BaseObserver<List<RoonGiftModel>>() {
api.getGiftList(Integer.parseInt(id),"", new BaseObserver<List<RoonGiftModel>>() {
@Override
public void onSubscribe(Disposable d) {