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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user