fix bugs 55

This commit is contained in:
2025-11-26 12:01:31 +08:00
parent 46b02ac407
commit 2221a11f0a
16 changed files with 285 additions and 161 deletions

View File

@@ -26,6 +26,7 @@ import androidx.databinding.ViewDataBinding;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.BarUtils;
import com.blankj.utilcode.util.LogUtils;
import com.hjq.toast.ToastUtils;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.dialog.LoadingDialog;
@@ -257,6 +258,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
public void finish() {
EventBus.getDefault().unregister(this);
super.finish();
LogUtils.e(this.getComponentName()+"========finish");
}
@Override
@@ -346,5 +348,22 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
}
@Override
protected void onResume() {
super.onResume();
LogUtils.e(this.getComponentName()+"========onResume");
}
@Override
protected void onPause() {
super.onPause();
LogUtils.e(this.getComponentName()+"=========onPause");
}
@Override
protected void onStop() {
super.onStop();
LogUtils.e(this.getComponentName()+"=========onStop");
}
}

View File

@@ -161,7 +161,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
//设置mqtt环境 false 测试环境 true 正式环境
// ExternalResConstants.INSTANCE.setIS_MQTT_RELEASE(false);
//设置http环境 false 测试环境 true 正式环境
ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(true);
ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(false);
currentEnvironment = ExternalResConstants.INSTANCE.HTTP_PATH();

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.modulemain.activity.login.activity.ImproveInfoActivity;
@@ -111,7 +112,6 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
}
@Override
public void switchAccounts(String loginId) {
api.switchAccounts(loginId, new BaseObserver<List<UserBean>>() {
@@ -143,6 +143,7 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
}
});
}
//一键登陆
@Override
public void oauthLoginLogin(String auth_code) {
@@ -202,29 +203,32 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
}
if (userBean.get(0).getSex() == 0) {
try {
Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), ImproveInfoActivity.class);
Intent intent = new Intent(ActivityUtils.getTopActivity(), ImproveInfoActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("userBean", userBean.get(0));
intent.putExtras(bundle);
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
com.blankj.utilcode.util.ActivityUtils.getTopActivity().finish();
ActivityUtils.startActivity(intent);
if (ActivityUtils.getTopActivity() != null)
ActivityUtils.getTopActivity().finish();
} catch (Exception e) {
e.printStackTrace();
}
} else {
EventBus.getDefault().post(userBean.get(0));
com.blankj.utilcode.util.ActivityUtils.startActivity(MainActivity.class);
com.blankj.utilcode.util.ActivityUtils.getTopActivity().finish();
ActivityUtils.startActivity(MainActivity.class);
if (ActivityUtils.getTopActivity() != null)
ActivityUtils.getTopActivity().finish();
}
} else {
Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), SwitchAccountsActivity.class);
Intent intent = new Intent(ActivityUtils.getTopActivity(), SwitchAccountsActivity.class);
Bundle bundle = new Bundle();
// bundle.putSerializable("userBean", (Serializable) userBean);
intent.putExtra("userBean", (ArrayList<UserBean>) userBean);
intent.putExtras(bundle);
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
com.blankj.utilcode.util.ActivityUtils.getTopActivity().finish();
ActivityUtils.startActivity(intent);
if (ActivityUtils.getTopActivity() != null)
ActivityUtils.getTopActivity().finish();
}
// EventBus.getDefault().post(new LoginFinishEvent());
@@ -263,19 +267,19 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
}
public void ysxl() {
Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), WebViewActivity.class);
Intent intent = new Intent(ActivityUtils.getTopActivity(), WebViewActivity.class);
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4");
intent.putExtra("title", "隐私协议");
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
ActivityUtils.startActivity(intent);
// ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
}
public void yhxy() {
Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), WebViewActivity.class);
Intent intent = new Intent(ActivityUtils.getTopActivity(), WebViewActivity.class);
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6");
intent.putExtra("title", "用户协议");
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
ActivityUtils.startActivity(intent);
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6").withString("title", "用户协议").navigation();
}

View File

