1:修改BUG
This commit is contained in:
@@ -16,7 +16,13 @@
|
||||
android:name=".activity.RoomActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity=".RoomTaskAffinity"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:enableOnBackInvokedCallback="false"
|
||||
android:theme="@style/TransparentActivityTheme"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
/>
|
||||
<!-- <activity-->
|
||||
<!-- android:name=".activity.RoomActivity"-->
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,11 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
@@ -12,7 +17,9 @@ import com.bumptech.glide.Glide;
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.GiftBean;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.room.EMMessageInfo;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
@@ -38,6 +45,8 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
private List<EMMessageInfo> allMsgList;
|
||||
private List<EMMessageInfo> userMsgList;
|
||||
private List<EMMessageInfo> systemMsgList;
|
||||
private String messageNameColor = "#00C8FF";//名称的颜色
|
||||
private String messageGiftColor="#FFE309";//礼物的颜色
|
||||
|
||||
public EaseChatAdapter() {
|
||||
super(null);
|
||||
@@ -76,37 +85,106 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
//notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private SpannableStringBuilder getSpannable(RoomMessageEvent message) {
|
||||
// 在 Android 中实现类似的富文本功能
|
||||
SpannableStringBuilder spannable = new SpannableStringBuilder(message.getText().getText());
|
||||
|
||||
// 设置发送者昵称的颜色
|
||||
if (message.getText().getFromUserInfo() != null && !TextUtils.isEmpty(message.getText().getFromUserInfo().getNickname())) {
|
||||
String nickname = message.getText ().getFromUserInfo().getNickname();
|
||||
int startIndex = message.getText().getText().indexOf(nickname);
|
||||
if (startIndex != -1) {
|
||||
int endIndex = startIndex + nickname.length();
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageNameColor)), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置接收者昵称的颜色
|
||||
if (message.getText().getToUserInfo() != null && !TextUtils.isEmpty(message.getText().getToUserInfo().getNickname())) {
|
||||
String nickname = message.getText().getToUserInfo().getNickname();
|
||||
int startIndex = message.getText().getText().indexOf(nickname);
|
||||
if (startIndex != -1) {
|
||||
int endIndex = startIndex + nickname.length();
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageNameColor)), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理礼物名称的颜色设置
|
||||
if (message.getText().getGiftInfo() != null && !TextUtils.isEmpty(message.getText().getGiftInfo().getGift_name())) {
|
||||
String[] giftNames = message.getText().getGiftInfo().getGift_name().split(",");
|
||||
for (String giftName : giftNames) {
|
||||
List<int[]> occurrences = findAllOccurrencesOfString(message.getText().getText(), giftName);
|
||||
for (int[] range : occurrences) {
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageGiftColor)), range[0], range[1], Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理多个礼物信息的颜色设置
|
||||
if (message.getText().getGiftInfos() != null && !message.getText().getGiftInfos().isEmpty()) {
|
||||
for (GiftBean gift : message.getText().getGiftInfos()) {
|
||||
if (!TextUtils.isEmpty(gift.getGift_name())) {
|
||||
int startIndex = message.getText().getText().indexOf(gift.getGift_name());
|
||||
if (startIndex != -1) {
|
||||
int endIndex = startIndex + gift.getGift_name().length();
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageGiftColor)), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理多个接收者信息的颜色设置
|
||||
if (message.getText().getToUserInfos() != null && !message.getText().getToUserInfos().isEmpty()) {
|
||||
for (int i = 0; i < message.getText().getToUserInfos().size(); i++) {
|
||||
UserInfo userModel = message.getText().getToUserInfos().get(i);
|
||||
if (!TextUtils.isEmpty(userModel.getNickname())) {
|
||||
List<int[]> occurrences = findAllOccurrencesOfString(message.getText().getText(), userModel.getNickname());
|
||||
for (int[] range : occurrences) {
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageNameColor)), range[0], range[1], Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return spannable;
|
||||
}
|
||||
/**
|
||||
* 查找字符串中所有子字符串出现的位置
|
||||
* @param text 原始文本
|
||||
* @param searchString 要查找的子字符串
|
||||
* @return 包含所有出现位置的列表,每个位置用 [start, end] 表示
|
||||
*/
|
||||
private List<int[]> findAllOccurrencesOfString(String text, String searchString) {
|
||||
List<int[]> occurrences = new ArrayList<>();
|
||||
if (TextUtils.isEmpty(text) || TextUtils.isEmpty(searchString)) {
|
||||
return occurrences;
|
||||
}
|
||||
|
||||
int index = text.indexOf(searchString);
|
||||
while (index >= 0) {
|
||||
occurrences.add(new int[]{index, index + searchString.length()});
|
||||
index = text.indexOf(searchString, index + searchString.length());
|
||||
}
|
||||
|
||||
return occurrences;
|
||||
}
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, EMMessageInfo item) {
|
||||
RoomMessageEvent emMessage = item.getEmMessage();
|
||||
// EMTextMessageBody txtBody = (EMTextMessageBody) emMessage.getBody();
|
||||
// Spanned spanned = Html.fromHtml(txtBody.getMessage());
|
||||
// String message = txtBody.getMessage();
|
||||
// Log.e("环信消息", message);
|
||||
// SpanUtils spanUtils = new SpanUtils();
|
||||
// String role = emMessage.getStringAttribute("role", "0");
|
||||
// String userIsNew = emMessage.getStringAttribute("user_is_new", "0");
|
||||
// String rankIcon = emMessage.getStringAttribute("rank_icon", "");
|
||||
// String nobilityIcon = emMessage.getStringAttribute("nobility_icon", "");
|
||||
// String nickname = emMessage.getStringAttribute("nickname", "");
|
||||
// String type = emMessage.getStringAttribute("type", "");
|
||||
// String charmIcon = emMessage.getStringAttribute("charm_icon", null);
|
||||
// String user_title = emMessage.getStringAttribute("user_title", null);
|
||||
// String emoji_special = emMessage.getStringAttribute("face_special", message);
|
||||
// String userId = emMessage.getStringAttribute("user_id", null);
|
||||
// Spanned spanned1 = null;
|
||||
//
|
||||
TextView tv_content= helper.getView(R.id.tv_content);
|
||||
|
||||
switch (helper.getItemViewType()) {
|
||||
case 1:
|
||||
helper.getView(R.id.tv_content).setVisibility(View.VISIBLE);
|
||||
helper.setText(R.id.tv_content, emMessage.getText().getText());
|
||||
tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
helper.setText(R.id.tv_content, getSpannable(emMessage));
|
||||
// helper.setText(R.id.tv_content, emMessage.getText().getText());
|
||||
// tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
break;
|
||||
case 2:
|
||||
ImageUtils.loadHeadCC(emMessage.getText().getFromUserInfo().getAvatar(), helper.getView(com.xscm.moduleutil.R.id.avatar));
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_name, emMessage.getText().getFromUserInfo().getNickname());
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_content, getSpannable(emMessage));
|
||||
// helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
||||
List<String> images = emMessage.getText().getFromUserInfo().getIcon();
|
||||
LinearLayout ll_images = helper.getView(com.xscm.moduleutil.R.id.line);
|
||||
ll_images.removeAllViews();
|
||||
@@ -125,80 +203,20 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
ll_images.addView(imageView);
|
||||
}
|
||||
}
|
||||
tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
// tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
break;
|
||||
case 3:
|
||||
// int paddingLeftValues3 = 0;//距离左边距(默认加上8dp间距)
|
||||
// ivRole = helper.getView(R.id.iv_role);
|
||||
// ivNew = helper.getView(R.id.iv_new);
|
||||
// ivGrade = helper.getView(R.id.iv_grade);
|
||||
// ivTitle = helper.getView(R.id.iv_title_label);
|
||||
// ivNHobility = helper.getView(R.id.iv_nobility);
|
||||
// TextView tvContent3 = helper.getView(R.id.tv_content);
|
||||
// ivRole.setRole(Integer.parseInt(role));
|
||||
// ivNew.setNew(Integer.parseInt(userIsNew));
|
||||
// ivGrade.setGrade(rankIcon);
|
||||
// ivTitle.setLabelView(user_title);
|
||||
// ivTitle.setLabelView(user_title);
|
||||
// ivNHobility.setNobility(nobilityIcon);
|
||||
// ImageUtils.loadIcon(charmIcon, helper.getView(R.id.iv_charm));
|
||||
// // !---------------------------- 获取 最终的padding值
|
||||
// //爵位图标判断
|
||||
// if (ivNHobility.getVisibility() == View.VISIBLE) {
|
||||
// paddingLeftValues3 += 23;
|
||||
// }
|
||||
// //角色图标
|
||||
// if (ivRole.getVisibility() == View.VISIBLE) {
|
||||
// paddingLeftValues3 += 27;
|
||||
// }
|
||||
// //新人图标
|
||||
// if (ivNew.getVisibility() == View.VISIBLE) {
|
||||
// paddingLeftValues3 += 33;
|
||||
// }
|
||||
// //等级图标
|
||||
// if (ivGrade.getVisibility() == View.VISIBLE) {
|
||||
// paddingLeftValues3 += 33;
|
||||
// }
|
||||
//
|
||||
// //称号图标
|
||||
// try {
|
||||
// if (user_title == null || user_title.isEmpty()){
|
||||
// user_title = "";
|
||||
// }
|
||||
// String s = user_title.substring(user_title.lastIndexOf("=") + 1);
|
||||
// if (TextUtils.isEmpty(s)){
|
||||
// s = "1";
|
||||
// }
|
||||
// int mWidth = (int) (Float.parseFloat(s) * 20);
|
||||
// int mHeight = 20;
|
||||
// ViewGroup.LayoutParams layoutParams = ivTitle.getLayoutParams();
|
||||
// layoutParams.width = ConvertUtils.dp2px(mWidth);
|
||||
// layoutParams.height = ConvertUtils.dp2px(mHeight);
|
||||
// ivTitle.setLayoutParams(layoutParams);
|
||||
// if (ivTitle.getVisibility() == View.VISIBLE) {
|
||||
// paddingLeftValues3 += (mWidth + 3);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// //魅力图标
|
||||
// if (helper.getView(R.id.iv_charm).getVisibility() == View.VISIBLE) {
|
||||
// paddingLeftValues3 += 23;
|
||||
// }
|
||||
// spanUtils.append(nickname + " ").setForegroundColor(mContext.getResources().getColor(R.color.color_FFFFBC00)).setFontSize(ResourceUtil.getDimen(R.dimen.sp_13))
|
||||
// .append(spanned);
|
||||
// tvContent3.setPadding(ResourceUtil.getDimen(String.valueOf(paddingLeftValues3)), 0, 0, 0);
|
||||
// tvContent3.setText(spanUtils.create());
|
||||
|
||||
if (emMessage.getText().getFromUserInfo()!=null && emMessage.getText().getFromUserInfo().getAvatar()!=null) {
|
||||
ImageUtils.loadHeadCC(emMessage.getText().getFromUserInfo().getAvatar(), helper.getView(com.xscm.moduleutil.R.id.avatar));
|
||||
}
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_name, emMessage.getText().getFromUserInfo().getNickname());
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
||||
// helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_content, getSpannable(emMessage));
|
||||
List<String> images1 = emMessage.getText().getFromUserInfo().getIcon();
|
||||
LinearLayout ll_images1 = helper.getView(com.xscm.moduleutil.R.id.line);
|
||||
ll_images1.removeAllViews();
|
||||
tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
// tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
if (images1 == null){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ public class RoomSettingAdapter extends BaseMultiItemQuickAdapter<RoomSettingBea
|
||||
return b ? "排麦模式" : "自由模式";
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomCloseEffects:
|
||||
return b ? "关闭特效" : "开启特效";
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen:
|
||||
return b ? "关闭飘屏" : "开启飘屏";
|
||||
default:
|
||||
return name;
|
||||
}
|
||||
@@ -83,6 +85,8 @@ public class RoomSettingAdapter extends BaseMultiItemQuickAdapter<RoomSettingBea
|
||||
return b ? com.xscm.moduleutil.R.mipmap.ic_close_effects : com.xscm.moduleutil.R.mipmap.ic_open_effects;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomReport:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_report;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen:
|
||||
return b ? com.xscm.moduleutil.R.mipmap.ic_close_floating_screen : com.xscm.moduleutil.R.mipmap.ic_open_floating_screen;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
});
|
||||
}
|
||||
mSelectGiftNumPopupWindow.setData(mGiftNumList);
|
||||
mSelectGiftNumPopupWindow.showAtLocation(mBinding.tvGiveCoinNum, Gravity.BOTTOM | Gravity.RIGHT, 100, 230);
|
||||
mSelectGiftNumPopupWindow.showAtLocation(mBinding.tvGiveCoinNum, Gravity.BOTTOM | Gravity.RIGHT, 100, 190);
|
||||
|
||||
|
||||
} else if (view1.getId() == R.id.tv_give) {
|
||||
|
||||
@@ -100,15 +100,32 @@ public class RoomOnlineDialogFragment extends BaseMvpDialogFragment<RoomPresente
|
||||
mBinding.srl.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), page + "", "10");
|
||||
// 添加延迟以避免过于频繁的请求
|
||||
mBinding.getRoot().postDelayed(() -> {
|
||||
page++;
|
||||
if (MvpPre != null && getArguments() != null) {
|
||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), page + "", "10");
|
||||
} else {
|
||||
refreshLayout.finishLoadMore(false);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
page = 1;
|
||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||
// page = 1;
|
||||
// MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||
|
||||
// 添加延迟以避免过于频繁的请求
|
||||
mBinding.getRoot().postDelayed(() -> {
|
||||
page = 1;
|
||||
if (MvpPre != null && getArguments() != null) {
|
||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||
} else {
|
||||
refreshLayout.finishRefresh(false);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -153,6 +170,14 @@ public class RoomOnlineDialogFragment extends BaseMvpDialogFragment<RoomPresente
|
||||
// });
|
||||
}
|
||||
|
||||
// 在类中添加以下方法
|
||||
private void resetRefreshState() {
|
||||
if (mBinding != null && mBinding.srl != null) {
|
||||
mBinding.srl.resetNoMoreData();
|
||||
}
|
||||
page = 1;
|
||||
}
|
||||
|
||||
private int isNumberWhether() {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
if (roomInfoResp.getRoom_info().getPit_list().get(i).getPit_number().equals("9") && roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id() != null &&
|
||||
@@ -215,55 +240,152 @@ public class RoomOnlineDialogFragment extends BaseMvpDialogFragment<RoomPresente
|
||||
|
||||
@Override
|
||||
public void getRoomOnline(RoomOnline onlineBean) {
|
||||
List<RoomOnlineBean> roomOnlineBeanList=new ArrayList<>();
|
||||
roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
||||
int type_pit;
|
||||
if (pit_number.isEmpty()) {
|
||||
type_pit = 1;
|
||||
} else {
|
||||
type_pit = 2;
|
||||
}
|
||||
if (onlineBean.getOn_pit() != null && onlineBean.getOn_pit().size() > 0) {
|
||||
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
||||
roomOnlineBean.setItemViewType(1);
|
||||
roomOnlineBean.setTypeNames("麦上用户");
|
||||
roomOnlineBeanList.add(roomOnlineBean);
|
||||
for (RoomOnlineBean roomOnlineBean1 : onlineBean.getOn_pit()) {
|
||||
roomOnlineBean1.setType(1);
|
||||
roomOnlineBean1.setType_pit(0);
|
||||
roomOnlineBean1.setItemViewType(2);
|
||||
roomOnlineBeanList.add(roomOnlineBean1);
|
||||
|
||||
try {
|
||||
// 确保在主线程中执行UI操作
|
||||
if (getActivity() == null || mBinding == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
getActivity().runOnUiThread(() -> {
|
||||
// 完成刷新或加载更多操作
|
||||
if (mBinding.srl != null) {
|
||||
if (page <= 1) {
|
||||
mBinding.srl.finishRefresh();
|
||||
} else {
|
||||
mBinding.srl.finishLoadMore();
|
||||
}
|
||||
}
|
||||
|
||||
List<RoomOnlineBean> roomOnlineBeanList = new ArrayList<>();
|
||||
// 处理第一页数据(刷新操作)
|
||||
if (page <= 1) {
|
||||
// 清空之前的数据
|
||||
roomOnlineAdapter.setNewData(new ArrayList<>());
|
||||
}
|
||||
|
||||
// roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
||||
int type_pit;
|
||||
if (pit_number.isEmpty()) {
|
||||
type_pit = 1;
|
||||
} else {
|
||||
type_pit = 2;
|
||||
}
|
||||
if (onlineBean.getOn_pit() != null && onlineBean.getOn_pit().size() > 0) {
|
||||
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
||||
roomOnlineBean.setItemViewType(1);
|
||||
roomOnlineBean.setTypeNames("麦上用户");
|
||||
roomOnlineBeanList.add(roomOnlineBean);
|
||||
for (RoomOnlineBean roomOnlineBean1 : onlineBean.getOn_pit()) {
|
||||
roomOnlineBean1.setType(1);
|
||||
roomOnlineBean1.setType_pit(0);
|
||||
roomOnlineBean1.setItemViewType(2);
|
||||
roomOnlineBeanList.add(roomOnlineBean1);
|
||||
}
|
||||
|
||||
// roomOnlineAdapter.setNewData(onlineBean.getOn_pit());
|
||||
}
|
||||
if (onlineBean.getOff_pit() != null && onlineBean.getOff_pit().size() > 0) {
|
||||
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
||||
roomOnlineBean.setItemViewType(1);
|
||||
roomOnlineBean.setTypeNames("麦下用户");
|
||||
roomOnlineBeanList.add(roomOnlineBean);
|
||||
for (RoomOnlineBean roomOnlineBean2 : onlineBean.getOff_pit()) {
|
||||
roomOnlineBean2.setType(2);
|
||||
roomOnlineBean2.setType_pit(type_pit);
|
||||
roomOnlineBean2.setItemViewType(2);
|
||||
roomOnlineBeanList.add(roomOnlineBean2);
|
||||
}
|
||||
}
|
||||
if (onlineBean.getOff_pit() != null && onlineBean.getOff_pit().size() > 0) {
|
||||
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
||||
roomOnlineBean.setItemViewType(1);
|
||||
roomOnlineBean.setTypeNames("麦下用户");
|
||||
roomOnlineBeanList.add(roomOnlineBean);
|
||||
for (RoomOnlineBean roomOnlineBean2 : onlineBean.getOff_pit()) {
|
||||
roomOnlineBean2.setType(2);
|
||||
roomOnlineBean2.setType_pit(type_pit);
|
||||
roomOnlineBean2.setItemViewType(2);
|
||||
roomOnlineBeanList.add(roomOnlineBean2);
|
||||
}
|
||||
// roomOnlineAdapter2.setNewData(onlineBean.getOff_pit());
|
||||
}
|
||||
roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
||||
int total = onlineBean.getOn_pit().size() + onlineBean.getOff_pit().size();
|
||||
}
|
||||
|
||||
mBinding.tvNum.setText("在线用户(" + total + ")人");
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setOnlineNumber(total);
|
||||
// 根据是刷新还是加载更多来处理数据
|
||||
if (page <= 1) {
|
||||
// 刷新操作,设置新数据
|
||||
roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
||||
} else {
|
||||
// 加载更多操作,添加数据
|
||||
if (roomOnlineBeanList.size() > 0) {
|
||||
roomOnlineAdapter.addData(roomOnlineBeanList);
|
||||
} else {
|
||||
// 没有更多数据了
|
||||
if (mBinding.srl != null) {
|
||||
mBinding.srl.finishLoadMoreWithNoMoreData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新用户总数
|
||||
// 更新用户总数 - 仅在第一页刷新时更新总数
|
||||
if (page <= 1) {
|
||||
int total = 0;
|
||||
if (onlineBean.getOn_pit() != null) {
|
||||
total += onlineBean.getOn_pit().size();
|
||||
}
|
||||
if (onlineBean.getOff_pit() != null) {
|
||||
total += onlineBean.getOff_pit().size();
|
||||
}
|
||||
|
||||
// 只有当获取到有效数据时才更新总数显示
|
||||
if (onlineBean.getOn_pit() != null || onlineBean.getOff_pit() != null) {
|
||||
mBinding.tvNum.setText("在线用户(" + total + ")人");
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setOnlineNumber(total);
|
||||
}
|
||||
}
|
||||
// 如果两个列表都为null,保持之前的总数显示不变
|
||||
} else {
|
||||
// 加载更多时,更新总数显示
|
||||
int currentTotal = 0;
|
||||
List<RoomOnlineBean> currentData = roomOnlineAdapter.getData();
|
||||
for (RoomOnlineBean bean : currentData) {
|
||||
if (bean.getItemViewType() == 2) { // 只统计用户项,不统计标题项
|
||||
currentTotal++;
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.tvNum.setText("在线用户(" + currentTotal + ")人");
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setOnlineNumber(currentTotal);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否需要禁用加载更多(如果当前页数据少于预期)
|
||||
if (onlineBean.getOn_pit() != null && onlineBean.getOff_pit() != null) {
|
||||
int currentCount = onlineBean.getOn_pit().size() + onlineBean.getOff_pit().size();
|
||||
if (currentCount < 10 && page > 1) { // 每页预期10条数据
|
||||
if (mBinding.srl != null) {
|
||||
mBinding.srl.finishLoadMoreWithNoMoreData();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
// 确保在异常情况下也能完成刷新操作
|
||||
if (getActivity() != null && mBinding != null && mBinding.srl != null) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (page <= 1) {
|
||||
mBinding.srl.finishRefresh(false);
|
||||
} else {
|
||||
mBinding.srl.finishLoadMore(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @Override
|
||||
// public void getRoomOnline(List<RoomOnlineBean> onlineBean) {
|
||||
// roomOnlineAdapter.setNewData(onlineBean);
|
||||
// mBinding.tvNum.setText("在线用户("+onlineBean.size()+")人");
|
||||
// }
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// 每次恢复时重置刷新状态
|
||||
resetRefreshState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPit() {
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.event.EffectEvent;
|
||||
import com.xscm.moduleutil.event.FloatingScreenEvent;
|
||||
import com.xscm.moduleutil.event.MusicEvent;
|
||||
import com.xscm.moduleutil.event.RoomOutEvent;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
@@ -61,6 +62,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
private int read;
|
||||
private boolean isSelected;
|
||||
private boolean effectOn = false;//开启/关闭特效
|
||||
private boolean floatingScreen = false;//开启/关闭飘屏
|
||||
|
||||
@Override
|
||||
protected RoomSettingPresenter bindPresenter() {
|
||||
@@ -133,6 +135,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
protected void initData() {
|
||||
dataList = new ArrayList<>();
|
||||
effectOn = SpUtil.getOpenEffect() == 1;
|
||||
floatingScreen = SpUtil.getFloatingScreen() == 1;
|
||||
boolean b = roomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1");
|
||||
LogUtils.e("effectOn=" + effectOn);
|
||||
// 添加标题和对应的内容项
|
||||
@@ -160,6 +163,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
dataList.add(new RoomSettingBean("房间设置", "ic_room_setting", null, null, RoomSettingBean.QXRoomSettingTypeRoomSetting, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("房间欢迎语", "ic_welcome", null, null, RoomSettingBean.QXRoomSettingTypeRoomWelcome,read,isSelected, false));
|
||||
dataList.add(new RoomSettingBean("关闭特效", "ic_close_effects", null, null, RoomSettingBean.QXRoomSettingTypeRoomCloseEffects, read, isSelected, false, effectOn));
|
||||
dataList.add(new RoomSettingBean("关闭飘屏", "ic_close_floating_screen", null, null, RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen, read, isSelected, false, floatingScreen));
|
||||
dataList.add(new RoomSettingBean("举报", "ic_report", null, null, RoomSettingBean.QXRoomSettingTypeRoomReport, read, isSelected, false, false));
|
||||
List<RoomSettingBean> filteredList = new ArrayList<>();
|
||||
// 更新 itemType
|
||||
@@ -281,7 +285,22 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + 2 + "&fromId=" + roomId).navigation();
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomSubsidy) {
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_ALLOWANCE).withString("from", "我的界面").withString("roomId", roomInfoResp.getRoom_info().getRoom_id() + "").navigation();
|
||||
|
||||
}else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen){//2025年9月22日14:10:25,添加飘屏关闭打开按钮
|
||||
if (floatingScreen) {
|
||||
//关闭
|
||||
floatingScreen = false;
|
||||
//保存到本地
|
||||
SpUtil.setFloatingScreen(0);
|
||||
EventBus.getDefault().post(new FloatingScreenEvent(false));
|
||||
bean.setSelect(false);
|
||||
} else {
|
||||
//打开
|
||||
floatingScreen = true;
|
||||
SpUtil.setFloatingScreen(1);
|
||||
EventBus.getDefault().post(new FloatingScreenEvent(true));
|
||||
bean.setSelect(true);
|
||||
}
|
||||
upAdapter();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -318,31 +337,44 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
|| roomInfoResp.getRoom_info().getType_id().equals("4") || roomInfoResp.getRoom_info().getType_id().equals("8")) && roomInfoResp.getRoom_info().getLabel_id().equals("2")) {
|
||||
onMic = true;
|
||||
}
|
||||
|
||||
// 2025年9月22日14:18:50,因为声网sdk不对,和点唱有关系的所有,需要关闭
|
||||
// 房主显示全部
|
||||
if (roleLevel == 1) {
|
||||
if (onMic) {
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) {
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
if (type==RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (roleLevel == 2 || roleLevel == 3) { // type == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy || type == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl || 2025年9月19日11:21:04,将男神女神合并成互娱,最总是新添加一个标签
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomTypeSing || type == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeHUYU ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic || type == RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen
|
||||
|| type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage || type == -1) {
|
||||
if (onMic) {
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) {
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
if (type==RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (type >= RoomSettingBean.QXRoomSettingTypeRoomLeave &&
|
||||
type <= RoomSettingBean.QXRoomSettingTypeRoomReport) {
|
||||
type <= RoomSettingBean.QXRoomSettingTypeRoomReport
|
||||
) {
|
||||
return true;
|
||||
}else {
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -368,7 +400,8 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomShare ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomCloseEffects ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomReport;
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomReport ||
|
||||
type== RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -271,6 +271,7 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
|
||||
// showContent = "点击 Item菜单6";
|
||||
//TODO 举报功能
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id).withString("title", "举报").navigation();
|
||||
dismiss();
|
||||
} else if (id == R.id.action_blacklist) {
|
||||
MvpPre.addBlackList(user_id);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,10 @@ import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import android.os.CountDownTimer;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -45,10 +48,13 @@ import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.utils.ClickUtils;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.StringUtil;
|
||||
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
import com.xscm.moduleutil.widget.floatingView.IFloatingView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -111,6 +117,22 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
return;
|
||||
}
|
||||
}
|
||||
private SharedViewModel sharedViewModel;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
//
|
||||
// // 观察专门给子Fragment的数据
|
||||
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||
// if (data != null) {
|
||||
// // 处理数据
|
||||
// roomInfoUpdate(data);
|
||||
// }
|
||||
// });
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConcernSelected(RoomRelationBean selectedDean, FriendUserBean relationshipList) {
|
||||
@@ -937,8 +959,9 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
* @param pitArr 麦位数组
|
||||
*/
|
||||
public void friendSeatDidChanged(List<RoomPitBean> pitArr) { // 使用实际的麦位模型类
|
||||
boolean isHaveMe=false;
|
||||
if (myPitNumber == 9 || myPitNumber == 10) {
|
||||
|
||||
isHaveMe=true;
|
||||
} else {
|
||||
myPitNumber = -1;
|
||||
}
|
||||
@@ -957,6 +980,20 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
friendshipWheatView.setData(roomPitBean);
|
||||
if (pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
myPitNumber = Integer.parseInt(pitBean.getPit_number());
|
||||
isHaveMe=true;
|
||||
}
|
||||
}
|
||||
if (!isHaveMe){
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setrlMic(false);
|
||||
((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
|
||||
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled( false,SpUtil.getUserId()+"");
|
||||
}
|
||||
}else {
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setrlMic(true);
|
||||
((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
|
||||
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled( false,SpUtil.getUserId()+"");
|
||||
}
|
||||
}
|
||||
configPowerBtn();
|
||||
@@ -1072,7 +1109,8 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
mBinding.imX1.setVisibility(View.VISIBLE);
|
||||
// mBinding.iv11.setVisibility(View.VISIBLE);
|
||||
mBinding.tv1.setVisibility(View.VISIBLE);
|
||||
mBinding.tv1.setText(heartList2.getHeartNum() + "");
|
||||
mBinding.tv1.setText(StringUtil.toWan2(heartList2.getHeartNum()+"", 1));
|
||||
// mBinding.tv1.setText(heartList2.getHeartNum() + "");
|
||||
// if (!topIsAnimate) {
|
||||
// // 强制刷新视图
|
||||
// mBinding.iv11.requestLayout();
|
||||
@@ -1093,7 +1131,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
mBinding.imX3.setVisibility(View.VISIBLE);
|
||||
// mBinding.iv33.setVisibility(View.VISIBLE);
|
||||
mBinding.tv3.setVisibility(View.VISIBLE);
|
||||
mBinding.tv3.setText(heartList3.getHeartNum() + "");
|
||||
mBinding.tv3.setText(StringUtil.toWan2(heartList3.getHeartNum() + "",2));
|
||||
// if (!bottomIsAnimate) {
|
||||
// // 强制刷新视图
|
||||
// mBinding.iv33.requestLayout();
|
||||
@@ -1324,8 +1362,12 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
setTime(time1);
|
||||
remainingTime = time1;
|
||||
if (time1 <= 10) {
|
||||
|
||||
mBinding.tvJsq.setVisibility(VISIBLE);
|
||||
mBinding.tvJsq.setText(time1 + "");
|
||||
if (time1==0){
|
||||
mBinding.tvJsq.setVisibility(GONE);
|
||||
}
|
||||
} else {
|
||||
mBinding.tvJsq.setVisibility(GONE);
|
||||
}
|
||||
@@ -1408,6 +1450,13 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
/// self.cpView.model=relationModel;[self.cpView showInView:KEYWINDOW];
|
||||
}
|
||||
|
||||
public void clearDialog(){
|
||||
dialogFragment = (RoomConcernDialogFragment) getChildFragmentManager().findFragmentByTag("RoomConcernDialogFragment");
|
||||
if (dialogFragment != null && dialogFragment.isAdded()) {
|
||||
dialogFragment.dismiss();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void registerWheatViews() {
|
||||
|
||||
|
||||
@@ -163,17 +163,53 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
* 登录聊天室
|
||||
*/
|
||||
public void onChatRoomViewCreation() {
|
||||
// MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||
// RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
// t.setText("羽声严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||
// // 加入群组成功
|
||||
// handleRoomMessage(new RoomMessageEvent(1000,roomId, t));
|
||||
if (messageListener == null) {
|
||||
|
||||
// 创建并添加监听器
|
||||
messageListener = new MessageListenerSingleton.PublicScreenMessageListener() {
|
||||
@Override
|
||||
public void onPublicScreenMessageReceived(RoomMessageEvent message) {
|
||||
// 确保在主线程更新 UI
|
||||
// 先移除旧的监听器
|
||||
if (messageListener != null) {
|
||||
MessageListenerSingleton.getInstance().removePublicScreenMessageListener(messageListener);
|
||||
messageListener = null;
|
||||
}
|
||||
// 执行加入操作
|
||||
// MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||
// 设置消息监听器
|
||||
setupMessageListener();
|
||||
|
||||
// 检查是否有缓存的消息需要处理
|
||||
checkAndProcessCachedMessages();
|
||||
// if (messageListener == null) {
|
||||
//
|
||||
// // 创建并添加监听器
|
||||
// messageListener = new MessageListenerSingleton.PublicScreenMessageListener() {
|
||||
// @Override
|
||||
// public void onPublicScreenMessageReceived(RoomMessageEvent message) {
|
||||
// // 确保在主线程更新 UI
|
||||
// getActivity().runOnUiThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// handleRoomMessage(message);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// MessageListenerSingleton.getInstance().addPublicScreenMessageListener(messageListener);
|
||||
|
||||
}
|
||||
/**
|
||||
* 设置消息监听器
|
||||
*/
|
||||
private void setupMessageListener() {
|
||||
// 创建并添加监听器
|
||||
messageListener = new MessageListenerSingleton.PublicScreenMessageListener() {
|
||||
@Override
|
||||
public void onPublicScreenMessageReceived(RoomMessageEvent message) {
|
||||
// 确保在主线程更新 UI
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -181,17 +217,51 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
MessageListenerSingleton.getInstance().addPublicScreenMessageListener(messageListener);
|
||||
|
||||
// 注册消息监听器
|
||||
// MessageListenerSingleton.getInstance().addOnMessageReceivedListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查并处理缓存的消息
|
||||
*/
|
||||
private void checkAndProcessCachedMessages() {
|
||||
if (roomId == null || roomId.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 延迟一小段时间,确保监听器已注册
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 获取并处理缓存的消息
|
||||
List<RoomMessageEvent> cachedMessages = MessageListenerSingleton.getInstance().getAndClearCachedMessages(roomId);
|
||||
if (!cachedMessages.isEmpty()) {
|
||||
LogUtils.d("PublicScreenEaseChatFragment", "处理缓存消息数量: " + cachedMessages.size());
|
||||
for (RoomMessageEvent message : cachedMessages) {
|
||||
handleRoomMessage(message);
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// // 如果没有缓存消息,发送默认的欢迎消息
|
||||
// sendWelcomeMessage();
|
||||
// }
|
||||
}
|
||||
}, 300); // 延迟300ms确保监听器已注册
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送欢迎消息
|
||||
*/
|
||||
private void sendWelcomeMessage() {
|
||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
t.setText("秘地严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||
// 加入群组成功
|
||||
handleRoomMessage(new RoomMessageEvent(1000, roomId, t));
|
||||
}
|
||||
@Override
|
||||
protected void initListener() {
|
||||
mBinding.recycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
mBinding.recycleViewPublic.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
@@ -219,25 +289,49 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
|
||||
public void getUpRoomInfo(RoomInfoResp resp) {
|
||||
this.roomInfoResp = resp;
|
||||
// 确保适配器已初始化
|
||||
if (easeChatAdapter == null) {
|
||||
initChatAdapter();
|
||||
// 确保Fragment视图已创建
|
||||
if (isAdded() && getActivity() != null && mBinding != null) {
|
||||
// 确保适配器已初始化
|
||||
if (easeChatAdapter == null) {
|
||||
initChatAdapter();
|
||||
}
|
||||
if (easeChatAdapter != null) {
|
||||
easeChatAdapter.clearData();
|
||||
}
|
||||
toChatUsername = roomInfoResp.getRoom_info().getChatrooms();
|
||||
this.roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
|
||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
t.setText("秘地严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||
// 加入群组成功
|
||||
handleRoomMessage(new RoomMessageEvent(1000, roomId, t));
|
||||
onChatRoomViewCreation();
|
||||
|
||||
} else {
|
||||
// 如果视图尚未准备好,延迟执行
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 使用post延迟执行,确保视图已创建
|
||||
if (getView() != null) {
|
||||
getView().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getUpRoomInfo(resp);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
easeChatAdapter.clearData();
|
||||
// roomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfo");
|
||||
toChatUsername = roomInfoResp.getRoom_info().getChatrooms();
|
||||
this.roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
t.setText("秘地严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||
// 加入群组成功
|
||||
handleRoomMessage(new RoomMessageEvent(1000, roomId, t));
|
||||
onChatRoomViewCreation();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||
mBinding.recycleView.setLayoutManager(linearLayoutManager);
|
||||
mBinding.recycleViewPublic.setLayoutManager(linearLayoutManager);
|
||||
initChatAdapter();
|
||||
// mBinding.recycleView.setAdapter(easeChatAdapter = new EaseChatAdapter());
|
||||
// easeChatAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
@@ -282,8 +376,9 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
private void initChatAdapter() {
|
||||
if (easeChatAdapter == null) {
|
||||
easeChatAdapter = new EaseChatAdapter();
|
||||
if (mBinding.recycleView != null) {
|
||||
mBinding.recycleView.setAdapter(easeChatAdapter);
|
||||
// 添加空值检查,确保mBinding和recycleViewPublic都不为null
|
||||
if (mBinding != null) {
|
||||
mBinding.recycleViewPublic.setAdapter(easeChatAdapter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -330,11 +425,11 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
private void setUpPublicScreen() {
|
||||
// if (roomInfoResp.getRoom_info().getChat_status() == 1) {
|
||||
// //如果有数据或者recycle view有item view就删除;否则程序崩溃,找不到item
|
||||
if (mBinding.recycleView.getChildCount() > 0) {
|
||||
mBinding.recycleView.removeAllViews();
|
||||
if (mBinding.recycleViewPublic.getChildCount() > 0) {
|
||||
mBinding.recycleViewPublic.removeAllViews();
|
||||
// easeChatAdapter.clearData();
|
||||
}
|
||||
mBinding.recycleView.setVisibility(View.VISIBLE);//开启消息列表
|
||||
mBinding.recycleViewPublic.setVisibility(View.VISIBLE);//开启消息列表
|
||||
mBinding.llHeadTab.setVisibility(View.VISIBLE);
|
||||
mBinding.tvClose.setVisibility(View.GONE);
|
||||
// } else {
|
||||
@@ -456,8 +551,8 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabAll.setTextSize(14);
|
||||
|
||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabSystem.setBackgroundResource(0);
|
||||
mBinding.tvTabUser.setBackgroundResource(0);
|
||||
mBinding.tvTabUser.setTextSize(12);
|
||||
@@ -468,8 +563,8 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabUser.setTextSize(14);
|
||||
|
||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabSystem.setBackgroundResource(0);
|
||||
mBinding.tvTabAll.setBackgroundResource(0);
|
||||
mBinding.tvTabAll.setTextSize(12);
|
||||
@@ -480,14 +575,14 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabSystem.setTextSize(14);
|
||||
|
||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabUser.setBackgroundResource(0);
|
||||
mBinding.tvTabAll.setBackgroundResource(0);
|
||||
mBinding.tvTabAll.setTextSize(12);
|
||||
mBinding.tvTabUser.setTextSize(12);
|
||||
} else if (view_id == R.id.tv_count) {
|
||||
mBinding.recycleView.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
||||
mBinding.recycleViewPublic.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
||||
mBinding.tvCount.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -908,8 +1003,15 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
|
||||
private void addSingleMessage(RoomMessageEvent message) {
|
||||
if (easeChatAdapter != null) {
|
||||
easeChatAdapter.addData(new EMMessageInfo(message));
|
||||
scrollToBottomIfNeed();
|
||||
if (message.getMsgType()==1049 ){
|
||||
if (message.getText().getStep() != 3){
|
||||
easeChatAdapter.addData(new EMMessageInfo(message));
|
||||
scrollToBottomIfNeed();
|
||||
}
|
||||
}else {
|
||||
easeChatAdapter.addData(new EMMessageInfo(message));
|
||||
scrollToBottomIfNeed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -927,10 +1029,10 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
|
||||
// 优化 scrollToBottomIfNeed 方法
|
||||
private void scrollToBottomIfNeed() {
|
||||
if (isBottom && mBinding.recycleView != null && easeChatAdapter != null) {
|
||||
if (isBottom && mBinding.recycleViewPublic != null && easeChatAdapter != null) {
|
||||
int itemCount = easeChatAdapter.getItemCount();
|
||||
if (itemCount > 0) {
|
||||
mBinding.recycleView.scrollToPosition(itemCount - 1);
|
||||
mBinding.recycleViewPublic.scrollToPosition(itemCount - 1);
|
||||
}
|
||||
} else {
|
||||
count++;
|
||||
@@ -1219,8 +1321,8 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
// }
|
||||
// }
|
||||
private void refreshSelectLast() {
|
||||
if (mBinding.recycleView != null) {
|
||||
mBinding.recycleView.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
||||
if (mBinding.recycleViewPublic != null) {
|
||||
mBinding.recycleViewPublic.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewStub;
|
||||
@@ -19,8 +20,11 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.TimeUtils;
|
||||
import com.example.moduleroom.R;
|
||||
@@ -37,7 +41,9 @@ import com.example.moduleroom.dialog.RoomUserInfoFragment;
|
||||
import com.example.moduleroom.presenter.RoomAuctionPresenterTow;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
@@ -47,6 +53,8 @@ import com.xscm.moduleutil.bean.room.RoomBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.dialog.WebViewDialog;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ClickUtils;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
@@ -54,6 +62,7 @@ import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.StringUtil;
|
||||
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
|
||||
import com.xscm.moduleutil.widget.RoomMakeWheatView;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -107,6 +116,23 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
// return fragment;
|
||||
// }
|
||||
|
||||
private SharedViewModel sharedViewModel;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
//
|
||||
// // 观察专门给子Fragment的数据
|
||||
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||
// if (data != null) {
|
||||
// // 处理数据
|
||||
// roomInfoUpdate(data);
|
||||
// }
|
||||
// });
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
@@ -177,7 +203,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
roomPitBean1.setPit_number("888");
|
||||
roomPitBean1.setIs_pm(1);
|
||||
wheatView2.setData(roomPitBean1);
|
||||
mBinding.tvPB.setText(StringUtil.toWan2(auctionUserBean.getCharm(),1));
|
||||
mBinding.tvPB.setText(StringUtil.toWan2(auctionUserBean.getCharm(), 1));
|
||||
countDownTime(auctionUserBean.getDuration());
|
||||
|
||||
if (auctionUserBean.getAuction_id() != null) {
|
||||
@@ -371,6 +397,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
mBinding.user5.setOnClickListener(this::onChock);
|
||||
mBinding.user6.setOnClickListener(this::onChock);
|
||||
mBinding.tvPB.setOnClickListener(this::onChock);
|
||||
mBinding.questionMark.setOnClickListener(this::onChock);
|
||||
getTextView();
|
||||
// initOverlayButtons();
|
||||
// steView(type);
|
||||
@@ -534,6 +561,16 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
return;
|
||||
}
|
||||
RoomCharmDialog.newInstance(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.pitBean.getUser_id()).show(getChildFragmentManager(), "RoomCharmDialog");
|
||||
}else if (id == R.id.question_mark){
|
||||
// Bundle bundle = new Bundle();
|
||||
// bundle.putString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"api/Page/page_show?id=22");
|
||||
// WebViewDialog dialog = new WebViewDialog(getActivity(), bundle);
|
||||
// dialog.show();
|
||||
if (type==1) {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=23").withString("title", "真爱拍规则").navigation();
|
||||
}else {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=22").withString("title", "亲密拍规则").navigation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1031,34 +1068,44 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
|
||||
|
||||
RoomPitBean pitBean = wheatView.pitBean;
|
||||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean.setIs_online(type == 1 ? 1 : 2);
|
||||
wheatView.setData(pitBean);
|
||||
return;
|
||||
if (pitBean.getUser_id()!=null) {
|
||||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean.setIs_online(type == 1 ? 1 : 2);
|
||||
wheatView.setData(pitBean);
|
||||
return;
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean2 = wheatView2.pitBean;
|
||||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean2.setIs_online(type == 1 ? 1 : 2);
|
||||
wheatView2.setData(pitBean2);
|
||||
return;
|
||||
if (pitBean2.getUser_id()!=null) {
|
||||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean2.setIs_online(type == 1 ? 1 : 2);
|
||||
wheatView2.setData(pitBean2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||||
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean3.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction1.setData(pitBean3);
|
||||
return;
|
||||
if (pitBean3.getUser_id()!=null) {
|
||||
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean3.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction1.setData(pitBean3);
|
||||
return;
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean4.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction2.setData(pitBean4);
|
||||
return;
|
||||
if (pitBean4.getUser_id()!=null) {
|
||||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean4.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction2.setData(pitBean4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean5.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction3.setData(pitBean5);
|
||||
return;
|
||||
if (pitBean5.getUser_id()!=null) {
|
||||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean5.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction3.setData(pitBean5);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (auctionList != null && auctionList.size() > 0) {
|
||||
for (int i = 0; i < auctionList.size(); i++) {
|
||||
@@ -1159,6 +1206,21 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
|
||||
public void event1021(RoomMessageEvent messageEvent) {
|
||||
mBinding.tvPB.setText("0");
|
||||
if (mBinding.ivAuction1.pitBean != null) {
|
||||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||||
pitBean3.setCharm("");
|
||||
mBinding.ivAuction1.setData(pitBean3);
|
||||
}
|
||||
if (mBinding.ivAuction2.pitBean != null) {
|
||||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||||
pitBean4.setCharm("");
|
||||
mBinding.ivAuction2.setData(pitBean4);
|
||||
}
|
||||
if (mBinding.ivAuction3.pitBean != null) {
|
||||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||||
pitBean5.setCharm("");
|
||||
mBinding.ivAuction3.setData(pitBean5);
|
||||
}
|
||||
}
|
||||
|
||||
public void event1027(RoomMessageEvent messageEvent) {
|
||||
@@ -1295,7 +1357,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
|
||||
// 特殊处理拍卖主持人(888号麦位)
|
||||
if (wheatView2.getUserId().equals(userId)) {
|
||||
mBinding.tvPB.setText(StringUtil.toWan2(charm,1));
|
||||
mBinding.tvPB.setText(StringUtil.toWan2(charm, 1));
|
||||
wheatView2.pitBean.setCharm(charm);
|
||||
wheatView2.setData(wheatView2.pitBean);
|
||||
return;
|
||||
|
||||
@@ -108,7 +108,7 @@ public class RoomBackgroundDialogFragment extends BaseMvpDialogFragment<RoomBack
|
||||
.setImageEngine(GlideEngine.createGlideEngine())
|
||||
.setMaxSelectNum(type)
|
||||
.isPreviewImage(true)
|
||||
.isDisplayCamera(true)
|
||||
.isDisplayCamera(false)
|
||||
.setOutputCameraDir(Constants.FILE_PATH)
|
||||
.isOriginalSkipCompress(true)
|
||||
.forResult(requestCode); //结果回调onActivityResult code
|
||||
|
||||
@@ -14,13 +14,18 @@ import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
@@ -47,6 +52,7 @@ import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
import com.xscm.moduleutil.widget.dialog.CommonDialog;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -150,7 +156,21 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
|
||||
|
||||
}
|
||||
|
||||
private SharedViewModel sharedViewModel;
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
//
|
||||
// // 观察专门给子Fragment的数据
|
||||
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||
// if (data != null) {
|
||||
// // 处理数据
|
||||
// roomInfoUpdate(data);
|
||||
// }
|
||||
// });
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
@@ -627,7 +647,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
public void quitRoom() {
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
LogUtils.e("lxj", "退出房间时间:" + TimeUtils.date2String(new Date())+":退出的roomId"+roomId);
|
||||
MessageListenerSingleton.quitGroup(roomId);
|
||||
MessageListenerSingleton.getInstance().quitGroup(roomId);
|
||||
((RoomActivity) getActivity()).quit();
|
||||
((RoomActivity) getActivity()).quitRoom2(roomId);
|
||||
if (label_id!=null && label_id.equals(LABEL_ID_MOVIE)){
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.media.metrics.Event;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
@@ -16,19 +12,10 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.TimeUtils;
|
||||
@@ -36,20 +23,12 @@ import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.activity.RoomActivity;
|
||||
import com.example.moduleroom.contacts.RoomContacts;
|
||||
import com.example.moduleroom.databinding.FragmentRoomBinding;
|
||||
import com.example.moduleroom.dialog.RequestDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomGiftDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomMessageDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomPkDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomSettingFragment;
|
||||
import com.example.moduleroom.dialog.SoundEffectsDialogFragment;
|
||||
import com.example.moduleroom.dialog.WheatFeedingDialogFragment;
|
||||
import com.example.moduleroom.presenter.RoomPresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.bean.RoomCharmRankBean;
|
||||
import com.xscm.moduleutil.bean.RoomInputEvent;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.FriendInfo;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
@@ -60,19 +39,15 @@ import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.event.QXRoomSeatViewType;
|
||||
import com.xscm.moduleutil.event.RoomWheatEvent;
|
||||
import com.xscm.moduleutil.event.UnreadCountEvent;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -83,7 +58,6 @@ import java.util.List;
|
||||
* @description:房间fragment
|
||||
*/
|
||||
public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBinding> implements RoomContacts.View {
|
||||
|
||||
public static RoomFragment newInstance() {
|
||||
Bundle args = new Bundle();
|
||||
RoomFragment fragment = new RoomFragment();
|
||||
@@ -129,6 +103,41 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
|
||||
super.initArgs(arguments);
|
||||
}
|
||||
private SharedViewModel sharedViewModel;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
// 获取 ViewModel
|
||||
|
||||
// 通知 Activity Fragment 已就绪
|
||||
// sharedViewModel.setFragmentReady(true);
|
||||
//
|
||||
// // 观察数据变化
|
||||
// sharedViewModel.getDataForFragment().observe(getViewLifecycleOwner(), data -> {
|
||||
// if (data != null) {
|
||||
// // 处理接收到的数据
|
||||
// refreshData(data, qxRoomSeatViewType);
|
||||
// // 可选:清除数据以避免重复处理
|
||||
// // sharedViewModel.clearData();
|
||||
// }
|
||||
// });
|
||||
// sharedViewModel.getSeatViewType().observe(getViewLifecycleOwner(), type -> {
|
||||
// if (type != null) {
|
||||
// // 处理数据
|
||||
// setqxRoomSeatViewType(type);
|
||||
// }
|
||||
// });
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoomPresenter bindPresenter() {
|
||||
@@ -138,6 +147,10 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
// 清理ViewModel数据
|
||||
// if (sharedViewModel != null) {
|
||||
// sharedViewModel.clearChildFragmentData();
|
||||
// }
|
||||
onFragmentShowDestroy();
|
||||
}
|
||||
|
||||
@@ -450,7 +463,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
mRoomInfoResp = resp;
|
||||
loadSubFragment(qxRoomSeatViewType);
|
||||
// upView(qxRoomSeatViewType);
|
||||
// 更新子Fragment视图
|
||||
// // 更新子Fragment视图
|
||||
// updateChildFragmentViews();
|
||||
}
|
||||
|
||||
@@ -517,30 +530,37 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
|
||||
if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) {
|
||||
friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||
}
|
||||
} else if ("2".equals(typeId)) {
|
||||
RoomAuctionFragment auctionRoomFragment = findFragmentByTag(RoomAuctionFragment.class);
|
||||
if (auctionRoomFragment != null && auctionRoomFragment.isAdded()) {
|
||||
auctionRoomFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||
}
|
||||
} else if ("1".equals(typeId) || "3".equals(typeId) || "4".equals(typeId) || "8".equals(typeId)) {
|
||||
if ("2".equals(labelId)) {
|
||||
RoomKtvFragment roomKtvFragment = findFragmentByTag(RoomKtvFragment.class);
|
||||
if (roomKtvFragment != null && roomKtvFragment.isAdded()) {
|
||||
roomKtvFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||
}
|
||||
} else if ("1".equals(labelId)) {
|
||||
SingSongFragment singSongFragment = findFragmentByTag(SingSongFragment.class);
|
||||
if (singSongFragment != null && singSongFragment.isAdded()) {
|
||||
singSongFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// sharedViewModel.setDataForFragment(mRoomInfoResp);
|
||||
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||
}
|
||||
}
|
||||
} else if ("6".equals(typeId)) {
|
||||
RoomCabinFragment roomCabinFragment = findFragmentByTag(RoomCabinFragment.class);
|
||||
if (roomCabinFragment != null && roomCabinFragment.isAdded()) {
|
||||
roomCabinFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -562,6 +582,10 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
friendshipRoomFragment.upDataFriendship(FriendshipRoomFragment.FriendshipPartType.HAND, friend_id, end_time, friendshipUserBean);
|
||||
}
|
||||
}
|
||||
//这里是进行判断,当已经弹起选择关系的页面的时候,这里直接退出
|
||||
public void clearDialog(){
|
||||
friendshipRoomFragment.clearDialog();
|
||||
}
|
||||
|
||||
/// 交友房时间发生延时
|
||||
public void friendTimeDelayWithTime(long end_time) {
|
||||
@@ -616,6 +640,8 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
getView().post(() -> {
|
||||
if (isAdded() && getActivity() != null) {
|
||||
performLoadSubFragment(qxRoomSeatViewType);
|
||||
}else {
|
||||
// loadSubFragment(qxRoomSeatViewType);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -794,12 +820,6 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
}
|
||||
|
||||
public void replaceNestedFragment(@NonNull Fragment newFragment, int containerId) {
|
||||
// String tag = newFragment.getClass().getSimpleName(); // 使用类名作为 tag
|
||||
//
|
||||
// FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
// callSpecificDestroyMethod(newFragment);
|
||||
// transaction.replace(containerId, newFragment, tag);
|
||||
// transaction.commitAllowingStateLoss();
|
||||
// 检查Fragment是否已经附加到Activity
|
||||
if (!isAdded() || getActivity() == null) {
|
||||
// 如果Fragment还没有附加,则延迟执行
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
@@ -47,6 +48,7 @@ import com.xscm.moduleutil.utils.ClickUtils;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.RoomKtvWheatView;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -109,6 +111,22 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
// parent.setTouchDelegate(new TouchDelegate(bounds, muZc));
|
||||
// });
|
||||
}
|
||||
private SharedViewModel sharedViewModel;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
//
|
||||
// // 观察专门给子Fragment的数据
|
||||
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||
// if (data != null) {
|
||||
// // 处理数据
|
||||
// roomInfoUpdate(data);
|
||||
// }
|
||||
// });
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
public View getNegativeMarginView() {
|
||||
return mBinding.muZc;
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.blankj.utilcode.util.ObjectUtils;
|
||||
import com.example.moduleroom.R;
|
||||
@@ -68,6 +69,7 @@ import com.xscm.moduleutil.utils.logger.Logger;
|
||||
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
||||
import com.xscm.moduleutil.widget.RoomDefaultWheatView;
|
||||
import com.xscm.moduleutil.widget.RoomSingSongWheatView;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
import com.xscm.moduleutil.widget.WheatLayoutManager;
|
||||
import com.xscm.moduleutil.widget.WheatLayoutSingManager;
|
||||
import com.xscm.moduleutil.widget.dialog.CommonDialog;
|
||||
@@ -106,7 +108,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
CountDownTimer mCountDownTimersta;
|
||||
private RoomFragment parentFragment;
|
||||
List<RoomPitBean> pitList;
|
||||
|
||||
private SharedViewModel sharedViewModel;
|
||||
public static SingSongFragment newInstance() {
|
||||
Bundle args = new Bundle();
|
||||
SingSongFragment fragment = new SingSongFragment();
|
||||
@@ -151,6 +153,15 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
//
|
||||
// // 观察专门给子Fragment的数据
|
||||
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||
// if (data != null) {
|
||||
// // 处理数据
|
||||
// roomInfoUpdate(data);
|
||||
// }
|
||||
// });
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@@ -1742,5 +1753,12 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
}
|
||||
mBinding.flexboxLayout.removeAllViews();
|
||||
mBinding.flexboxLayout2.removeAllViews();
|
||||
if (sharedViewModel != null) {
|
||||
sharedViewModel.clearChildFragmentData();
|
||||
}
|
||||
if (MvpPre != null) {
|
||||
MvpPre.detachView();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,16 @@ import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.View> implements RoomAuctionContacts.IRoomDataListPre {
|
||||
RoomAuctionContacts.View mView;
|
||||
public RoomAuctionPresenterTow(RoomAuctionContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -28,6 +31,9 @@ public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.V
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().applyPit();
|
||||
}
|
||||
});
|
||||
@@ -43,6 +49,9 @@ public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.V
|
||||
|
||||
@Override
|
||||
public void onNext(AuctionBean auctionBean) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().roomAuction(auctionBean);
|
||||
}
|
||||
});
|
||||
@@ -105,6 +114,9 @@ public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.V
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserOnlineStatusBean> userOnlineStatusBean) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().userOnlineStatus(userOnlineStatusBean);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -60,9 +60,17 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
}
|
||||
LogUtils.e("token",token);
|
||||
LogUtils.e("roomId:",roomId);
|
||||
|
||||
if (getView()!= null && getView().getSelfActivity()!=null){
|
||||
AgoraManager.getInstance(getView().getSelfActivity())
|
||||
.joinRoom(token, roomId, uid, enableMic,enableJs);
|
||||
}else {
|
||||
AgoraManager.getInstance(mContext.getApplicationContext())
|
||||
.joinRoom(token, roomId, uid, enableMic,enableJs);
|
||||
}
|
||||
|
||||
// 初始化 Agora 并加入房间
|
||||
AgoraManager.getInstance(getView().getSelfActivity())
|
||||
.joinRoom(token, roomId, uid, enableMic,enableJs);
|
||||
|
||||
|
||||
// RtcCore rtcCore = RtcCore.getInstance(getView().getSelfActivity());
|
||||
// rtcCore.initAgora(appId);
|
||||
@@ -78,6 +86,9 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
if (e instanceof APIException) {
|
||||
APIException apiException = (APIException) e;
|
||||
if (apiException.getCode() == 10000) {
|
||||
|
||||
@@ -21,6 +21,7 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
private SingSongContacts.View mView;
|
||||
public SingSongPresenter(SingSongContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -239,6 +239,7 @@
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-20dp"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:layout_constraintStart_toEndOf="@+id/wheat_view9"
|
||||
app:layout_constraintTop_toBottomOf="@+id/wheat_view9"
|
||||
app:layout_constraintTop_toTopOf="@id/background_image"
|
||||
@@ -250,6 +251,7 @@
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-20dp"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:layout_constraintEnd_toStartOf="@+id/wheat_view1"
|
||||
app:layout_constraintTop_toBottomOf="@+id/wheat_view1"
|
||||
app:room_make_pic="@mipmap/jiaoy"
|
||||
@@ -260,6 +262,7 @@
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-10dp"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:layout_constraintStart_toEndOf="@+id/wheat_view2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/wheat_view2"
|
||||
app:room_make_pic="@mipmap/jiaoy"
|
||||
@@ -269,6 +272,7 @@
|
||||
android:id="@+id/wheat_view6"
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/wheat_view1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/wheat_view10"
|
||||
app:layout_constraintTop_toTopOf="@id/wheat_view1"
|
||||
@@ -279,6 +283,7 @@
|
||||
android:id="@+id/wheat_view5"
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/wheat_view2"
|
||||
app:layout_constraintStart_toEndOf="@+id/wheat_view6"
|
||||
app:layout_constraintTop_toBottomOf="@+id/wheat_view6"
|
||||
@@ -290,6 +295,7 @@
|
||||
android:id="@+id/wheat_view4"
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="@id/wheat_view3"
|
||||
app:layout_constraintEnd_toStartOf="@+id/wheat_view5"
|
||||
app:layout_constraintTop_toBottomOf="@+id/wheat_view5"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
android:layout_marginLeft="5dp"
|
||||
android:textSize="12sp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ccc"
|
||||
android:textColor="#FFF"
|
||||
android:text="聊天"/>
|
||||
|
||||
<TextView
|
||||
@@ -44,7 +44,7 @@
|
||||
android:layout_marginLeft="5dp"
|
||||
android:textSize="12sp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ccc"
|
||||
android:textColor="#FFF"
|
||||
android:text="礼物"/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycle_view"
|
||||
android:id="@+id/recycle_view_public"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/ll_vertical_scroll"
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
android:paddingStart="@dimen/dp_16"
|
||||
android:paddingTop="@dimen/dp_25"
|
||||
android:paddingEnd="@dimen/dp_16"
|
||||
android:paddingBottom="@dimen/dp_10"
|
||||
|
||||
>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user