66 1
This commit is contained in:
@@ -43,6 +43,7 @@ import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.modulemain.activity.main.activity.MainActivity;
|
||||
import com.xscm.modulemain.activity.room.activity.RoomActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.HeartCpActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.MyRoomActivity;
|
||||
import com.xscm.modulemain.manager.RoomManager;
|
||||
import com.xscm.moduleutil.BaseEvent;
|
||||
import com.xscm.moduleutil.R;
|
||||
@@ -122,11 +123,13 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
disLoading();
|
||||
}
|
||||
|
||||
private Activity mThis;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
RetrofitClient.getInstance ().CpListener(new CPListener() {
|
||||
mThis = this;
|
||||
RetrofitClient.getInstance().CpListener(new CPListener() {
|
||||
@Override
|
||||
public void onReceiveMsg(@NotNull RoomMessageEvent roomMessageEvent) {
|
||||
cpReceiver(roomMessageEvent);
|
||||
@@ -137,6 +140,16 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
cpMsg(gitData);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
RetrofitClient.getInstance().setJoinRoomLoadListener(result -> {
|
||||
if (mThis instanceof MainActivity) {
|
||||
((MainActivity) mThis).isShowLoading(false);
|
||||
} else if (mThis instanceof MyRoomActivity) {
|
||||
((MyRoomActivity) mThis).isShowLoading(false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -196,19 +209,19 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
String cpTypeJson = GsonUtils.toJson(event.getCp_type());
|
||||
if (event.getCp_type().getCp_type() == 1) {
|
||||
|
||||
if (event.getGift_user_data()!=null && event.getGift_user_data().size()>0){
|
||||
for (int i = 0; i <event.getGift_user_data().size(); i++)
|
||||
if (event.getGift_user_data() != null && event.getGift_user_data().size() > 0) {
|
||||
for (int i = 0; i < event.getGift_user_data().size(); i++)
|
||||
// 创建自定义消息
|
||||
MessageListenerSingleton.getInstance().sendCustomC2CMessage(130,cpTypeJson,
|
||||
MessageListenerSingleton.getInstance().sendCustomC2CMessage(130, cpTypeJson,
|
||||
event.getGift_user_data().get(i).getUser_id()
|
||||
);
|
||||
}
|
||||
}else if (event.getCp_type().getCp_type() == 2) {
|
||||
if (event.getGift_user_data()!=null && event.getGift_user_data().size()>0){
|
||||
} else if (event.getCp_type().getCp_type() == 2) {
|
||||
if (event.getGift_user_data() != null && event.getGift_user_data().size() > 0) {
|
||||
for (int i = 0; i < event.getGift_user_data().size(); i++)
|
||||
// 创建自定义消息
|
||||
MessageListenerSingleton.getInstance().sendCustomC2CMessage(131,cpTypeJson,
|
||||
event.getGift_user_data().get(i).getUser_id()
|
||||
MessageListenerSingleton.getInstance().sendCustomC2CMessage(131, cpTypeJson,
|
||||
event.getGift_user_data().get(i).getUser_id()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -216,13 +229,13 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
}
|
||||
|
||||
public void cpReceiver(BaseEvent event) {
|
||||
String a = ActivityUtils.getTopActivity().getLocalClassName();
|
||||
if (event instanceof RoomMessageEvent) {
|
||||
com.xscm.moduleutil.bean.RoomGiftData.CpType text = GsonUtils.fromJson(((RoomMessageEvent) event).getText().getText().toString(),com.xscm.moduleutil.bean.RoomGiftData.CpType.class);
|
||||
String a = ActivityUtils.getTopActivity().getLocalClassName();
|
||||
if (event instanceof RoomMessageEvent) {
|
||||
com.xscm.moduleutil.bean.RoomGiftData.CpType text = GsonUtils.fromJson(((RoomMessageEvent) event).getText().getText().toString(), com.xscm.moduleutil.bean.RoomGiftData.CpType.class);
|
||||
if (text.getCp_type() == 1) {
|
||||
queren1(1,text.getText1(),text.getGift_id()+"",((RoomMessageEvent) event).getText().getFromUserInfo().getUser_id()+"",((RoomMessageEvent) event).getRoomId());
|
||||
}else if (text.getCp_type() == 2) {
|
||||
queren1(2,text.getText1(),text.getGift_id()+"",((RoomMessageEvent) event).getText().getFromUserInfo().getUser_id()+"",((RoomMessageEvent) event).getRoomId());
|
||||
queren1(1, text.getText1(), text.getGift_id() + "", ((RoomMessageEvent) event).getText().getFromUserInfo().getUser_id() + "", ((RoomMessageEvent) event).getRoomId());
|
||||
} else if (text.getCp_type() == 2) {
|
||||
queren1(2, text.getText1(), text.getGift_id() + "", ((RoomMessageEvent) event).getText().getFromUserInfo().getUser_id() + "", ((RoomMessageEvent) event).getRoomId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -312,15 +325,15 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
}
|
||||
};
|
||||
|
||||
private void queren1(int type,String content,String giftid,String userId,String roomId) {
|
||||
private void queren1(int type, String content, String giftid, String userId, String roomId) {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(ActivityUtils.getTopActivity(),
|
||||
type==1?"心动信号":"缘定三生 此刻同心",
|
||||
new ConfirmDialog(ActivityUtils.getTopActivity(),
|
||||
type == 1 ? "心动信号" : "缘定三生 此刻同心",
|
||||
content,
|
||||
type==1?"回赠同心锁":"进入心动空间",
|
||||
type==1?"再想想":"我知道了",
|
||||
type == 1 ? "回赠同心锁" : "进入心动空间",
|
||||
type == 1 ? "再想想" : "我知道了",
|
||||
v -> {
|
||||
if (type==1) {
|
||||
if (type == 1) {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
RetrofitClient.getInstance().cpGiveGift(userId, giftid, roomId, new BaseObserver<RoomGiftData>() {
|
||||
@Override
|
||||
@@ -331,23 +344,23 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
@Override
|
||||
public void onNext(RoomGiftData roomGiftData) {
|
||||
if (roomGiftData.getCp_type() != null) {
|
||||
if (roomGiftData.getCp_type().getCp_type()==2){
|
||||
queren1(2,roomGiftData.getCp_type().getText(),"",SpUtil.getUserId()+"","");
|
||||
}
|
||||
if (roomGiftData.getCp_type().getCp_type() == 2) {
|
||||
queren1(2, roomGiftData.getCp_type().getText(), "", SpUtil.getUserId() + "", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
int userids= Integer.parseInt(userId);
|
||||
} else {
|
||||
int userids = Integer.parseInt(userId);
|
||||
Intent intent = new Intent(ActivityUtils.getTopActivity(), HeartCpActivity.class);
|
||||
intent.putExtra("userId",userids);
|
||||
intent.putExtra("userId", userids);
|
||||
startActivity(intent);
|
||||
}
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
|
||||
}, false,0).show();
|
||||
}, false, 0).show();
|
||||
}
|
||||
|
||||
|
||||
@@ -1081,7 +1094,7 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
// 这里可以根据实际需求实现跳转逻辑
|
||||
// 例如:跳转到礼物详情页面、用户主页等
|
||||
// 使用缓存数据进入房间
|
||||
if (ActivityUtils.getTopActivity() instanceof RoomActivity){
|
||||
if (ActivityUtils.getTopActivity() instanceof RoomActivity) {
|
||||
if (!Objects.equals(((RoomActivity) ActivityUtils.getTopActivity()).getRoomId(), xlhBean.getRoom_id())) {
|
||||
((RoomActivity) ActivityUtils.getTopActivity()).refreshRoomInfo(xlhBean.getRoom_id());
|
||||
}
|
||||
@@ -1095,7 +1108,7 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
// 这里可以根据实际需求实现跳转逻辑
|
||||
// 例如:跳转到礼物详情页面、用户主页等
|
||||
// 使用缓存数据进入房间
|
||||
if (ActivityUtils.getTopActivity() instanceof RoomActivity){
|
||||
if (ActivityUtils.getTopActivity() instanceof RoomActivity) {
|
||||
if (!Objects.equals(((RoomActivity) ActivityUtils.getTopActivity()).getRoomId(), redBean.getRoom_id())) {
|
||||
((RoomActivity) ActivityUtils.getTopActivity()).refreshRoomInfo(redBean.getRoom_id());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xscm.modulemain.activity.room.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
@@ -178,7 +179,7 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
|
||||
// }
|
||||
|
||||
mBinding.roomHeadTop1Label.setText(StringUtil.toWan2(listsBean.getTotal(), 2));
|
||||
setview(listsBean.getIcon(), mBinding.llVip1);
|
||||
// setview(listsBean.getIcon(), mBinding.llVip1);
|
||||
mBinding.roomRankTop1HeadIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -202,7 +203,7 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
|
||||
|
||||
|
||||
mBinding.roomHeadTop2Label.setText(StringUtil.toWan2(listsBean.getTotal(), 2));
|
||||
setview(listsBean.getIcon(), mBinding.llVip2);
|
||||
// setview(listsBean.getIcon(), mBinding.llVip2);
|
||||
mBinding.roomRankTop2HeadIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -212,11 +213,25 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
|
||||
}
|
||||
|
||||
private void setview(List<String> item, LinearLayout llContainer) {
|
||||
// 1. 基础判空:容器/数据为空直接返回
|
||||
if (llContainer == null || item == null || item.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 2. 检查 Fragment 状态 + 获取有效 Context
|
||||
Context context = null;
|
||||
// 检查 Fragment 是否还附加在 Activity 上
|
||||
if (isAdded() && getContext() != null) {
|
||||
context = getContext(); // 非空校验,避免隐性空指针
|
||||
} else {
|
||||
// 兜底:如果 Context 为空,直接返回(避免后续崩溃)
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> images = item; // 获取图片列表
|
||||
|
||||
for (String url : images) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(Application.getInstance());
|
||||
ImageView imageView1 = new ImageView(context);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_57),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
@@ -248,7 +263,7 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
|
||||
// }
|
||||
|
||||
mBinding.roomHeadTop3Label.setText(StringUtil.toWan2(listsBean.getTotal(), 2));
|
||||
setview(listsBean.getIcon(), mBinding.llVip3);
|
||||
// setview(listsBean.getIcon(), mBinding.llVip3);
|
||||
mBinding.roomRankTop3HeadIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
@@ -389,8 +389,7 @@ public class RoomManager {
|
||||
CommonAppContext.getInstance().playId.equals(roomId) ?"取消":"在想想",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
// MvpPre.deleteComment(String.valueOf(commentId));
|
||||
fetchRoomDataAndEnter(ActivityUtils.getTopActivity(),roomId,"",taskId);
|
||||
fetchAndJoinRoom(ActivityUtils.getTopActivity(),roomId,"",taskId);
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
|
||||
Reference in New Issue
Block a user