合并 new_dev

This commit is contained in:
2025-11-26 17:27:56 +08:00
19 changed files with 343 additions and 179 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

@@ -14,9 +14,11 @@ import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
import com.alibaba.sdk.android.oss.model.PutObjectResult;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.SPUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.utils.Md5Utils;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.moduleutil.utils.TimeUtils;
import com.xscm.moduleutil.utils.logger.Logger;
@@ -85,7 +87,7 @@ public class OSSOperUtils {
if (file.getName().contains(".")) {
suffix = file.getName().substring(file.getName().lastIndexOf("."));
}
return AppLog + fileMD5 + TimeUtils.getCurrentDate2() + suffix;
return AppLog+ SpUtil.getUserInfo().getNickname()+"_"+SpUtil.getUserInfo().getUser_id() +"_"+ TimeUtils.getCurrentDate2() +"_" + fileMD5+ suffix;
}
public static OSSOperUtils newInstance() {

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

@@ -705,7 +705,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()
@@ -947,7 +947,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(",")
@@ -983,7 +983,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)
@@ -998,13 +998,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
@@ -1429,25 +1429,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 抽奖结果
@@ -1587,11 +1587,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) {
@@ -1614,13 +1614,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()
@@ -1637,14 +1637,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)
}
@@ -1682,17 +1682,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
@@ -1720,7 +1720,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
@@ -1738,8 +1738,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())
@@ -1751,9 +1751,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)
@@ -1761,11 +1761,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)
@@ -1798,7 +1798,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
@@ -1828,7 +1828,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)
@@ -1836,14 +1836,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)
@@ -1854,13 +1854,13 @@ 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)
}
}
@@ -1881,7 +1881,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
@@ -1899,7 +1899,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)
@@ -1912,23 +1912,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)
@@ -1970,6 +1970,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
if (roomMessageEvent.text.fromUserInfo.enter_image?.isNotEmpty() == true) {
showFloatingMessage(roomMessageEvent.text.fromUserInfo)
}
MvpPre?.getRoomOnline(roomId, "1", "10")
// number++
@@ -2110,17 +2111,17 @@ 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 || "9" == typeId) {
@@ -2134,14 +2135,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
}
@@ -2256,15 +2257,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 {
@@ -2278,9 +2279,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() + "") {
@@ -2313,32 +2314,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)
}
@@ -2379,14 +2380,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()
}
}
@@ -2452,7 +2453,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 = ""
@@ -2471,8 +2472,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("公告")
@@ -2496,8 +2506,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 ->
@@ -2508,13 +2518,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) {
@@ -2574,6 +2584,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
addActiveDialogFragment(fragment) // 添加到管理列表
}
} else if (id == R.id.rl_gift) { //礼物
LogUtils.e("RoomGiftDialogFragment_RoomActivity");
val fragment = RoomGiftDialogFragment.show(
mRoomInfoResp, null, roomId, 0, "",
supportFragmentManager
@@ -2592,10 +2603,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 {
@@ -2630,7 +2641,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
@@ -2697,7 +2708,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 =
@@ -2871,12 +2882,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 时,只显示消息按钮
@@ -2981,7 +2992,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)
@@ -2996,7 +3007,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
@SuppressLint("MissingInflatedId")
fun dialogDismiss(type: Int) {
// // 使用 AlertDialog.Builder
val builder = AlertDialog.Builder(this)
val inflater = layoutInflater
val dialogView =
@@ -3132,7 +3142,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)
@@ -3156,7 +3166,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)
@@ -3167,31 +3177,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)
@@ -3208,18 +3218,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(
@@ -3231,11 +3241,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
)
@@ -3306,7 +3316,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
}
@@ -3393,9 +3403,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)
@@ -3515,7 +3525,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
}
is HeadlineBean -> {
mRoomInfoResp!!.room_info.head_line = event
mRoomInfoResp?.room_info?.head_line = event
toutiao()
}
@@ -3617,6 +3627,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
GiftDisplayManager.getInstance().setupDisplayView(mBinding?.giftContainer)
}
// 添加检查房间连接状态的方法
private fun resumeRoomState() {
// 恢复房间相关状态
@@ -3782,20 +3794,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
} else if (mRoomInfoResp!!.room_info.type_id == "9") {
maxHeightDp = 373
@@ -3805,35 +3817,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 {
@@ -4378,7 +4390,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)
@@ -4393,7 +4405,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)
}
@@ -4452,4 +4464,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,6 +106,7 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
if (MvpPre == null) {
MvpPre = bindPresenter();
}
<<<<<<< HEAD
int id = view.getId();
// 通过 ID 获取资源名称
String viewName = "";
@@ -117,6 +118,17 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
LogUtils.e("点击了~" + viewName);
if (id == R.id.ll_youth) {
=======
// 通过 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) {
>>>>>>> branch_new_dev
// startActivity(new Intent(this, UnderageActivity.class));
showYouthModelDialog();
} else if (id == R.id.ll_notification) {

View File

@@ -33,10 +33,12 @@ import io.reactivex.schedulers.Schedulers;
public class SettingPresenter extends BasePresenter<SettingConacts.View> implements SettingConacts.IMePre {
private SettingConacts.View mView;
public SettingPresenter(SettingConacts.View view, Context context) {
super(view, context);
mView = view;
}
@Override
public void clearLoginInfo() {
api.clearLoginInfo(new BaseObserver<String>() {
@@ -47,8 +49,8 @@ public class SettingPresenter extends BasePresenter<SettingConacts.View> impleme
@Override
public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().clearLoginInfo(s);
}
@@ -66,8 +68,8 @@ public class SettingPresenter extends BasePresenter<SettingConacts.View> impleme
@Override
public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().cancel(s);
}
@@ -101,18 +103,18 @@ public class SettingPresenter extends BasePresenter<SettingConacts.View> impleme
try {
File file = new File(Application.Companion.getInstance().getAppContent());
if (FileUtils.isFileExists(file.getParent() +"/DataInfo.zip")){
FileUtils.delete(file.getParent() +"/DataInfo.zip");
if (FileUtils.isFileExists(file.getParent() + "/DataInfo.zip")) {
FileUtils.delete(file.getParent() + "/DataInfo.zip");
}
boolean isZip = ZipUtils.zipFile(Application.Companion.getInstance().getAppContent(),
file.getParent() +"/DataInfo.zip");
file.getParent() + "/DataInfo.zip");
if (isZip) {
emitter.onNext(file.getParent() + "/DataInfo.zip");
}else {
} else {
emitter.onNext("");
}
}catch (Exception e){
LogUtils.e("压缩失败",e.toString());
} catch (Exception e) {
LogUtils.e("压缩失败", e.toString());
emitter.onNext("");
}
}
@@ -121,15 +123,15 @@ public class SettingPresenter extends BasePresenter<SettingConacts.View> impleme
@Override
public void accept(String zipPath) {
String upLogUrl = OSSOperUtils.getAppLogPath(new File(zipPath));
if(!zipPath.isEmpty()){
CosUploadManager.getInstance(Application.getInstance()).upParameters(upLogUrl,zipPath, new CosUploadManager.UploadCallback(){
if (!zipPath.isEmpty()) {
CosUploadManager.getInstance(Application.getInstance()).upParameters(upLogUrl, zipPath, new CosUploadManager.UploadCallback() {
@Override
public void onSuccess(String url) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
api.sendAppLog(upLogUrl,url, new BaseObserver<String>() {
api.sendAppLog(upLogUrl, url, new BaseObserver<String>() {
@Override
@@ -149,21 +151,27 @@ public class SettingPresenter extends BasePresenter<SettingConacts.View> impleme
@Override
public void onFailure(Exception e) {
ToastUtils.showLong("上传失败");
LogUtils.e("上传失败",e.toString());
LogUtils.e("上传失败", e.toString());
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().disLoadings();
}
@Override
public void onFailure1(IllegalStateException e) {
ToastUtils.showLong("上传失败");
LogUtils.e("上传失败",e.toString());
LogUtils.e("上传失败", e.toString());
MvpRef.get().disLoadings();
}
});
}else {
} else {
ToastUtils.showLong("上传失败");
LogUtils.e("压缩失败");
MvpRef.get().disLoadings();
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().disLoadings();
}
}
});

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

@@ -22,6 +22,7 @@ import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager;
import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils;
import com.xscm.modulemain.R;
import com.xscm.modulemain.databinding.DialogGiftLotteryBinding;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
@@ -371,6 +372,15 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
private void onClisk(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("GiftLotteryDFragment","点击了" + viewName );
if (id == R.id.ll_one) {
if (!isDrawing) {
isDrawing = true;

View File

@@ -97,6 +97,10 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
}
public static RoomGiftDialogFragment show(RoomInfoResp roomInfoResp, UserInfo userInfo, String roomId, int jingp, String heart_id, FragmentManager fragmentManager) {
if (roomInfoResp == null && userInfo == null) {
LogUtils.e("RoomGiftDialogFragment_show", "roomInfoResp and userInfo is null");
return null;
}
RoomGiftDialogFragment dialogFragment = new RoomGiftDialogFragment();
Bundle args = new Bundle();
args.putSerializable("roomInfoResp", roomInfoResp);
@@ -811,7 +815,6 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
if (mBinding.tvBbQs != null) {
mBinding.tvBbQs.setVisibility(View.GONE);
mBinding.cz.setVisibility(View.VISIBLE);
MvpPre.wallet();
}
}
}

View File

@@ -24,9 +24,13 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
<<<<<<< HEAD
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.LogUtils;
import com.xscm.modulemain.Application;
=======
import com.blankj.utilcode.util.LogUtils;
>>>>>>> branch_new_dev
import com.xscm.modulemain.R;
import com.xscm.modulemain.activity.room.contacts.RoomUserContacts;
import com.xscm.modulemain.activity.user.activity.GiftWallActivity;
@@ -190,6 +194,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, "");
@@ -228,6 +240,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

@@ -9,10 +9,14 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/concern_dialog">
android:layout_height="wrap_content">
<ImageView
android:src="@mipmap/concern_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/image"
android:layout_width="@dimen/dp_50"
@@ -117,10 +121,13 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rl_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="4dp"
android:clipToPadding="false"
android:paddingBottom="@dimen/dp_100"
app:layout_constraintStart_toStartOf="@+id/tv_title"
app:layout_constraintTop_toBottomOf="@id/tv_title"
app:layout_constraintBottom_toBottomOf="parent"
tools:listitem="@layout/room_concern_item" />
<LinearLayout