巡乐会添加榜单和记录
剩余转盘,屏幕适配器
This commit is contained in:
@@ -467,39 +467,68 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
if (giftGiveEvent == null || giftGiveEvent.roonGiftModel == null) {
|
||||
return;
|
||||
}
|
||||
// if (giftCountTimer != null) {
|
||||
// giftCountTimer.cancel();
|
||||
// giftCountTimer = null;
|
||||
// }
|
||||
RetrofitClient.getInstance().roomGift(giftGiveEvent.getRoom_id(), giftGiveEvent.getRoonGiftModel().getGift_id(), giftGiveEvent.getNum(), giftGiveEvent.getUserId(), "1", giftGiveEvent.getPit(), giftGiveEvent.heart_id, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
if (giftGiveEvent.auction_id!=null && !giftGiveEvent.auction_id.isEmpty()){
|
||||
RetrofitClient.getInstance().roomAuctionJoin(giftGiveEvent.getAuction_id(), giftGiveEvent.getUserId(),giftGiveEvent.getRoonGiftModel().getGift_id(), giftGiveEvent.getNum(), "1", new BaseObserver<RoomAuction.AuctionListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
// showGiftGiveProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomAuction.AuctionListBean auctionListBean) {
|
||||
showGiftGiveProgress();
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
String msg = e.getMessage();
|
||||
if (!TextUtils.isEmpty(msg) && msg.contains("当前余额不足")) {
|
||||
com.hjq.toast.ToastUtils.show("当前余额不足,请充值");
|
||||
ThreadUtils.runOnUiThreadDelayed(() -> {
|
||||
RechargeDialogFragment fragment = RechargeDialogFragment.show(roomId, null, getSupportFragmentManager());
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment); // 添加到管理列表
|
||||
}
|
||||
}, 1400);
|
||||
}
|
||||
hideGiftGiveProgress();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}else {
|
||||
|
||||
RetrofitClient.getInstance().roomGift(giftGiveEvent.getRoom_id(), giftGiveEvent.getRoonGiftModel().getGift_id(), giftGiveEvent.getNum(), giftGiveEvent.getUserId(), "1", giftGiveEvent.getPit(), giftGiveEvent.heart_id, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
// showGiftGiveProgress();
|
||||
// LogUtils.e("xj", "onSubscribe");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
showGiftGiveProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
String msg = e.getMessage();
|
||||
if (!TextUtils.isEmpty(msg) && msg.contains("当前余额不足")) {
|
||||
com.hjq.toast.ToastUtils.show("当前余额不足,请充值");
|
||||
ThreadUtils.runOnUiThreadDelayed(() -> {
|
||||
RechargeDialogFragment fragment = RechargeDialogFragment.show(roomId, null, getSupportFragmentManager());
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment); // 添加到管理列表
|
||||
}
|
||||
}, 1400);
|
||||
}
|
||||
hideGiftGiveProgress();
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
showGiftGiveProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
String msg = e.getMessage();
|
||||
if (!TextUtils.isEmpty(msg) && msg.contains("当前余额不足")) {
|
||||
com.hjq.toast.ToastUtils.show("当前余额不足,请充值");
|
||||
ThreadUtils.runOnUiThreadDelayed(() -> {
|
||||
RechargeDialogFragment fragment = RechargeDialogFragment.show(roomId, null, getSupportFragmentManager());
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment); // 添加到管理列表
|
||||
}
|
||||
}, 1400);
|
||||
}
|
||||
hideGiftGiveProgress();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private RoomGiftGiveEvent giftGiveEvent;
|
||||
@@ -1091,8 +1120,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
customMusicFloatingView.destroy();
|
||||
AgoraManager.getInstance(RoomActivity.this).desMusic();
|
||||
isMusic = false;
|
||||
mBinding.roomTop.rl.setVisibility(GONE);
|
||||
}
|
||||
mBinding.roomTop.rl.setVisibility(GONE);
|
||||
}
|
||||
|
||||
String typeId = mRoomInfoResp.getRoom_info().getType_id();
|
||||
@@ -2229,6 +2258,12 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
publicScreenFragment.getUpRoomInfo(resp);
|
||||
}
|
||||
instView();
|
||||
|
||||
if (mRoomInfoResp.getUser_info().getPit_number() == 9 && mRoomInfoResp.getUser_info().getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
mBinding.roomTop.rl.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.roomTop.rl.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void instView() {//隐藏视图
|
||||
@@ -2722,9 +2757,10 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
/// 小黑屋退出房间后调用这个加入房间
|
||||
public void jiaR() {
|
||||
LogUtils.e("@@@", "上一个房间的roonid" + AgoraManager.getInstance(context).getLastRoomId());
|
||||
MvpPre.getRoomIn(AgoraManager.getInstance(context).getLastRoomId(), "");
|
||||
// MvpPre.getRoomIn(AgoraManager.getInstance(context).getLastRoomId(), "");
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "电影房").withString("roomId", AgoraManager.getInstance(context).getLastRoomId()).navigation();
|
||||
AgoraManager.getInstance(context).setLastRoomId("");
|
||||
setviewyc(true);
|
||||
// setviewyc(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -66,13 +66,7 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
List currData = new ArrayList();
|
||||
if (type == SHOW_TYPE_ALL) {
|
||||
currData.addAll(allMsgList);
|
||||
// if (allMsgList.size() > 20) {
|
||||
// // 只添加最近的20条消息
|
||||
// int startIndex = Math.max(0, allMsgList.size() - 20);
|
||||
// currData.addAll(allMsgList.subList(startIndex, allMsgList.size()));
|
||||
// }else {
|
||||
// currData.addAll(allMsgList);
|
||||
// }
|
||||
|
||||
} else if (type == SHOW_TYPE_USER) {
|
||||
currData.addAll(userMsgList);
|
||||
} else if (type == SHOW_TYPE_SYSTEM) {
|
||||
@@ -455,26 +449,81 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
|
||||
@Override
|
||||
public void addData(@NonNull EMMessageInfo data) {
|
||||
// super.addData(data);
|
||||
if (data.getItemType()==1) {
|
||||
allMsgList.add(data);
|
||||
}else if (data.getItemType() == 2) {
|
||||
userMsgList.add(data);
|
||||
allMsgList.add(data);
|
||||
} else if (data.getItemType() == 3) {
|
||||
systemMsgList.add(data);
|
||||
|
||||
// 添加到对应的存储列表
|
||||
addToStorageLists(data);
|
||||
|
||||
// 维护数据量限制
|
||||
maintainDataLimits();
|
||||
|
||||
// 根据显示类型决定是否添加到适配器
|
||||
if (shouldAddToAdapter(data)) {
|
||||
super.addData(data);
|
||||
// 确保适配器数据量也不超过限制
|
||||
if (mData.size() > 20) {
|
||||
int removeCount = mData.size() - 20;
|
||||
mData.subList(0, removeCount).clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// 根据当前显示类型决定是否添加到适配器中
|
||||
boolean shouldAdd = (listShowType == SHOW_TYPE_ALL && (data.getItemType() == 1 || data.getItemType() == 2)) ||
|
||||
(listShowType == SHOW_TYPE_USER && data.getItemType() == 2) ||
|
||||
(listShowType == SHOW_TYPE_SYSTEM && data.getItemType() == 3);
|
||||
|
||||
if (shouldAdd) {
|
||||
super.addData(data);
|
||||
// if (data.getItemType()==1) {
|
||||
// allMsgList.add(data);
|
||||
// }else if (data.getItemType() == 2) {
|
||||
// userMsgList.add(data);
|
||||
// allMsgList.add(data);
|
||||
// } else if (data.getItemType() == 3) {
|
||||
// systemMsgList.add(data);
|
||||
// }
|
||||
// if (allMsgList.size() > 20) {
|
||||
// // 只添加最近的20条消息
|
||||
// int startIndex = Math.max(0, allMsgList.size() - 20);
|
||||
// allMsgList.subList(startIndex, allMsgList.size());
|
||||
// }
|
||||
// // 根据当前显示类型决定是否添加到适配器中
|
||||
// boolean shouldAdd = (listShowType == SHOW_TYPE_ALL && (data.getItemType() == 1 || data.getItemType() == 2)) ||
|
||||
// (listShowType == SHOW_TYPE_USER && data.getItemType() == 2) ||
|
||||
// (listShowType == SHOW_TYPE_SYSTEM && data.getItemType() == 3);
|
||||
//
|
||||
// if (shouldAdd) {
|
||||
// super.addData(data);
|
||||
// }
|
||||
}
|
||||
private void addToStorageLists(EMMessageInfo data) {
|
||||
switch (data.getItemType()) {
|
||||
case 1: // 系统消息
|
||||
allMsgList.add(data);
|
||||
break;
|
||||
case 2: // 用户消息
|
||||
userMsgList.add(data);
|
||||
allMsgList.add(data);
|
||||
break;
|
||||
case 3: // 系统消息类型3
|
||||
systemMsgList.add(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void maintainDataLimits() {
|
||||
// 确保所有存储列表都不超过最大限制
|
||||
trimListToMaxSize(allMsgList);
|
||||
// trimListToMaxSize(userMsgList);
|
||||
// trimListToMaxSize(systemMsgList);
|
||||
}
|
||||
|
||||
private void trimListToMaxSize(List<EMMessageInfo> list) {
|
||||
if (list.size() > 20) {
|
||||
int removeCount = list.size() - 20;
|
||||
list.subList(0, removeCount).clear();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldAddToAdapter(EMMessageInfo data) {
|
||||
return (listShowType == SHOW_TYPE_ALL && (data.getItemType() == 1 || data.getItemType() == 2)) ||
|
||||
(listShowType == SHOW_TYPE_USER && data.getItemType() == 2) ||
|
||||
(listShowType == SHOW_TYPE_SYSTEM && data.getItemType() == 3);
|
||||
}
|
||||
@Override
|
||||
public void addData(@NonNull Collection<? extends EMMessageInfo> newData) {
|
||||
// super.addData(newData);
|
||||
|
||||
@@ -29,15 +29,35 @@ public class ExitRoomBottomSheet extends BottomSheetDialogFragment {
|
||||
}
|
||||
|
||||
private OnOptionSelectedListener listener;
|
||||
private TextView tv_minimize;
|
||||
private static final String ARG_SHOW_MINIMIZE = "show_minimize";
|
||||
private static final String ARG_SHOW_EXIT = "show_exit";
|
||||
private static final String ARG_SHOW_CANCEL = "show_cancel";
|
||||
|
||||
public static ExitRoomBottomSheet newInstance() {
|
||||
return new ExitRoomBottomSheet();
|
||||
private boolean showMinimize = true;
|
||||
private boolean showExit = true;
|
||||
private boolean showCancel = true;
|
||||
|
||||
public static ExitRoomBottomSheet newInstance(boolean showMinimize, boolean showExit, boolean showCancel) {
|
||||
ExitRoomBottomSheet fragment = new ExitRoomBottomSheet();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ARG_SHOW_MINIMIZE, showMinimize);
|
||||
args.putBoolean(ARG_SHOW_EXIT, showExit);
|
||||
args.putBoolean(ARG_SHOW_CANCEL, showCancel);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public static ExitRoomBottomSheet newInstance() {
|
||||
return newInstance(true, true, true);
|
||||
}
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
showMinimize = getArguments().getBoolean(ARG_SHOW_MINIMIZE, true);
|
||||
showExit = getArguments().getBoolean(ARG_SHOW_EXIT, true);
|
||||
showCancel = getArguments().getBoolean(ARG_SHOW_CANCEL, true);
|
||||
}
|
||||
setStyle(STYLE_NORMAL, com.xscm.moduleutil.R.style.AppBottomSheetDialogTheme); // 自定义样式(可选)
|
||||
setCancelable(true); // 点击外部可关闭
|
||||
}
|
||||
@@ -47,18 +67,31 @@ public class ExitRoomBottomSheet extends BottomSheetDialogFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.dialog_exit_room_bottom_sheet, container, false);
|
||||
tv_minimize = view.findViewById(R.id.tv_minimize);
|
||||
view.findViewById(R.id.tv_minimize).setOnClickListener(v -> {
|
||||
TextView tv_minimize = view.findViewById(R.id.tv_minimize);
|
||||
TextView tv_exit_room = view.findViewById(R.id.tv_exit_room);
|
||||
TextView tv_cancel = view.findViewById(R.id.tv_cancel);
|
||||
|
||||
// 根据参数设置按钮可见性
|
||||
if (tv_minimize != null) {
|
||||
tv_minimize.setVisibility(showMinimize ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (tv_exit_room != null) {
|
||||
tv_exit_room.setVisibility(showExit ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (tv_cancel != null) {
|
||||
tv_cancel.setVisibility(showCancel ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
tv_minimize.setOnClickListener(v -> {
|
||||
if (listener != null) listener.onMinimize();
|
||||
dismiss();
|
||||
});
|
||||
|
||||
view.findViewById(R.id.tv_exit_room).setOnClickListener(v -> {
|
||||
tv_exit_room.setOnClickListener(v -> {
|
||||
if (listener != null) listener.onExitRoom();
|
||||
dismiss();
|
||||
});
|
||||
|
||||
view.findViewById(R.id.tv_cancel).setOnClickListener(v -> {
|
||||
tv_cancel.setOnClickListener(v -> {
|
||||
if (listener != null) listener.onCancel();
|
||||
dismiss();
|
||||
});
|
||||
@@ -66,9 +99,6 @@ public class ExitRoomBottomSheet extends BottomSheetDialogFragment {
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setViewUp(boolean isUp) {
|
||||
tv_minimize.setVisibility(isUp ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public void setOnOptionSelectedListener(OnOptionSelectedListener listener) {
|
||||
this.listener = listener;
|
||||
|
||||
@@ -292,17 +292,34 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
|
||||
contentView.findViewById(R.id.action_report).setOnClickListener(listener);
|
||||
contentView.findViewById(R.id.action_blacklist).setOnClickListener(listener);
|
||||
|
||||
if (type != 1) {
|
||||
if (type==1){
|
||||
contentView.findViewById(R.id.action_set_manager).setVisibility(VISIBLE);
|
||||
contentView.findViewById(R.id.action_kick_out).setVisibility(VISIBLE);
|
||||
contentView.findViewById(R.id.action_set_host).setVisibility(VISIBLE);
|
||||
}else if (type==2){
|
||||
contentView.findViewById(R.id.action_set_manager).setVisibility(GONE);
|
||||
contentView.findViewById(R.id.action_kick_out).setVisibility(VISIBLE);
|
||||
contentView.findViewById(R.id.action_set_host).setVisibility(VISIBLE);
|
||||
}else if (type==3){
|
||||
contentView.findViewById(R.id.action_set_manager).setVisibility(GONE);
|
||||
}
|
||||
if (type != 1 && type != 2) {
|
||||
contentView.findViewById(R.id.action_set_host).setVisibility(GONE);
|
||||
}
|
||||
if (paim==1){
|
||||
contentView.findViewById(R.id.action_kick_out).setVisibility(GONE);
|
||||
}else {
|
||||
contentView.findViewById(R.id.action_kick_out).setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
// if (type != 1) {
|
||||
// contentView.findViewById(R.id.action_set_manager).setVisibility(GONE);
|
||||
// contentView.findViewById(R.id.action_kick_out).setVisibility(GONE);
|
||||
// }
|
||||
// if (type != 1 && type != 2) {
|
||||
// contentView.findViewById(R.id.action_set_host).setVisibility(GONE);
|
||||
// contentView.findViewById(R.id.action_kick_out).setVisibility(GONE);
|
||||
// }
|
||||
// if (paim==1){
|
||||
// contentView.findViewById(R.id.action_kick_out).setVisibility(GONE);
|
||||
// }else {
|
||||
// contentView.findViewById(R.id.action_kick_out).setVisibility(VISIBLE);
|
||||
// }
|
||||
}
|
||||
|
||||
private String getValue(int type, String key) {
|
||||
|
||||
@@ -330,8 +330,8 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
if (view.getId() == R.id.iv_exit) {
|
||||
// EventBus.getDefault().post(new RoomOutEvent());
|
||||
// ARouter.getInstance().build(ARouteConstants.LIVE_ROOM).withString("form","首页热门列表").withString("roomId", item.getRoom_id()).navigation();
|
||||
ExitRoomBottomSheet bottomSheet = ExitRoomBottomSheet.newInstance();
|
||||
bottomSheet.setViewUp(false);
|
||||
ExitRoomBottomSheet bottomSheet = ExitRoomBottomSheet.newInstance(false,true,true);
|
||||
|
||||
bottomSheet.setOnOptionSelectedListener(new ExitRoomBottomSheet.OnOptionSelectedListener() {
|
||||
@Override
|
||||
public void onMinimize() {
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.6" />
|
||||
app:layout_constraintGuide_percent="0.66" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/vp_room_pager"
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
android:id="@+id/view_top2"
|
||||
android:layout_width="@dimen/dp_70"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
app:layout_constraintEnd_toStartOf="@+id/view_top1"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -101,16 +101,14 @@
|
||||
android:id="@+id/room_head_top2_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="34dp"
|
||||
android:drawableStart="@mipmap/rank_h"
|
||||
android:drawablePadding="@dimen/dp_4"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ll_vip2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_vip2"
|
||||
app:layout_constraintEnd_toEndOf="@id/ll_vip2"
|
||||
app:layout_constraintStart_toStartOf="@id/ll_vip2"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_top2"
|
||||
app:layout_constraintStart_toStartOf="@id/view_top2"
|
||||
tools:text="00000" />
|
||||
|
||||
|
||||
|
||||
@@ -62,8 +62,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
android:textSize="@dimen/sp_10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user