@@ -121,7 +121,6 @@ import com.xscm.moduleutil.bean.room.FriendInfo.HeartList
import com.xscm.moduleutil.bean.room.FriendUserBean
import com.xscm.moduleutil.bean.room.RoomAuction
import com.xscm.moduleutil.bean.room.RoomAuction.AuctionListBean
import com.xscm.moduleutil.bean.room.RoomBean
import com.xscm.moduleutil.bean.room.RoomHourBean
import com.xscm.moduleutil.bean.room.RoomInfoResp
import com.xscm.moduleutil.bean.room.RoomOnline
@@ -689,7 +688,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
LogUtils.e("RoomActivity", "onPause")
GiftDisplayManager.getInstance().clearAll()
if (mRoomInfoResp != null) {
if (mRoomInfoResp!!.room_info.type_id != "6") {
if (mRoomInfoResp?.room_info?.type_id != "6") {
// 只有在用户主动离开应用时才执行最小化操作
if (!userLeaving) {
// 保持Activity alive不调用finish()
@@ -922,7 +921,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
val userIds = StringBuilder()
if (mRoomInfoResp?.room_info?.pit_list != null) {
for (i in mRoomInfoResp?.room_info?.pit_list!!.indices) {
val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id
val userId = mRoomInfoResp?.room_info?.pit_list!![i].user_id
if (userId != null && userId != "0" && !userId.isEmpty()) {
if (userIds.length > 0) {
userIds.append(",")
@@ -958,7 +957,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()) {
if (mRoomInfoResp?.user_info?.pit_number == 9 && mRoomInfoResp?.user_info?.user_id == SpUtil.getUserId()) {
ivSoundEffects(true)
} else {
ivSoundEffects(false)
@@ -973,13 +972,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
if (mRoomInfoResp?.gift_cycle?.xlh_info?.xlh_status == "1") {
mBinding?.xlhRk?.visibility = View.VISIBLE
xlhDjs(mRoomInfoResp!!.gift_cycle.xlh_info.end_time)
xlhDjs(mRoomInfoResp?.gift_cycle?.xlh_info?.end_time)
} else {
mBinding?.xlhRk?.visibility = View.INVISIBLE
releaseCountDownTimer1()
}
if (mRoomInfoResp!!.hour_ranking_open == 1) {
if (mRoomInfoResp?.hour_ranking_open == 1) {
mBinding!!.clXsb.visibility = View.VISIBLE
} else {
mBinding!!.clXsb.visibility = View.GONE
@@ -1393,25 +1392,25 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
val userId = messageEvent.text?.user_id
LogUtils.e("messageEvent!!.text.type" + messageEvent.text.type)
CommonAppContext.getInstance().onlineMap[userId ?: ""] = messageEvent.text.type
if (mRoomInfoResp != null && mRoomInfoResp!!.room_info != null) {
if (mRoomInfoResp!!.room_info.type_id == "1" || mRoomInfoResp!!.room_info.type_id == "3" ||
mRoomInfoResp!!.room_info.type_id == "4" || mRoomInfoResp!!.room_info.type_id == "8"
if (mRoomInfoResp != null && mRoomInfoResp?.room_info != null) {
if (mRoomInfoResp?.room_info?.type_id == "1" || mRoomInfoResp?.room_info?.type_id == "3" ||
mRoomInfoResp?.room_info?.type_id == "4" || mRoomInfoResp?.room_info?.type_id == "8"
) {
if (mRoomInfoResp!!.room_info.label_id == "1") {
if (mRoomInfoResp?.room_info?.label_id == "1") {
// roomFragment!!.SingSongEvent(messageEvent)
} else {
roomFragment!!.handleRoomMessage(messageEvent)
}
} else if (mRoomInfoResp!!.room_info.type_id == "2") {
} else if (mRoomInfoResp?.room_info?.type_id == "2") {
roomFragment!!.handleRoomMessage(messageEvent)
} else if (mRoomInfoResp!!.room_info.type_id == "7") {
} else if (mRoomInfoResp?.room_info?.type_id == "7") {
roomFragment!!.handleRoomMessage(messageEvent)
}
}
CommonAppContext.getInstance().getOnlineMap()
} else if (msgType == EMMessageInfo.QXRoomMessageTypeQingGRMl) { // 1059清除个人魅力 1058在离线
if (mRoomInfoResp != null && mRoomInfoResp!!.room_info != null) {
if (mRoomInfoResp != null && mRoomInfoResp?.room_info != null) {
roomFragment!!.handleRoomMessage(messageEvent)
}
} else if (msgType == EMMessageInfo.QXRoomMessageTypeMangH) { // 1056 抽奖结果
@@ -1533,11 +1532,11 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun handleMsgType1039(messageEvent: RoomMessageEvent, text: T?) {
if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) {
if (mRoomInfoResp == null || mRoomInfoResp?.room_info == null) {
return
}
val pitList = mRoomInfoResp!!.room_info.pit_list
val pitList = mRoomInfoResp?.room_info?.pit_list
if (pitList != null && !pitList.isEmpty()) {
if (text == null) {
@@ -1560,13 +1559,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
toPitNumber: String,
messageEvent: RoomMessageEvent
) {
mRoomInfoResp!!.room_info.pit_list[toPitNumber.toInt() - 1] = getPitBean(messageEvent, 2)
mRoomInfoResp?.room_info?.pit_list!![toPitNumber.toInt() - 1] = getPitBean(messageEvent, 2)
mRoomInfoResp?.room_info?.pit_list!![fromPitNumber.toInt() - 1] = RoomPitBean(fromPitNumber)
if ("9" == toPitNumber && messageEvent.text.fromUserInfo.user_id == SpUtil.getUserId()) {
mRoomInfoResp!!.user_info.pit_number = Integer.parseInt(toPitNumber)
mRoomInfoResp?.user_info?.pit_number = Integer.parseInt(toPitNumber)
ivSoundEffects(true)
setRoleType(3, mRoomInfoResp!!.user_info.pit_number)
setRoleType(3, mRoomInfoResp?.user_info?.pit_number!!)
} else {
if (customMusicFloatingView != null) {
customMusicFloatingView!!.destroy()
@@ -1583,14 +1582,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
userPermissionChange()
if (mRoomInfoResp!!.user_info.pit_number == 9) {
if (mRoomInfoResp?.user_info?.pit_number == 9) {
ivSoundEffects(true)
}
}
private fun hand1005(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) return
if (text == null || mRoomInfoResp == null || mRoomInfoResp?.room_info == null) return
roomFragment!!.handleRoomMessage(messageEvent)
}
@@ -1628,17 +1627,17 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
AgoraManager.getInstance().desMusic()
if ((mRoomInfoResp!!.room_info.type_id == "1" || mRoomInfoResp!!.room_info.type_id == "4" ||
mRoomInfoResp!!.room_info.type_id == "3" || mRoomInfoResp!!.room_info.type_id == "8") &&
mRoomInfoResp!!.room_info.label_id == "2"
if ((mRoomInfoResp?.room_info?.type_id == "1" || mRoomInfoResp?.room_info?.type_id == "4" ||
mRoomInfoResp?.room_info?.type_id == "3" || mRoomInfoResp?.room_info?.type_id == "8") &&
mRoomInfoResp?.room_info?.label_id == "2"
) {
for (roomPitBean in mRoomInfoResp!!.song_pit_list) {
for (roomPitBean in mRoomInfoResp?.song_pit_list!!) {
AgoraManager.getInstance().ClientRole(false)
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding)
mBinding?.rlMic?.visibility = View.GONE
}
if (mRoomInfoResp!!.song_user_info != null && mRoomInfoResp!!.song_user_info.user_id != null) {
if (mRoomInfoResp!!.song_user_info.user_id == SpUtil.getUserId().toString() + "") {
if (mRoomInfoResp?.song_user_info != null && mRoomInfoResp?.song_user_info?.user_id != null) {
if (mRoomInfoResp?.song_user_info?.user_id == SpUtil.getUserId().toString() + "") {
AgoraManager.getInstance().ClientRole(false)
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding)
mBinding?.rlMic?.visibility = View.GONE
@@ -1666,7 +1665,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun handleMsgType1003(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) return
if (text == null || mRoomInfoResp == null || mRoomInfoResp?.room_info == null) return
val fromUserInfo = text.fromUserInfo ?: return
@@ -1684,8 +1683,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
aBoolean = false
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up)
setBoolean(aBoolean)
if (mRoomInfoResp!!.user_info != null) {
mRoomInfoResp!!.user_info.pit_number =
if (mRoomInfoResp?.user_info != null) {
mRoomInfoResp?.user_info?.pit_number =
pitNumber?.toInt() ?: -1
}
setRoleType(3, pitNumber!!.toInt())
@@ -1697,9 +1696,9 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
when (typeId) {
RoomType.AUCTION -> {
if ("9" == pitNumber) {
mRoomInfoResp!!.room_info.pit_list[0] = getPitBean(messageEvent, 1)
if (mRoomInfoResp!!.user_info != null) {
mRoomInfoResp!!.user_info.pit_number = pitNumber.toInt()
mRoomInfoResp?.room_info?.pit_list!![0] = getPitBean(messageEvent, 1)
if (mRoomInfoResp?.user_info != null) {
mRoomInfoResp?.user_info?.pit_number = pitNumber.toInt()
}
}
roomFragment!!.upRoomInfoData(mRoomInfoResp)
@@ -1707,11 +1706,11 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
RoomType.DATING -> {
val labelId = mRoomInfoResp!!.room_info.label_id
val labelId = mRoomInfoResp?.room_info?.label_id
if ("2" == labelId) {
roomFragment!!.handleRoomMessage(messageEvent)
} else if ("1" == labelId) {
mRoomInfoResp!!.room_info.pit_list[pitNumber.toInt() - 1] =
mRoomInfoResp?.room_info?.pit_list!![pitNumber.toInt() - 1] =
getPitBean(messageEvent, 1)
roomFragment!!.upRoomInfoData(mRoomInfoResp)
roomFragment!!.handleRoomMessage(messageEvent)
@@ -1736,7 +1735,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun handleMsgType1004(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) return
if (text == null || mRoomInfoResp == null || mRoomInfoResp?.room_info == null) return
val fromUserInfo = text.fromUserInfo ?: return
@@ -1766,7 +1765,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
switchMic(2)
}
val typeId = mRoomInfoResp!!.room_info.type_id
val typeId = mRoomInfoResp?.room_info?.type_id
val roomType = RoomType.fromTypeId(typeId)
@@ -1774,14 +1773,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
when (roomType) {
RoomType.AUCTION -> {
if ("9" == pitNumber) {
mRoomInfoResp!!.room_info.pit_list[0] = RoomPitBean(pitNumber)
mRoomInfoResp?.room_info?.pit_list!![0] = RoomPitBean(pitNumber)
if (userId == currentUserId) {
if (mRoomInfoResp!!.user_info != null) {
mRoomInfoResp!!.user_info.pit_number = 0
if (mRoomInfoResp?.user_info != null) {
mRoomInfoResp?.user_info?.pit_number = 0
}
}
} else if ("888" == pitNumber) {//被拍者
mRoomInfoResp!!.room_auction = null
mRoomInfoResp?.room_auction = null
if (userId == currentUserId) {
setRoleType(0, 0)
switchMic(2)
@@ -1792,12 +1791,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
RoomType.DATING -> {
//TODO 下麦更换数据
val labelId = mRoomInfoResp!!.room_info.label_id
val labelId = mRoomInfoResp?.room_info?.label_id
if ("1" == labelId) {
mRoomInfoResp?.room_info?.pit_list!![pitNumber.toInt() - 1] = RoomPitBean(pitNumber)
roomFragment!!.upRoomInfoData(mRoomInfoResp)
if (mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()) {
if (mRoomInfoResp?.user_info?.user_id == SpUtil.getUserId()) {
ivSoundEffects(false)
}
}
@@ -1816,7 +1815,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun handleMsgType1022(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) return
if (text == null || mRoomInfoResp == null || mRoomInfoResp?.room_info == null) return
val pitNumber = text.pit_number
val userId = text.fromUserInfo.user_id
@@ -1834,7 +1833,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
setRoleType(0, 0)
switchMic(2)
} else if ("888" == pitNumber) {
mRoomInfoResp!!.room_auction = RoomAuction()
mRoomInfoResp?.room_auction = RoomAuction()
if (userId == currentUserId) {
setRoleType(0, 0)
switchMic(2)
@@ -1847,23 +1846,23 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun handleMsgType1023(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp!!.room_auction == null) return
if (text == null || mRoomInfoResp == null || mRoomInfoResp?.room_auction == null) return
mRoomInfoResp!!.room_auction.auction_user = text.auction_user
mRoomInfoResp?.room_auction?.auction_user = text.auction_user
SpUtil.setAuctionId(text.auction_user.auction_id)
roomFragment!!.upRoomInfoData(mRoomInfoResp)
roomFragment!!.handleRoomMessage(messageEvent)
}
private fun handleMsgType1024(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp!!.room_auction == null) return
if (mRoomInfoResp!!.room_auction.auction_list != null) {
mRoomInfoResp!!.room_auction.auction_list.clear()
if (text == null || mRoomInfoResp == null || mRoomInfoResp?.room_auction == null) return
if (mRoomInfoResp?.room_auction?.auction_list != null) {
mRoomInfoResp?.room_auction?.auction_list!!.clear()
}
if (mRoomInfoResp!!.room_auction.auction_list != null && text.auction_list != null) {
mRoomInfoResp!!.room_auction.auction_list.addAll(text.auction_list)
if (mRoomInfoResp?.room_auction?.auction_list != null && text.auction_list != null) {
mRoomInfoResp?.room_auction?.auction_list!!.addAll(text.auction_list)
} else {
mRoomInfoResp!!.room_auction.auction_list = ArrayList()
mRoomInfoResp?.room_auction?.auction_list = ArrayList()
}
roomFragment!!.upRoomInfoData(mRoomInfoResp)
roomFragment!!.handleRoomMessage(messageEvent)
@@ -1905,6 +1904,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
if (roomMessageEvent.text.fromUserInfo.enter_image?.isNotEmpty() == true) {
showFloatingMessage(roomMessageEvent.text.fromUserInfo)
}
MvpPre?.getRoomOnline(roomId, "1", "10")
// number++
@@ -2045,21 +2045,21 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun handleMsgType1029(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp!!.user_info == null) return
if (text == null || mRoomInfoResp == null || mRoomInfoResp?.user_info == null) return
if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()) {
if (mRoomInfoResp?.user_info?.pit_number == 9 && mRoomInfoResp?.user_info?.user_id == SpUtil.getUserId()) {
querenPk(text.text, text.pkId)
}
}
private fun handleMsgType1021(messageEvent: RoomMessageEvent, text: T) {
if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) return
if (mRoomInfoResp == null || mRoomInfoResp?.room_info == null) return
val typeId = mRoomInfoResp!!.room_info.type_id
val typeId = mRoomInfoResp?.room_info?.type_id
if ("2" == typeId) {
roomFragment!!.handleRoomMessage(messageEvent)
} else if ("1" == typeId || "4" == typeId || "3" == typeId || "8" == typeId) {
val labelId = mRoomInfoResp!!.room_info.label_id
val labelId = mRoomInfoResp?.room_info?.label_id
if ("2" == labelId) {
roomFragment!!.handleRoomMessage(messageEvent)
} else {
@@ -2069,14 +2069,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
} else {
updateCharmForAllPitBeans("")
roomFragment!!.upFriendList(mRoomInfoResp!!.room_info.pit_list)
roomFragment!!.upFriendList(mRoomInfoResp?.room_info?.pit_list)
}
}
private fun updateCharmForAllPitBeans(charm: String) {
if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) return
if (mRoomInfoResp == null || mRoomInfoResp?.room_info == null) return
val pitList = mRoomInfoResp!!.room_info.pit_list ?: return
val pitList = mRoomInfoResp?.room_info?.pit_list ?: return
pitList.forEach { roomPitBean ->
roomPitBean.charm = charm
}
@@ -2191,15 +2191,15 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun handleMsgType1035(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) return
if (text == null || mRoomInfoResp == null || mRoomInfoResp?.room_info == null) return
val fromUserInfo = text.fromUserInfo ?: return
val typeId = mRoomInfoResp!!.room_info.type_id
val typeId = mRoomInfoResp?.room_info?.type_id
if ("2" == typeId) {
roomFragment!!.handleRoomMessage(messageEvent)
} else if ("1" == typeId || "3" == typeId || "4" == typeId || "8" == typeId) {
val labelId = mRoomInfoResp!!.room_info.label_id
val labelId = mRoomInfoResp?.room_info?.label_id
if ("2" == labelId) {
roomFragment!!.handleRoomMessage(messageEvent)
} else {
@@ -2213,9 +2213,9 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun updatePitBeanForUser(fromUserInfo: UserInfo): RoomInfoResp? {
if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) return mRoomInfoResp
if (mRoomInfoResp == null || mRoomInfoResp?.room_info == null) return mRoomInfoResp
val pitList = mRoomInfoResp!!.room_info.pit_list ?: return mRoomInfoResp
val pitList = mRoomInfoResp?.room_info?.pit_list ?: return mRoomInfoResp
for (pitBean in pitList) {
if (pitBean.user_id == fromUserInfo.user_id.toString() + "") {
@@ -2248,32 +2248,32 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun handleMsgType1007() {
if (mRoomInfoResp != null && mRoomInfoResp!!.user_info != null) {
mRoomInfoResp!!.user_info.is_host = 1
if (mRoomInfoResp != null && mRoomInfoResp?.user_info != null) {
mRoomInfoResp?.user_info?.is_host = 1
userPermissionChange()
roomFragment!!.upRoomInfoData(mRoomInfoResp)
}
}
private fun handleMsgType1006() {
if (mRoomInfoResp != null && mRoomInfoResp!!.user_info != null) {
mRoomInfoResp!!.user_info.is_management = 1
if (mRoomInfoResp != null && mRoomInfoResp?.user_info != null) {
mRoomInfoResp?.user_info?.is_management = 1
userPermissionChange()
roomFragment!!.upRoomInfoData(mRoomInfoResp)
}
}
private fun handleMsgType1018() {
if (mRoomInfoResp != null && mRoomInfoResp!!.user_info != null) {
mRoomInfoResp!!.user_info.is_host = 0
if (mRoomInfoResp != null && mRoomInfoResp?.user_info != null) {
mRoomInfoResp?.user_info?.is_host = 0
userPermissionChange()
roomFragment!!.upRoomInfoData(mRoomInfoResp)
}
}
private fun handleMsgType1017() {
if (mRoomInfoResp != null && mRoomInfoResp!!.user_info != null) {
mRoomInfoResp!!.user_info.is_management = 0
if (mRoomInfoResp != null && mRoomInfoResp?.user_info != null) {
mRoomInfoResp?.user_info?.is_management = 0
userPermissionChange()
roomFragment!!.upRoomInfoData(mRoomInfoResp)
}
@@ -2314,14 +2314,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun handleMsgType1016(messageEvent: RoomMessageEvent, text: T?) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp!!.user_info == null) return
if (text == null || mRoomInfoResp == null || mRoomInfoResp?.user_info == null) return
if (text.fromUserInfo.user_id == SpUtil.getUserId()) {
if (text.is_mute_pit == 1) {
switchMic(2)
}
mRoomInfoResp!!.user_info.is_mute_pit = text.is_mute_pit.toString()
mRoomInfoResp!!.user_info.is_mute = text.is_mute.toString()
mRoomInfoResp?.user_info?.is_mute_pit = text.is_mute_pit.toString()
mRoomInfoResp?.user_info?.is_mute = text.is_mute.toString()
}
}
@@ -2387,7 +2387,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
fun setUserInfo() {
mRoomInfoResp!!.user_info.is_collect = 1
mRoomInfoResp?.user_info?.is_collect = 1
mBinding!!.roomTop.btnFollow.background =
resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
mBinding!!.roomTop.btnFollow.text = ""
@@ -2406,8 +2406,17 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
return
}
val id = view.id
// 通过 ID 获取资源名称
var viewName = try {
view.context.resources.getResourceEntryName(id)
} catch (e: java.lang.Exception) {
"未知View ID: $id"
}
LogUtils.e("RoomActivity", "点击了$viewName")
if (id == R.id.btn_follow) {
MvpPre!!.userGuanz(mRoomInfoResp!!.room_info.room_id, "2")
MvpPre!!.userGuanz(mRoomInfoResp?.room_info?.room_id, "2")
} else if (id == R.id.btn_notice) {
val roomNoticeDialogFragment = RoomNoticeDialogFragment(this)
roomNoticeDialogFragment.setTitle("公告")
@@ -2431,8 +2440,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
} else if (id == R.id.rl) {
MvpPre!!.clearUserCharm(roomId, "")
} else if (id == R.id.ll_input) {
mBinding!!.llInput.visibility = View.GONE
mBinding!!.inputMenu1.dismiss()
mBinding?.llInput?.visibility = View.GONE
mBinding?.inputMenu1?.dismiss()
} else if (id == R.id.iv_emoji) {
val emotionPickerDialog = EmotionPickerDialog(this)
emotionPickerDialog.setOnEmotionSelectedListener { emotion ->
@@ -2443,13 +2452,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
emotionPickerDialog.show()
} else if (id == R.id.iv_chat) {
if (mRoomInfoResp!!.user_info.is_mute == "1") {
if (mRoomInfoResp?.user_info?.is_mute == "1") {
ToastUtils.show("您已经被禁言")
} else {
dialogDismiss(1)
}
} else if (id == R.id.rl_mic) {
if (mRoomInfoResp!!.user_info.is_mute_pit != null && mRoomInfoResp!!.user_info.is_mute_pit == "1") {
if (mRoomInfoResp?.user_info?.is_mute_pit != null && mRoomInfoResp?.user_info?.is_mute_pit == "1") {
ToastUtils.show("您被禁麦了")
} else {
if (isSwith) {
@@ -2527,10 +2536,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
} else if (id == R.id.cl_first_charge) {
roomFragment!!.showWheatFeedingDialog(
roomId,
if ((mRoomInfoResp!!.user_info.is_room_owner == 1 || mRoomInfoResp!!.user_info.is_host == 1 || mRoomInfoResp!!.user_info.is_management == 1)) 1 else 2
if ((mRoomInfoResp?.user_info?.is_room_owner == 1 || mRoomInfoResp?.user_info?.is_host == 1 || mRoomInfoResp?.user_info?.is_management == 1)) 1 else 2
)
} else if (id == R.id.iv_wheat_feeding) { //点击上麦操作
if (mRoomInfoResp!!.room_info.room_up_pit_type == "1") {
if (mRoomInfoResp?.room_info?.room_up_pit_type == "1") {
if (aBoolean) {
MvpPre!!.applyPit(roomId, "")
} else {
@@ -2565,7 +2574,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
private fun isNumberWhether(): Int {
if (mRoomInfoResp!!.getUser_info().getPit_number() == 9) {
if (mRoomInfoResp?.user_info?.pit_number == 9) {
return 1
}
return 0
@@ -2632,7 +2641,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
if (mRoomInfoResp == null) {
return true
}
if (mRoomInfoResp!!.room_info.label_id != "6") {
if (mRoomInfoResp?.room_info?.label_id != "6") {
val activityManager =
getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val appProcesses =
@@ -2806,12 +2815,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
rl_misc?.visibility = View.GONE
// 空指针保护
if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null || mRoomInfoResp!!.user_info == null) {
if (mRoomInfoResp == null || mRoomInfoResp?.room_info == null || mRoomInfoResp?.user_info == null) {
return
}
val typeId = mRoomInfoResp!!.room_info.type_id
val labelId = mRoomInfoResp!!.room_info.label_id
val typeId = mRoomInfoResp?.room_info?.type_id
val labelId = mRoomInfoResp?.room_info?.label_id
val userPitNumber = mRoomInfoResp?.user_info?.pit_number!!
// 情况1: typeId = 6 时,只显示消息按钮
@@ -2916,7 +2925,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
val t = T()
t.fromUserInfo = SpUtil.getUserInfo()
t.text = s
val roomMessageEvent = RoomMessageEvent(126, mRoomInfoResp!!.room_info.room_id, t)
val roomMessageEvent = RoomMessageEvent(126, mRoomInfoResp?.room_info?.room_id, t)
val json = GsonUtils.toJson(roomMessageEvent)
// 转换为 byte[]
val binaryData = json.toByteArray(StandardCharsets.UTF_8)
@@ -2931,7 +2940,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
@SuppressLint("MissingInflatedId")
fun dialogDismiss(type: Int) {
// // 使用 AlertDialog.Builder
val builder = AlertDialog.Builder(this)
val inflater = layoutInflater
val dialogView =
@@ -3067,7 +3075,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
userPermissionChange()
if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()) {
if (mRoomInfoResp?.user_info?.pit_number == 9 && mRoomInfoResp?.user_info?.user_id == SpUtil.getUserId()) {
ivSoundEffects(true)
} else {
ivSoundEffects(false)
@@ -3091,7 +3099,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
//隐藏视图
private fun instView() {
if (mRoomInfoResp!!.user_info.pit_number != 0) {
if (mRoomInfoResp?.user_info?.pit_number != 0) {
aBoolean = false
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up)
setrlMic(true)
@@ -3102,31 +3110,31 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
setrlMic(false)
setBoolean(aBoolean)
}
val pitNumber = mRoomInfoResp!!.user_info.pit_number
val pitNumber = mRoomInfoResp?.user_info?.pit_number
val roleType = if (pitNumber == 9) {
if (mRoomInfoResp!!.user_info.is_room_owner != 0) 1 else if (mRoomInfoResp!!.user_info.is_host != 0) 2 else 0
if (mRoomInfoResp?.user_info?.is_room_owner != 0) 1 else if (mRoomInfoResp?.user_info?.is_host != 0) 2 else 0
} else if (pitNumber != 0 && pitNumber != 9) {
3
} else {
0
}
if (mRoomInfoResp!!.user_info.pit_number == 9) {
if (mRoomInfoResp?.user_info?.pit_number == 9) {
ivSoundEffects(true)
} else {
ivSoundEffects(false)
}
// }
if (mRoomInfoResp?.user_info?.user_id == SpUtil.getUserId()
&& mRoomInfoResp!!.user_info.pit_number == 9
&& mRoomInfoResp!!.room_info.type_id != "2"
&& mRoomInfoResp!!.room_info.type_id != "6"
&& mRoomInfoResp?.user_info?.pit_number == 9
&& mRoomInfoResp?.room_info?.type_id != "2"
&& mRoomInfoResp?.room_info?.type_id != "6"
) {
rlMore(true)
} else {
rlMore(false)
}
val countText = mRoomInfoResp!!.room_info.queue_number.toString()
val countText = mRoomInfoResp?.room_info?.queue_number.toString()
val fullText = countText + "人排队"
val spannableStringBuilder = SpannableStringBuilder(fullText)
@@ -3143,18 +3151,18 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
)
tvFirst(spannableStringBuilder)
setRoleType(roleType, pitNumber)
setRoleType(roleType, pitNumber!!)
}
/** 头条 */
@SuppressLint("ClickableViewAccessibility")
fun toutiao() {
if (mRoomInfoResp!!.room_info.head_line != null) {
if (mRoomInfoResp?.room_info?.head_line != null) {
mBinding!!.flaoatZuoji.visibility = View.VISIBLE
ImageUtils.loadHeadCC(mRoomInfoResp!!.room_info.head_line.avatar, mBinding!!.headAvate)
mBinding!!.headName.text = mRoomInfoResp!!.room_info.head_line.nickname
mBinding!!.headCone.text = mRoomInfoResp!!.room_info.head_line.content
ImageUtils.loadHeadCC(mRoomInfoResp?.room_info?.head_line?.avatar, mBinding!!.headAvate)
mBinding!!.headName.text = mRoomInfoResp?.room_info?.head_line?.nickname
mBinding!!.headCone.text = mRoomInfoResp?.room_info?.head_line?.content
mBinding!!.ivQuanQiang.setOnClickListener { v: View? ->
val fragment = PublishCommentDialogFragment.show(
@@ -3166,11 +3174,11 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
}
mBinding!!.ivQuanC.setOnClickListener { v: View? ->
if (mRoomInfoResp!!.room_info.head_line.room_id != null && mRoomInfoResp!!.room_info.head_line.room_id.isNotEmpty()) {
if (mRoomInfoResp!!.room_info.head_line.room_id != roomId) {
if (mRoomInfoResp?.room_info?.head_line?.room_id != null && mRoomInfoResp?.room_info?.head_line?.room_id!!.isNotEmpty()) {
if (mRoomInfoResp?.room_info?.head_line?.room_id != roomId) {
RoomManager.getInstance().fetchRoomDataAndEnter(
applicationContext,
mRoomInfoResp!!.room_info.head_line.room_id,
mRoomInfoResp?.room_info?.head_line?.room_id,
"",
null
)
@@ -3241,7 +3249,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
hideSomeViewOrDoSomething()
}
silentCountDownTimer!!.start(mRoomInfoResp!!.room_info.head_line.end_time.toLong())
silentCountDownTimer!!.start(mRoomInfoResp?.room_info?.head_line?.end_time!!.toLong())
} else {
mBinding!!.flaoatZuoji.visibility = View.GONE
}
@@ -3328,9 +3336,9 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
is SurfaceEvent -> {
if (mRoomInfoResp!!.room_info.type_id == "6") { //判断是否是电影房
if (mRoomInfoResp?.room_info?.type_id == "6") { //判断是否是电影房
floatingMagnetView = findViewById(R.id.flaoat) //电影房
if (mRoomInfoResp!!.user_info.is_room_owner != 1) { //判断是不是房主1是 如何是,不展示 0不是展示布局
if (mRoomInfoResp?.user_info?.is_room_owner != 1) { //判断是不是房主1是 如何是,不展示 0不是展示布局
if (event.type != 1) {
val container =
floatingMagnetView?.findViewById<FrameLayout>(R.id.fl_screenshare)
@@ -3450,7 +3458,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
is HeadlineBean -> {
mRoomInfoResp!!.room_info.head_line = event
mRoomInfoResp?.room_info?.head_line = event
toutiao()
}
@@ -3552,6 +3560,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
GiftDisplayManager.getInstance().setupDisplayView(mBinding?.giftContainer)
}
// 添加检查房间连接状态的方法
private fun resumeRoomState() {
// 恢复房间相关状态
@@ -3717,20 +3727,20 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
fun upHeight() {
if (mRoomInfoResp!!.room_info.type_id == "1" || mRoomInfoResp!!.room_info.type_id == "3" || mRoomInfoResp!!.room_info.type_id == "4"
|| mRoomInfoResp!!.room_info.type_id == "8"
if (mRoomInfoResp?.room_info?.type_id == "1" || mRoomInfoResp?.room_info?.type_id == "3" || mRoomInfoResp?.room_info?.type_id == "4"
|| mRoomInfoResp?.room_info?.type_id == "8"
) {
maxHeightDp = if (mRoomInfoResp!!.room_info.label_id == "1") {
maxHeightDp = if (mRoomInfoResp?.room_info?.label_id == "1") {
333
} else {
287
}
} else if (mRoomInfoResp!!.room_info.type_id == "2") {
} else if (mRoomInfoResp?.room_info?.type_id == "2") {
maxHeightDp = 297
}
if (mRoomInfoResp!!.room_info.type_id == "6") {
if (mRoomInfoResp?.room_info?.type_id == "6") {
maxHeightDp = 453
} else if (mRoomInfoResp!!.room_info.type_id == "7") {
} else if (mRoomInfoResp?.room_info?.type_id == "7") {
maxHeightDp = 373
}
adjustLayoutHeights()
@@ -3738,35 +3748,35 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
@SuppressLint("CommitTransaction")
private fun resetFragment() {
val typeId = mRoomInfoResp!!.room_info.type_id
val labelId = mRoomInfoResp!!.room_info.label_id
val typeId = mRoomInfoResp?.room_info?.type_id
val labelId = mRoomInfoResp?.room_info?.label_id
CommonAppContext.getInstance().lable_id = typeId
val roomType = RoomType.fromTypeId(typeId)
val qxType: QXRoomSeatViewType = when (roomType) {
RoomType.MUTUAL_ENTERTAINMENT -> {
if (mRoomInfoResp!!.room_info.room_background == null || mRoomInfoResp!!.room_info.room_background == "") {
if (mRoomInfoResp?.room_info?.room_background == null || mRoomInfoResp?.room_info?.room_background == "") {
changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj)
} else {
changeBackgroundColor(mRoomInfoResp!!.room_info.room_background)
changeBackgroundColor(mRoomInfoResp?.room_info?.room_background)
}
setvisibTop(true)
QXRoomSeatViewType.FRIEND
}
RoomType.AUCTION -> {
changeBackgroundColor(mRoomInfoResp!!.room_info.room_background)
changeBackgroundColor(mRoomInfoResp?.room_info?.room_background)
setvisibTop(true)
QXRoomSeatViewType.AUCTION
}
RoomType.DATING -> {
if ("2" == labelId) {
changeBackgroundColor(mRoomInfoResp!!.room_info.room_background)
changeBackgroundColor(mRoomInfoResp?.room_info?.room_background)
setvisibTop(true)
QXRoomSeatViewType.KTV
} else if ("1" == labelId) {
changeBackgroundColor(mRoomInfoResp!!.room_info.room_background)
changeBackgroundColor(mRoomInfoResp?.room_info?.room_background)
setvisibTop(true)
QXRoomSeatViewType.NORMAL
} else {
@@ -4289,7 +4299,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
if (redEnvelopesFragment!!.mRedPacketInfo.type == 1) {
if (redEnvelopesFragment!!.mRedPacketInfo.conditions.contains("1")) {
//有收藏房间条件
if (mRoomInfoResp!!.user_info.is_collect == 1) {
if (mRoomInfoResp?.user_info?.is_collect == 1) {
if (packet!!.redpacket_id == redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) {
//需要满足收藏在倒计时
redEnvelopesFragment!!.setNeedTime(packetTime)
@@ -4304,7 +4314,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
if (redEnvelopesFragment!!.isFromToComment) {
if (redEnvelopesFragment!!.mRedPacketInfo.conditions.contains("1")) {
//有收藏房间条件
if (mRoomInfoResp!!.user_info.is_collect == 1) {
if (mRoomInfoResp?.user_info?.is_collect == 1) {
if (packet!!.redpacket_id == redEnvelopesFragment!!.mRedPacketInfo.redpacket_id) {
redEnvelopesFragment!!.setNeedTime(packetTime)
}
@@ -4363,4 +4373,5 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
return false // 不是快速重复点击
}
}

View File

@@ -17,6 +17,7 @@ import android.widget.Switch;
import android.widget.TextView;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.LogUtils;
import com.orhanobut.logger.Logger;
import com.xscm.modulemain.R;
import com.xscm.modulemain.activity.room.activity.RoomActivity;
@@ -212,6 +213,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
userInfo.setNickname(pitBean.getNickname());
userInfo.setUser_id(Integer.parseInt(pitBean.getUser_id()));
userInfo.setPit_number("0");
LogUtils.e("RoomGiftDialogFragment_friend");
RoomGiftDialogFragment.show(null, userInfo, roomId, 0, pitBean.getHeartId() + "", getParentFragmentManager());
}

View File

@@ -349,10 +349,22 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
private void onChock(View view) {
int id = view.getId();
// 通过 ID 获取资源名称
String viewName = "";
try {
viewName = view.getContext().getResources().getResourceEntryName(id);
} catch (Exception e) {
viewName = "未知View ID: " + id;
}
LogUtils.e("wheatFeedingDF","点击了" + viewName +"========="+ClickUtils.isFastDoubleClick(view));
if (ClickUtils.isFastDoubleClick(view)) {
return;
}
int id = view.getId();
if (id == R.id.iv_jp) {
// 添加多层空值检查
if (roomInfoResp != null &&
@@ -371,6 +383,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
if (roomInfoResp.getRoom_info() != null &&
roomInfoResp.getRoom_info().getRoom_id() != null) {
LogUtils.e("RoomGiftDialogFragment_Auction");
RoomGiftDialogFragment.show(null, userInfo, roomInfoResp.getRoom_info().getRoom_id(), 1, "", getParentFragmentManager());
}
} catch (NumberFormatException e) {

View File

@@ -228,6 +228,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
userInfo.setNickname(roomPitBean.getNickname());
userInfo.setAvatar(roomPitBean.getAvatar());
userInfo.setPit_number("");
LogUtils.e("RoomGiftDialogFragment_Cabin");
RoomGiftDialogFragment.show(null, userInfo, roomInfoResp.getRoom_info().getRoom_id(),0,"", getParentFragmentManager());
}

View File

@@ -525,6 +525,14 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
private void onClick(View view) {
int id = view.getId();
// 通过 ID 获取资源名称
String viewName = "";
try {
viewName = view.getContext().getResources().getResourceEntryName(id);
} catch (Exception e) {
viewName = "未知View ID: " + id;
}
LogUtils.e("roomKTVFragment","点击了" + viewName );
if (id == R.id.ll_tiaoyt) {
// MvpPre.endSong(roomInfoResp.getRoom_info().getRoom_id());
TunerDialogFragment.show(roomInfoResp.getRoom_info().getRoom_id(), getChildFragmentManager());
@@ -544,6 +552,7 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
userInfo.setNickname(roomInfoResp.getSong_user_info().getNickname());
userInfo.setUser_id(Integer.parseInt(roomInfoResp.getSong_user_info().getUser_id()));
userInfo.setPit_number("0");
LogUtils.e("RoomGiftDialogFragment_ktv");
RoomGiftDialogFragment.show(null, userInfo, roomInfoResp.getRoom_info().getRoom_id(), 0, "", getParentFragmentManager());
} else {
com.hjq.toast.ToastUtils.show("请等待演唱者上麦");

View File

@@ -9,6 +9,7 @@ import com.xscm.moduleutil.base.BaseRoomPresenter;
import com.xscm.moduleutil.bean.CharmRankingResp;
import com.xscm.moduleutil.http.BaseObserver;
import java.lang.ref.WeakReference;
import java.util.List;
import io.reactivex.disposables.Disposable;
@@ -19,9 +20,10 @@ import io.reactivex.disposables.Disposable;
*/
public class DataListPresenter extends BaseRoomPresenter<DataListContacts.View> implements DataListContacts.IRoomDataListPre {
private static final String TAG = "DataListPresenter";
DataListContacts.View mView;
public DataListPresenter(DataListContacts.View view, Context context) {
super(view, context);
mView = view;
}
@@ -38,6 +40,9 @@ public class DataListPresenter extends BaseRoomPresenter<DataListContacts.View>
@Override
public void onNext(List<CharmRankingResp> charmRankingResp) {
if (!ObjectUtils.isEmpty(charmRankingResp)){
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
if (charmRankingResp.size()>0){
MvpRef.get().setNo1(charmRankingResp.get(0));
}
@@ -68,6 +73,9 @@ public class DataListPresenter extends BaseRoomPresenter<DataListContacts.View>
@Override
public void onNext(List<CharmRankingResp> charmRankingResp) {
if (!ObjectUtils.isEmpty(charmRankingResp)){
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
if (charmRankingResp.size()>0){
MvpRef.get().setNo1(charmRankingResp.get(0));
}

View File

@@ -31,6 +31,9 @@ public class FriendshipRoomPresenter extends BaseRoomPresenter<FriendshipRoomCon
@Override
public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().applyPit();
}
});
@@ -79,6 +82,9 @@ public class FriendshipRoomPresenter extends BaseRoomPresenter<FriendshipRoomCon
@Override
public void onNext(FriendUserBean friendUserBean) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().endFriend(friendUserBean);
}
@@ -96,6 +102,9 @@ public class FriendshipRoomPresenter extends BaseRoomPresenter<FriendshipRoomCon
@Override
public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().createRelation();
}
});

View File

@@ -106,7 +106,14 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
if (MvpPre == null) {
MvpPre = bindPresenter();
}
// 通过 ID 获取资源名称
String viewName = "";
try {
viewName = view.getContext().getResources().getResourceEntryName(view.getId());
} catch (Exception e) {
viewName = "未知View ID: " + view.getId();
}
LogUtils.e("roomUserInfoFragment","点击了" + viewName );
if (view.getId() == R.id.ll_youth) {
// startActivity(new Intent(this, UnderageActivity.class));
showYouthModelDialog();

View File

@@ -24,6 +24,7 @@ import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import com.blankj.utilcode.util.LogUtils;
import com.xscm.modulemain.R;
import com.xscm.moduleutil.bean.room.FriendUserBean;
import com.xscm.moduleutil.utils.ImageUtils;
@@ -56,17 +57,27 @@ public class FriendsDialogFragment extends DialogFragment {
}
public static void show(FriendUserBean bean, FragmentManager fragmentManager) {
FriendsDialogFragment fragment = new FriendsDialogFragment();
Bundle args = new Bundle();
args.putSerializable("FriendUserBean", bean);
fragment.setArguments(args);
fragment.show(fragmentManager, "FriendsDialogFragment");
new Handler(Looper.getMainLooper()).postDelayed(() -> {
if (fragment != null && fragment.isAdded()) {
fragment.dismiss();
//activity 退到后台调用闪退
try {
// 检查 FragmentManager 状态
if (fragmentManager.isDestroyed() || fragmentManager.isStateSaved()) {
return;
}
}, 4000); // 4秒后关闭
FriendsDialogFragment fragment = new FriendsDialogFragment();
Bundle args = new Bundle();
args.putSerializable("FriendUserBean", bean);
fragment.setArguments(args);
fragment.show(fragmentManager, "FriendsDialogFragment");
new Handler(Looper.getMainLooper()).postDelayed(() -> {
if (fragment != null && fragment.isAdded()) {
fragment.dismiss();
}
}, 4000); // 4秒后关闭
}catch (IllegalStateException e){
LogUtils.e("FriendsDialogFragment: " + e.getMessage());
}
}

View File

@@ -20,6 +20,7 @@ import android.view.Window;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.LogUtils;
import com.xscm.modulemain.R;
import com.xscm.modulemain.activity.room.contacts.RoomUserContacts;
import com.xscm.modulemain.databinding.FragmentRoomUserInfoBinding;
@@ -181,6 +182,14 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
private void onClick(View view) {
int id = view.getId();
// 通过 ID 获取资源名称
String viewName = "";
try {
viewName = view.getContext().getResources().getResourceEntryName(id);
} catch (Exception e) {
viewName = "未知View ID: " + id;
}
LogUtils.e("roomUserInfoFragment","点击了" + viewName );
if (id == R.id.room_m_cz) {
if (mBinding.roomMCz.getText().equals("上麦")) {
MvpPre.applyPit(room_id, "");
@@ -219,6 +228,7 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
pit_number = "";
}
userInfo.setPit_number(pit_number);
LogUtils.e("RoomGiftDialogFragment_userinfo");
RoomGiftDialogFragment.show(null, userInfo, room_id, 0, "", getParentFragmentManager());
}
dismiss();

View File

@@ -18,6 +18,7 @@ import androidx.recyclerview.widget.LinearSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftBean;
@@ -254,6 +255,14 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
private void onClick(View view) {
int id = view.getId();
// 通过 ID 获取资源名称
String viewName = "";
try {
viewName = view.getContext().getResources().getResourceEntryName(id);
} catch (Exception e) {
viewName = "未知View ID: " + id;
}
LogUtils.e("tourClubDFragment","点击了" + viewName );
if (id == R.id.tv_jc) {
if (giftLists != null && !giftLists.isEmpty()) {
PrizePoolDialog prizePoolDialog = new PrizePoolDialog(getActivity());
@@ -381,7 +390,9 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
}
mBinding.gvFz.setIsLuckUser(false);
giftXlhChouAdapter.setNewData(giftLists);
if (giftXlhChouAdapter != null) {
giftXlhChouAdapter.setNewData(giftLists);
}
// // 数据加载完成后启动自动滚动
// if (giftLists != null && !giftLists.isEmpty()) {
// mBinding.recycleView.post(() -> {
@@ -543,10 +554,10 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
scrollHelper = null;
}
// 清理适配器引用
if (giftXlhChouAdapter != null) {
giftXlhChouAdapter = null;
}
// 清理适配器引用 存在一次调用 giftXlhChouAdapter.setNewData(giftLists); 中giftXlhChouAdapter = null;
// if (giftXlhChouAdapter != null) {
// giftXlhChouAdapter = null;
// }
if (xlhRecordDialog != null && xlhRecordDialog.isVisible()) {

View File

@@ -14,6 +14,7 @@ import android.view.WindowManager;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.modulemain.R;
import com.xscm.modulemain.activity.room.contacts.WheatContacts;
@@ -164,6 +165,14 @@ public class WheatFeedingDialogFragment extends BaseMvpDialogFragment<WheatPrese
private void onClick(View view) {
int id = view.getId();
// 通过 ID 获取资源名称
String viewName = "";
try {
viewName = view.getContext().getResources().getResourceEntryName(id);
} catch (Exception e) {
viewName = "未知View ID: " + id;
}
LogUtils.e("wheatFeedingDF","点击了" + viewName );
if (id == R.id.tv_3) {
if (mBinding.tv3.getText().equals("设置")) {
RoomWheatGiftSettingFragment.show(roomId, getChildFragmentManager());

View File

@@ -28,8 +28,8 @@ isBuildModule=false
#org.gradle.deamon=false
android.injected.testOnly=false
APP_VERSION_NAME=1.0.6.5
APP_VERSION_CODE=54
APP_VERSION_NAME=1.0.6.6
APP_VERSION_CODE=55
org.gradle.jvm.toolchain.useLegacyAdapters=false
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15