修改BUG
修改飘屏,飘屏不合适
This commit is contained in:
@@ -339,6 +339,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
sActivityRef = new WeakReference<>(this);
|
||||
|
||||
SpUtil.saveMyRoomId(roomId);
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||
// MvpPre.getRoomIn(roomId, password);
|
||||
// MvpPre.getRoomOnline(roomId, "1", "10");
|
||||
// 在子线程中执行网络请求
|
||||
@@ -1286,7 +1287,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
}
|
||||
} else {
|
||||
updateCharmForAllPitBeans("");
|
||||
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
|
||||
roomFragment.upFriendList(mRoomInfoResp.getRoom_info().getPit_list());
|
||||
}
|
||||
|
||||
|
||||
@@ -2208,7 +2209,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
Log.e("Fragment", "Fragment transaction skipped due to state loss.");
|
||||
}
|
||||
LogUtils.e("加入", roomId);
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||
|
||||
CommonAppContext.getInstance().isPlaying = true;
|
||||
CommonAppContext.getInstance().playId = roomId;
|
||||
CommonAppContext.getInstance().playName = mRoomBean.getRoom_name();
|
||||
@@ -2521,7 +2522,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 添加成员变量来跟踪前后台状态
|
||||
private boolean isInBackground = false;
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -2529,7 +2531,23 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
CommonAppContext.getInstance().isPlaying = true;
|
||||
// 延迟调整布局,确保视图已经完全加载
|
||||
mBinding.mainContentContainer.post(this::adjustLayoutHeights);
|
||||
// MvpPre.postRoomInfo(roomId);
|
||||
// 检查是否从后台返回
|
||||
if (isInBackground) {
|
||||
isInBackground = false;
|
||||
// 从后台回到前台时调用
|
||||
if (MvpPre != null && roomId != null) {
|
||||
MvpPre.postRoomInfo(roomId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
// 判断应用是否进入后台
|
||||
isInBackground = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2652,6 +2670,14 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
|
||||
@Override
|
||||
public void postRoomInfo(RoomInfoResp resp) {
|
||||
if (resp == null){
|
||||
ARouter.getInstance().build(ARouteConstants.ME)
|
||||
.withFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.navigation();
|
||||
cleanupResources();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
this.mRoomInfoResp = resp;
|
||||
RoomBean roomBean = resp.getRoom_info();
|
||||
this.mRoomBean = roomBean;
|
||||
|
||||
@@ -494,55 +494,53 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (roonGiftModel != null && roonGiftModel.getGift_id() != null) {
|
||||
if (currentItem != 0) {
|
||||
//礼物打赏
|
||||
giftNumber = num;
|
||||
|
||||
if (currentItem != 0) {
|
||||
//礼物打赏
|
||||
giftNumber = num;
|
||||
|
||||
if (userInfo != null) {
|
||||
if (userInfo.getPit_number() != null) {
|
||||
if (userInfo.getPit_number().equals("888") || userInfo.getPit_number().equals("")) {
|
||||
if (userInfo.getPit_number().isEmpty() || jingp != 1) {
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
|
||||
if (userInfo != null) {
|
||||
if (userInfo.getPit_number() != null) {
|
||||
if (userInfo.getPit_number().equals("888") || userInfo.getPit_number().equals("")) {
|
||||
if (userInfo.getPit_number().isEmpty() || jingp != 1) {
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
|
||||
} else {
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, userInfo.getAuction_id());
|
||||
EventBus.getDefault().post(roomGiftGiveEvent);
|
||||
roomGiftGiveEvent = null;
|
||||
MvpPre.roomAuctionJoin(userInfo.getAuction_id(), userInfo.getUser_id() + "", roonGiftModel.getGift_id(), num, "1");
|
||||
dismiss();
|
||||
}
|
||||
} else {
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, userInfo.getAuction_id());
|
||||
EventBus.getDefault().post(roomGiftGiveEvent);
|
||||
roomGiftGiveEvent = null;
|
||||
MvpPre.roomAuctionJoin(userInfo.getAuction_id(), userInfo.getUser_id() + "", roonGiftModel.getGift_id(), num, "1");
|
||||
dismiss();
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, heart_id);
|
||||
}
|
||||
} else {
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, heart_id);
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
|
||||
}
|
||||
} else {
|
||||
if (all) {
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", null, "");
|
||||
} else {
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
|
||||
}
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
|
||||
}
|
||||
} else if (currentItem == 0) {
|
||||
giftNumber = num;
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "2", pit, heart_id);
|
||||
} else {
|
||||
if (all) {
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", null, "");
|
||||
} else {
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
|
||||
}
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
}
|
||||
} else if (currentItem == 0) {
|
||||
// if (all) {
|
||||
// MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", null);
|
||||
// } else {
|
||||
// MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit);
|
||||
// }
|
||||
giftNumber = num;
|
||||
// roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 1, giftModel, null);
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "2", pit, heart_id);
|
||||
} else {
|
||||
//背包礼物打赏
|
||||
//背包礼物打赏
|
||||
// giftNumber = num;
|
||||
// roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 1, giftModel, null);
|
||||
//
|
||||
// MvpPre.giveBackGift(userId, giftModel.getGift_id(), roomId, pit, num, giftModel, 1);
|
||||
}
|
||||
} else {
|
||||
ToastUtils.show("数据错误");
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -588,7 +586,10 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
EventBus.getDefault().post(roomGiftGiveEvent);
|
||||
roomGiftGiveEvent = null;
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
dismiss();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -260,6 +260,25 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
|
||||
}
|
||||
|
||||
public void upFriendList(){
|
||||
mBinding.wheatView1.pitBean.setCharm("0");
|
||||
mBinding.wheatView1.setData(mBinding.wheatView1.pitBean);
|
||||
mBinding.wheatView2.pitBean.setCharm("0");
|
||||
mBinding.wheatView2.setData(mBinding.wheatView2.pitBean);
|
||||
mBinding.wheatView3.pitBean.setCharm("0");
|
||||
mBinding.wheatView3.setData(mBinding.wheatView3.pitBean);
|
||||
mBinding.wheatView4.pitBean.setCharm("0");
|
||||
mBinding.wheatView4.setData(mBinding.wheatView4.pitBean);
|
||||
mBinding.wheatView5.pitBean.setCharm("0");
|
||||
mBinding.wheatView5.setData(mBinding.wheatView5.pitBean);
|
||||
mBinding.wheatView6.pitBean.setCharm("0");
|
||||
mBinding.wheatView6.setData(mBinding.wheatView6.pitBean);
|
||||
mBinding.wheatView9.pitBean.setCharm("0");
|
||||
mBinding.wheatView9.setData(mBinding.wheatView9.pitBean);
|
||||
mBinding.wheatView10.pitBean.setCharm("0");
|
||||
mBinding.wheatView10.setData(mBinding.wheatView10.pitBean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理空麦位点击
|
||||
*/
|
||||
|
||||
@@ -367,6 +367,13 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
friendshipRoomFragment.friendSeatDidChanged(pitArr);
|
||||
}
|
||||
|
||||
public void upFriendList(List<RoomPitBean> pitArr){
|
||||
FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
|
||||
if (friendshipRoomFragment != null) {
|
||||
friendshipRoomFragment.upFriendList();
|
||||
}
|
||||
}
|
||||
|
||||
/// 小黑屋修改倒计时
|
||||
public void upCabinFragment(long time) {
|
||||
RoomCabinFragment roomCabinFragment = findFragmentByTag(RoomCabinFragment.class);
|
||||
|
||||
@@ -218,17 +218,23 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
|
||||
@Override
|
||||
public void onNext(RoomInfoResp roomInfoResp) {
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||
String token = roomInfoResp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||
String roomId = roomInfoResp.getRoom_info().getRoom_id(); // 房间 ID
|
||||
String rtm_token=roomInfoResp.getUser_info().getAgora_rtm_token();
|
||||
SpUtil.setRtmToken(rtm_token);
|
||||
int uid = SpUtil.getUserId(); // 0 表示由 Agora 自动生成 UID
|
||||
boolean enableMic = false; // 是否开启麦克风
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().postRoomInfo(roomInfoResp);
|
||||
if (roomInfoResp==null){
|
||||
MvpRef.get().postRoomInfo(null);
|
||||
}else {
|
||||
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||
String token = roomInfoResp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||
String roomId = roomInfoResp.getRoom_info().getRoom_id(); // 房间 ID
|
||||
String rtm_token = roomInfoResp.getUser_info().getAgora_rtm_token();
|
||||
SpUtil.setRtmToken(rtm_token);
|
||||
int uid = SpUtil.getUserId(); // 0 表示由 Agora 自动生成 UID
|
||||
boolean enableMic = false; // 是否开启麦克风
|
||||
|
||||
MvpRef.get().postRoomInfo(roomInfoResp);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,11 +12,13 @@ import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View> implements SingSongContacts.IEmotionRoomPre {
|
||||
private SingSongContacts.View mView;
|
||||
public SingSongPresenter(SingSongContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
@@ -31,6 +33,9 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().applyPit();
|
||||
}
|
||||
});
|
||||
@@ -46,6 +51,9 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
|
||||
@Override
|
||||
public void onNext(String string) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().setMutePit(pitNumber, is_mute);
|
||||
}
|
||||
});
|
||||
@@ -61,6 +69,9 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
|
||||
@Override
|
||||
public void onNext(String string) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().setLockPit(pitNumber, is_lock);
|
||||
}
|
||||
});
|
||||
@@ -77,6 +88,9 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
|
||||
@Override
|
||||
public void onNext(RoomInfoResp roomInfoResp) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||
String token = roomInfoResp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||
String roomId = roomInfoResp.getRoom_info().getRoom_id(); // 房间 ID
|
||||
@@ -114,6 +128,9 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().endPk();
|
||||
}
|
||||
});
|
||||
@@ -129,6 +146,9 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserOnlineStatusBean> userOnlineStatusBean) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().userOnlineStatus(userOnlineStatusBean);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user