1:修改卡顿问题,
2:修改玄镜的动画 3:修改转盘获取数据 4:修改排行榜
This commit is contained in:
@@ -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;
|
||||
@@ -41,6 +42,7 @@ import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -49,6 +51,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
@@ -74,10 +77,14 @@ import com.example.moduleroom.dialog.RoomOnlineDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomPkDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomSettingFragment;
|
||||
import com.example.moduleroom.dialog.SoundEffectsDialogFragment;
|
||||
import com.example.moduleroom.fragment.FriendshipRoomFragment;
|
||||
import com.example.moduleroom.fragment.PublicScreenEaseChatFragment;
|
||||
import com.example.moduleroom.fragment.RoomAuctionFragment;
|
||||
import com.example.moduleroom.fragment.RoomCabinFragment;
|
||||
import com.example.moduleroom.fragment.RoomChartsFragment;
|
||||
import com.example.moduleroom.fragment.RoomKtvFragment;
|
||||
import com.example.moduleroom.fragment.RoomNoticeDialogFragment;
|
||||
import com.example.moduleroom.fragment.SingSongFragment;
|
||||
import com.petterp.floatingx.assist.helper.FxScopeHelper;
|
||||
import com.petterp.floatingx.listener.control.IFxControl;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
@@ -98,9 +105,11 @@ import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
||||
import com.xscm.moduleutil.dialog.giftLottery.GiftLotteryDialog;
|
||||
import com.xscm.moduleutil.dialog.giftLottery.TourClubDialogFragment;
|
||||
import com.xscm.moduleutil.event.ColoseCardEvent;
|
||||
import com.xscm.moduleutil.event.EffectEvent;
|
||||
import com.xscm.moduleutil.event.MusicEvent;
|
||||
import com.xscm.moduleutil.event.QXRoomSeatViewType;
|
||||
import com.xscm.moduleutil.event.RoomGiftGiveEvent;
|
||||
import com.xscm.moduleutil.event.RoomInputHideEvent;
|
||||
import com.xscm.moduleutil.event.RoomOutEvent;
|
||||
@@ -378,6 +387,61 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
return false;
|
||||
}
|
||||
|
||||
public void tob() {
|
||||
LinearLayout stub = mBinding.roomTop.stubButtons2;
|
||||
stub.setVisibility(VISIBLE);
|
||||
ImageView imActionJs = mBinding.roomTop.imActionJs.findViewById(R.id.im_action_js);
|
||||
ImageView imActionYs = mBinding.roomTop.imActionYs.findViewById(R.id.im_action_ys);
|
||||
if (imActionJs != null && imActionYs != null) {
|
||||
imActionJs.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dialogEnd();
|
||||
}
|
||||
});
|
||||
imActionYs.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MvpPre.auctionDelay(SpUtil.getauctionId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void upTop() {
|
||||
mBinding.roomTop.stubButtons2.setVisibility(GONE);
|
||||
}
|
||||
|
||||
private void dialogEnd() {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(this,
|
||||
"提示",
|
||||
"您确定要结束本次拍卖吗?",
|
||||
"确认",
|
||||
"取消",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
MvpPre.auctionEnd(SpUtil.getauctionId(), roomId);
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
}, false, 0).show();
|
||||
}
|
||||
|
||||
public void upVisibility(boolean visible) {
|
||||
mBinding.roomTop.imActionJs.setVisibility(visible ? VISIBLE : INVISIBLE);
|
||||
mBinding.roomTop.imActionYs.setVisibility(visible ? VISIBLE : INVISIBLE);
|
||||
}
|
||||
|
||||
public void upJs(boolean visible) {
|
||||
mBinding.roomTop.imActionJs.setVisibility(visible ? VISIBLE : INVISIBLE);
|
||||
}
|
||||
|
||||
public void upYs(boolean visible) {
|
||||
mBinding.roomTop.imActionYs.setVisibility(visible ? VISIBLE : INVISIBLE);
|
||||
}
|
||||
|
||||
/// 最小化
|
||||
private void showExitRoomDialog() {
|
||||
ExitRoomBottomSheet bottomSheet = ExitRoomBottomSheet.newInstance();
|
||||
@@ -496,47 +560,10 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
isSave = false;
|
||||
sDestroied = false;
|
||||
// // 进入房间10s后检查是否显示提示上麦对话框
|
||||
// new Handler(getMainLooper()).postDelayed(
|
||||
// () -> EventBus.getDefault().post(new ShowOnWheatDialogEvent()),
|
||||
// 10000);
|
||||
|
||||
isSave = false;
|
||||
sDestroied = false;
|
||||
isMinimized = false;
|
||||
// ThreadUtils.executeBySingleAtFixRate(new ThreadUtils.Task<String>() {
|
||||
//
|
||||
// @Override
|
||||
// public String doInBackground() throws Throwable {
|
||||
// if (mBinding.svgaGift.isPlaying()){
|
||||
// Thread.sleep(100); // 短暂等待
|
||||
// return "";
|
||||
// }
|
||||
// if(!roomMessageEventQueue.isEmpty()){
|
||||
// Thread.sleep(100); // 短暂等待
|
||||
// return roomMessageEventQueue.poll();
|
||||
// }
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(String result) {
|
||||
// LogUtils.e("@@@@" + "onSuccess"+"playQueue.size()===="+roomMessageEventQueue.size());
|
||||
// if(!TextUtils.isEmpty(result)){
|
||||
//// mBinding.svgaGift.setSource(result, 2);
|
||||
// mBinding.svgaGift.downloadAndPlayMp4(result);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail(Throwable t) {
|
||||
//
|
||||
// }
|
||||
// },2, TimeUnit.SECONDS);
|
||||
overridePendingTransition(0, 0); // 关闭转场动画
|
||||
|
||||
|
||||
@@ -552,6 +579,12 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
|
||||
// 在子线程中执行网络请求
|
||||
performNetworkRequestsAsync();
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
// roomFragment.setqxRoomSeatViewType(QXRoomSeatViewType.NONE);
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.vp_room_pager, roomFragment)
|
||||
.commitAllowingStateLoss();
|
||||
|
||||
|
||||
}
|
||||
@@ -969,7 +1002,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
private BlockingQueue<String> roomMessageEventQueue = new LinkedBlockingQueue<>();
|
||||
int i = 0;
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void roomInfoEvent(RoomMessageEvent messageEvent) {
|
||||
if (messageEvent == null) return;
|
||||
|
||||
@@ -978,7 +1011,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
RoomMessageEvent.T text = messageEvent.getText();
|
||||
|
||||
if (msgType == 1005) {
|
||||
LogUtils.e("@@@@" + "EventBusnujm2"+"playQueue.size()===="+ messageEvent.getText().getGiftInfo());
|
||||
LogUtils.e("@@@@" + "EventBusnujm2" + "playQueue.size()====" + messageEvent.getText().getGiftInfo());
|
||||
// synchronized (roomMessageLock) {
|
||||
// roomMessageEventQueue.add(messageEvent.getText().getGiftInfo().getPlay_image());
|
||||
// }
|
||||
@@ -1074,66 +1107,82 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
|
||||
roomFragment.friendshipRoomFragmentEvent(messageEvent);
|
||||
}
|
||||
}else if(msgType==1056){
|
||||
} else if (msgType == 1056) {
|
||||
GiftLotteryDialog dialog = (GiftLotteryDialog) getSupportFragmentManager()
|
||||
.findFragmentByTag("GiftLotteryDialog");
|
||||
if (dialog != null && dialog.isVisible()) {
|
||||
dialog.UpView( messageEvent.getText().getXlh_data());
|
||||
dialog.UpView(messageEvent.getText().getXlh_data());
|
||||
}
|
||||
} else if (msgType == 1057) {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
TourClubDialogFragment existingFragment = (TourClubDialogFragment) getSupportFragmentManager().findFragmentByTag("TourClubDialogFragment");
|
||||
if (existingFragment != null && existingFragment.isVisible()){
|
||||
existingFragment.onMusicPlay(messageEvent);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, RoomPitBean> pitMap = new HashMap<>();
|
||||
|
||||
public void handleMsgType1039(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
|
||||
if (text == null || mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
|
||||
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
pitMap.clear();
|
||||
if (mRoomInfoResp.getRoom_info().getPit_list() != null && !mRoomInfoResp.getRoom_info().getPit_list().isEmpty()) {
|
||||
for (RoomPitBean roomPitBean : mRoomInfoResp.getRoom_info().getPit_list()) {
|
||||
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
|
||||
if (pitList != null && !pitList.isEmpty()) {
|
||||
pitMap.clear(); // 避免数据累积
|
||||
for (RoomPitBean roomPitBean : pitList) {
|
||||
pitMap.put(roomPitBean.getPit_number(), roomPitBean);
|
||||
}
|
||||
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String fromPitNumber = text.getFrom_pit_number();
|
||||
String toPitNumber = text.getTo_pit_number();
|
||||
|
||||
if (!TextUtils.isEmpty(fromPitNumber) && !TextUtils.isEmpty(toPitNumber)) {
|
||||
performSwitchMic(fromPitNumber, toPitNumber);
|
||||
performSwitchMic(fromPitNumber, toPitNumber, messageEvent);
|
||||
}
|
||||
// 执行换麦逻辑
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void performSwitchMic(String fromPitNumber, String toPitNumber) {
|
||||
private void performSwitchMic(String fromPitNumber, String toPitNumber, RoomMessageEvent messageEvent) {
|
||||
if (TextUtils.isEmpty(fromPitNumber) || TextUtils.isEmpty(toPitNumber)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取房间信息中的 pit_list
|
||||
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
|
||||
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) {
|
||||
LogUtils.e("Room info is null");
|
||||
return;
|
||||
}
|
||||
|
||||
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
|
||||
if (pitList == null || pitList.isEmpty()) {
|
||||
LogUtils.e("pit_list is null or empty");
|
||||
return;
|
||||
}
|
||||
|
||||
// 查找两个麦位对应的 RoomPitBean
|
||||
RoomPitBean fromBean = null;
|
||||
RoomPitBean toBean = null;
|
||||
List<RoomPitBean> pitListCopy = new ArrayList<>();
|
||||
|
||||
for (RoomPitBean bean : pitList) {
|
||||
if (bean.getPit_number().equals(fromPitNumber)) {
|
||||
if (bean == null) continue;
|
||||
if (fromPitNumber.equals(bean.getPit_number())) {
|
||||
fromBean = bean;
|
||||
pitListCopy.add(bean);
|
||||
} else if (bean.getPit_number().equals(toPitNumber)) {
|
||||
} else if (toPitNumber.equals(bean.getPit_number())) {
|
||||
toBean = bean;
|
||||
pitListCopy.add(bean);
|
||||
}
|
||||
}
|
||||
|
||||
pitList.removeAll(pitListCopy);
|
||||
// 如果没有找到任一麦位,则不执行操作
|
||||
if (fromBean == null || toBean == null) {
|
||||
LogUtils.e("Cannot find pit number: from=" + fromPitNumber + ", to=" + toPitNumber);
|
||||
return;
|
||||
@@ -1143,32 +1192,72 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
String temp = fromBean.getPit_number();
|
||||
fromBean.setPit_number(toBean.getPit_number());
|
||||
toBean.setPit_number(temp);
|
||||
pitList.add(fromBean);
|
||||
pitList.add(toBean);// 在调用 setPit_list 之前,先对 pitList 按照 pit_number 升序排序
|
||||
pitList.sort((a, b) -> {
|
||||
|
||||
// 构造新的 pitList
|
||||
List<RoomPitBean> newPitList = new ArrayList<>();
|
||||
for (RoomPitBean bean : pitList) {
|
||||
if (!pitListCopy.contains(bean)) {
|
||||
newPitList.add(bean);
|
||||
}
|
||||
}
|
||||
newPitList.add(fromBean);
|
||||
newPitList.add(toBean);
|
||||
|
||||
// 排序
|
||||
newPitList.sort((a, b) -> {
|
||||
try {
|
||||
return Integer.compare(Integer.parseInt(a.getPit_number()), Integer.parseInt(b.getPit_number()));
|
||||
} catch (NumberFormatException e) {
|
||||
return a.getPit_number().compareTo(b.getPit_number()); // 字符串比较作为备选
|
||||
return a.getPit_number().compareTo(b.getPit_number());
|
||||
}
|
||||
});
|
||||
|
||||
mRoomInfoResp.getRoom_info().setPit_list(pitList);
|
||||
mRoomInfoResp.getRoom_info().setPit_list(newPitList);
|
||||
|
||||
// 更新当前用户的 pit_number(如果当前用户参与了换麦)
|
||||
// 更新当前用户 pit_number
|
||||
if (mRoomInfoResp.getUser_info() != null) {
|
||||
String currentUserId = String.valueOf(SpUtil.getUserId());
|
||||
if (fromBean.getUser_id().equals(currentUserId)) {
|
||||
// 当前用户原来在 fromBean 位置,现在换到了 toBean 位置
|
||||
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(toBean.getPit_number()));
|
||||
} else if (toBean.getUser_id().equals(currentUserId)) {
|
||||
// 当前用户原来在 toBean 位置,现在换到了 fromBean 位置
|
||||
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(fromBean.getPit_number()));
|
||||
String fromUserId = fromBean.getUser_id();
|
||||
String toUserId = toBean.getUser_id();
|
||||
|
||||
if (fromUserId != null && fromUserId.equals(currentUserId)) {
|
||||
try {
|
||||
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(toBean.getPit_number()));
|
||||
} catch (NumberFormatException e) {
|
||||
LogUtils.e("Invalid pit number: " + toBean.getPit_number());
|
||||
}
|
||||
} else if (toUserId != null && toUserId.equals(currentUserId)) {
|
||||
try {
|
||||
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(fromBean.getPit_number()));
|
||||
} catch (NumberFormatException e) {
|
||||
LogUtils.e("Invalid pit number: " + fromBean.getPit_number());
|
||||
}
|
||||
}
|
||||
}
|
||||
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
|
||||
dispatchRoomEvent(messageEvent);
|
||||
}
|
||||
|
||||
private void dispatchRoomEvent(RoomMessageEvent messageEvent) {
|
||||
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
|
||||
|
||||
String typeId = mRoomInfoResp.getRoom_info().getType_id();
|
||||
if ("2".equals(typeId)) {
|
||||
roomFragment.upRoomInfoData(mRoomInfoResp);
|
||||
roomFragment.handleAuctionMessageEvent(messageEvent);
|
||||
} else if ("3".equals(typeId) || "4".equals(typeId) || "1".equals(typeId)) {
|
||||
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
|
||||
if ("2".equals(labelId)) {
|
||||
roomFragment.KtvFragmentEvent(messageEvent);
|
||||
} else if ("1".equals(labelId)) {
|
||||
roomFragment.SingSongEvent(messageEvent);
|
||||
}
|
||||
} else if ("7".equals(typeId)) {
|
||||
roomFragment.friendshipRoomFragmentEvent(messageEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static volatile MP4PlaybackCallback sInstance;
|
||||
|
||||
public static class MP4PlaybackCallback implements IAnimListener {
|
||||
@@ -1367,6 +1456,12 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
switchMic(2);
|
||||
}
|
||||
|
||||
if (pitNumber.equals("9")) {
|
||||
ivSoundEffects(true);
|
||||
} else {
|
||||
ivSoundEffects(false);
|
||||
}
|
||||
|
||||
String typeId = mRoomInfoResp.getRoom_info().getType_id();
|
||||
if ("2".equals(typeId)) {
|
||||
if ("9".equals(pitNumber)) {
|
||||
@@ -1375,7 +1470,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(pitNumber));
|
||||
}
|
||||
}
|
||||
roomFragment.upRoomInfo(mRoomInfoResp);
|
||||
roomFragment.upRoomInfoData(mRoomInfoResp);
|
||||
roomFragment.handleAuctionMessageEvent(messageEvent);
|
||||
} else if ("3".equals(typeId) || "4".equals(typeId) || "1".equals(typeId)) {
|
||||
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
|
||||
@@ -1383,31 +1478,13 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
roomFragment.KtvFragmentEvent(messageEvent);
|
||||
} else if ("1".equals(labelId)) {
|
||||
roomFragment.SingSongEvent(messageEvent);
|
||||
if (mRoomInfoResp.getUser_info().getPit_number() == 9) {
|
||||
ivSoundEffects(true);
|
||||
} else {
|
||||
ivSoundEffects(false);
|
||||
}
|
||||
|
||||
}
|
||||
} else if ("7".equals(typeId)) {
|
||||
mBinding.rlMore.setVisibility(GONE);
|
||||
mBinding.rlMisc.setVisibility(GONE);
|
||||
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
|
||||
if (pitList != null && !pitList.isEmpty()) {
|
||||
try {
|
||||
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
|
||||
pitBean.setUser_id(userId + "");
|
||||
pitBean.setAvatar(fromUserInfo.getAvatar());
|
||||
pitBean.setNickname(fromUserInfo.getNickname());
|
||||
pitBean.setSex(fromUserInfo.getSex() + "");
|
||||
pitBean.setCharm(fromUserInfo.getCharm());
|
||||
pitBean.setDress(fromUserInfo.getDress());
|
||||
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
|
||||
} catch (NumberFormatException e) {
|
||||
// Handle exception
|
||||
}
|
||||
}
|
||||
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
|
||||
roomFragment.friendshipRoomFragmentEvent(messageEvent);
|
||||
} else {
|
||||
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
}
|
||||
@@ -1434,6 +1511,10 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
switchMic(2);
|
||||
}
|
||||
|
||||
if (pitNumber.equals("9")) {
|
||||
ivSoundEffects(false);
|
||||
}
|
||||
|
||||
if (userId == currentUserId && "9".equals(pitNumber)) {
|
||||
if (customMusicFloatingView != null) {
|
||||
customMusicFloatingView.destroy();
|
||||
@@ -1459,7 +1540,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
switchMic(2);
|
||||
}
|
||||
}
|
||||
roomFragment.upRoomInfo(mRoomInfoResp);
|
||||
roomFragment.upRoomInfoData(mRoomInfoResp);
|
||||
roomFragment.handleAuctionMessageEvent(messageEvent);
|
||||
} else if ("3".equals(typeId) || "4".equals(typeId) || "1".equals(typeId)) {
|
||||
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
|
||||
@@ -1472,22 +1553,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
|
||||
if (pitList != null && !pitList.isEmpty()) {
|
||||
try {
|
||||
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
|
||||
pitBean.setUser_id("");
|
||||
pitBean.setAvatar("");
|
||||
pitBean.setNickname("");
|
||||
pitBean.setSex("");
|
||||
pitBean.setCharm("");
|
||||
pitBean.setDress("");
|
||||
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
|
||||
} catch (NumberFormatException e) {
|
||||
// Handle exception
|
||||
}
|
||||
}
|
||||
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
|
||||
roomFragment.friendshipRoomFragmentEvent(messageEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1522,7 +1589,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
}
|
||||
}
|
||||
|
||||
roomFragment.upRoomInfo(mRoomInfoResp);
|
||||
roomFragment.upRoomInfoData(mRoomInfoResp);
|
||||
roomFragment.handleAuctionMessageEvent(messageEvent);
|
||||
}
|
||||
|
||||
@@ -1532,7 +1599,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
|
||||
mRoomInfoResp.getRoom_auction().setAuction_user(text.getAuction_user());
|
||||
SpUtil.setAuctionId(text.getAuction_user().getAuction_id());
|
||||
roomFragment.upRoomInfo(mRoomInfoResp);
|
||||
roomFragment.upRoomInfoData(mRoomInfoResp);
|
||||
roomFragment.handleAuctionMessageEvent(messageEvent);
|
||||
// roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
}
|
||||
@@ -1547,9 +1614,9 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
mRoomInfoResp.getRoom_auction().getAuction_list().addAll(text.getAuction_list());
|
||||
} else {
|
||||
mRoomInfoResp.getRoom_auction().setAuction_list(new ArrayList<>());
|
||||
mRoomInfoResp.getRoom_auction().getAuction_list().addAll(text.getAuction_list());
|
||||
// mRoomInfoResp.getRoom_auction().getAuction_list().addAll(text.getAuction_list());
|
||||
}
|
||||
roomFragment.upRoomInfo(mRoomInfoResp);
|
||||
roomFragment.upRoomInfoData(mRoomInfoResp);
|
||||
roomFragment.handleAuctionMessageEvent(messageEvent);
|
||||
// roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
}
|
||||
@@ -1600,7 +1667,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
roomFragment.KtvFragmentEvent(messageEvent);
|
||||
} else {
|
||||
updateCharmForAllPitBeans("");
|
||||
roomFragment.upRoomInfo(mRoomInfoResp);
|
||||
roomFragment.upRoomInfoData(mRoomInfoResp);
|
||||
roomFragment.SingSongEvent(messageEvent);
|
||||
}
|
||||
} else {
|
||||
@@ -1658,9 +1725,14 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
private void handleMsgType1051(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
|
||||
if (text == null) return;
|
||||
|
||||
if (text.getUser1_id() == null || text.getUser2_id() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
FriendUserBean friend_user = getFriendUserBean(messageEvent);
|
||||
FriendsDialogFragment.show(friend_user, getSupportFragmentManager());
|
||||
|
||||
|
||||
if (text.getUser1_id().equals(SpUtil.getUserId() + "") || text.getUser2_id().equals(SpUtil.getUserId() + "")) {
|
||||
if (roomSwitchRunnable != null) {
|
||||
roomSwitchHandler.removeCallbacks(roomSwitchRunnable);
|
||||
@@ -1738,12 +1810,12 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
roomFragment.KtvFragmentEvent(messageEvent);
|
||||
} else {
|
||||
// updatePitBeanForUser(fromUserInfo);
|
||||
roomFragment.upRoomInfo(updatePitBeanForUser(fromUserInfo));
|
||||
roomFragment.upRoomInfoData(updatePitBeanForUser(fromUserInfo));
|
||||
roomFragment.SingSongEvent(messageEvent);
|
||||
}
|
||||
} else {
|
||||
updatePitBeanForUser(fromUserInfo);
|
||||
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
roomFragment.upRoomInfoData(updatePitBeanForUser(fromUserInfo));
|
||||
roomFragment.friendshipRoomFragmentEvent(messageEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -1787,7 +1859,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
private void handleMsgType1007() {
|
||||
if (mRoomInfoResp != null && mRoomInfoResp.getUser_info() != null) {
|
||||
mRoomInfoResp.getUser_info().setIs_host(1);
|
||||
roomFragment.upRoomInfo(mRoomInfoResp);
|
||||
roomFragment.upRoomInfoData(mRoomInfoResp);
|
||||
// roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
}
|
||||
}
|
||||
@@ -1795,7 +1867,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
private void handleMsgType1018() {
|
||||
if (mRoomInfoResp != null && mRoomInfoResp.getUser_info() != null) {
|
||||
mRoomInfoResp.getUser_info().setIs_host(0);
|
||||
roomFragment.upRoomInfo(mRoomInfoResp);
|
||||
roomFragment.upRoomInfoData(mRoomInfoResp);
|
||||
// roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
}
|
||||
}
|
||||
@@ -2313,7 +2385,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
|
||||
/// 进入小黑屋将所有的底部隐藏
|
||||
public void setviewyc(boolean voive) {
|
||||
mBinding.rlMore.setVisibility(voive ? VISIBLE : View.GONE);
|
||||
mBinding.rlMore.setVisibility(voive ? GONE : View.GONE);
|
||||
mBinding.rlMisc.setVisibility(voive ? VISIBLE : View.GONE);
|
||||
mBinding.rlMic.setVisibility(voive ? VISIBLE : View.GONE);
|
||||
mBinding.rlSett.setVisibility(voive ? VISIBLE : View.GONE);
|
||||
@@ -2350,7 +2422,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
}
|
||||
|
||||
public void rlMore(boolean voive) {
|
||||
mBinding.rlMore.setVisibility(voive ? VISIBLE : View.GONE);
|
||||
mBinding.rlMore.setVisibility(voive ? GONE : View.GONE);
|
||||
}
|
||||
|
||||
public void ivMic(int inIvMic) {
|
||||
@@ -2392,7 +2464,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
case 3: // 麦上用户
|
||||
rl_voice.setVisibility(View.VISIBLE);
|
||||
rl_mic.setVisibility(pit_number != 0 ? View.VISIBLE : View.GONE);
|
||||
rl_more.setVisibility(pit_number == 9 ? View.VISIBLE : View.GONE);
|
||||
rl_more.setVisibility(pit_number == 9 ? GONE : View.GONE);
|
||||
rl_misc.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case 0: // 观众
|
||||
@@ -2416,7 +2488,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
} else if (roleType != 5) {
|
||||
rl_misc.setVisibility(View.VISIBLE);
|
||||
if (userPitNumber == 9) {
|
||||
rl_more.setVisibility(View.VISIBLE);
|
||||
rl_more.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2611,7 +2683,6 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
this.mPitList = mRoomBean.getPit_list();
|
||||
this.roomId = roomBean.getRoom_id();
|
||||
|
||||
upHeight();
|
||||
ImageUtils.loadHeadCC(resp.getRoom_info().getRoom_cover(), mBinding.roomTop.avatar);
|
||||
mBinding.roomTop.name.setText(roomBean.getRoom_name());
|
||||
mBinding.roomTop.idVal.setText("ID:" + roomBean.getRoom_number());
|
||||
@@ -2640,15 +2711,21 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
initPublicScreenFragment();
|
||||
if (!isFinishing() && !isDestroyed()) {
|
||||
|
||||
if (roomFragment == null || !roomFragment.isAdded()) {
|
||||
roomFragment = RoomFragment.newInstance(resp, "");
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.vp_room_pager, roomFragment)
|
||||
.commitAllowingStateLoss();
|
||||
} else {
|
||||
roomFragment.refreshData(resp);
|
||||
}
|
||||
// if (roomFragment == null || !roomFragment.isAdded()) {
|
||||
// roomFragment = RoomFragment.newInstance(resp, "");
|
||||
// getSupportFragmentManager()
|
||||
// .beginTransaction()
|
||||
// .replace(R.id.vp_room_pager, roomFragment)
|
||||
// .commitAllowingStateLoss();
|
||||
//
|
||||
//
|
||||
// } else {
|
||||
|
||||
resetFragment();
|
||||
// roomFragment.refreshData(resp);
|
||||
upHeight();
|
||||
// }
|
||||
|
||||
} else {
|
||||
Log.e("Fragment", "Fragment transaction skipped due to state loss.");
|
||||
}
|
||||
@@ -2966,39 +3043,16 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
CommonAppContext.getInstance().isShow = true;
|
||||
CommonAppContext.getInstance().isPlaying = true;
|
||||
|
||||
// 检查是否是从最小化状态恢复
|
||||
// if (wasMinimized()) {
|
||||
// // 从最小化状态恢复,保持当前房间
|
||||
// clearMinimizeState();
|
||||
// isMinimized = false;
|
||||
//
|
||||
// // 恢复房间状态
|
||||
// resumeRoomState();
|
||||
// } else {
|
||||
// 正常启动或从后台恢复
|
||||
if (isInBackground) {
|
||||
isInBackground = false;
|
||||
// 从后台回到前台时调用
|
||||
if (MvpPre != null && roomId != null) {
|
||||
MvpPre.postRoomInfo(roomId);
|
||||
// MvpPre.postRoomInfo(roomId);
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
// 延迟调整布局,确保视图已经完全加载
|
||||
mBinding.mainContentContainer.post(this::adjustLayoutHeights);
|
||||
|
||||
// // 延迟调整布局,确保视图已经完全加载
|
||||
// mBinding.mainContentContainer.post(this::adjustLayoutHeights);
|
||||
//// MvpPre.postRoomInfo(roomId);
|
||||
// // 检查是否从后台返回
|
||||
// if (isInBackground) {
|
||||
// isInBackground = false;
|
||||
// // 从后台回到前台时调用
|
||||
// if (MvpPre != null && roomId != null) {
|
||||
// MvpPre.postRoomInfo(roomId);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void resumeRoomState() {
|
||||
@@ -3176,20 +3230,22 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
mBinding.roomTop.btnFollow.setText("");
|
||||
}
|
||||
}
|
||||
upHeight();
|
||||
|
||||
|
||||
if (!isFinishing() && !isDestroyed()) {
|
||||
|
||||
|
||||
if (roomFragment == null || !roomFragment.isAdded()) {
|
||||
roomFragment = RoomFragment.newInstance(resp, "");
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.vp_room_pager, roomFragment)
|
||||
.commitAllowingStateLoss();
|
||||
} else {
|
||||
roomFragment.refreshData(resp);
|
||||
}
|
||||
// if (roomFragment == null || !roomFragment.isAdded()) {
|
||||
// roomFragment = RoomFragment.newInstance(resp, "");
|
||||
// getSupportFragmentManager()
|
||||
// .beginTransaction()
|
||||
// .replace(R.id.vp_room_pager, roomFragment)
|
||||
// .commitAllowingStateLoss();
|
||||
// } else {
|
||||
resetFragment();
|
||||
// roomFragment.refreshData(resp);
|
||||
upHeight();
|
||||
// }
|
||||
} else {
|
||||
Log.e("Fragment", "Fragment transaction skipped due to state loss.");
|
||||
}
|
||||
@@ -3215,7 +3271,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
mBinding.rlMore.setVisibility(GONE);
|
||||
mBinding.rlMisc.setVisibility(GONE);
|
||||
} else if (mRoomInfoResp.getRoom_info().getLabel_id().equals("1") || mRoomInfoResp.getRoom_info().getType_id().equals("3") || mRoomInfoResp.getRoom_info().getType_id().equals("4")) {
|
||||
mBinding.rlMore.setVisibility(VISIBLE);
|
||||
mBinding.rlMore.setVisibility(GONE);
|
||||
mBinding.rlMisc.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
@@ -3235,13 +3291,50 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
if (mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
|
||||
maxHeightDp = 453;
|
||||
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
|
||||
maxHeightDp = 413;
|
||||
maxHeightDp = 373;
|
||||
|
||||
}
|
||||
adjustLayoutHeights();
|
||||
}
|
||||
|
||||
|
||||
private void resetFragment() {
|
||||
String typeId = mRoomInfoResp.getRoom_info().getType_id();
|
||||
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
|
||||
|
||||
if ("7".equals(typeId)) {
|
||||
if (mRoomInfoResp.getRoom_info().getRoom_background() == null || mRoomInfoResp.getRoom_info().getRoom_background().equals("")) {
|
||||
changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj);
|
||||
} else {
|
||||
changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||
}
|
||||
setvisibTop(true);
|
||||
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.FRIEND);
|
||||
} else if ("2".equals(typeId)) {
|
||||
changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||
setvisibTop(true);
|
||||
|
||||
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.AUCTION);
|
||||
} else if ("1".equals(typeId) || "3".equals(typeId) || "4".equals(typeId)) {
|
||||
if ("2".equals(labelId)) {
|
||||
changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||
setvisibTop(true);
|
||||
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.KTV);
|
||||
} else if ("1".equals(labelId)) {
|
||||
changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||
setvisibTop(true);
|
||||
|
||||
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.NORMAL);
|
||||
}
|
||||
} else if ("6".equals(typeId)) {
|
||||
changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
|
||||
setvisibTop(false);
|
||||
|
||||
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.CABIN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getCharmRank(List<RoomCharmRankBean> list) {
|
||||
|
||||
|
||||
@@ -468,27 +468,6 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
}
|
||||
|
||||
|
||||
// if (data.getItemType()==1) {
|
||||
// allMsgList.add(data);
|
||||
// }else if (data.getItemType() == 2) {
|
||||
// userMsgList.add(data);
|
||||
// allMsgList.add(data);
|
||||
// } else if (data.getItemType() == 3) {
|
||||
// systemMsgList.add(data);
|
||||
// }
|
||||
// if (allMsgList.size() > 20) {
|
||||
// // 只添加最近的20条消息
|
||||
// int startIndex = Math.max(0, allMsgList.size() - 20);
|
||||
// allMsgList.subList(startIndex, allMsgList.size());
|
||||
// }
|
||||
// // 根据当前显示类型决定是否添加到适配器中
|
||||
// boolean shouldAdd = (listShowType == SHOW_TYPE_ALL && (data.getItemType() == 1 || data.getItemType() == 2)) ||
|
||||
// (listShowType == SHOW_TYPE_USER && data.getItemType() == 2) ||
|
||||
// (listShowType == SHOW_TYPE_SYSTEM && data.getItemType() == 3);
|
||||
//
|
||||
// if (shouldAdd) {
|
||||
// super.addData(data);
|
||||
// }
|
||||
}
|
||||
private void addToStorageLists(EMMessageInfo data) {
|
||||
switch (data.getItemType()) {
|
||||
@@ -508,8 +487,8 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
private void maintainDataLimits() {
|
||||
// 确保所有存储列表都不超过最大限制
|
||||
trimListToMaxSize(allMsgList);
|
||||
// trimListToMaxSize(userMsgList);
|
||||
// trimListToMaxSize(systemMsgList);
|
||||
trimListToMaxSize(userMsgList);
|
||||
trimListToMaxSize(systemMsgList);
|
||||
}
|
||||
|
||||
private void trimListToMaxSize(List<EMMessageInfo> list) {
|
||||
|
||||
@@ -82,5 +82,9 @@ public class RoomContacts {
|
||||
void clearUserCharm(String roomId, String userId);//清除魅力值
|
||||
|
||||
void userOnlineStatus(String userId, String roomid);
|
||||
|
||||
void auctionEnd(String auctionId,String roomId);
|
||||
|
||||
void auctionDelay(String auctionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +242,17 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
pitList.clear();
|
||||
pitList.addAll(uniquePitSet);
|
||||
}
|
||||
|
||||
if (roomInfoResp.getRoom_auction().getAuction_user()!=null ){
|
||||
if (roomInfoResp.getRoom_auction().getAuction_user().getUser_id()!=null && !roomInfoResp.getRoom_auction().getAuction_user().getUser_id().equals(SpUtil.getUserId()+"")) {
|
||||
RewardUserBean rewardUserBean = new RewardUserBean();
|
||||
rewardUserBean.setUser_id(roomInfoResp.getRoom_auction().getAuction_user().getUser_id());
|
||||
rewardUserBean.setNickname(roomInfoResp.getRoom_auction().getAuction_user().getNickname());
|
||||
rewardUserBean.setAvatar(roomInfoResp.getRoom_auction().getAuction_user().getAvatar());
|
||||
rewardUserBean.setPit_number("888");
|
||||
result.add(rewardUserBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 优先添加指定麦位
|
||||
@@ -280,9 +291,28 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
}
|
||||
}
|
||||
|
||||
List<RewardUserBean> uniquePitSet = removeDuplicateByUserId(result);
|
||||
result.clear();
|
||||
result.addAll(uniquePitSet);
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO: 2025/9/15 去重
|
||||
private List<RewardUserBean> removeDuplicateByUserId(List<RewardUserBean> list) {
|
||||
Set<String> userIdSet = new HashSet<>();
|
||||
List<RewardUserBean> uniqueList = new ArrayList<>();
|
||||
|
||||
for (RewardUserBean bean : list) {
|
||||
if (bean != null && bean.getUser_id() != null && !userIdSet.contains(bean.getUser_id())) {
|
||||
userIdSet.add(bean.getUser_id());
|
||||
uniqueList.add(bean);
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
// mBinding.rvGiftUser.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
|
||||
@@ -233,6 +233,10 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
this.roomInfoResp = roomInfoResp;
|
||||
}
|
||||
|
||||
public void upRoomId(RoomInfoResp roomInfoResp) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 麦位视图点击事件处理
|
||||
*
|
||||
@@ -387,6 +391,108 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
}
|
||||
}
|
||||
|
||||
public void event1003(RoomMessageEvent messageEvent){
|
||||
UserInfo fromUserInfo = messageEvent.getText().getFromUserInfo();
|
||||
if (fromUserInfo == null) return;
|
||||
|
||||
String pitNumber = messageEvent.getText().getPit_number();
|
||||
int userId = fromUserInfo.getUser_id();
|
||||
List<RoomPitBean> pitList = roomInfoResp.getRoom_info().getPit_list();
|
||||
if (pitList != null && !pitList.isEmpty()) {
|
||||
try {
|
||||
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
|
||||
pitBean.setUser_id(userId + "");
|
||||
pitBean.setAvatar(fromUserInfo.getAvatar());
|
||||
pitBean.setNickname(fromUserInfo.getNickname());
|
||||
pitBean.setSex(fromUserInfo.getSex() + "");
|
||||
pitBean.setCharm(fromUserInfo.getCharm());
|
||||
pitBean.setDress(fromUserInfo.getDress());
|
||||
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
|
||||
if (userId==SpUtil.getUserId() && pitNumber.equals("9")){
|
||||
myPitNumber=9;
|
||||
configGameOptionBtn();
|
||||
}
|
||||
for (int i = 0; i < mWheatViews.size(); i++){
|
||||
if (i==Integer.parseInt(pitNumber) - 1){
|
||||
mWheatViews.get(i).setData(pitBean);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
// Handle exception
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void event1004(RoomMessageEvent messageEvent){
|
||||
String pitNumber = messageEvent.getText().getPit_number();
|
||||
List<RoomPitBean> pitList = roomInfoResp.getRoom_info().getPit_list();
|
||||
if (pitList != null && !pitList.isEmpty()) {
|
||||
try {
|
||||
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
|
||||
pitBean.setUser_id("");
|
||||
pitBean.setAvatar("");
|
||||
pitBean.setNickname("");
|
||||
pitBean.setSex("");
|
||||
pitBean.setCharm("");
|
||||
pitBean.setDress("");
|
||||
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
|
||||
if (pitNumber.equals("9")){
|
||||
myPitNumber=0;
|
||||
configGameOptionBtn();
|
||||
}
|
||||
for (int i = 0; i < mWheatViews.size(); i++){
|
||||
if (i==Integer.parseInt(pitNumber) - 1){
|
||||
mWheatViews.get(i).setData(pitBean);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// Handle exception
|
||||
}
|
||||
}
|
||||
}
|
||||
public void event1035(RoomMessageEvent message) {
|
||||
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
RoomPitBean roomPitBean = roomInfoResp.getRoom_info().getPit_list().get(i);
|
||||
if (roomPitBean.getPit_number().equals("7") || roomPitBean.getPit_number().equals("8")) {
|
||||
continue;
|
||||
}
|
||||
if (Integer.parseInt(!roomPitBean.getPit_number().isEmpty() ? roomPitBean.getPit_number() : "0") > 10) {
|
||||
continue;
|
||||
}
|
||||
RoomFriendshipWheatView object = mWheatViews.get(Integer.parseInt(roomPitBean.getPit_number()) - 1);
|
||||
if (object != null) {
|
||||
object.setData(roomPitBean);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void event1039(RoomMessageEvent messageEvent){
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
RoomPitBean roomPitBean = roomInfoResp.getRoom_info().getPit_list().get(i);
|
||||
if (roomPitBean.getPit_number().equals("7") || roomPitBean.getPit_number().equals("8")) {
|
||||
continue;
|
||||
}
|
||||
if (Integer.parseInt(!roomPitBean.getPit_number().isEmpty() ? roomPitBean.getPit_number() : "0") > 10) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RoomFriendshipWheatView object = mWheatViews.get(Integer.parseInt(roomPitBean.getPit_number()) - 1);
|
||||
|
||||
if (object != null) {
|
||||
object.setData(roomPitBean);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2025/9/12 更新火热值
|
||||
public void event1005(RoomMessageEvent messageEvent){
|
||||
RoomPitBean pitBean = mBinding.wheatView9.pitBean;
|
||||
@@ -764,8 +870,10 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
} else {
|
||||
myPitNumber = -1;
|
||||
}
|
||||
|
||||
// 更新麦位显示
|
||||
for (RoomPitBean pitBean : pitArr) {
|
||||
|
||||
RoomFriendshipWheatView friendshipWheatView = mWheatViews.get(Integer.parseInt(pitBean.getPit_number()) - 1);
|
||||
RoomPitBean roomPitBean = friendshipWheatView.pitBean;
|
||||
roomPitBean.setCharm(pitBean.getCharm());
|
||||
@@ -822,12 +930,16 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
private void configHeart() {
|
||||
if (currentPartType.value == 1) {
|
||||
//隐藏中间心动值 、心动背景 、隐藏连线 连线停止动画
|
||||
mBinding.iv22.setVisibility(GONE);
|
||||
mBinding.iv11.setVisibility(GONE);
|
||||
mBinding.iv33.setVisibility(GONE);
|
||||
mBinding.iv22.stopAnimation();
|
||||
mBinding.iv11.stopAnimation();
|
||||
mBinding.iv33.stopAnimation();
|
||||
mBinding.imX2.setVisibility(GONE);
|
||||
mBinding.imX1.setVisibility(GONE);
|
||||
mBinding.imX3.setVisibility(GONE);
|
||||
|
||||
// mBinding.iv22.setVisibility(GONE);
|
||||
// mBinding.iv11.setVisibility(GONE);
|
||||
// mBinding.iv33.setVisibility(GONE);
|
||||
// mBinding.iv22.stopAnimation();
|
||||
// mBinding.iv11.stopAnimation();
|
||||
// mBinding.iv33.stopAnimation();
|
||||
topIsAnimate = false;
|
||||
centerIsAnimate = false;
|
||||
bottomIsAnimate = false;
|
||||
@@ -854,97 +966,106 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
}
|
||||
if (heartList1 != null && heartList1.getHeartNum() > 0) {
|
||||
Logger.d("显示 iv_22 动画 - 心动值: " + heartList1.getHeartNum());
|
||||
mBinding.iv22.setVisibility(View.VISIBLE);
|
||||
// mBinding.iv22.setVisibility(View.VISIBLE);
|
||||
mBinding.imX2.setVisibility(View.VISIBLE);
|
||||
mBinding.tv2.setVisibility(View.VISIBLE);
|
||||
mBinding.tv2.setText(heartList1.getHeartNum() + "");
|
||||
// 添加回调确认动画是否加载成功
|
||||
mBinding.iv22.setCallback(new SVGACallback() {
|
||||
@Override
|
||||
public void onRepeat() {
|
||||
Logger.d("SVGA onRepeat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStep(int i, double v) {
|
||||
// 每一步的回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Logger.d("SVGA onPause");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinished() {
|
||||
Logger.d("SVGA onFinished");
|
||||
// 如果需要循环播放,可以在这里重新开始
|
||||
if (mBinding.iv22.getVisibility() == View.VISIBLE) {
|
||||
mBinding.iv22.startAnimation();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!centerIsAnimate) {
|
||||
// 强制刷新视图
|
||||
mBinding.iv22.requestLayout();
|
||||
mBinding.iv22.invalidate();
|
||||
|
||||
ImageUtils.loadDecorationAvatar2(0, mBinding.iv22);
|
||||
mBinding.iv22.startAnimation();
|
||||
centerIsAnimate = true;
|
||||
}
|
||||
// mBinding.iv22.setCallback(new SVGACallback() {
|
||||
// @Override
|
||||
// public void onRepeat() {
|
||||
// Logger.d("SVGA onRepeat");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStep(int i, double v) {
|
||||
// // 每一步的回调
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPause() {
|
||||
// Logger.d("SVGA onPause");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFinished() {
|
||||
// Logger.d("SVGA onFinished");
|
||||
// // 如果需要循环播放,可以在这里重新开始
|
||||
// if (mBinding.iv22.getVisibility() == View.VISIBLE) {
|
||||
// mBinding.iv22.startAnimation();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// if (!centerIsAnimate) {
|
||||
// // 强制刷新视图
|
||||
// mBinding.iv22.requestLayout();
|
||||
// mBinding.iv22.invalidate();
|
||||
//
|
||||
// ImageUtils.loadDecorationAvatar2(0, mBinding.iv22);
|
||||
// mBinding.iv22.startAnimation();
|
||||
// centerIsAnimate = true;
|
||||
// }
|
||||
} else {
|
||||
mBinding.iv22.setVisibility(View.GONE);
|
||||
mBinding.imX2.setVisibility(View.GONE);
|
||||
// mBinding.iv22.setVisibility(View.GONE);
|
||||
mBinding.tv2.setVisibility(View.GONE);
|
||||
mBinding.iv22.stopAnimation();
|
||||
// mBinding.iv22.stopAnimation();
|
||||
centerIsAnimate = false;
|
||||
}
|
||||
|
||||
if (heartList2 != null && heartList2.getHeartNum() > 0) {
|
||||
mBinding.iv11.setVisibility(View.VISIBLE);
|
||||
mBinding.imX1.setVisibility(View.VISIBLE);
|
||||
// mBinding.iv11.setVisibility(View.VISIBLE);
|
||||
mBinding.tv1.setVisibility(View.VISIBLE);
|
||||
mBinding.tv1.setText(heartList2.getHeartNum() + "");
|
||||
if (!topIsAnimate) {
|
||||
// 强制刷新视图
|
||||
mBinding.iv11.requestLayout();
|
||||
mBinding.iv11.invalidate();
|
||||
|
||||
mBinding.iv11.startAnimation();
|
||||
topIsAnimate = true;
|
||||
ImageUtils.loadDecorationAvatar2(0, mBinding.iv11);
|
||||
}
|
||||
// if (!topIsAnimate) {
|
||||
// // 强制刷新视图
|
||||
// mBinding.iv11.requestLayout();
|
||||
// mBinding.iv11.invalidate();
|
||||
//
|
||||
// mBinding.iv11.startAnimation();
|
||||
// topIsAnimate = true;
|
||||
// ImageUtils.loadDecorationAvatar2(0, mBinding.iv11);
|
||||
// }
|
||||
} else {
|
||||
mBinding.iv11.setVisibility(View.GONE);
|
||||
mBinding.imX1.setVisibility(View.GONE);
|
||||
// mBinding.iv11.setVisibility(View.GONE);
|
||||
mBinding.tv1.setVisibility(View.GONE);
|
||||
mBinding.iv11.stopAnimation();
|
||||
// mBinding.iv11.stopAnimation();
|
||||
topIsAnimate = false;
|
||||
}
|
||||
if (heartList3 != null && heartList3.getHeartNum() > 0) {
|
||||
mBinding.iv33.setVisibility(View.VISIBLE);
|
||||
mBinding.imX3.setVisibility(View.VISIBLE);
|
||||
// mBinding.iv33.setVisibility(View.VISIBLE);
|
||||
mBinding.tv3.setVisibility(View.VISIBLE);
|
||||
mBinding.tv3.setText(heartList3.getHeartNum() + "");
|
||||
if (!bottomIsAnimate) {
|
||||
// 强制刷新视图
|
||||
mBinding.iv33.requestLayout();
|
||||
mBinding.iv33.invalidate();
|
||||
|
||||
mBinding.iv33.startAnimation();
|
||||
bottomIsAnimate = true;
|
||||
ImageUtils.loadDecorationAvatar2(0, mBinding.iv33);
|
||||
}
|
||||
// if (!bottomIsAnimate) {
|
||||
// // 强制刷新视图
|
||||
// mBinding.iv33.requestLayout();
|
||||
// mBinding.iv33.invalidate();
|
||||
//
|
||||
// mBinding.iv33.startAnimation();
|
||||
// bottomIsAnimate = true;
|
||||
// ImageUtils.loadDecorationAvatar2(0, mBinding.iv33);
|
||||
// }
|
||||
} else {
|
||||
mBinding.iv33.setVisibility(View.GONE);
|
||||
mBinding.imX3.setVisibility(View.GONE);
|
||||
// mBinding.iv33.setVisibility(View.GONE);
|
||||
mBinding.tv3.setVisibility(View.GONE);
|
||||
mBinding.iv33.stopAnimation();
|
||||
// mBinding.iv33.stopAnimation();
|
||||
bottomIsAnimate = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
mBinding.iv22.setVisibility(GONE);
|
||||
mBinding.iv11.setVisibility(GONE);
|
||||
mBinding.iv33.setVisibility(GONE);
|
||||
mBinding.iv22.stopAnimation();
|
||||
mBinding.iv11.stopAnimation();
|
||||
mBinding.iv33.stopAnimation();
|
||||
mBinding.imX2.setVisibility(GONE);
|
||||
mBinding.imX1.setVisibility(GONE);
|
||||
mBinding.imX3.setVisibility(GONE);
|
||||
// mBinding.iv22.setVisibility(GONE);
|
||||
// mBinding.iv11.setVisibility(GONE);
|
||||
// mBinding.iv33.setVisibility(GONE);
|
||||
// mBinding.iv22.stopAnimation();
|
||||
// mBinding.iv11.stopAnimation();
|
||||
// mBinding.iv33.stopAnimation();
|
||||
topIsAnimate = false;
|
||||
centerIsAnimate = false;
|
||||
bottomIsAnimate = false;
|
||||
@@ -1235,9 +1356,9 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
*/
|
||||
public void releaseResources() {
|
||||
// 停止并释放所有SVGA动画资源
|
||||
stopAndReleaseSVGA(mBinding.iv22);
|
||||
stopAndReleaseSVGA(mBinding.iv11);
|
||||
stopAndReleaseSVGA(mBinding.iv33);
|
||||
// stopAndReleaseSVGA(mBinding.iv22);
|
||||
// stopAndReleaseSVGA(mBinding.iv11);
|
||||
// stopAndReleaseSVGA(mBinding.iv33);
|
||||
|
||||
// 重置动画状态标志
|
||||
topIsAnimate = false;
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.view.ViewGroup;
|
||||
import android.view.ViewStub;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -79,8 +80,8 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
private String auctionId = "";
|
||||
private RoomAuction.AuctionUserBean auctionUserBean;
|
||||
private List<RoomAuction.AuctionListBean> auctionList;
|
||||
private ImageView imActionJs, imActionYs;
|
||||
private ViewStub stub;
|
||||
// private ImageView imActionJs, imActionYs;
|
||||
// private LinearLayout stub;
|
||||
private boolean isButtonsInflated = false;
|
||||
private int type;
|
||||
RoomFragment parentFragment;
|
||||
@@ -116,6 +117,14 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
this.roomInfoResp = roomInfoResp;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
// 确保 overlay buttons 已初始化
|
||||
initOverlayButtons();
|
||||
}
|
||||
|
||||
/// 更新数据
|
||||
public void roomInfoUpdate(RoomInfoResp resp) {
|
||||
roomInfoResp = resp;
|
||||
@@ -135,8 +144,12 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
roomPitBean.setIs_pm(1);
|
||||
wheatView.setData(roomPitBean);
|
||||
|
||||
if (imActionJs != null)
|
||||
imActionJs.setVisibility(VISIBLE);
|
||||
// if (imActionJs != null)
|
||||
// imActionJs.setVisibility(VISIBLE);
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upYs(true);
|
||||
}
|
||||
} else {
|
||||
RoomPitBean pitBean = new RoomPitBean();
|
||||
pitBean.setUser_id("");
|
||||
@@ -165,29 +178,6 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
wheatView2.setData(roomPitBean1);
|
||||
mBinding.tvPB.setText(auctionUserBean.getCharm());
|
||||
countDownTime(auctionUserBean.getDuration());
|
||||
if (auctionUserBean.getUser_id() != null && auctionUserBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
if (wheatView.pitBean != null) {
|
||||
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
if (imActionJs != null && imActionYs != null) {
|
||||
imActionJs.setVisibility(VISIBLE);
|
||||
imActionYs.setVisibility(VISIBLE);
|
||||
}
|
||||
} else {
|
||||
if (imActionJs != null && imActionYs != null) {
|
||||
imActionJs.setVisibility(INVISIBLE);
|
||||
imActionYs.setVisibility(INVISIBLE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (imActionJs != null && imActionYs != null) {
|
||||
imActionJs.setVisibility(INVISIBLE);
|
||||
imActionYs.setVisibility(INVISIBLE);
|
||||
}
|
||||
}
|
||||
mBinding.ivJp.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
if (auctionUserBean.getAuction_id() != null) {
|
||||
mBinding.ivJp.setVisibility(VISIBLE);
|
||||
@@ -199,6 +189,41 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||||
}
|
||||
|
||||
if (auctionUserBean.getUser_id() != null && auctionUserBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
if (wheatView.pitBean != null) {
|
||||
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
// if (imActionJs != null && imActionYs != null) {
|
||||
// imActionJs.setVisibility(VISIBLE);
|
||||
// imActionYs.setVisibility(VISIBLE);
|
||||
// }
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upVisibility(true);
|
||||
}
|
||||
} else {
|
||||
// if (imActionJs != null && imActionYs != null) {
|
||||
// imActionJs.setVisibility(INVISIBLE);
|
||||
// imActionYs.setVisibility(INVISIBLE);
|
||||
// }
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upVisibility(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if (imActionJs != null && imActionYs != null) {
|
||||
// imActionJs.setVisibility(INVISIBLE);
|
||||
// imActionYs.setVisibility(INVISIBLE);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upVisibility(false);
|
||||
}
|
||||
// }
|
||||
}
|
||||
mBinding.ivJp.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (roomAuction.getAuction_list() != null && roomAuction.getAuction_list().size() > 0) {
|
||||
auctionList = roomAuction.getAuction_list();
|
||||
@@ -223,14 +248,25 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
RoomPitBean roomPitBean2 = wheatView.pitBean;
|
||||
if (roomPitBean2 != null && roomPitBean2.getUser_id() != null && !roomPitBean2.getUser_id().equals("0")) {
|
||||
if (roomPitBean2.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
if (imActionJs != null && imActionYs != null) {
|
||||
imActionJs.setVisibility(VISIBLE);
|
||||
imActionYs.setVisibility(VISIBLE);
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upVisibility(true);
|
||||
}
|
||||
// if (imActionJs != null && imActionYs != null) {
|
||||
//
|
||||
//
|
||||
//
|
||||
// imActionJs.setVisibility(VISIBLE);
|
||||
// imActionYs.setVisibility(VISIBLE);
|
||||
// }
|
||||
} else {
|
||||
if (imActionJs != null && imActionYs != null) {
|
||||
imActionJs.setVisibility(INVISIBLE);
|
||||
imActionYs.setVisibility(INVISIBLE);
|
||||
// if (imActionJs != null && imActionYs != null) {
|
||||
// imActionJs.setVisibility(INVISIBLE);
|
||||
// imActionYs.setVisibility(INVISIBLE);
|
||||
// }
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upVisibility(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,24 +282,28 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
|
||||
public void initOverlayButtons() {
|
||||
// if (isButtonsInflated) return;
|
||||
// stub= getActivity().findViewById(R.id.stub_buttons2);
|
||||
// if (stub != null) {
|
||||
//// View inflated = stub.getRootView();
|
||||
// stub.setVisibility(VISIBLE);
|
||||
// imActionJs = stub.findViewById(R.id.im_action_ys);
|
||||
// imActionYs = stub.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");
|
||||
// }
|
||||
// }
|
||||
|
||||
stub = requireActivity().findViewById(R.id.stub_buttons2);
|
||||
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");
|
||||
}
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).tob();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,11 +313,22 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
}
|
||||
|
||||
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);
|
||||
} else {
|
||||
imActionJs.setVisibility(INVISIBLE);
|
||||
}
|
||||
// if (imActionJs == null) {
|
||||
// initOverlayButtons();
|
||||
// }
|
||||
// if (imActionJs != null) {
|
||||
if (roomInfoResp.getUser_info().getIs_room_owner() == 1 || roomInfoResp.getUser_info().getIs_management() == 1 || roomInfoResp.getUser_info().getIs_host() == 1) {
|
||||
// imActionJs.setVisibility(VISIBLE);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upJs( true);
|
||||
}
|
||||
} else {
|
||||
// imActionJs.setVisibility(INVISIBLE);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upJs( false);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
protected void tzblChanged() {
|
||||
@@ -438,18 +489,20 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
RoomOnlineDialogFragment.show(roomInfoResp.getRoom_info().getRoom_id(), 888 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
}
|
||||
} else {
|
||||
if (roomInfoResp.getRoom_auction() != null && roomInfoResp.getRoom_auction().getAuction_user() != null ) {
|
||||
if (roomInfoResp.getRoom_auction() != null && roomInfoResp.getRoom_auction().getAuction_user() != null) {
|
||||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.getUserId(), wheatView2.pitNumber, getHostUser(), false, 1, Integer.parseInt(roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() != null ? roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() : "0"), getChildFragmentManager());
|
||||
}else {
|
||||
} else {
|
||||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.getUserId(), wheatView2.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (id == R.id.im_action_js) {//延时
|
||||
MvpPre.auctionDelay(SpUtil.getauctionId());
|
||||
} else if (id == R.id.im_action_ys) {//结束
|
||||
dialogEnd();
|
||||
} else if (id == R.id.bangdan) {//出价榜单
|
||||
}
|
||||
// else if (id == R.id.im_action_js) {//延时
|
||||
// MvpPre.auctionDelay(SpUtil.getauctionId());
|
||||
// } else if (id == R.id.im_action_ys) {//结束
|
||||
// dialogEnd();
|
||||
// }
|
||||
else if (id == R.id.bangdan) {//出价榜单
|
||||
BidListDialogFragment.newInstance(SpUtil.getauctionId()).show(getChildFragmentManager(), "BidListDialogFragment");
|
||||
} else if (id == R.id.iv_auction1) {
|
||||
if (mBinding.ivAuction1.getUserId() != null && !mBinding.ivAuction1.getUserId().equals("")) {
|
||||
@@ -972,36 +1025,35 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
}
|
||||
}
|
||||
|
||||
public void event1058(RoomMessageEvent messageEvent){
|
||||
public void event1058(RoomMessageEvent messageEvent) {
|
||||
int type = messageEvent.getText().getType();
|
||||
RoomPitBean pitBean = wheatView.pitBean;
|
||||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean.setIs_online(type == 1 ? 1 :2);
|
||||
pitBean.setIs_online(type == 1 ? 1 : 2);
|
||||
wheatView.setData(pitBean);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean2 = wheatView2.pitBean;
|
||||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean2.setIs_online(type == 1 ? 1 :2);
|
||||
pitBean2.setIs_online(type == 1 ? 1 : 2);
|
||||
wheatView2.setData(pitBean2);
|
||||
mBinding.tvPB.setText("0");
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||||
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean3.setIs_online(type == 1 ? 1 :2);
|
||||
pitBean3.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction1.setData(pitBean3);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean4.setIs_online(type == 1 ? 1 :2);
|
||||
pitBean4.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction2.setData(pitBean4);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean5.setIs_online(type == 1 ? 1 :2);
|
||||
pitBean5.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction3.setData(pitBean5);
|
||||
return;
|
||||
}
|
||||
@@ -1011,16 +1063,16 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
int j = i;
|
||||
j++;
|
||||
if (j == 4) {
|
||||
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())){
|
||||
mBinding.ivOnline4.setVisibility(type==1?GONE : VISIBLE);
|
||||
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
mBinding.ivOnline4.setVisibility(type == 1 ? GONE : VISIBLE);
|
||||
}
|
||||
} else if (j == 5) {
|
||||
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())){
|
||||
mBinding.ivOnline5.setVisibility(type==1?GONE : VISIBLE);
|
||||
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
mBinding.ivOnline5.setVisibility(type == 1 ? GONE : VISIBLE);
|
||||
}
|
||||
} else if (j == 6) {
|
||||
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())){
|
||||
mBinding.ivOnline6.setVisibility(type==1?GONE : VISIBLE);
|
||||
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
mBinding.ivOnline6.setVisibility(type == 1 ? GONE : VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1031,12 +1083,19 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
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);
|
||||
// imActionJs.setVisibility(View.VISIBLE);
|
||||
// imActionYs.setVisibility(View.VISIBLE);
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upVisibility( true);
|
||||
}
|
||||
// 用户上麦,根据权限显示按钮
|
||||
} else {
|
||||
getvjs();
|
||||
imActionYs.setVisibility(INVISIBLE);
|
||||
// imActionYs.setVisibility(INVISIBLE);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upYs( false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1044,8 +1103,12 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
public void event1004(RoomMessageEvent messageEvent) {
|
||||
if (messageEvent.getText().getPit_number().equals("9")) {
|
||||
wheatView.setData(getPitBean2(messageEvent, "9"));
|
||||
// 下麦时隐藏按钮
|
||||
getvjs();
|
||||
imActionYs.setVisibility(GONE);
|
||||
// imActionYs.setVisibility(GONE);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upYs( false);
|
||||
}
|
||||
} else if (messageEvent.getText().getPit_number().equals("888")) {
|
||||
wheatView2.setData(getPitBean2(messageEvent, "888"));
|
||||
|
||||
@@ -1057,7 +1120,10 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
if (messageEvent.getText().getPit_number().equals("888")) {
|
||||
wheatView2.setData(getPitBean(messageEvent));
|
||||
getvjs();
|
||||
imActionYs.setVisibility(GONE);
|
||||
// imActionYs.setVisibility(GONE);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upYs( false);
|
||||
}
|
||||
}
|
||||
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||||
CardRelationshipFragment.show(roomInfoResp.getRoom_info().getRoom_id(), SpUtil.getUserId() + "", type + "", getActivity().getSupportFragmentManager());
|
||||
@@ -1084,6 +1150,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
gexList();
|
||||
steView(type);
|
||||
isButtonsInflated = false;
|
||||
mBinding.tvPB.setText("0");
|
||||
}
|
||||
|
||||
public void event1021(RoomMessageEvent messageEvent) {
|
||||
@@ -1114,11 +1181,18 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
public void event1023(RoomMessageEvent messageEvent) {
|
||||
mBinding.ivJp.setVisibility(VISIBLE);
|
||||
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
imActionYs.setVisibility(VISIBLE);
|
||||
imActionJs.setVisibility(VISIBLE);
|
||||
// imActionYs.setVisibility(VISIBLE);
|
||||
// imActionJs.setVisibility(VISIBLE);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upVisibility( true);
|
||||
}
|
||||
|
||||
} else {
|
||||
getvjs();
|
||||
imActionYs.setVisibility(GONE);
|
||||
// imActionYs.setVisibility(GONE);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upJs( false);
|
||||
}
|
||||
}
|
||||
if (messageEvent.getText().getAuction_user().getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||||
@@ -1200,9 +1274,12 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
}
|
||||
|
||||
private void yinc() {
|
||||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||||
getvjs();
|
||||
imActionYs.setVisibility(INVISIBLE);
|
||||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||||
// imActionYs.setVisibility(INVISIBLE);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upYs( false);
|
||||
}
|
||||
mBinding.tvDjTime.setVisibility(INVISIBLE);
|
||||
mBinding.tvRelation.setText("关系");
|
||||
mBinding.tvTimetg.setText("时间");
|
||||
@@ -1452,14 +1529,6 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
return pitBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
// if (!EventBus.getDefault().isRegistered(this)) {
|
||||
// EventBus.getDefault().register(this);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
@@ -1475,9 +1544,8 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
if (stub != null) {
|
||||
stub.setVisibility(GONE);
|
||||
stub = null;
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).upTop();
|
||||
}
|
||||
isButtonsInflated = false;
|
||||
releaseCountDownTimer();
|
||||
|
||||
@@ -54,6 +54,7 @@ import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
|
||||
import io.agora.rtc2.Constants;
|
||||
@@ -311,16 +312,35 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
AgoraManager.getInstance(getActivity()).muteLocalAudioStream(false);
|
||||
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled(true,SpUtil.getUserId()+"");
|
||||
isShow = false;
|
||||
|
||||
} else {
|
||||
mBinding.im1.setImageResource(com.xscm.moduleutil.R.mipmap.op_m);
|
||||
AgoraManager.getInstance(getActivity()).ClientRole(true);
|
||||
AgoraManager.getInstance(getActivity()).muteLocalAudioStream(true);
|
||||
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled(false,SpUtil.getUserId()+"");
|
||||
isShow = true;
|
||||
|
||||
isMute(1);
|
||||
}
|
||||
}
|
||||
|
||||
public void isMute(int is_mute) {
|
||||
RoomMessageEvent.text text = new RoomMessageEvent.text();
|
||||
text.setIs_mute(is_mute);
|
||||
String s = com.blankj.utilcode.util.GsonUtils.toJson(text);
|
||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
t.setFromUserInfo(SpUtil.getUserInfo());
|
||||
t.setText(s);
|
||||
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(126, roomInfoResp.getRoom_info().getRoom_id(), t);
|
||||
String json = com.blankj.utilcode.util.GsonUtils.toJson(roomMessageEvent);
|
||||
// 转换为 byte[]
|
||||
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
|
||||
// 创建自定义消息
|
||||
MessageListenerSingleton.getInstance().sendCustomRoomMessage(
|
||||
roomId + "",
|
||||
binaryData
|
||||
);
|
||||
}
|
||||
|
||||
public void roomInfoEvent(RoomMessageEvent messageEvent) {
|
||||
if (messageEvent.getMsgType() == 1028) {
|
||||
mBinding.tvHeartValue2.setText(messageEvent.getText().getHot_value());
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.media.metrics.Event;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -26,6 +27,7 @@ import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
@@ -57,6 +59,7 @@ import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.event.QXRoomSeatViewType;
|
||||
import com.xscm.moduleutil.event.RoomWheatEvent;
|
||||
import com.xscm.moduleutil.event.UnreadCountEvent;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
@@ -81,10 +84,8 @@ import java.util.List;
|
||||
*/
|
||||
public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBinding> implements RoomContacts.View {
|
||||
|
||||
public static RoomFragment newInstance(RoomInfoResp roomInfo, String password) {
|
||||
public static RoomFragment newInstance() {
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("roomInfo", roomInfo);
|
||||
args.putString("password", password);
|
||||
RoomFragment fragment = new RoomFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
@@ -101,25 +102,29 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
String[] permissions = {Manifest.permission.RECORD_AUDIO};
|
||||
private WheatFeedingDialogFragment wheatFeedingDialogFragment;
|
||||
|
||||
private SingSongFragment singSongFragment; /// 二卡八 --pk
|
||||
private RoomKtvFragment ktvFragment; /// KTV
|
||||
private SingSongFragment singSongFragment;
|
||||
/// 二卡八 --pk
|
||||
private RoomKtvFragment ktvFragment;
|
||||
/// KTV
|
||||
|
||||
private RoomAuctionFragment roomAuctionFragment;///拍卖
|
||||
private RoomAuctionFragment roomAuctionFragment;
|
||||
/// 拍卖
|
||||
|
||||
private FriendshipRoomFragment friendshipRoomFragment; //交友
|
||||
|
||||
private RoomCabinFragment roomCabinFragment;// 小黑屋
|
||||
|
||||
public QXRoomSeatViewType qxRoomSeatViewType;
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
|
||||
mRoomInfoResp = new RoomInfoResp();
|
||||
mRoomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfo");
|
||||
password = arguments.getString("password");
|
||||
roomId = mRoomInfoResp.getRoom_info().getRoom_id();
|
||||
role = mRoomInfoResp.getRoom_info().getRole();
|
||||
roomInfo(mRoomInfoResp);
|
||||
// mRoomInfoResp = new RoomInfoResp();
|
||||
// mRoomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfo");
|
||||
// password = arguments.getString("password");
|
||||
// roomId = mRoomInfoResp.getRoom_info().getRoom_id();
|
||||
// role = mRoomInfoResp.getRoom_info().getRole();
|
||||
// roomInfo(mRoomInfoResp);
|
||||
|
||||
|
||||
super.initArgs(arguments);
|
||||
@@ -136,6 +141,151 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
onFragmentShowDestroy();
|
||||
}
|
||||
|
||||
public void setqxRoomSeatViewType(QXRoomSeatViewType type) {
|
||||
this.qxRoomSeatViewType = type;
|
||||
switch (type) {
|
||||
case NORMAL:
|
||||
releaseKtvFragment();
|
||||
releaseRoomAuctionFragment();
|
||||
releaseFriendshipRoomFragment();
|
||||
releaseRoomCabinFragment();
|
||||
createSingSongFragment();
|
||||
break;
|
||||
case AUCTION:
|
||||
releaseSingSongFragment();
|
||||
releaseKtvFragment();
|
||||
releaseFriendshipRoomFragment();
|
||||
releaseRoomCabinFragment();
|
||||
createRoomAuctionFragment();
|
||||
break;
|
||||
case KTV:
|
||||
releaseRoomAuctionFragment();
|
||||
releaseFriendshipRoomFragment();
|
||||
releaseSingSongFragment();
|
||||
releaseRoomCabinFragment();
|
||||
createKtvFragment();
|
||||
case CABIN:
|
||||
releaseKtvFragment();
|
||||
releaseRoomAuctionFragment();
|
||||
releaseFriendshipRoomFragment();
|
||||
releaseSingSongFragment();
|
||||
createRoomCabinFragment();
|
||||
break;
|
||||
case FRIEND:
|
||||
releaseRoomAuctionFragment();
|
||||
releaseRoomCabinFragment();
|
||||
releaseKtvFragment();
|
||||
releaseSingSongFragment();
|
||||
createFriendshipRoomFragment();
|
||||
break;
|
||||
case NONE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void releaseSingSongFragment() {
|
||||
if (singSongFragment != null) {
|
||||
singSongFragment.releaseResources();
|
||||
singSongFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void createSingSongFragment() {
|
||||
if (singSongFragment == null) {
|
||||
singSongFragment = SingSongFragment.newInstance();
|
||||
// 确保 Fragment 已添加且处于活跃状态再进行操作
|
||||
// 如果当前状态不允许添加 Fragment,则延迟执行
|
||||
if (isAdded() && getActivity() != null && getView() != null) {
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.container, singSongFragment)
|
||||
.commitAllowingStateLoss();
|
||||
} else if (getView() != null) {
|
||||
// 延迟执行直到 Fragment 处于合适状态
|
||||
getView().post(() -> {
|
||||
if (isAdded() && getActivity() != null) {
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.container, singSongFragment)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseKtvFragment() {
|
||||
if (ktvFragment != null) {
|
||||
ktvFragment.releaseResources();
|
||||
ktvFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void createKtvFragment() {
|
||||
if (ktvFragment == null) {
|
||||
ktvFragment = RoomKtvFragment.newInstance();
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.container, ktvFragment)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseRoomAuctionFragment() {
|
||||
if (roomAuctionFragment != null) {
|
||||
roomAuctionFragment.releaseResources();
|
||||
roomAuctionFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void createRoomAuctionFragment() {
|
||||
if (roomAuctionFragment == null) {
|
||||
roomAuctionFragment = RoomAuctionFragment.newInstance();
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.container, roomAuctionFragment)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseFriendshipRoomFragment() {
|
||||
if (friendshipRoomFragment != null) {
|
||||
friendshipRoomFragment.releaseResources();
|
||||
friendshipRoomFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void createFriendshipRoomFragment() {
|
||||
if (friendshipRoomFragment == null) {
|
||||
friendshipRoomFragment = FriendshipRoomFragment.newInstance();
|
||||
// replaceNestedFragment(friendshipRoomFragment, R.id.container);
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.container, friendshipRoomFragment)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseRoomCabinFragment() {
|
||||
if (roomCabinFragment != null) {
|
||||
roomCabinFragment.releaseResources();
|
||||
roomCabinFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void createRoomCabinFragment() {
|
||||
if (roomCabinFragment == null) {
|
||||
roomCabinFragment = RoomCabinFragment.newInstance();
|
||||
// replaceNestedFragment(roomCabinFragment, R.id.container);
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.container, roomCabinFragment)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
public void onFragmentShowDestroy() {
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
@@ -162,21 +312,8 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
wheatFeedingDialogFragment.dismissAllowingStateLoss();
|
||||
wheatFeedingDialogFragment = null;
|
||||
}
|
||||
|
||||
// 释放子Fragment
|
||||
releaseChildFragments();
|
||||
|
||||
// 释放输入菜单相关资源
|
||||
// if (mBinding != null && mBinding.inputMenu1 != null) {
|
||||
// mBinding.inputMenu1.dismiss();
|
||||
// }
|
||||
|
||||
// 取消所有可能的网络请求
|
||||
// if (MvpPre != null) {
|
||||
// // 取消与Fragment相关的网络请求(如果有提供相应方法)
|
||||
// MvpPre.cancelRequest();
|
||||
// }
|
||||
|
||||
} catch (Exception e) {
|
||||
LogUtils.e("releaseAllResources error: " + e.getMessage());
|
||||
}
|
||||
@@ -254,34 +391,66 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
loadSubFragment();
|
||||
// loadSubFragment();
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onMessageEvent(UnreadCountEvent messageEvent) {
|
||||
// if (messageEvent.getALong() == 0) {
|
||||
// mBinding.ivMessageDot.setVisibility(View.GONE);
|
||||
// } else {
|
||||
// mBinding.ivMessageDot.setVisibility(View.VISIBLE);
|
||||
// mBinding.ivMessageDot.setText(String.valueOf(messageEvent.getALong()));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
// 定义一个可被外部调用的方法
|
||||
public void refreshData(RoomInfoResp resp) {
|
||||
public void refreshData(RoomInfoResp resp, QXRoomSeatViewType qxRoomSeatViewType) {
|
||||
// 使用传入的参数刷新界面或逻辑
|
||||
mRoomInfoResp = resp;
|
||||
loadSubFragment();
|
||||
loadSubFragment(qxRoomSeatViewType);
|
||||
// upView(qxRoomSeatViewType);
|
||||
// 更新子Fragment视图
|
||||
updateChildFragmentViews();
|
||||
// updateChildFragmentViews();
|
||||
}
|
||||
|
||||
private <T extends Fragment> T findFragmentByTag(Class<T> fragmentClass) {
|
||||
return (T) getChildFragmentManager().findFragmentByTag(fragmentClass.getSimpleName());
|
||||
}
|
||||
|
||||
private void upView(QXRoomSeatViewType qxRoomSeatViewType) {
|
||||
this.qxRoomSeatViewType = qxRoomSeatViewType;
|
||||
switch (qxRoomSeatViewType) {
|
||||
case KTV:
|
||||
if (ktvFragment != null && ktvFragment.isAdded()) {
|
||||
ktvFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
} else {
|
||||
setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
}
|
||||
break;
|
||||
case AUCTION:
|
||||
if (roomAuctionFragment != null && roomAuctionFragment.isAdded()) {
|
||||
// roomAuctionFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
} else {
|
||||
setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
}
|
||||
break;
|
||||
case CABIN:
|
||||
if (roomCabinFragment != null && roomCabinFragment.isAdded()) {
|
||||
roomCabinFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
} else {
|
||||
setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
}
|
||||
break;
|
||||
case FRIEND:
|
||||
if (friendshipRoomFragment != null) {
|
||||
friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
} else {
|
||||
setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
}
|
||||
break;
|
||||
case NORMAL:
|
||||
if (singSongFragment != null && singSongFragment.isAdded()) {
|
||||
singSongFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
} else {
|
||||
setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateChildFragmentViews() {
|
||||
|
||||
// 使用弱引用避免内存泄漏
|
||||
@@ -386,8 +555,48 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
roomCabinFragment.upCabinFragment(time);
|
||||
}
|
||||
|
||||
private void loadSubFragment() {
|
||||
|
||||
private void loadSubFragment(QXRoomSeatViewType qxRoomSeatViewType) {
|
||||
this.qxRoomSeatViewType = qxRoomSeatViewType;
|
||||
// switch (qxRoomSeatViewType) {
|
||||
//
|
||||
// case KTV:
|
||||
// if (ktvFragment != null && ktvFragment.isAdded()) {
|
||||
// ktvFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// }else {
|
||||
// setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
// }
|
||||
// break;
|
||||
// case AUCTION:
|
||||
// if (roomAuctionFragment != null && roomAuctionFragment.isAdded()) {
|
||||
// roomAuctionFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// }else {
|
||||
// setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
// }
|
||||
// break;
|
||||
// case CABIN:
|
||||
// if (roomCabinFragment != null && roomCabinFragment.isAdded()) {
|
||||
// roomCabinFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// }else {
|
||||
// setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
// }
|
||||
// break;
|
||||
// case FRIEND:
|
||||
// if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) {
|
||||
// friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// }else {
|
||||
// setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
// }
|
||||
// break;
|
||||
// case NORMAL:
|
||||
// if (singSongFragment != null && singSongFragment.isAdded()) {
|
||||
// singSongFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// }else {
|
||||
// setqxRoomSeatViewType(qxRoomSeatViewType);
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
|
||||
String typeId = mRoomInfoResp.getRoom_info().getType_id();
|
||||
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
|
||||
@@ -396,29 +605,38 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
|
||||
if ("1".equals(typeId)) {
|
||||
if ("1".equals(labelId)) {
|
||||
newFragment = SingSongFragment.newInstance();
|
||||
singSongFragment = SingSongFragment.newInstance();
|
||||
newFragment = singSongFragment;
|
||||
} else if ("2".equals(labelId)) {
|
||||
newFragment = RoomKtvFragment.newInstance();
|
||||
ktvFragment = RoomKtvFragment.newInstance();
|
||||
newFragment = ktvFragment;
|
||||
}
|
||||
} else if ("2".equals(typeId)) {
|
||||
newFragment = RoomAuctionFragment.newInstance();
|
||||
roomAuctionFragment = RoomAuctionFragment.newInstance();
|
||||
newFragment = roomAuctionFragment;
|
||||
} else if ("6".equals(typeId)) {
|
||||
newFragment = RoomCabinFragment.newInstance();
|
||||
roomCabinFragment = RoomCabinFragment.newInstance();
|
||||
newFragment = roomCabinFragment;
|
||||
setviewyc();
|
||||
} else if ("3".equals(typeId)) {
|
||||
if ("1".equals(labelId)) {
|
||||
newFragment = SingSongFragment.newInstance();
|
||||
singSongFragment = SingSongFragment.newInstance();
|
||||
newFragment = singSongFragment;
|
||||
} else if ("2".equals(labelId)) {
|
||||
newFragment = RoomKtvFragment.newInstance();
|
||||
ktvFragment = RoomKtvFragment.newInstance();
|
||||
newFragment = ktvFragment;
|
||||
}
|
||||
} else if ("4".equals(typeId)) {
|
||||
if ("1".equals(labelId)) {
|
||||
newFragment = SingSongFragment.newInstance();
|
||||
singSongFragment = SingSongFragment.newInstance();
|
||||
newFragment = singSongFragment;
|
||||
} else if ("2".equals(labelId)) {
|
||||
newFragment = RoomKtvFragment.newInstance();
|
||||
ktvFragment = RoomKtvFragment.newInstance();
|
||||
newFragment = ktvFragment;
|
||||
}
|
||||
} else if ("7".equals(typeId)) {
|
||||
newFragment = FriendshipRoomFragment.newInstance();
|
||||
friendshipRoomFragment = FriendshipRoomFragment.newInstance();
|
||||
newFragment = friendshipRoomFragment;
|
||||
}
|
||||
|
||||
if (newFragment != null) {
|
||||
@@ -434,26 +652,28 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
AgoraManager.getInstance(getActivity()).muteLocalAudioStream(true);
|
||||
}
|
||||
// 延迟执行更新,确保 Fragment 已经添加完成
|
||||
if (getActivity() != null && isAdded()) {
|
||||
getView().post(() -> updateChildFragmentViews());
|
||||
}
|
||||
// if (getActivity() != null && isAdded()) {
|
||||
// getView().post(() -> updateChildFragmentViews());
|
||||
// }
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
if (mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
|
||||
((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
|
||||
((RoomActivity) getActivity()).setvisibTop(false);
|
||||
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
|
||||
if (mRoomInfoResp.getRoom_info().getRoom_background()==null || mRoomInfoResp.getRoom_info().getRoom_background().equals("")) {
|
||||
((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj);
|
||||
}else {
|
||||
((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||
}
|
||||
((RoomActivity) getActivity()).setvisibTop(true);
|
||||
} else {
|
||||
((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||
((RoomActivity) getActivity()).setvisibTop(true);
|
||||
}
|
||||
}
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// if (mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
|
||||
// ((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
|
||||
// ((RoomActivity) getActivity()).setvisibTop(false);
|
||||
// } else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
|
||||
// if (mRoomInfoResp.getRoom_info().getRoom_background() == null || mRoomInfoResp.getRoom_info().getRoom_background().equals("")) {
|
||||
// ((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj);
|
||||
// } else {
|
||||
// ((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||
// }
|
||||
// ((RoomActivity) getActivity()).setvisibTop(true);
|
||||
// } else {
|
||||
// ((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
|
||||
// ((RoomActivity) getActivity()).setvisibTop(true);
|
||||
// }
|
||||
// }
|
||||
|
||||
updateChildFragmentViews();
|
||||
}
|
||||
|
||||
/// 这是在进入电影放的时候,隐藏下面的和排麦视图
|
||||
@@ -532,12 +752,21 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
|
||||
public void updateSeatViewExchangedWithPitArray(RoomInfoResp roomInfoResp) {
|
||||
mRoomInfoResp = roomInfoResp;
|
||||
loadSubFragment(qxRoomSeatViewType);
|
||||
updateChildFragmentViews();
|
||||
// upView(qxRoomSeatViewType);
|
||||
|
||||
}
|
||||
|
||||
public void upRoomInfoData(RoomInfoResp roomInfoResp) {
|
||||
this.mRoomInfoResp = roomInfoResp;
|
||||
}
|
||||
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp) {
|
||||
mRoomInfoResp = roomInfoResp;
|
||||
loadSubFragment(qxRoomSeatViewType);
|
||||
updateChildFragmentViewsUp();
|
||||
// upView(qxRoomSeatViewType);
|
||||
}
|
||||
|
||||
private void updateChildFragmentViewsUp() {
|
||||
@@ -964,88 +1193,128 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
}
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void roomInfoEvent(UserInfo messageEvent) {
|
||||
// mBinding.llInput.setVisibility(View.VISIBLE);
|
||||
// mBinding.inputMenu1.bringToFront(); // 强制将该 View 置于最上层
|
||||
// mBinding.inputMenu1.show();
|
||||
// mBinding.inputMenu1.setText("@" + messageEvent.getNickname());
|
||||
// }
|
||||
// TODO: 2025/8/29 拍卖房的方法
|
||||
// TODO: 2025/8/29 拍卖房的方法
|
||||
public void handleAuctionMessageEvent(RoomMessageEvent messageEvent) {
|
||||
RoomAuctionFragment auctionFragment = (RoomAuctionFragment) getChildFragmentManager()
|
||||
.findFragmentByTag(RoomAuctionFragment.class.getSimpleName());
|
||||
|
||||
if (auctionFragment != null) {
|
||||
auctionFragment.upRoomInfo(mRoomInfoResp);
|
||||
switch (messageEvent.getMsgType()) {
|
||||
case 1022:
|
||||
auctionFragment.event1022(messageEvent);
|
||||
break;
|
||||
case 1025:
|
||||
auctionFragment.event1025(messageEvent);
|
||||
break;
|
||||
case 1026:
|
||||
auctionFragment.event1026(messageEvent);
|
||||
break;
|
||||
case 1005:
|
||||
auctionFragment.event1005(messageEvent);
|
||||
break;
|
||||
case 1035:
|
||||
auctionFragment.event1035(messageEvent);
|
||||
break;
|
||||
case 1021:
|
||||
auctionFragment.event1021(messageEvent);
|
||||
break;
|
||||
case 1027:
|
||||
auctionFragment.event1027(messageEvent);
|
||||
break;
|
||||
case 1023:
|
||||
auctionFragment.event1023(messageEvent);
|
||||
break;
|
||||
case 1024:
|
||||
auctionFragment.event1024(messageEvent);
|
||||
break;
|
||||
case 1004:
|
||||
auctionFragment.event1004(messageEvent);
|
||||
break;
|
||||
case 1003:
|
||||
auctionFragment.event1003(messageEvent);
|
||||
break;
|
||||
case 1059:
|
||||
auctionFragment.event1059(messageEvent);
|
||||
break;
|
||||
case 1058:
|
||||
auctionFragment.event1058(messageEvent);
|
||||
break;
|
||||
default:
|
||||
// 可以添加默认处理或日志记录
|
||||
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
|
||||
break;
|
||||
}
|
||||
switch (qxRoomSeatViewType) {
|
||||
case KTV:
|
||||
break;
|
||||
case AUCTION:
|
||||
roomAuctionFragment.upRoomInfo(mRoomInfoResp);
|
||||
switch (messageEvent.getMsgType()) {
|
||||
case 1022:
|
||||
roomAuctionFragment.event1022(messageEvent);
|
||||
break;
|
||||
case 1025:
|
||||
roomAuctionFragment.event1025(messageEvent);
|
||||
break;
|
||||
case 1026:
|
||||
roomAuctionFragment.event1026(messageEvent);
|
||||
break;
|
||||
case 1005:
|
||||
roomAuctionFragment.event1005(messageEvent);
|
||||
break;
|
||||
case 1035:
|
||||
roomAuctionFragment.event1035(messageEvent);
|
||||
break;
|
||||
case 1021:
|
||||
roomAuctionFragment.event1021(messageEvent);
|
||||
break;
|
||||
case 1027:
|
||||
roomAuctionFragment.event1027(messageEvent);
|
||||
break;
|
||||
case 1023:
|
||||
roomAuctionFragment.event1023(messageEvent);
|
||||
break;
|
||||
case 1024:
|
||||
roomAuctionFragment.event1024(messageEvent);
|
||||
break;
|
||||
case 1004:
|
||||
roomAuctionFragment.event1004(messageEvent);
|
||||
break;
|
||||
case 1003:
|
||||
roomAuctionFragment.event1003(messageEvent);
|
||||
break;
|
||||
case 1059:
|
||||
roomAuctionFragment.event1059(messageEvent);
|
||||
break;
|
||||
case 1058:
|
||||
roomAuctionFragment.event1058(messageEvent);
|
||||
break;
|
||||
default:
|
||||
// 可以添加默认处理或日志记录
|
||||
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CABIN:
|
||||
break;
|
||||
case FRIEND:
|
||||
break;
|
||||
case NORMAL:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// RoomAuctionFragment auctionFragment = (RoomAuctionFragment) getChildFragmentManager()
|
||||
// .findFragmentByTag(RoomAuctionFragment.class.getSimpleName());
|
||||
//
|
||||
// if (auctionFragment != null) {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
// TODO: 2025/9/12 交友房
|
||||
public void friendshipRoomFragmentEvent(RoomMessageEvent messageEvent) {
|
||||
FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager()
|
||||
.findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
|
||||
if (friendshipRoomFragment != null) {
|
||||
friendshipRoomFragment.upRoomInfo(mRoomInfoResp);
|
||||
switch (messageEvent.getMsgType()) {
|
||||
case 1059:
|
||||
friendshipRoomFragment.event1059(messageEvent);
|
||||
break;
|
||||
case 1058:
|
||||
friendshipRoomFragment.event1058(messageEvent);
|
||||
break;
|
||||
case 1005:
|
||||
friendshipRoomFragment.event1005(messageEvent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (qxRoomSeatViewType) {
|
||||
case KTV:
|
||||
break;
|
||||
case FRIEND:
|
||||
friendshipRoomFragment.upRoomInfo(mRoomInfoResp);
|
||||
switch (messageEvent.getMsgType()) {
|
||||
case 1059:
|
||||
friendshipRoomFragment.event1059(messageEvent);
|
||||
break;
|
||||
case 1058:
|
||||
friendshipRoomFragment.event1058(messageEvent);
|
||||
break;
|
||||
case 1005:
|
||||
friendshipRoomFragment.event1005(messageEvent);
|
||||
break;
|
||||
case 1003:
|
||||
friendshipRoomFragment.event1003(messageEvent);
|
||||
break;
|
||||
case 1004:
|
||||
friendshipRoomFragment.event1004(messageEvent);
|
||||
break;
|
||||
case 1039:
|
||||
|
||||
friendshipRoomFragment.event1039(messageEvent);
|
||||
break;
|
||||
case 1035:
|
||||
friendshipRoomFragment.event1035(messageEvent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CABIN:
|
||||
break;
|
||||
case AUCTION:
|
||||
break;
|
||||
case NORMAL:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager()
|
||||
// .findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
|
||||
// if (friendshipRoomFragment != null) {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -1057,96 +1326,133 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
cabinFragment.handleMsgType1028(messageEvent);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2025/8/30 Ktv模式
|
||||
public void KtvFragmentEvent(RoomMessageEvent messageEvent) {
|
||||
RoomKtvFragment ktvFragment = (RoomKtvFragment) getChildFragmentManager()
|
||||
.findFragmentByTag(RoomKtvFragment.class.getSimpleName());
|
||||
|
||||
if (ktvFragment != null) {
|
||||
switch (messageEvent.getMsgType()) {
|
||||
case 1013:
|
||||
ktvFragment.event1013(messageEvent);
|
||||
break;
|
||||
case 1003:
|
||||
ktvFragment.event1003(messageEvent);
|
||||
break;
|
||||
case 1004:
|
||||
ktvFragment.event1004(messageEvent);
|
||||
break;
|
||||
case 1021:
|
||||
ktvFragment.event1021(messageEvent);
|
||||
case 1005:
|
||||
ktvFragment.event1005(messageEvent);
|
||||
break;
|
||||
case 1035:
|
||||
ktvFragment.event1035(messageEvent);
|
||||
break;
|
||||
case 1059:
|
||||
ktvFragment.event1059(messageEvent);
|
||||
break;
|
||||
case 1058:
|
||||
ktvFragment.event1058(messageEvent);
|
||||
default:
|
||||
// 可以添加默认处理或日志记录
|
||||
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
|
||||
break;
|
||||
}
|
||||
switch (qxRoomSeatViewType) {
|
||||
case KTV:
|
||||
ktvFragment.upRoomInfo(mRoomInfoResp);
|
||||
switch (messageEvent.getMsgType()) {
|
||||
case 1013:
|
||||
ktvFragment.event1013(messageEvent);
|
||||
break;
|
||||
case 1003:
|
||||
ktvFragment.event1003(messageEvent);
|
||||
break;
|
||||
case 1004:
|
||||
ktvFragment.event1004(messageEvent);
|
||||
break;
|
||||
case 1021:
|
||||
ktvFragment.event1021(messageEvent);
|
||||
case 1005:
|
||||
ktvFragment.event1005(messageEvent);
|
||||
break;
|
||||
case 1035:
|
||||
ktvFragment.event1035(messageEvent);
|
||||
break;
|
||||
case 1059:
|
||||
ktvFragment.event1059(messageEvent);
|
||||
break;
|
||||
case 1058:
|
||||
ktvFragment.event1058(messageEvent);
|
||||
default:
|
||||
// 可以添加默认处理或日志记录
|
||||
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NORMAL:
|
||||
break;
|
||||
case AUCTION:
|
||||
break;
|
||||
case CABIN:
|
||||
break;
|
||||
case FRIEND:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// RoomKtvFragment ktvFragment = (RoomKtvFragment) getChildFragmentManager()
|
||||
// .findFragmentByTag(RoomKtvFragment.class.getSimpleName());
|
||||
//
|
||||
// if (ktvFragment != null) {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
// TODO: 2025/8/30 点唱房模式
|
||||
public void SingSongEvent(RoomMessageEvent messageEvent) {
|
||||
switch (qxRoomSeatViewType) {
|
||||
case NORMAL:
|
||||
singSongFragment.upRoonInfo(mRoomInfoResp);
|
||||
switch (messageEvent.getMsgType()) {
|
||||
case 1037:
|
||||
singSongFragment.event1037(messageEvent);
|
||||
break;
|
||||
case 1003:
|
||||
singSongFragment.event1003(messageEvent);
|
||||
break;
|
||||
case 1004:
|
||||
singSongFragment.event1004(messageEvent);
|
||||
break;
|
||||
case 1005:
|
||||
singSongFragment.event1005(messageEvent);
|
||||
break;
|
||||
case 1015:
|
||||
singSongFragment.event1015(messageEvent);
|
||||
break;
|
||||
case 1030:
|
||||
singSongFragment.event1030(messageEvent);
|
||||
break;
|
||||
case 1031:
|
||||
singSongFragment.event1031(messageEvent);
|
||||
break;
|
||||
case 1032:
|
||||
singSongFragment.event1032(messageEvent);
|
||||
break;
|
||||
case 1033:
|
||||
singSongFragment.event1033(messageEvent);
|
||||
break;
|
||||
case 1035:
|
||||
singSongFragment.event1035(messageEvent);
|
||||
break;
|
||||
case 1021:
|
||||
singSongFragment.event1021(messageEvent);
|
||||
break;
|
||||
case 1059:
|
||||
singSongFragment.event1059(messageEvent);
|
||||
break;
|
||||
case 1058:
|
||||
singSongFragment.event1058(messageEvent);
|
||||
break;
|
||||
case 1039:
|
||||
singSongFragment.event1039(messageEvent);
|
||||
break;
|
||||
default:
|
||||
// 可以添加默认处理或日志记录
|
||||
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case KTV:
|
||||
break;
|
||||
case FRIEND:
|
||||
break;
|
||||
case CABIN:
|
||||
break;
|
||||
case AUCTION:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
SingSongFragment singSongFragment = (SingSongFragment) getChildFragmentManager()
|
||||
.findFragmentByTag(SingSongFragment.class.getSimpleName());
|
||||
if (singSongFragment != null) {
|
||||
singSongFragment.upRoonInfo(mRoomInfoResp);
|
||||
switch (messageEvent.getMsgType()) {
|
||||
case 1037:
|
||||
singSongFragment.event1037(messageEvent);
|
||||
break;
|
||||
case 1003:
|
||||
singSongFragment.event1003(messageEvent);
|
||||
break;
|
||||
case 1004:
|
||||
singSongFragment.event1004(messageEvent);
|
||||
break;
|
||||
case 1005:
|
||||
singSongFragment.event1005(messageEvent);
|
||||
break;
|
||||
case 1015:
|
||||
singSongFragment.event1015(messageEvent);
|
||||
break;
|
||||
case 1030:
|
||||
singSongFragment.event1030(messageEvent);
|
||||
break;
|
||||
case 1031:
|
||||
singSongFragment.event1031(messageEvent);
|
||||
break;
|
||||
case 1032:
|
||||
singSongFragment.event1032(messageEvent);
|
||||
break;
|
||||
case 1033:
|
||||
singSongFragment.event1033(messageEvent);
|
||||
break;
|
||||
case 1035:
|
||||
singSongFragment.event1035(messageEvent);
|
||||
break;
|
||||
case 1021:
|
||||
singSongFragment.event1021(messageEvent);
|
||||
break;
|
||||
case 1059:
|
||||
singSongFragment.event1059(messageEvent);
|
||||
break;
|
||||
case 1058:
|
||||
singSongFragment.event1058(messageEvent);
|
||||
break;
|
||||
default:
|
||||
// 可以添加默认处理或日志记录
|
||||
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
|
||||
break;
|
||||
}
|
||||
}
|
||||
// SingSongFragment singSongFragment = (SingSongFragment) getChildFragmentManager()
|
||||
// .findFragmentByTag(SingSongFragment.class.getSimpleName());
|
||||
// if (singSongFragment != null) {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -130,9 +130,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
protected void initData() {
|
||||
upDtaView();
|
||||
}
|
||||
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp) {
|
||||
this.roomInfoResp = roomInfoResp;
|
||||
}
|
||||
|
||||
private void upDtaView() {
|
||||
pitList = new ArrayList<>();
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
@@ -338,7 +340,8 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
/**
|
||||
* 检查是否为快速重复点击
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param pitNumber 麦位号
|
||||
* @return true表示是快速重复点击,false表示不是
|
||||
*/
|
||||
@@ -457,7 +460,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
pitNumber = pitBean.getPit_number();
|
||||
roomPitBean = pitBean;
|
||||
showPopupMenu(view); // v 是点击的按钮视图
|
||||
} else if (pitNumber1 == 10 && isUserHostOfRoom() ) {
|
||||
} else if (pitNumber1 == 10 && isUserHostOfRoom()) {
|
||||
RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
} else if (pitNumber1 != 10) {
|
||||
MvpPre.applyPit(roomId, pitNumber1 + "");
|
||||
@@ -516,8 +519,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
mBinding.imMkf.setOnClickListener(this::onClick);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查当前用户是否是房间的主持人
|
||||
*
|
||||
* @return true表示是主持人,false表示不是主持人或数据不完整
|
||||
*/
|
||||
private boolean isUserHostOfRoom() {
|
||||
@@ -913,7 +918,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
// 可选:点击事件处理
|
||||
Log.d("Wheat", "Clicked pit: " + pitNumber);
|
||||
if (!pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (isFastDoubleClick(pitBean.getUser_id(), pitBean.getPit_number())){
|
||||
if (isFastDoubleClick(pitBean.getUser_id(), pitBean.getPit_number())) {
|
||||
return;
|
||||
}
|
||||
RoomUserInfoFragment.show(roomInfoRespPk.getRoom_info().getRoom_id(), pitBean.getUser_id(), pitNumber + "", getHostUser(), true, 3, isNumberWhether(), getChildFragmentManager());
|
||||
@@ -1273,12 +1278,12 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
}
|
||||
|
||||
// TODO: 2025/9/12 清除个人魅力
|
||||
public void event1059(RoomMessageEvent message){
|
||||
public void event1059(RoomMessageEvent message) {
|
||||
String userId = message.getText().getUser_id();
|
||||
RoomPitBean pitBean=new RoomPitBean();
|
||||
for (RoomPitBean roomPitBean : roomInfoResp.getRoom_info().getPit_list()){
|
||||
if (roomPitBean.getUser_id().equals(userId)){
|
||||
pitBean=roomPitBean;
|
||||
RoomPitBean pitBean = new RoomPitBean();
|
||||
for (RoomPitBean roomPitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
if (roomPitBean.getUser_id().equals(userId)) {
|
||||
pitBean = roomPitBean;
|
||||
pitBean.setCharm("");
|
||||
break;
|
||||
}
|
||||
@@ -1295,10 +1300,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
public void event1058(RoomMessageEvent message) {
|
||||
String userId = message.getText().getUser_id();
|
||||
int type = message.getText().getType();
|
||||
RoomPitBean pitBean=new RoomPitBean();
|
||||
for (RoomPitBean roomPitBean : roomInfoResp.getRoom_info().getPit_list()){
|
||||
if (roomPitBean.getUser_id() == null && roomPitBean.getUser_id().equals(userId)){
|
||||
pitBean=roomPitBean;
|
||||
RoomPitBean pitBean = new RoomPitBean();
|
||||
for (RoomPitBean roomPitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
if (roomPitBean.getUser_id() == null && roomPitBean.getUser_id().equals(userId)) {
|
||||
pitBean = roomPitBean;
|
||||
pitBean.setIs_online(type == 1 ? 1 : 2);
|
||||
break;
|
||||
}
|
||||
@@ -1310,6 +1315,17 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
}
|
||||
}
|
||||
|
||||
public void event1039(RoomMessageEvent message) {
|
||||
if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
wheatLayoutSingManager.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
wheatLayoutManager1.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// 推送的下麦1003
|
||||
@@ -1637,7 +1653,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
releaseResources();
|
||||
}
|
||||
|
||||
public void releaseResources(){
|
||||
public void releaseResources() {
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@@ -403,4 +403,36 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auctionEnd(String auctionId,String roomId) {
|
||||
api.auctionEnd(auctionId,roomId, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
// MvpRef.get().auctionEnd();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auctionDelay(String auctionId) {
|
||||
RetrofitClient.getInstance().auctionDelay(auctionId, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
|
||||
// MvpRef.get().auctionDelay();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +468,8 @@
|
||||
android:src="@mipmap/room_sound_effects"
|
||||
app:layout_constraintBottom_toTopOf="@+id/iv_wheat_feeding"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:visibility="visible" />
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_wheat_feeding"
|
||||
|
||||
@@ -145,19 +145,19 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/wheat_view9"
|
||||
app:layout_constraintWidth_percent="1" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/iv_22"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_57"
|
||||
android:visibility="gone"
|
||||
app:autoPlay="true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/background_image"
|
||||
app:layout_constraintEnd_toEndOf="@id/background_image"
|
||||
app:layout_constraintStart_toStartOf="@id/background_image"
|
||||
app:layout_constraintTop_toTopOf="@id/background_image"
|
||||
app:loopCount="0"
|
||||
app:source="heart_line_31.svga"
|
||||
tools:visibility="visible" />
|
||||
<!-- <com.opensource.svgaplayer.SVGAImageView-->
|
||||
<!-- android:id="@+id/iv_22"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="@dimen/dp_57"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:autoPlay="true"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@id/background_image"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@id/background_image"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@id/background_image"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@id/background_image"-->
|
||||
<!-- app:loopCount="0"-->
|
||||
<!-- app:source="heart_line_31.svga"-->
|
||||
<!-- tools:visibility="visible" />-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_x2"
|
||||
@@ -166,10 +166,10 @@
|
||||
android:scaleType="fitXY"
|
||||
android:src="@mipmap/jiaoy_xian"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/background_image"
|
||||
app:layout_constraintEnd_toEndOf="@id/background_image"
|
||||
app:layout_constraintStart_toStartOf="@id/background_image"
|
||||
app:layout_constraintTop_toTopOf="@id/background_image" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/wheat_view2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/wheat_view5"
|
||||
app:layout_constraintStart_toEndOf="@id/wheat_view2"
|
||||
app:layout_constraintTop_toTopOf="@id/wheat_view2" />
|
||||
|
||||
|
||||
<ImageView
|
||||
@@ -297,20 +297,20 @@
|
||||
app:room_make_pic="@mipmap/jiaoy_n"
|
||||
app:room_make_wheat_number="4" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/iv_11"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_57"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
app:autoPlay="true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/wheat_view1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/wheat_view6"
|
||||
app:layout_constraintStart_toEndOf="@+id/wheat_view1"
|
||||
app:layout_constraintTop_toTopOf="@id/wheat_view1"
|
||||
app:loopCount="0"
|
||||
app:source="heart_line_31.svga"
|
||||
tools:visibility="visible" />
|
||||
<!-- <com.opensource.svgaplayer.SVGAImageView-->
|
||||
<!-- android:id="@+id/iv_11"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="@dimen/dp_57"-->
|
||||
<!-- android:layout_gravity="center"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:autoPlay="true"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@id/wheat_view1"-->
|
||||
<!-- app:layout_constraintEnd_toStartOf="@+id/wheat_view6"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/wheat_view1"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@id/wheat_view1"-->
|
||||
<!-- app:loopCount="0"-->
|
||||
<!-- app:source="heart_line_31.svga"-->
|
||||
<!-- tools:visibility="visible" />-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_x1"
|
||||
@@ -339,20 +339,20 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/wheat_view1"
|
||||
app:layout_constraintTop_toTopOf="@id/wheat_view1" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/iv_33"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_57"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
app:autoPlay="true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/wheat_view3"
|
||||
app:layout_constraintEnd_toStartOf="@+id/wheat_view4"
|
||||
app:layout_constraintStart_toEndOf="@+id/wheat_view3"
|
||||
app:layout_constraintTop_toTopOf="@id/wheat_view3"
|
||||
app:loopCount="0"
|
||||
app:source="heart_line_31.svga"
|
||||
tools:visibility="visible" />
|
||||
<!-- <com.opensource.svgaplayer.SVGAImageView-->
|
||||
<!-- android:id="@+id/iv_33"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="@dimen/dp_57"-->
|
||||
<!-- android:layout_gravity="center"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:autoPlay="true"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@id/wheat_view3"-->
|
||||
<!-- app:layout_constraintEnd_toStartOf="@+id/wheat_view4"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/wheat_view3"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@id/wheat_view3"-->
|
||||
<!-- app:loopCount="0"-->
|
||||
<!-- app:source="heart_line_31.svga"-->
|
||||
<!-- tools:visibility="visible" />-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_x3"
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ViewStub
|
||||
<LinearLayout
|
||||
android:id="@+id/stub_buttons2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -232,10 +232,30 @@
|
||||
android:layout_toEndOf="@+id/rl"
|
||||
android:layout_alignTop="@id/btn_notice"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout="@layout/top_overlay_buttons"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
/>
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/im_action_ys"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@mipmap/action_ys"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_action_js"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@mipmap/action_js"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="invisible"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user