1:修改卡顿问题,

2:修改玄镜的动画
3:修改转盘获取数据
4:修改排行榜
This commit is contained in:
2025-09-15 18:22:36 +08:00
parent 572967ca16
commit e87a368862
40 changed files with 1752 additions and 911 deletions

View File

@@ -8,10 +8,12 @@ import android.os.PersistableBundle;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.xscm.modulelogin.activity.ImproveInfoActivity;
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.dialog.PolicyDialog;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.midi.databinding.ActivityLaunchPageBinding;
@@ -27,7 +29,15 @@ public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPage
return;
}
}
private boolean shouldRestoreRoom() {
// 检查是否应该恢复房间:
// 1. 应用有正在播放的房间
// 2. 应用应该显示房间
// 3. 应用是从后台恢复的(通过检查 CommonAppContext 状态)
return CommonAppContext.getInstance().isPlaying
&& CommonAppContext.getInstance().isShow
;
}
@Override
protected void initData() {
handler = new Handler();

View File

@@ -30,7 +30,7 @@ isBuildModule=false
android.injected.testOnly=false
APP_VERSION_NAME=1.0.0
APP_VERSION_CODE=125
APP_VERSION_CODE=129
org.gradle.jvm.toolchain.useLegacyAdapters=false
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15

View File

@@ -1,11 +1,16 @@
package com.xscm.moduleutil.adapter;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.bean.RechargeBean;
import com.xscm.moduleutil.utils.SystemUtils;
import java.util.List;
@@ -36,7 +41,10 @@ public class BalanceRechargeAdapter extends BaseMultiItemQuickAdapter<RechargeBe
@Override
protected void convert(BaseViewHolder helper, RechargeBean item) {
int type = helper.getItemViewType();
// ConstraintLayout constraintLayout = helper.getView(R.id.cl_item);
// ViewGroup.LayoutParams layoutParams =constraintLayout.getLayoutParams();
// layoutParams.width = ( com.blankj.utilcode.util.ScreenUtils.getScreenWidth()-32-24)/3-24; // 使用你定义的getWidth方法
// constraintLayout.setLayoutParams(layoutParams);
if (type == ITEM_TYPE_NORMAL) {
// 正常 item 显示逻辑
helper.setText(R.id.tv_gold_num, item.getCoins());

View File

@@ -869,15 +869,19 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
giftCardView.setVisibilitymResultTextView(true);
giftCardView.setSelected(true);
// 不要设置isDrawing=true这会影响动画控制
MvpPre.wallet();
isDrawing = false;
MvpPre.giftSend(blind_box_turntable_id);
// MvpPre.wallet();
// isDrawing = false;
// MvpPre.giftSend(blind_box_turntable_id);
giftCardView.bindGiftData(giftBean);
}
}
}
}
MvpPre.wallet();
isDrawing = false;
MvpPre.giftSend(blind_box_turntable_id);
Log.e("isOpenSound===","isOpenSound1222"+isOpenSound);
if (isOpenSpecial) {
Log.e("isOpenSound===","isOpenSound333"+isOpenSound);

View File

@@ -49,7 +49,11 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
*@author qx
*@data 2025/9/15
*@description: 玄镜之旅
*/
public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FragmentTourClubDialogBinding> implements GiftLotteryContacts.View {
private String roomId;
private List<GiftBean> giftLists = new ArrayList<>();
@@ -94,8 +98,8 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCancelable(true);
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this);
// if (!EventBus.getDefault().isRegistered(this))
// EventBus.getDefault().register(this);
return dialog;
}
@@ -300,7 +304,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
}
// TODO: 2025/8/29 接收im推送过来的消息
@Subscribe(threadMode = ThreadMode.MAIN)
// @Subscribe(threadMode = ThreadMode.MAIN)
public void onMusicPlay(RoomMessageEvent message) {
if (message.getMsgType() == 1057) {
// UpView(message.getText().getXlh_data());
@@ -444,67 +448,69 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
public void xlhChouSuccess(List<XlhDrawBean> data) {
if (data != null) {
showResultDialog(data);
// 取消之前可能存在的任务
clearPendingTasks();
// 抽奖完成后执行动画滚动
pendingLotteryRunnable = new Runnable() {
@Override
public void run() {
// 清理之前的状态
if (giftXlhChouAdapter != null) {
giftXlhChouAdapter.clearSelection();
}
int winningPosition = findHighestValueWinningPosition(data);//这是获取到的中奖位置下标
if (winningPosition != -1) {
if (scrollHelper == null) {
scrollHelper = new CenterScrollHelper(mBinding.recycleView);
}
// 计算在循环列表中的目标位置(滚动几圈后停在目标位置)
int loopCount = 4; // 滚动4圈
int originalSize = giftLists.size();///这是列表的总大小
// 计算目标在循环列表中的位置(确保在中间区域)
///这是计算总圈数的大小
int middleBaseIndex = (loopCount * originalSize);
///这里是展示在中奖的位置,加上总圈数的大小,
int targetLoopIndex = middleBaseIndex + (winningPosition % originalSize);
// 使用scrollWithCircles方法执行带动画的滚动带完成回调
scrollHelper.scrollWithCircles(
targetLoopIndex, // 在循环列表中的位置
loopCount, // 滚动圈数
200, // 每个item滚动时间200ms控制速度
originalSize, // 原始数据大小
() -> { // 滚动完成回调
// 滚动完成后更新选中状态(使用原始位置)
if (giftXlhChouAdapter != null) {
giftXlhChouAdapter.setSelectedPosition(winningPosition);
}
// 滚动完成后延迟一小段时间再居中确保UI更新完成
pendingCenteringRunnable = new Runnable() {
@Override
public void run() {
// 手动将选中项居中
centerSelectedItem(winningPosition, originalSize);
// 显示结果对话框
getActivity().runOnUiThread(() -> {
scrollHelper = null;
showResultDialog(data);
});
}
};
mBinding.recycleView.postDelayed(pendingCenteringRunnable, 100);
}
);
} else {
// 如果没有找到中奖位置,直接显示对话框
showResultDialog(data);
}
}
};
mBinding.recycleView.postDelayed(pendingLotteryRunnable, 300);
// clearPendingTasks();
// // 抽奖完成后执行动画滚动
// pendingLotteryRunnable = new Runnable() {
// @Override
// public void run() {
// // 清理之前的状态
// if (giftXlhChouAdapter != null) {
// giftXlhChouAdapter.clearSelection();
// }
// int winningPosition = findHighestValueWinningPosition(data);//这是获取到的中奖位置下标
// if (winningPosition != -1) {
// if (scrollHelper == null) {
// scrollHelper = new CenterScrollHelper(mBinding.recycleView);
// }
//
// // 计算在循环列表中的目标位置(滚动几圈后停在目标位置)
// int loopCount = 4; // 滚动4圈
// int originalSize = giftLists.size();///这是列表的总大小
// // 计算目标在循环列表中的位置(确保在中间区域)
// ///这是计算总圈数的大小
// int middleBaseIndex = (loopCount * originalSize);
// ///这里是展示在中奖的位置,加上总圈数的大小,
// int targetLoopIndex = middleBaseIndex + (winningPosition % originalSize);
//
// // 使用scrollWithCircles方法执行带动画的滚动带完成回调
// scrollHelper.scrollWithCircles(
// targetLoopIndex, // 在循环列表中的位置
// loopCount, // 滚动圈数
// 200, // 每个item滚动时间200ms控制速度
// originalSize, // 原始数据大小
// () -> { // 滚动完成回调
// // 滚动完成后更新选中状态(使用原始位置)
// if (giftXlhChouAdapter != null) {
// giftXlhChouAdapter.setSelectedPosition(winningPosition);
// }
// // 滚动完成后延迟一小段时间再居中确保UI更新完成
// pendingCenteringRunnable = new Runnable() {
// @Override
// public void run() {
// // 手动将选中项居中
// centerSelectedItem(winningPosition, originalSize);
//
// // 显示结果对话框
// getActivity().runOnUiThread(() -> {
// scrollHelper = null;
// showResultDialog(data);
// });
// }
// };
// mBinding.recycleView.postDelayed(pendingCenteringRunnable, 100);
// }
// );
//
// } else {
// // 如果没有找到中奖位置,直接显示对话框
// showResultDialog(data);
// }
// }
// };
// mBinding.recycleView.postDelayed(pendingLotteryRunnable, 300);
}

View File

@@ -0,0 +1,76 @@
package com.xscm.moduleutil.event;
public enum QXRoomSeatViewType {
/**
* 无类型
*/
NONE(0, "无类型"),
/**
* 普通麦位(二卡八麦)
*/
NORMAL(1, "点唱"),
KTV(3,"K歌"),
/**
* 拍卖麦位
*/
AUCTION(2, "拍卖麦位"),
/**
* 小黑屋麦位
*/
CABIN(6, "小黑屋麦位"),
/**
* 交友房麦位
*/
FRIEND(7, "交友房麦位");
private final int value;
private final String description;
QXRoomSeatViewType(int value, String description) {
this.value = value;
this.description = description;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
public static QXRoomSeatViewType fromLotteryEvent(int value) {
if (value==1) {
return NORMAL;
}
if (value==2) {
return AUCTION;
}
if (value==3) {
return KTV;
}
if (value==6){
return CABIN;
}
if (value==7){
return FRIEND;
}
return NONE;
}
@Override
public String toString() {
return "QXRoomSeatViewType{" +
"value=" + value +
", description='" + description + '\'' +
'}';
}
}

View File

@@ -13,7 +13,7 @@ public enum EnvironmentEnum {
1600101474,
"a3f0f0c78307434fa1c697c3429fbdcf",
"tcp://81.70.45.221",
"https://mdh.xscmmidi.site"),
"https://md.xscmmidi.site/h5"),
TEST(//测试环境
"http://md.qxmier.com/",
"6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=",

View File

@@ -589,8 +589,8 @@ public class AvatarFrameView extends FrameLayout {
if (file != null && file.exists()) {
// 设置循环次数根据mType决定
if (mType == 1) {
mBinding.playView.setLoop(0); // 无限循环
if (mType == 1 || mType == 3) {
mBinding.playView.setLoop(Integer.max(1, 999999999)); // 无限循环
} else {
mBinding.playView.setLoop(1); // 播放一次
}
@@ -767,7 +767,9 @@ public class AvatarFrameView extends FrameLayout {
public void onRepeat() {
// 循环播放处理
if (mType != 1) { // 非循环播放
svgaSurface.stopAnimation(true);
svgaSurface.stopAnimation();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable(null);
onPlaybackComplete();
}
}
@@ -811,6 +813,22 @@ public class AvatarFrameView extends FrameLayout {
}
}
public void stopAll(){
if (svgaSurface != null){
svgaSurface.stopAnimation();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable( null);
}
if (svgaSurface2 != null){
svgaSurface2.stopAnimation();
svgaSurface2.clearAnimation();
svgaSurface.setImageDrawable( null);
}
if (mBinding.playView!=null){
mBinding.playView.stopPlay();
}
}
private void playCachedSVGA(SVGAVideoEntity videoItem) {
// if (isDestroyed || svgaSurface == null) return;
@@ -1196,6 +1214,8 @@ public class AvatarFrameView extends FrameLayout {
// svgaSurface.setImageDrawable(null);
svgaSurface.stopAnimation(true);
svgaSurface.clear();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable( null);
} catch (Exception e) {
Logger.e(TAG, "Error releasing SVGA resources: " + e.getMessage());
}

View File

@@ -91,7 +91,7 @@ public class GiftAnimView extends FrameLayout implements GiftSvgaView.OnAnimatio
@Override
public void onVideoRender(int i, @Nullable AnimConfig animConfig) {
LogUtils.e("onVideoRender", i, animConfig);
// LogUtils.e("onVideoRender", i, animConfig);
}
@Override

View File

@@ -218,6 +218,8 @@ public class GiftSvgaView extends FrameLayout implements SVGACallback {
public void stopEffectSvgaPlay() {
if (player != null) {
player.stopAnimation();
player.clearAnimation();
player.setImageDrawable( null);
}
}

View File

@@ -95,9 +95,11 @@ public class RoomFriendshipWheatView extends BaseWheatView {
mTvName.setText(bean.getNickname());
ImageUtils.loadCenterCrop(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(pitBean.getDress())) {
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
} else {
mIvFrame.setVisibility(VISIBLE);
mIvFrame.stopAll();
mIvFrame.setSource(pitBean.getDress(), 3);
}
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
@@ -121,7 +123,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
if (isMute()) {
ImageUtils.loadRes(R.mipmap.room_microphone_off, mIvSex);
}
mIvFrame.stopSvga();
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
mIvFace.remove();
//停止声浪

View File

@@ -79,6 +79,7 @@ public class RoomKtvWheatView extends BaseWheatView {
mTvName.setText(bean.getNickname());
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(pitBean.getDress())) {
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
} else {
mIvFrame.setVisibility(VISIBLE);
@@ -110,6 +111,7 @@ public class RoomKtvWheatView extends BaseWheatView {
if (isMute()) {
ImageUtils.loadRes(R.mipmap.room_microphone_off, mIvSex);
}
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
mIvFace.remove();
//停止声浪

View File

@@ -103,6 +103,7 @@ public class RoomMakeWheatView extends BaseWheatView {
mTvName.setText(bean.getNickname());
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(pitBean.getDress())) {
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
} else {
mIvFrame.setVisibility(VISIBLE);
@@ -124,7 +125,7 @@ public class RoomMakeWheatView extends BaseWheatView {
if (isMute()){
ImageUtils.loadRes(R.mipmap.room_microphone_off, mIvSex);
}
mIvFrame.stopSvga();
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
mIvFace.remove();
//停止声浪

View File

@@ -84,6 +84,7 @@ public class RoomSingSongWheatView extends BaseWheatView {
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(bean.getDress())) {
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
} else {
mIvFrame.setVisibility(VISIBLE);
@@ -109,7 +110,7 @@ public class RoomSingSongWheatView extends BaseWheatView {
if (isMute()) {
ImageUtils.loadRes(R.mipmap.room_microphone_off, mIvSex);
}
mIvFrame.stopSvga();
mIvFrame.stopAll();
mIvFrame.setVisibility(INVISIBLE);
mIvFace.remove();
mIvRipple.setVisibility(GONE);

View File

@@ -31,16 +31,14 @@
android:id="@+id/iv_frame"
android:layout_width="0dp"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintHeight_percent="1"
app:layout_constraintWidth_percent="1.05"
app:layout_constraintBottom_toBottomOf="@id/riv"
app:layout_constraintEnd_toEndOf="@id/riv"
android:layout_marginStart="-2dp"
android:layout_marginEnd="-2dp"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-2dp"
app:layout_constraintStart_toStartOf="@id/riv"
app:layout_constraintTop_toTopOf="@id/riv" />
app:layout_constraintEnd_toEndOf="@id/riv"
app:layout_constraintTop_toTopOf="@id/riv"
app:layout_constraintBottom_toBottomOf="@id/riv"/>
<!-- 说话麦圈,与头像大小相同,覆盖在头像上 -->
<com.opensource.svgaplayer.SVGAImageView

View File

@@ -29,6 +29,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -3,36 +3,37 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cl_item"
android:layout_width="@dimen/dp_106"
android:layout_height="@dimen/dp_66"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_12"
android:layout_marginStart="@dimen/dp_12"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_76"
android:layout_gravity="center"
android:layout_marginEnd="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_12"
android:background="@drawable/bg_r10_white">
<ImageView
android:id="@+id/iv_gold"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:src="@mipmap/jinb"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginBottom="@dimen/dp_35"
android:layout_marginStart="@dimen/dp_19"
android:layout_marginEnd="@dimen/dp_67"/>
<!-- <ImageView-->
<!-- android:id="@+id/iv_gold"-->
<!-- android:layout_width="@dimen/dp_20"-->
<!-- android:layout_height="@dimen/dp_20"-->
<!-- android:src="@mipmap/jinb"-->
<!-- android:layout_marginTop="@dimen/dp_19"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- android:layout_marginStart="@dimen/dp_19"-->
<!-- />-->
<TextView
android:id="@+id/tv_gold_num"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_20"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
android:drawableLeft="@mipmap/jinb"
android:textColor="@color/color_353535"
android:textSize="@dimen/sp_18"
app:layout_constraintLeft_toRightOf="@+id/iv_gold"
app:layout_constraintTop_toTopOf="@+id/iv_gold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="600" />
<TextView
@@ -41,21 +42,15 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginStart="@dimen/dp_25"
android:layout_marginEnd="@dimen/dp_40"
android:textColor="@color/color_FF666666"
android:textSize="@dimen/sp_14"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_gold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_gold_num"
tools:text="¥6" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="tv_money,tv_gold_num,iv_gold" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -10,7 +10,8 @@
<activity
android:name=".activity.MainActivity"
android:launchMode="singleInstance"
android:exported="true"
/>
</application>

View File

@@ -17,6 +17,7 @@ import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@@ -95,6 +96,13 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
return R.layout.activity_main;
}
@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -141,6 +149,20 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// 处理新的intent
setIntent(intent);
// 检查是否需要跳转到房间
if (shouldRestoreRoom()) {
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS)
.withString("form", "首页")
.withString("roomId", CommonAppContext.getInstance().playId)
.withFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP)
.navigation();
return;
}
// 处理tab切换
checkTab(intent.getIntExtra("tab", -1));
}
@@ -389,6 +411,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS)
.withString("form", "首页")
.withString("roomId", CommonAppContext.getInstance().playId)
.withFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
.navigation();
return;
}

View File

@@ -2,6 +2,7 @@ package com.example.moduleroom.activity;
import static android.app.PendingIntent.getActivity;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static com.liulishuo.okdownload.OkDownloadProvider.context;
@@ -41,6 +42,7 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
@@ -49,6 +51,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -74,10 +77,14 @@ import com.example.moduleroom.dialog.RoomOnlineDialogFragment;
import com.example.moduleroom.dialog.RoomPkDialogFragment;
import com.example.moduleroom.dialog.RoomSettingFragment;
import com.example.moduleroom.dialog.SoundEffectsDialogFragment;
import com.example.moduleroom.fragment.FriendshipRoomFragment;
import com.example.moduleroom.fragment.PublicScreenEaseChatFragment;
import com.example.moduleroom.fragment.RoomAuctionFragment;
import com.example.moduleroom.fragment.RoomCabinFragment;
import com.example.moduleroom.fragment.RoomChartsFragment;
import com.example.moduleroom.fragment.RoomKtvFragment;
import com.example.moduleroom.fragment.RoomNoticeDialogFragment;
import com.example.moduleroom.fragment.SingSongFragment;
import com.petterp.floatingx.assist.helper.FxScopeHelper;
import com.petterp.floatingx.listener.control.IFxControl;
import com.tencent.imsdk.v2.V2TIMValueCallback;
@@ -98,9 +105,11 @@ import com.xscm.moduleutil.bean.room.RoomOnline;
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
import com.xscm.moduleutil.dialog.giftLottery.GiftLotteryDialog;
import com.xscm.moduleutil.dialog.giftLottery.TourClubDialogFragment;
import com.xscm.moduleutil.event.ColoseCardEvent;
import com.xscm.moduleutil.event.EffectEvent;
import com.xscm.moduleutil.event.MusicEvent;
import com.xscm.moduleutil.event.QXRoomSeatViewType;
import com.xscm.moduleutil.event.RoomGiftGiveEvent;
import com.xscm.moduleutil.event.RoomInputHideEvent;
import com.xscm.moduleutil.event.RoomOutEvent;
@@ -378,6 +387,61 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
return false;
}
public void tob() {
LinearLayout stub = mBinding.roomTop.stubButtons2;
stub.setVisibility(VISIBLE);
ImageView imActionJs = mBinding.roomTop.imActionJs.findViewById(R.id.im_action_js);
ImageView imActionYs = mBinding.roomTop.imActionYs.findViewById(R.id.im_action_ys);
if (imActionJs != null && imActionYs != null) {
imActionJs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialogEnd();
}
});
imActionYs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MvpPre.auctionDelay(SpUtil.getauctionId());
}
});
}
}
public void upTop() {
mBinding.roomTop.stubButtons2.setVisibility(GONE);
}
private void dialogEnd() {
// 创建并显示确认对话框
new ConfirmDialog(this,
"提示",
"您确定要结束本次拍卖吗?",
"确认",
"取消",
v -> {
// 点击“确认”按钮时执行删除操作
MvpPre.auctionEnd(SpUtil.getauctionId(), roomId);
},
v -> {
// 点击“取消”按钮时什么都不做
}, false, 0).show();
}
public void upVisibility(boolean visible) {
mBinding.roomTop.imActionJs.setVisibility(visible ? VISIBLE : INVISIBLE);
mBinding.roomTop.imActionYs.setVisibility(visible ? VISIBLE : INVISIBLE);
}
public void upJs(boolean visible) {
mBinding.roomTop.imActionJs.setVisibility(visible ? VISIBLE : INVISIBLE);
}
public void upYs(boolean visible) {
mBinding.roomTop.imActionYs.setVisibility(visible ? VISIBLE : INVISIBLE);
}
/// 最小化
private void showExitRoomDialog() {
ExitRoomBottomSheet bottomSheet = ExitRoomBottomSheet.newInstance();
@@ -496,47 +560,10 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
isSave = false;
sDestroied = false;
// // 进入房间10s后检查是否显示提示上麦对话框
// new Handler(getMainLooper()).postDelayed(
// () -> EventBus.getDefault().post(new ShowOnWheatDialogEvent()),
// 10000);
isSave = false;
sDestroied = false;
isMinimized = false;
// ThreadUtils.executeBySingleAtFixRate(new ThreadUtils.Task<String>() {
//
// @Override
// public String doInBackground() throws Throwable {
// if (mBinding.svgaGift.isPlaying()){
// Thread.sleep(100); // 短暂等待
// return "";
// }
// if(!roomMessageEventQueue.isEmpty()){
// Thread.sleep(100); // 短暂等待
// return roomMessageEventQueue.poll();
// }
// return "";
// }
//
// @Override
// public void onSuccess(String result) {
// LogUtils.e("@@@@" + "onSuccess"+"playQueue.size()===="+roomMessageEventQueue.size());
// if(!TextUtils.isEmpty(result)){
//// mBinding.svgaGift.setSource(result, 2);
// mBinding.svgaGift.downloadAndPlayMp4(result);
// }
// }
//
// @Override
// public void onCancel() {
//
// }
//
// @Override
// public void onFail(Throwable t) {
//
// }
// },2, TimeUnit.SECONDS);
overridePendingTransition(0, 0); // 关闭转场动画
@@ -552,6 +579,12 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
// 在子线程中执行网络请求
performNetworkRequestsAsync();
roomFragment = RoomFragment.newInstance();
// roomFragment.setqxRoomSeatViewType(QXRoomSeatViewType.NONE);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.vp_room_pager, roomFragment)
.commitAllowingStateLoss();
}
@@ -969,7 +1002,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
private BlockingQueue<String> roomMessageEventQueue = new LinkedBlockingQueue<>();
int i = 0;
// @Subscribe(threadMode = ThreadMode.MAIN)
// @Subscribe(threadMode = ThreadMode.MAIN)
public void roomInfoEvent(RoomMessageEvent messageEvent) {
if (messageEvent == null) return;
@@ -978,7 +1011,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
RoomMessageEvent.T text = messageEvent.getText();
if (msgType == 1005) {
LogUtils.e("@@@@" + "EventBusnujm2"+"playQueue.size()===="+ messageEvent.getText().getGiftInfo());
LogUtils.e("@@@@" + "EventBusnujm2" + "playQueue.size()====" + messageEvent.getText().getGiftInfo());
// synchronized (roomMessageLock) {
// roomMessageEventQueue.add(messageEvent.getText().getGiftInfo().getPlay_image());
// }
@@ -1074,66 +1107,82 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
roomFragment.friendshipRoomFragmentEvent(messageEvent);
}
}else if(msgType==1056){
} else if (msgType == 1056) {
GiftLotteryDialog dialog = (GiftLotteryDialog) getSupportFragmentManager()
.findFragmentByTag("GiftLotteryDialog");
if (dialog != null && dialog.isVisible()) {
dialog.UpView( messageEvent.getText().getXlh_data());
dialog.UpView(messageEvent.getText().getXlh_data());
}
} else if (msgType == 1057) {
FragmentManager fragmentManager = getSupportFragmentManager();
TourClubDialogFragment existingFragment = (TourClubDialogFragment) getSupportFragmentManager().findFragmentByTag("TourClubDialogFragment");
if (existingFragment != null && existingFragment.isVisible()){
existingFragment.onMusicPlay(messageEvent);
}
}
}
private Map<String, RoomPitBean> pitMap = new HashMap<>();
public void handleMsgType1039(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
if (text == null || mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) {
return;
}
pitMap.clear();
if (mRoomInfoResp.getRoom_info().getPit_list() != null && !mRoomInfoResp.getRoom_info().getPit_list().isEmpty()) {
for (RoomPitBean roomPitBean : mRoomInfoResp.getRoom_info().getPit_list()) {
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
if (pitList != null && !pitList.isEmpty()) {
pitMap.clear(); // 避免数据累积
for (RoomPitBean roomPitBean : pitList) {
pitMap.put(roomPitBean.getPit_number(), roomPitBean);
}
if (text == null) {
return;
}
String fromPitNumber = text.getFrom_pit_number();
String toPitNumber = text.getTo_pit_number();
if (!TextUtils.isEmpty(fromPitNumber) && !TextUtils.isEmpty(toPitNumber)) {
performSwitchMic(fromPitNumber, toPitNumber);
performSwitchMic(fromPitNumber, toPitNumber, messageEvent);
}
// 执行换麦逻辑
}
}
private void performSwitchMic(String fromPitNumber, String toPitNumber) {
private void performSwitchMic(String fromPitNumber, String toPitNumber, RoomMessageEvent messageEvent) {
if (TextUtils.isEmpty(fromPitNumber) || TextUtils.isEmpty(toPitNumber)) {
return;
}
// 获取房间信息中的 pit_list
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) {
LogUtils.e("Room info is null");
return;
}
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
if (pitList == null || pitList.isEmpty()) {
LogUtils.e("pit_list is null or empty");
return;
}
// 查找两个麦位对应的 RoomPitBean
RoomPitBean fromBean = null;
RoomPitBean toBean = null;
List<RoomPitBean> pitListCopy = new ArrayList<>();
for (RoomPitBean bean : pitList) {
if (bean.getPit_number().equals(fromPitNumber)) {
if (bean == null) continue;
if (fromPitNumber.equals(bean.getPit_number())) {
fromBean = bean;
pitListCopy.add(bean);
} else if (bean.getPit_number().equals(toPitNumber)) {
} else if (toPitNumber.equals(bean.getPit_number())) {
toBean = bean;
pitListCopy.add(bean);
}
}
pitList.removeAll(pitListCopy);
// 如果没有找到任一麦位,则不执行操作
if (fromBean == null || toBean == null) {
LogUtils.e("Cannot find pit number: from=" + fromPitNumber + ", to=" + toPitNumber);
return;
@@ -1143,32 +1192,72 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
String temp = fromBean.getPit_number();
fromBean.setPit_number(toBean.getPit_number());
toBean.setPit_number(temp);
pitList.add(fromBean);
pitList.add(toBean);// 在调用 setPit_list 之前,先对 pitList 按照 pit_number 升序排序
pitList.sort((a, b) -> {
// 构造新的 pitList
List<RoomPitBean> newPitList = new ArrayList<>();
for (RoomPitBean bean : pitList) {
if (!pitListCopy.contains(bean)) {
newPitList.add(bean);
}
}
newPitList.add(fromBean);
newPitList.add(toBean);
// 排序
newPitList.sort((a, b) -> {
try {
return Integer.compare(Integer.parseInt(a.getPit_number()), Integer.parseInt(b.getPit_number()));
} catch (NumberFormatException e) {
return a.getPit_number().compareTo(b.getPit_number()); // 字符串比较作为备选
return a.getPit_number().compareTo(b.getPit_number());
}
});
mRoomInfoResp.getRoom_info().setPit_list(pitList);
mRoomInfoResp.getRoom_info().setPit_list(newPitList);
// 更新当前用户 pit_number(如果当前用户参与了换麦)
// 更新当前用户 pit_number
if (mRoomInfoResp.getUser_info() != null) {
String currentUserId = String.valueOf(SpUtil.getUserId());
if (fromBean.getUser_id().equals(currentUserId)) {
// 当前用户原来在 fromBean 位置,现在换到了 toBean 位置
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(toBean.getPit_number()));
} else if (toBean.getUser_id().equals(currentUserId)) {
// 当前用户原来在 toBean 位置,现在换到了 fromBean 位置
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(fromBean.getPit_number()));
String fromUserId = fromBean.getUser_id();
String toUserId = toBean.getUser_id();
if (fromUserId != null && fromUserId.equals(currentUserId)) {
try {
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(toBean.getPit_number()));
} catch (NumberFormatException e) {
LogUtils.e("Invalid pit number: " + toBean.getPit_number());
}
} else if (toUserId != null && toUserId.equals(currentUserId)) {
try {
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(fromBean.getPit_number()));
} catch (NumberFormatException e) {
LogUtils.e("Invalid pit number: " + fromBean.getPit_number());
}
}
}
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
dispatchRoomEvent(messageEvent);
}
private void dispatchRoomEvent(RoomMessageEvent messageEvent) {
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
String typeId = mRoomInfoResp.getRoom_info().getType_id();
if ("2".equals(typeId)) {
roomFragment.upRoomInfoData(mRoomInfoResp);
roomFragment.handleAuctionMessageEvent(messageEvent);
} else if ("3".equals(typeId) || "4".equals(typeId) || "1".equals(typeId)) {
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
if ("2".equals(labelId)) {
roomFragment.KtvFragmentEvent(messageEvent);
} else if ("1".equals(labelId)) {
roomFragment.SingSongEvent(messageEvent);
}
} else if ("7".equals(typeId)) {
roomFragment.friendshipRoomFragmentEvent(messageEvent);
}
}
private static volatile MP4PlaybackCallback sInstance;
public static class MP4PlaybackCallback implements IAnimListener {
@@ -1367,6 +1456,12 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
switchMic(2);
}
if (pitNumber.equals("9")) {
ivSoundEffects(true);
} else {
ivSoundEffects(false);
}
String typeId = mRoomInfoResp.getRoom_info().getType_id();
if ("2".equals(typeId)) {
if ("9".equals(pitNumber)) {
@@ -1375,7 +1470,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
mRoomInfoResp.getUser_info().setPit_number(Integer.parseInt(pitNumber));
}
}
roomFragment.upRoomInfo(mRoomInfoResp);
roomFragment.upRoomInfoData(mRoomInfoResp);
roomFragment.handleAuctionMessageEvent(messageEvent);
} else if ("3".equals(typeId) || "4".equals(typeId) || "1".equals(typeId)) {
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
@@ -1383,31 +1478,13 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
roomFragment.KtvFragmentEvent(messageEvent);
} else if ("1".equals(labelId)) {
roomFragment.SingSongEvent(messageEvent);
if (mRoomInfoResp.getUser_info().getPit_number() == 9) {
ivSoundEffects(true);
} else {
ivSoundEffects(false);
}
}
} else if ("7".equals(typeId)) {
mBinding.rlMore.setVisibility(GONE);
mBinding.rlMisc.setVisibility(GONE);
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
if (pitList != null && !pitList.isEmpty()) {
try {
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
pitBean.setUser_id(userId + "");
pitBean.setAvatar(fromUserInfo.getAvatar());
pitBean.setNickname(fromUserInfo.getNickname());
pitBean.setSex(fromUserInfo.getSex() + "");
pitBean.setCharm(fromUserInfo.getCharm());
pitBean.setDress(fromUserInfo.getDress());
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
} catch (NumberFormatException e) {
// Handle exception
}
}
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
roomFragment.friendshipRoomFragmentEvent(messageEvent);
} else {
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
}
@@ -1434,6 +1511,10 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
switchMic(2);
}
if (pitNumber.equals("9")) {
ivSoundEffects(false);
}
if (userId == currentUserId && "9".equals(pitNumber)) {
if (customMusicFloatingView != null) {
customMusicFloatingView.destroy();
@@ -1459,7 +1540,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
switchMic(2);
}
}
roomFragment.upRoomInfo(mRoomInfoResp);
roomFragment.upRoomInfoData(mRoomInfoResp);
roomFragment.handleAuctionMessageEvent(messageEvent);
} else if ("3".equals(typeId) || "4".equals(typeId) || "1".equals(typeId)) {
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
@@ -1472,22 +1553,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
}
}
} else {
List<RoomPitBean> pitList = mRoomInfoResp.getRoom_info().getPit_list();
if (pitList != null && !pitList.isEmpty()) {
try {
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
pitBean.setUser_id("");
pitBean.setAvatar("");
pitBean.setNickname("");
pitBean.setSex("");
pitBean.setCharm("");
pitBean.setDress("");
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
} catch (NumberFormatException e) {
// Handle exception
}
}
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
roomFragment.friendshipRoomFragmentEvent(messageEvent);
}
}
@@ -1522,7 +1589,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
}
}
roomFragment.upRoomInfo(mRoomInfoResp);
roomFragment.upRoomInfoData(mRoomInfoResp);
roomFragment.handleAuctionMessageEvent(messageEvent);
}
@@ -1532,7 +1599,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
mRoomInfoResp.getRoom_auction().setAuction_user(text.getAuction_user());
SpUtil.setAuctionId(text.getAuction_user().getAuction_id());
roomFragment.upRoomInfo(mRoomInfoResp);
roomFragment.upRoomInfoData(mRoomInfoResp);
roomFragment.handleAuctionMessageEvent(messageEvent);
// roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
}
@@ -1547,9 +1614,9 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
mRoomInfoResp.getRoom_auction().getAuction_list().addAll(text.getAuction_list());
} else {
mRoomInfoResp.getRoom_auction().setAuction_list(new ArrayList<>());
mRoomInfoResp.getRoom_auction().getAuction_list().addAll(text.getAuction_list());
// mRoomInfoResp.getRoom_auction().getAuction_list().addAll(text.getAuction_list());
}
roomFragment.upRoomInfo(mRoomInfoResp);
roomFragment.upRoomInfoData(mRoomInfoResp);
roomFragment.handleAuctionMessageEvent(messageEvent);
// roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
}
@@ -1600,7 +1667,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
roomFragment.KtvFragmentEvent(messageEvent);
} else {
updateCharmForAllPitBeans("");
roomFragment.upRoomInfo(mRoomInfoResp);
roomFragment.upRoomInfoData(mRoomInfoResp);
roomFragment.SingSongEvent(messageEvent);
}
} else {
@@ -1658,9 +1725,14 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
private void handleMsgType1051(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
if (text == null) return;
if (text.getUser1_id() == null || text.getUser2_id() == null) {
return;
}
FriendUserBean friend_user = getFriendUserBean(messageEvent);
FriendsDialogFragment.show(friend_user, getSupportFragmentManager());
if (text.getUser1_id().equals(SpUtil.getUserId() + "") || text.getUser2_id().equals(SpUtil.getUserId() + "")) {
if (roomSwitchRunnable != null) {
roomSwitchHandler.removeCallbacks(roomSwitchRunnable);
@@ -1738,12 +1810,12 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
roomFragment.KtvFragmentEvent(messageEvent);
} else {
// updatePitBeanForUser(fromUserInfo);
roomFragment.upRoomInfo(updatePitBeanForUser(fromUserInfo));
roomFragment.upRoomInfoData(updatePitBeanForUser(fromUserInfo));
roomFragment.SingSongEvent(messageEvent);
}
} else {
updatePitBeanForUser(fromUserInfo);
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
roomFragment.upRoomInfoData(updatePitBeanForUser(fromUserInfo));
roomFragment.friendshipRoomFragmentEvent(messageEvent);
}
@@ -1787,7 +1859,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
private void handleMsgType1007() {
if (mRoomInfoResp != null && mRoomInfoResp.getUser_info() != null) {
mRoomInfoResp.getUser_info().setIs_host(1);
roomFragment.upRoomInfo(mRoomInfoResp);
roomFragment.upRoomInfoData(mRoomInfoResp);
// roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
}
}
@@ -1795,7 +1867,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
private void handleMsgType1018() {
if (mRoomInfoResp != null && mRoomInfoResp.getUser_info() != null) {
mRoomInfoResp.getUser_info().setIs_host(0);
roomFragment.upRoomInfo(mRoomInfoResp);
roomFragment.upRoomInfoData(mRoomInfoResp);
// roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
}
}
@@ -2313,7 +2385,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
/// 进入小黑屋将所有的底部隐藏
public void setviewyc(boolean voive) {
mBinding.rlMore.setVisibility(voive ? VISIBLE : View.GONE);
mBinding.rlMore.setVisibility(voive ? GONE : View.GONE);
mBinding.rlMisc.setVisibility(voive ? VISIBLE : View.GONE);
mBinding.rlMic.setVisibility(voive ? VISIBLE : View.GONE);
mBinding.rlSett.setVisibility(voive ? VISIBLE : View.GONE);
@@ -2350,7 +2422,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
}
public void rlMore(boolean voive) {
mBinding.rlMore.setVisibility(voive ? VISIBLE : View.GONE);
mBinding.rlMore.setVisibility(voive ? GONE : View.GONE);
}
public void ivMic(int inIvMic) {
@@ -2392,7 +2464,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
case 3: // 麦上用户
rl_voice.setVisibility(View.VISIBLE);
rl_mic.setVisibility(pit_number != 0 ? View.VISIBLE : View.GONE);
rl_more.setVisibility(pit_number == 9 ? View.VISIBLE : View.GONE);
rl_more.setVisibility(pit_number == 9 ? GONE : View.GONE);
rl_misc.setVisibility(View.VISIBLE);
break;
case 0: // 观众
@@ -2416,7 +2488,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
} else if (roleType != 5) {
rl_misc.setVisibility(View.VISIBLE);
if (userPitNumber == 9) {
rl_more.setVisibility(View.VISIBLE);
rl_more.setVisibility(GONE);
}
}
@@ -2611,7 +2683,6 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
this.mPitList = mRoomBean.getPit_list();
this.roomId = roomBean.getRoom_id();
upHeight();
ImageUtils.loadHeadCC(resp.getRoom_info().getRoom_cover(), mBinding.roomTop.avatar);
mBinding.roomTop.name.setText(roomBean.getRoom_name());
mBinding.roomTop.idVal.setText("ID:" + roomBean.getRoom_number());
@@ -2640,15 +2711,21 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
initPublicScreenFragment();
if (!isFinishing() && !isDestroyed()) {
if (roomFragment == null || !roomFragment.isAdded()) {
roomFragment = RoomFragment.newInstance(resp, "");
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.vp_room_pager, roomFragment)
.commitAllowingStateLoss();
} else {
roomFragment.refreshData(resp);
}
// if (roomFragment == null || !roomFragment.isAdded()) {
// roomFragment = RoomFragment.newInstance(resp, "");
// getSupportFragmentManager()
// .beginTransaction()
// .replace(R.id.vp_room_pager, roomFragment)
// .commitAllowingStateLoss();
//
//
// } else {
resetFragment();
// roomFragment.refreshData(resp);
upHeight();
// }
} else {
Log.e("Fragment", "Fragment transaction skipped due to state loss.");
}
@@ -2966,39 +3043,16 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
CommonAppContext.getInstance().isShow = true;
CommonAppContext.getInstance().isPlaying = true;
// 检查是否是从最小化状态恢复
// if (wasMinimized()) {
// // 从最小化状态恢复,保持当前房间
// clearMinimizeState();
// isMinimized = false;
//
// // 恢复房间状态
// resumeRoomState();
// } else {
// 正常启动或从后台恢复
if (isInBackground) {
isInBackground = false;
// 从后台回到前台时调用
if (MvpPre != null && roomId != null) {
MvpPre.postRoomInfo(roomId);
// MvpPre.postRoomInfo(roomId);
}
}
// }
// 延迟调整布局,确保视图已经完全加载
mBinding.mainContentContainer.post(this::adjustLayoutHeights);
// // 延迟调整布局,确保视图已经完全加载
// mBinding.mainContentContainer.post(this::adjustLayoutHeights);
//// MvpPre.postRoomInfo(roomId);
// // 检查是否从后台返回
// if (isInBackground) {
// isInBackground = false;
// // 从后台回到前台时调用
// if (MvpPre != null && roomId != null) {
// MvpPre.postRoomInfo(roomId);
// }
// }
}
private void resumeRoomState() {
@@ -3176,20 +3230,22 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
mBinding.roomTop.btnFollow.setText("");
}
}
upHeight();
if (!isFinishing() && !isDestroyed()) {
if (roomFragment == null || !roomFragment.isAdded()) {
roomFragment = RoomFragment.newInstance(resp, "");
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.vp_room_pager, roomFragment)
.commitAllowingStateLoss();
} else {
roomFragment.refreshData(resp);
}
// if (roomFragment == null || !roomFragment.isAdded()) {
// roomFragment = RoomFragment.newInstance(resp, "");
// getSupportFragmentManager()
// .beginTransaction()
// .replace(R.id.vp_room_pager, roomFragment)
// .commitAllowingStateLoss();
// } else {
resetFragment();
// roomFragment.refreshData(resp);
upHeight();
// }
} else {
Log.e("Fragment", "Fragment transaction skipped due to state loss.");
}
@@ -3215,7 +3271,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
mBinding.rlMore.setVisibility(GONE);
mBinding.rlMisc.setVisibility(GONE);
} else if (mRoomInfoResp.getRoom_info().getLabel_id().equals("1") || mRoomInfoResp.getRoom_info().getType_id().equals("3") || mRoomInfoResp.getRoom_info().getType_id().equals("4")) {
mBinding.rlMore.setVisibility(VISIBLE);
mBinding.rlMore.setVisibility(GONE);
mBinding.rlMisc.setVisibility(VISIBLE);
}
}
@@ -3235,13 +3291,50 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
if (mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
maxHeightDp = 453;
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
maxHeightDp = 413;
maxHeightDp = 373;
}
adjustLayoutHeights();
}
private void resetFragment() {
String typeId = mRoomInfoResp.getRoom_info().getType_id();
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
if ("7".equals(typeId)) {
if (mRoomInfoResp.getRoom_info().getRoom_background() == null || mRoomInfoResp.getRoom_info().getRoom_background().equals("")) {
changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj);
} else {
changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
}
setvisibTop(true);
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.FRIEND);
} else if ("2".equals(typeId)) {
changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
setvisibTop(true);
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.AUCTION);
} else if ("1".equals(typeId) || "3".equals(typeId) || "4".equals(typeId)) {
if ("2".equals(labelId)) {
changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
setvisibTop(true);
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.KTV);
} else if ("1".equals(labelId)) {
changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
setvisibTop(true);
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.NORMAL);
}
} else if ("6".equals(typeId)) {
changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
setvisibTop(false);
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.CABIN);
}
}
@Override
public void getCharmRank(List<RoomCharmRankBean> list) {

View File

@@ -468,27 +468,6 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
}
// 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()) {
@@ -508,8 +487,8 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
private void maintainDataLimits() {
// 确保所有存储列表都不超过最大限制
trimListToMaxSize(allMsgList);
// trimListToMaxSize(userMsgList);
// trimListToMaxSize(systemMsgList);
trimListToMaxSize(userMsgList);
trimListToMaxSize(systemMsgList);
}
private void trimListToMaxSize(List<EMMessageInfo> list) {

View File

@@ -82,5 +82,9 @@ public class RoomContacts {
void clearUserCharm(String roomId, String userId);//清除魅力值
void userOnlineStatus(String userId, String roomid);
void auctionEnd(String auctionId,String roomId);
void auctionDelay(String auctionId);
}
}

View File

@@ -242,6 +242,17 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
pitList.clear();
pitList.addAll(uniquePitSet);
}
if (roomInfoResp.getRoom_auction().getAuction_user()!=null ){
if (roomInfoResp.getRoom_auction().getAuction_user().getUser_id()!=null && !roomInfoResp.getRoom_auction().getAuction_user().getUser_id().equals(SpUtil.getUserId()+"")) {
RewardUserBean rewardUserBean = new RewardUserBean();
rewardUserBean.setUser_id(roomInfoResp.getRoom_auction().getAuction_user().getUser_id());
rewardUserBean.setNickname(roomInfoResp.getRoom_auction().getAuction_user().getNickname());
rewardUserBean.setAvatar(roomInfoResp.getRoom_auction().getAuction_user().getAvatar());
rewardUserBean.setPit_number("888");
result.add(rewardUserBean);
}
}
}
// 优先添加指定麦位
@@ -280,9 +291,28 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
}
}
List<RewardUserBean> uniquePitSet = removeDuplicateByUserId(result);
result.clear();
result.addAll(uniquePitSet);
return result;
}
// TODO: 2025/9/15 去重
private List<RewardUserBean> removeDuplicateByUserId(List<RewardUserBean> list) {
Set<String> userIdSet = new HashSet<>();
List<RewardUserBean> uniqueList = new ArrayList<>();
for (RewardUserBean bean : list) {
if (bean != null && bean.getUser_id() != null && !userIdSet.contains(bean.getUser_id())) {
userIdSet.add(bean.getUser_id());
uniqueList.add(bean);
}
}
return uniqueList;
}
@Override
protected void initView() {
// mBinding.rvGiftUser.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));

View File

@@ -233,6 +233,10 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
this.roomInfoResp = roomInfoResp;
}
public void upRoomId(RoomInfoResp roomInfoResp) {
}
/**
* 麦位视图点击事件处理
*
@@ -387,6 +391,108 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
}
}
public void event1003(RoomMessageEvent messageEvent){
UserInfo fromUserInfo = messageEvent.getText().getFromUserInfo();
if (fromUserInfo == null) return;
String pitNumber = messageEvent.getText().getPit_number();
int userId = fromUserInfo.getUser_id();
List<RoomPitBean> pitList = roomInfoResp.getRoom_info().getPit_list();
if (pitList != null && !pitList.isEmpty()) {
try {
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
pitBean.setUser_id(userId + "");
pitBean.setAvatar(fromUserInfo.getAvatar());
pitBean.setNickname(fromUserInfo.getNickname());
pitBean.setSex(fromUserInfo.getSex() + "");
pitBean.setCharm(fromUserInfo.getCharm());
pitBean.setDress(fromUserInfo.getDress());
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
if (userId==SpUtil.getUserId() && pitNumber.equals("9")){
myPitNumber=9;
configGameOptionBtn();
}
for (int i = 0; i < mWheatViews.size(); i++){
if (i==Integer.parseInt(pitNumber) - 1){
mWheatViews.get(i).setData(pitBean);
break;
}
}
} catch (NumberFormatException e) {
// Handle exception
}
}
}
public void event1004(RoomMessageEvent messageEvent){
String pitNumber = messageEvent.getText().getPit_number();
List<RoomPitBean> pitList = roomInfoResp.getRoom_info().getPit_list();
if (pitList != null && !pitList.isEmpty()) {
try {
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
pitBean.setUser_id("");
pitBean.setAvatar("");
pitBean.setNickname("");
pitBean.setSex("");
pitBean.setCharm("");
pitBean.setDress("");
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
if (pitNumber.equals("9")){
myPitNumber=0;
configGameOptionBtn();
}
for (int i = 0; i < mWheatViews.size(); i++){
if (i==Integer.parseInt(pitNumber) - 1){
mWheatViews.get(i).setData(pitBean);
break;
}
}
} catch (NumberFormatException e) {
// Handle exception
}
}
}
public void event1035(RoomMessageEvent message) {
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
RoomPitBean roomPitBean = roomInfoResp.getRoom_info().getPit_list().get(i);
if (roomPitBean.getPit_number().equals("7") || roomPitBean.getPit_number().equals("8")) {
continue;
}
if (Integer.parseInt(!roomPitBean.getPit_number().isEmpty() ? roomPitBean.getPit_number() : "0") > 10) {
continue;
}
RoomFriendshipWheatView object = mWheatViews.get(Integer.parseInt(roomPitBean.getPit_number()) - 1);
if (object != null) {
object.setData(roomPitBean);
} else {
continue;
}
}
}
public void event1039(RoomMessageEvent messageEvent){
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
RoomPitBean roomPitBean = roomInfoResp.getRoom_info().getPit_list().get(i);
if (roomPitBean.getPit_number().equals("7") || roomPitBean.getPit_number().equals("8")) {
continue;
}
if (Integer.parseInt(!roomPitBean.getPit_number().isEmpty() ? roomPitBean.getPit_number() : "0") > 10) {
continue;
}
RoomFriendshipWheatView object = mWheatViews.get(Integer.parseInt(roomPitBean.getPit_number()) - 1);
if (object != null) {
object.setData(roomPitBean);
} else {
continue;
}
}
}
// TODO: 2025/9/12 更新火热值
public void event1005(RoomMessageEvent messageEvent){
RoomPitBean pitBean = mBinding.wheatView9.pitBean;
@@ -764,8 +870,10 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
} else {
myPitNumber = -1;
}
// 更新麦位显示
for (RoomPitBean pitBean : pitArr) {
RoomFriendshipWheatView friendshipWheatView = mWheatViews.get(Integer.parseInt(pitBean.getPit_number()) - 1);
RoomPitBean roomPitBean = friendshipWheatView.pitBean;
roomPitBean.setCharm(pitBean.getCharm());
@@ -822,12 +930,16 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
private void configHeart() {
if (currentPartType.value == 1) {
//隐藏中间心动值 、心动背景 、隐藏连线 连线停止动画
mBinding.iv22.setVisibility(GONE);
mBinding.iv11.setVisibility(GONE);
mBinding.iv33.setVisibility(GONE);
mBinding.iv22.stopAnimation();
mBinding.iv11.stopAnimation();
mBinding.iv33.stopAnimation();
mBinding.imX2.setVisibility(GONE);
mBinding.imX1.setVisibility(GONE);
mBinding.imX3.setVisibility(GONE);
// mBinding.iv22.setVisibility(GONE);
// mBinding.iv11.setVisibility(GONE);
// mBinding.iv33.setVisibility(GONE);
// mBinding.iv22.stopAnimation();
// mBinding.iv11.stopAnimation();
// mBinding.iv33.stopAnimation();
topIsAnimate = false;
centerIsAnimate = false;
bottomIsAnimate = false;
@@ -854,97 +966,106 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
}
if (heartList1 != null && heartList1.getHeartNum() > 0) {
Logger.d("显示 iv_22 动画 - 心动值: " + heartList1.getHeartNum());
mBinding.iv22.setVisibility(View.VISIBLE);
// mBinding.iv22.setVisibility(View.VISIBLE);
mBinding.imX2.setVisibility(View.VISIBLE);
mBinding.tv2.setVisibility(View.VISIBLE);
mBinding.tv2.setText(heartList1.getHeartNum() + "");
// 添加回调确认动画是否加载成功
mBinding.iv22.setCallback(new SVGACallback() {
@Override
public void onRepeat() {
Logger.d("SVGA onRepeat");
}
@Override
public void onStep(int i, double v) {
// 每一步的回调
}
@Override
public void onPause() {
Logger.d("SVGA onPause");
}
@Override
public void onFinished() {
Logger.d("SVGA onFinished");
// 如果需要循环播放,可以在这里重新开始
if (mBinding.iv22.getVisibility() == View.VISIBLE) {
mBinding.iv22.startAnimation();
}
}
});
if (!centerIsAnimate) {
// 强制刷新视图
mBinding.iv22.requestLayout();
mBinding.iv22.invalidate();
ImageUtils.loadDecorationAvatar2(0, mBinding.iv22);
mBinding.iv22.startAnimation();
centerIsAnimate = true;
}
// mBinding.iv22.setCallback(new SVGACallback() {
// @Override
// public void onRepeat() {
// Logger.d("SVGA onRepeat");
// }
//
// @Override
// public void onStep(int i, double v) {
// // 每一步的回调
// }
//
// @Override
// public void onPause() {
// Logger.d("SVGA onPause");
// }
//
// @Override
// public void onFinished() {
// Logger.d("SVGA onFinished");
// // 如果需要循环播放,可以在这里重新开始
// if (mBinding.iv22.getVisibility() == View.VISIBLE) {
// mBinding.iv22.startAnimation();
// }
// }
// });
// if (!centerIsAnimate) {
// // 强制刷新视图
// mBinding.iv22.requestLayout();
// mBinding.iv22.invalidate();
//
// ImageUtils.loadDecorationAvatar2(0, mBinding.iv22);
// mBinding.iv22.startAnimation();
// centerIsAnimate = true;
// }
} else {
mBinding.iv22.setVisibility(View.GONE);
mBinding.imX2.setVisibility(View.GONE);
// mBinding.iv22.setVisibility(View.GONE);
mBinding.tv2.setVisibility(View.GONE);
mBinding.iv22.stopAnimation();
// mBinding.iv22.stopAnimation();
centerIsAnimate = false;
}
if (heartList2 != null && heartList2.getHeartNum() > 0) {
mBinding.iv11.setVisibility(View.VISIBLE);
mBinding.imX1.setVisibility(View.VISIBLE);
// mBinding.iv11.setVisibility(View.VISIBLE);
mBinding.tv1.setVisibility(View.VISIBLE);
mBinding.tv1.setText(heartList2.getHeartNum() + "");
if (!topIsAnimate) {
// 强制刷新视图
mBinding.iv11.requestLayout();
mBinding.iv11.invalidate();
mBinding.iv11.startAnimation();
topIsAnimate = true;
ImageUtils.loadDecorationAvatar2(0, mBinding.iv11);
}
// if (!topIsAnimate) {
// // 强制刷新视图
// mBinding.iv11.requestLayout();
// mBinding.iv11.invalidate();
//
// mBinding.iv11.startAnimation();
// topIsAnimate = true;
// ImageUtils.loadDecorationAvatar2(0, mBinding.iv11);
// }
} else {
mBinding.iv11.setVisibility(View.GONE);
mBinding.imX1.setVisibility(View.GONE);
// mBinding.iv11.setVisibility(View.GONE);
mBinding.tv1.setVisibility(View.GONE);
mBinding.iv11.stopAnimation();
// mBinding.iv11.stopAnimation();
topIsAnimate = false;
}
if (heartList3 != null && heartList3.getHeartNum() > 0) {
mBinding.iv33.setVisibility(View.VISIBLE);
mBinding.imX3.setVisibility(View.VISIBLE);
// mBinding.iv33.setVisibility(View.VISIBLE);
mBinding.tv3.setVisibility(View.VISIBLE);
mBinding.tv3.setText(heartList3.getHeartNum() + "");
if (!bottomIsAnimate) {
// 强制刷新视图
mBinding.iv33.requestLayout();
mBinding.iv33.invalidate();
mBinding.iv33.startAnimation();
bottomIsAnimate = true;
ImageUtils.loadDecorationAvatar2(0, mBinding.iv33);
}
// if (!bottomIsAnimate) {
// // 强制刷新视图
// mBinding.iv33.requestLayout();
// mBinding.iv33.invalidate();
//
// mBinding.iv33.startAnimation();
// bottomIsAnimate = true;
// ImageUtils.loadDecorationAvatar2(0, mBinding.iv33);
// }
} else {
mBinding.iv33.setVisibility(View.GONE);
mBinding.imX3.setVisibility(View.GONE);
// mBinding.iv33.setVisibility(View.GONE);
mBinding.tv3.setVisibility(View.GONE);
mBinding.iv33.stopAnimation();
// mBinding.iv33.stopAnimation();
bottomIsAnimate = false;
}
} else {
mBinding.iv22.setVisibility(GONE);
mBinding.iv11.setVisibility(GONE);
mBinding.iv33.setVisibility(GONE);
mBinding.iv22.stopAnimation();
mBinding.iv11.stopAnimation();
mBinding.iv33.stopAnimation();
mBinding.imX2.setVisibility(GONE);
mBinding.imX1.setVisibility(GONE);
mBinding.imX3.setVisibility(GONE);
// mBinding.iv22.setVisibility(GONE);
// mBinding.iv11.setVisibility(GONE);
// mBinding.iv33.setVisibility(GONE);
// mBinding.iv22.stopAnimation();
// mBinding.iv11.stopAnimation();
// mBinding.iv33.stopAnimation();
topIsAnimate = false;
centerIsAnimate = false;
bottomIsAnimate = false;
@@ -1235,9 +1356,9 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
*/
public void releaseResources() {
// 停止并释放所有SVGA动画资源
stopAndReleaseSVGA(mBinding.iv22);
stopAndReleaseSVGA(mBinding.iv11);
stopAndReleaseSVGA(mBinding.iv33);
// stopAndReleaseSVGA(mBinding.iv22);
// stopAndReleaseSVGA(mBinding.iv11);
// stopAndReleaseSVGA(mBinding.iv33);
// 重置动画状态标志
topIsAnimate = false;

View File

@@ -15,6 +15,7 @@ import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -79,8 +80,8 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
private String auctionId = "";
private RoomAuction.AuctionUserBean auctionUserBean;
private List<RoomAuction.AuctionListBean> auctionList;
private ImageView imActionJs, imActionYs;
private ViewStub stub;
// private ImageView imActionJs, imActionYs;
// private LinearLayout stub;
private boolean isButtonsInflated = false;
private int type;
RoomFragment parentFragment;
@@ -116,6 +117,14 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
this.roomInfoResp = roomInfoResp;
}
@Override
public void onStart() {
super.onStart();
// 确保 overlay buttons 已初始化
initOverlayButtons();
}
/// 更新数据
public void roomInfoUpdate(RoomInfoResp resp) {
roomInfoResp = resp;
@@ -135,8 +144,12 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
roomPitBean.setIs_pm(1);
wheatView.setData(roomPitBean);
if (imActionJs != null)
imActionJs.setVisibility(VISIBLE);
// if (imActionJs != null)
// imActionJs.setVisibility(VISIBLE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upYs(true);
}
} else {
RoomPitBean pitBean = new RoomPitBean();
pitBean.setUser_id("");
@@ -165,29 +178,6 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
wheatView2.setData(roomPitBean1);
mBinding.tvPB.setText(auctionUserBean.getCharm());
countDownTime(auctionUserBean.getDuration());
if (auctionUserBean.getUser_id() != null && auctionUserBean.getUser_id().equals(SpUtil.getUserId() + "")) {
mBinding.ivJp.setVisibility(INVISIBLE);
} else {
if (wheatView.pitBean != null) {
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
if (imActionJs != null && imActionYs != null) {
imActionJs.setVisibility(VISIBLE);
imActionYs.setVisibility(VISIBLE);
}
} else {
if (imActionJs != null && imActionYs != null) {
imActionJs.setVisibility(INVISIBLE);
imActionYs.setVisibility(INVISIBLE);
}
}
} else {
if (imActionJs != null && imActionYs != null) {
imActionJs.setVisibility(INVISIBLE);
imActionYs.setVisibility(INVISIBLE);
}
}
mBinding.ivJp.setVisibility(VISIBLE);
}
if (auctionUserBean.getAuction_id() != null) {
mBinding.ivJp.setVisibility(VISIBLE);
@@ -199,6 +189,41 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
mBinding.ivJp.setVisibility(INVISIBLE);
}
if (auctionUserBean.getUser_id() != null && auctionUserBean.getUser_id().equals(SpUtil.getUserId() + "")) {
mBinding.ivJp.setVisibility(INVISIBLE);
} else {
if (wheatView.pitBean != null) {
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
// if (imActionJs != null && imActionYs != null) {
// imActionJs.setVisibility(VISIBLE);
// imActionYs.setVisibility(VISIBLE);
// }
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upVisibility(true);
}
} else {
// if (imActionJs != null && imActionYs != null) {
// imActionJs.setVisibility(INVISIBLE);
// imActionYs.setVisibility(INVISIBLE);
// }
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upVisibility(false);
}
}
} else {
// if (imActionJs != null && imActionYs != null) {
// imActionJs.setVisibility(INVISIBLE);
// imActionYs.setVisibility(INVISIBLE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upVisibility(false);
}
// }
}
mBinding.ivJp.setVisibility(VISIBLE);
}
}
if (roomAuction.getAuction_list() != null && roomAuction.getAuction_list().size() > 0) {
auctionList = roomAuction.getAuction_list();
@@ -223,14 +248,25 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
RoomPitBean roomPitBean2 = wheatView.pitBean;
if (roomPitBean2 != null && roomPitBean2.getUser_id() != null && !roomPitBean2.getUser_id().equals("0")) {
if (roomPitBean2.getUser_id().equals(SpUtil.getUserId() + "")) {
if (imActionJs != null && imActionYs != null) {
imActionJs.setVisibility(VISIBLE);
imActionYs.setVisibility(VISIBLE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upVisibility(true);
}
// if (imActionJs != null && imActionYs != null) {
//
//
//
// imActionJs.setVisibility(VISIBLE);
// imActionYs.setVisibility(VISIBLE);
// }
} else {
if (imActionJs != null && imActionYs != null) {
imActionJs.setVisibility(INVISIBLE);
imActionYs.setVisibility(INVISIBLE);
// if (imActionJs != null && imActionYs != null) {
// imActionJs.setVisibility(INVISIBLE);
// imActionYs.setVisibility(INVISIBLE);
// }
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upVisibility(false);
}
}
}
@@ -246,24 +282,28 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
public void initOverlayButtons() {
// if (isButtonsInflated) return;
// stub= getActivity().findViewById(R.id.stub_buttons2);
// if (stub != null) {
//// View inflated = stub.getRootView();
// stub.setVisibility(VISIBLE);
// imActionJs = stub.findViewById(R.id.im_action_ys);
// imActionYs = stub.findViewById(R.id.im_action_js);
//
// if (imActionJs != null && imActionYs != null) {
// // 设置点击事件
// imActionJs.setOnClickListener(this::onChock);
// imActionYs.setOnClickListener(this::onChock);
//
//// isButtonsInflated = true;
// } else {
// // 报错提示:说明 top_overlay_buttons.xml 中没有定义这些 id
// throw new IllegalStateException("im_action_js or im_action_ys not found in overlay layout");
// }
// }
stub = requireActivity().findViewById(R.id.stub_buttons2);
if (stub != null) {
View inflated = stub.inflate();
imActionJs = inflated.findViewById(R.id.im_action_ys);
imActionYs = inflated.findViewById(R.id.im_action_js);
if (imActionJs != null && imActionYs != null) {
// 设置点击事件
imActionJs.setOnClickListener(this::onChock);
imActionYs.setOnClickListener(this::onChock);
// isButtonsInflated = true;
} else {
// 报错提示:说明 top_overlay_buttons.xml 中没有定义这些 id
throw new IllegalStateException("im_action_js or im_action_ys not found in overlay layout");
}
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).tob();
}
}
@@ -273,11 +313,22 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
private void getvjs() {
if (roomInfoResp.getUser_info().getIs_room_owner() == 1 || roomInfoResp.getUser_info().getIs_management() == 1 || roomInfoResp.getUser_info().getIs_host() == 1) {
imActionJs.setVisibility(VISIBLE);
} else {
imActionJs.setVisibility(INVISIBLE);
}
// if (imActionJs == null) {
// initOverlayButtons();
// }
// if (imActionJs != null) {
if (roomInfoResp.getUser_info().getIs_room_owner() == 1 || roomInfoResp.getUser_info().getIs_management() == 1 || roomInfoResp.getUser_info().getIs_host() == 1) {
// imActionJs.setVisibility(VISIBLE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upJs( true);
}
} else {
// imActionJs.setVisibility(INVISIBLE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upJs( false);
}
}
// }
}
protected void tzblChanged() {
@@ -438,18 +489,20 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
RoomOnlineDialogFragment.show(roomInfoResp.getRoom_info().getRoom_id(), 888 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
}
} else {
if (roomInfoResp.getRoom_auction() != null && roomInfoResp.getRoom_auction().getAuction_user() != null ) {
if (roomInfoResp.getRoom_auction() != null && roomInfoResp.getRoom_auction().getAuction_user() != null) {
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.getUserId(), wheatView2.pitNumber, getHostUser(), false, 1, Integer.parseInt(roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() != null ? roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() : "0"), getChildFragmentManager());
}else {
} else {
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.getUserId(), wheatView2.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
}
}
}
} else if (id == R.id.im_action_js) {//延时
MvpPre.auctionDelay(SpUtil.getauctionId());
} else if (id == R.id.im_action_ys) {//结束
dialogEnd();
} else if (id == R.id.bangdan) {//出价榜单
}
// else if (id == R.id.im_action_js) {//延时
// MvpPre.auctionDelay(SpUtil.getauctionId());
// } else if (id == R.id.im_action_ys) {//结束
// dialogEnd();
// }
else if (id == R.id.bangdan) {//出价榜单
BidListDialogFragment.newInstance(SpUtil.getauctionId()).show(getChildFragmentManager(), "BidListDialogFragment");
} else if (id == R.id.iv_auction1) {
if (mBinding.ivAuction1.getUserId() != null && !mBinding.ivAuction1.getUserId().equals("")) {
@@ -972,36 +1025,35 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
}
public void event1058(RoomMessageEvent messageEvent){
public void event1058(RoomMessageEvent messageEvent) {
int type = messageEvent.getText().getType();
RoomPitBean pitBean = wheatView.pitBean;
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
pitBean.setIs_online(type == 1 ? 1 :2);
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);
pitBean2.setIs_online(type == 1 ? 1 : 2);
wheatView2.setData(pitBean2);
mBinding.tvPB.setText("0");
return;
}
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
pitBean3.setIs_online(type == 1 ? 1 :2);
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);
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);
pitBean5.setIs_online(type == 1 ? 1 : 2);
mBinding.ivAuction3.setData(pitBean5);
return;
}
@@ -1011,16 +1063,16 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
int j = i;
j++;
if (j == 4) {
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())){
mBinding.ivOnline4.setVisibility(type==1?GONE : VISIBLE);
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
mBinding.ivOnline4.setVisibility(type == 1 ? GONE : VISIBLE);
}
} else if (j == 5) {
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())){
mBinding.ivOnline5.setVisibility(type==1?GONE : VISIBLE);
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
mBinding.ivOnline5.setVisibility(type == 1 ? GONE : VISIBLE);
}
} else if (j == 6) {
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())){
mBinding.ivOnline6.setVisibility(type==1?GONE : VISIBLE);
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
mBinding.ivOnline6.setVisibility(type == 1 ? GONE : VISIBLE);
}
}
}
@@ -1031,12 +1083,19 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
if (messageEvent.getText().getPit_number().equals("9")) {
wheatView.setData(getPitBean(messageEvent));
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
imActionJs.setVisibility(View.VISIBLE);
imActionYs.setVisibility(View.VISIBLE);
// imActionJs.setVisibility(View.VISIBLE);
// imActionYs.setVisibility(View.VISIBLE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upVisibility( true);
}
// 用户上麦,根据权限显示按钮
} else {
getvjs();
imActionYs.setVisibility(INVISIBLE);
// imActionYs.setVisibility(INVISIBLE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upYs( false);
}
}
}
}
@@ -1044,8 +1103,12 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
public void event1004(RoomMessageEvent messageEvent) {
if (messageEvent.getText().getPit_number().equals("9")) {
wheatView.setData(getPitBean2(messageEvent, "9"));
// 下麦时隐藏按钮
getvjs();
imActionYs.setVisibility(GONE);
// imActionYs.setVisibility(GONE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upYs( false);
}
} else if (messageEvent.getText().getPit_number().equals("888")) {
wheatView2.setData(getPitBean2(messageEvent, "888"));
@@ -1057,7 +1120,10 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
if (messageEvent.getText().getPit_number().equals("888")) {
wheatView2.setData(getPitBean(messageEvent));
getvjs();
imActionYs.setVisibility(GONE);
// imActionYs.setVisibility(GONE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upYs( false);
}
}
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
CardRelationshipFragment.show(roomInfoResp.getRoom_info().getRoom_id(), SpUtil.getUserId() + "", type + "", getActivity().getSupportFragmentManager());
@@ -1084,6 +1150,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
gexList();
steView(type);
isButtonsInflated = false;
mBinding.tvPB.setText("0");
}
public void event1021(RoomMessageEvent messageEvent) {
@@ -1114,11 +1181,18 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
public void event1023(RoomMessageEvent messageEvent) {
mBinding.ivJp.setVisibility(VISIBLE);
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
imActionYs.setVisibility(VISIBLE);
imActionJs.setVisibility(VISIBLE);
// imActionYs.setVisibility(VISIBLE);
// imActionJs.setVisibility(VISIBLE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upVisibility( true);
}
} else {
getvjs();
imActionYs.setVisibility(GONE);
// imActionYs.setVisibility(GONE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upJs( false);
}
}
if (messageEvent.getText().getAuction_user().getUser_id().equals(SpUtil.getUserId() + "")) {
mBinding.ivJp.setVisibility(INVISIBLE);
@@ -1200,9 +1274,12 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
private void yinc() {
mBinding.ivJp.setVisibility(INVISIBLE);
getvjs();
imActionYs.setVisibility(INVISIBLE);
mBinding.ivJp.setVisibility(INVISIBLE);
// imActionYs.setVisibility(INVISIBLE);
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upYs( false);
}
mBinding.tvDjTime.setVisibility(INVISIBLE);
mBinding.tvRelation.setText("关系");
mBinding.tvTimetg.setText("时间");
@@ -1452,14 +1529,6 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
return pitBean;
}
@Override
public void onStart() {
super.onStart();
// if (!EventBus.getDefault().isRegistered(this)) {
// EventBus.getDefault().register(this);
// }
}
@Override
public void onDestroyView() {
@@ -1475,9 +1544,8 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
if (stub != null) {
stub.setVisibility(GONE);
stub = null;
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upTop();
}
isButtonsInflated = false;
releaseCountDownTimer();

View File

@@ -54,6 +54,7 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import io.agora.rtc2.Constants;
@@ -311,16 +312,35 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
AgoraManager.getInstance(getActivity()).muteLocalAudioStream(false);
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled(true,SpUtil.getUserId()+"");
isShow = false;
} else {
mBinding.im1.setImageResource(com.xscm.moduleutil.R.mipmap.op_m);
AgoraManager.getInstance(getActivity()).ClientRole(true);
AgoraManager.getInstance(getActivity()).muteLocalAudioStream(true);
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled(false,SpUtil.getUserId()+"");
isShow = true;
isMute(1);
}
}
public void isMute(int is_mute) {
RoomMessageEvent.text text = new RoomMessageEvent.text();
text.setIs_mute(is_mute);
String s = com.blankj.utilcode.util.GsonUtils.toJson(text);
RoomMessageEvent.T t = new RoomMessageEvent.T();
t.setFromUserInfo(SpUtil.getUserInfo());
t.setText(s);
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(126, roomInfoResp.getRoom_info().getRoom_id(), t);
String json = com.blankj.utilcode.util.GsonUtils.toJson(roomMessageEvent);
// 转换为 byte[]
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
// 创建自定义消息
MessageListenerSingleton.getInstance().sendCustomRoomMessage(
roomId + "",
binaryData
);
}
public void roomInfoEvent(RoomMessageEvent messageEvent) {
if (messageEvent.getMsgType() == 1028) {
mBinding.tvHeartValue2.setText(messageEvent.getText().getHot_value());

View File

@@ -5,6 +5,7 @@ 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;
@@ -26,6 +27,7 @@ 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;
@@ -57,6 +59,7 @@ import com.xscm.moduleutil.bean.room.RoomInfoResp;
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;
@@ -81,10 +84,8 @@ import java.util.List;
*/
public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBinding> implements RoomContacts.View {
public static RoomFragment newInstance(RoomInfoResp roomInfo, String password) {
public static RoomFragment newInstance() {
Bundle args = new Bundle();
args.putSerializable("roomInfo", roomInfo);
args.putString("password", password);
RoomFragment fragment = new RoomFragment();
fragment.setArguments(args);
return fragment;
@@ -101,25 +102,29 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
String[] permissions = {Manifest.permission.RECORD_AUDIO};
private WheatFeedingDialogFragment wheatFeedingDialogFragment;
private SingSongFragment singSongFragment; /// 二卡八 --pk
private RoomKtvFragment ktvFragment; /// KTV
private SingSongFragment singSongFragment;
/// 二卡八 --pk
private RoomKtvFragment ktvFragment;
/// KTV
private RoomAuctionFragment roomAuctionFragment;///拍卖
private RoomAuctionFragment roomAuctionFragment;
/// 拍卖
private FriendshipRoomFragment friendshipRoomFragment; //交友
private RoomCabinFragment roomCabinFragment;// 小黑屋
public QXRoomSeatViewType qxRoomSeatViewType;
@Override
public void initArgs(Bundle arguments) {
mRoomInfoResp = new RoomInfoResp();
mRoomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfo");
password = arguments.getString("password");
roomId = mRoomInfoResp.getRoom_info().getRoom_id();
role = mRoomInfoResp.getRoom_info().getRole();
roomInfo(mRoomInfoResp);
// mRoomInfoResp = new RoomInfoResp();
// mRoomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfo");
// password = arguments.getString("password");
// roomId = mRoomInfoResp.getRoom_info().getRoom_id();
// role = mRoomInfoResp.getRoom_info().getRole();
// roomInfo(mRoomInfoResp);
super.initArgs(arguments);
@@ -136,6 +141,151 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
onFragmentShowDestroy();
}
public void setqxRoomSeatViewType(QXRoomSeatViewType type) {
this.qxRoomSeatViewType = type;
switch (type) {
case NORMAL:
releaseKtvFragment();
releaseRoomAuctionFragment();
releaseFriendshipRoomFragment();
releaseRoomCabinFragment();
createSingSongFragment();
break;
case AUCTION:
releaseSingSongFragment();
releaseKtvFragment();
releaseFriendshipRoomFragment();
releaseRoomCabinFragment();
createRoomAuctionFragment();
break;
case KTV:
releaseRoomAuctionFragment();
releaseFriendshipRoomFragment();
releaseSingSongFragment();
releaseRoomCabinFragment();
createKtvFragment();
case CABIN:
releaseKtvFragment();
releaseRoomAuctionFragment();
releaseFriendshipRoomFragment();
releaseSingSongFragment();
createRoomCabinFragment();
break;
case FRIEND:
releaseRoomAuctionFragment();
releaseRoomCabinFragment();
releaseKtvFragment();
releaseSingSongFragment();
createFriendshipRoomFragment();
break;
case NONE:
break;
default:
break;
}
}
public void releaseSingSongFragment() {
if (singSongFragment != null) {
singSongFragment.releaseResources();
singSongFragment = null;
}
}
private void createSingSongFragment() {
if (singSongFragment == null) {
singSongFragment = SingSongFragment.newInstance();
// 确保 Fragment 已添加且处于活跃状态再进行操作
// 如果当前状态不允许添加 Fragment则延迟执行
if (isAdded() && getActivity() != null && getView() != null) {
getChildFragmentManager()
.beginTransaction()
.replace(R.id.container, singSongFragment)
.commitAllowingStateLoss();
} else if (getView() != null) {
// 延迟执行直到 Fragment 处于合适状态
getView().post(() -> {
if (isAdded() && getActivity() != null) {
getChildFragmentManager()
.beginTransaction()
.replace(R.id.container, singSongFragment)
.commitAllowingStateLoss();
}
});
}
}
}
private void releaseKtvFragment() {
if (ktvFragment != null) {
ktvFragment.releaseResources();
ktvFragment = null;
}
}
private void createKtvFragment() {
if (ktvFragment == null) {
ktvFragment = RoomKtvFragment.newInstance();
getChildFragmentManager()
.beginTransaction()
.replace(R.id.container, ktvFragment)
.commitAllowingStateLoss();
}
}
private void releaseRoomAuctionFragment() {
if (roomAuctionFragment != null) {
roomAuctionFragment.releaseResources();
roomAuctionFragment = null;
}
}
private void createRoomAuctionFragment() {
if (roomAuctionFragment == null) {
roomAuctionFragment = RoomAuctionFragment.newInstance();
getChildFragmentManager()
.beginTransaction()
.replace(R.id.container, roomAuctionFragment)
.commitAllowingStateLoss();
}
}
private void releaseFriendshipRoomFragment() {
if (friendshipRoomFragment != null) {
friendshipRoomFragment.releaseResources();
friendshipRoomFragment = null;
}
}
private void createFriendshipRoomFragment() {
if (friendshipRoomFragment == null) {
friendshipRoomFragment = FriendshipRoomFragment.newInstance();
// replaceNestedFragment(friendshipRoomFragment, R.id.container);
getChildFragmentManager()
.beginTransaction()
.replace(R.id.container, friendshipRoomFragment)
.commitAllowingStateLoss();
}
}
private void releaseRoomCabinFragment() {
if (roomCabinFragment != null) {
roomCabinFragment.releaseResources();
roomCabinFragment = null;
}
}
private void createRoomCabinFragment() {
if (roomCabinFragment == null) {
roomCabinFragment = RoomCabinFragment.newInstance();
// replaceNestedFragment(roomCabinFragment, R.id.container);
getChildFragmentManager()
.beginTransaction()
.replace(R.id.container, roomCabinFragment)
.commitAllowingStateLoss();
}
}
public void onFragmentShowDestroy() {
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
@@ -162,21 +312,8 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
wheatFeedingDialogFragment.dismissAllowingStateLoss();
wheatFeedingDialogFragment = null;
}
// 释放子Fragment
releaseChildFragments();
// 释放输入菜单相关资源
// if (mBinding != null && mBinding.inputMenu1 != null) {
// mBinding.inputMenu1.dismiss();
// }
// 取消所有可能的网络请求
// if (MvpPre != null) {
// // 取消与Fragment相关的网络请求如果有提供相应方法
// MvpPre.cancelRequest();
// }
} catch (Exception e) {
LogUtils.e("releaseAllResources error: " + e.getMessage());
}
@@ -254,34 +391,66 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
@Override
protected void initData() {
loadSubFragment();
// loadSubFragment();
}
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void onMessageEvent(UnreadCountEvent messageEvent) {
// if (messageEvent.getALong() == 0) {
// mBinding.ivMessageDot.setVisibility(View.GONE);
// } else {
// mBinding.ivMessageDot.setVisibility(View.VISIBLE);
// mBinding.ivMessageDot.setText(String.valueOf(messageEvent.getALong()));
// }
//
// }
// 定义一个可被外部调用的方法
public void refreshData(RoomInfoResp resp) {
public void refreshData(RoomInfoResp resp, QXRoomSeatViewType qxRoomSeatViewType) {
// 使用传入的参数刷新界面或逻辑
mRoomInfoResp = resp;
loadSubFragment();
loadSubFragment(qxRoomSeatViewType);
// upView(qxRoomSeatViewType);
// 更新子Fragment视图
updateChildFragmentViews();
// updateChildFragmentViews();
}
private <T extends Fragment> T findFragmentByTag(Class<T> fragmentClass) {
return (T) getChildFragmentManager().findFragmentByTag(fragmentClass.getSimpleName());
}
private void upView(QXRoomSeatViewType qxRoomSeatViewType) {
this.qxRoomSeatViewType = qxRoomSeatViewType;
switch (qxRoomSeatViewType) {
case KTV:
if (ktvFragment != null && ktvFragment.isAdded()) {
ktvFragment.roomInfoUpdate(mRoomInfoResp);
} else {
setqxRoomSeatViewType(qxRoomSeatViewType);
}
break;
case AUCTION:
if (roomAuctionFragment != null && roomAuctionFragment.isAdded()) {
// roomAuctionFragment.roomInfoUpdate(mRoomInfoResp);
} else {
setqxRoomSeatViewType(qxRoomSeatViewType);
}
break;
case CABIN:
if (roomCabinFragment != null && roomCabinFragment.isAdded()) {
roomCabinFragment.roomInfoUpdate(mRoomInfoResp);
} else {
setqxRoomSeatViewType(qxRoomSeatViewType);
}
break;
case FRIEND:
if (friendshipRoomFragment != null) {
friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
} else {
setqxRoomSeatViewType(qxRoomSeatViewType);
}
break;
case NORMAL:
if (singSongFragment != null && singSongFragment.isAdded()) {
singSongFragment.roomInfoUpdate(mRoomInfoResp);
} else {
setqxRoomSeatViewType(qxRoomSeatViewType);
}
break;
default:
break;
}
}
public void updateChildFragmentViews() {
// 使用弱引用避免内存泄漏
@@ -386,8 +555,48 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
roomCabinFragment.upCabinFragment(time);
}
private void loadSubFragment() {
private void loadSubFragment(QXRoomSeatViewType qxRoomSeatViewType) {
this.qxRoomSeatViewType = qxRoomSeatViewType;
// switch (qxRoomSeatViewType) {
//
// case KTV:
// if (ktvFragment != null && ktvFragment.isAdded()) {
// ktvFragment.roomInfoUpdate(mRoomInfoResp);
// }else {
// setqxRoomSeatViewType(qxRoomSeatViewType);
// }
// break;
// case AUCTION:
// if (roomAuctionFragment != null && roomAuctionFragment.isAdded()) {
// roomAuctionFragment.roomInfoUpdate(mRoomInfoResp);
// }else {
// setqxRoomSeatViewType(qxRoomSeatViewType);
// }
// break;
// case CABIN:
// if (roomCabinFragment != null && roomCabinFragment.isAdded()) {
// roomCabinFragment.roomInfoUpdate(mRoomInfoResp);
// }else {
// setqxRoomSeatViewType(qxRoomSeatViewType);
// }
// break;
// case FRIEND:
// if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) {
// friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
// }else {
// setqxRoomSeatViewType(qxRoomSeatViewType);
// }
// break;
// case NORMAL:
// if (singSongFragment != null && singSongFragment.isAdded()) {
// singSongFragment.roomInfoUpdate(mRoomInfoResp);
// }else {
// setqxRoomSeatViewType(qxRoomSeatViewType);
// }
// break;
// default:
// break;
// }
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
String typeId = mRoomInfoResp.getRoom_info().getType_id();
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
@@ -396,29 +605,38 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
if ("1".equals(typeId)) {
if ("1".equals(labelId)) {
newFragment = SingSongFragment.newInstance();
singSongFragment = SingSongFragment.newInstance();
newFragment = singSongFragment;
} else if ("2".equals(labelId)) {
newFragment = RoomKtvFragment.newInstance();
ktvFragment = RoomKtvFragment.newInstance();
newFragment = ktvFragment;
}
} else if ("2".equals(typeId)) {
newFragment = RoomAuctionFragment.newInstance();
roomAuctionFragment = RoomAuctionFragment.newInstance();
newFragment = roomAuctionFragment;
} else if ("6".equals(typeId)) {
newFragment = RoomCabinFragment.newInstance();
roomCabinFragment = RoomCabinFragment.newInstance();
newFragment = roomCabinFragment;
setviewyc();
} else if ("3".equals(typeId)) {
if ("1".equals(labelId)) {
newFragment = SingSongFragment.newInstance();
singSongFragment = SingSongFragment.newInstance();
newFragment = singSongFragment;
} else if ("2".equals(labelId)) {
newFragment = RoomKtvFragment.newInstance();
ktvFragment = RoomKtvFragment.newInstance();
newFragment = ktvFragment;
}
} else if ("4".equals(typeId)) {
if ("1".equals(labelId)) {
newFragment = SingSongFragment.newInstance();
singSongFragment = SingSongFragment.newInstance();
newFragment = singSongFragment;
} else if ("2".equals(labelId)) {
newFragment = RoomKtvFragment.newInstance();
ktvFragment = RoomKtvFragment.newInstance();
newFragment = ktvFragment;
}
} else if ("7".equals(typeId)) {
newFragment = FriendshipRoomFragment.newInstance();
friendshipRoomFragment = FriendshipRoomFragment.newInstance();
newFragment = friendshipRoomFragment;
}
if (newFragment != null) {
@@ -434,26 +652,28 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
AgoraManager.getInstance(getActivity()).muteLocalAudioStream(true);
}
// 延迟执行更新,确保 Fragment 已经添加完成
if (getActivity() != null && isAdded()) {
getView().post(() -> updateChildFragmentViews());
}
// if (getActivity() != null && isAdded()) {
// getView().post(() -> updateChildFragmentViews());
// }
if (getActivity() instanceof RoomActivity) {
if (mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
((RoomActivity) getActivity()).setvisibTop(false);
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
if (mRoomInfoResp.getRoom_info().getRoom_background()==null || mRoomInfoResp.getRoom_info().getRoom_background().equals("")) {
((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj);
}else {
((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
}
((RoomActivity) getActivity()).setvisibTop(true);
} else {
((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
((RoomActivity) getActivity()).setvisibTop(true);
}
}
// if (getActivity() instanceof RoomActivity) {
// if (mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
// ((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
// ((RoomActivity) getActivity()).setvisibTop(false);
// } else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
// if (mRoomInfoResp.getRoom_info().getRoom_background() == null || mRoomInfoResp.getRoom_info().getRoom_background().equals("")) {
// ((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj);
// } else {
// ((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
// }
// ((RoomActivity) getActivity()).setvisibTop(true);
// } else {
// ((RoomActivity) getActivity()).changeBackgroundColor(mRoomInfoResp.getRoom_info().getRoom_background());
// ((RoomActivity) getActivity()).setvisibTop(true);
// }
// }
updateChildFragmentViews();
}
/// 这是在进入电影放的时候,隐藏下面的和排麦视图
@@ -532,12 +752,21 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
public void updateSeatViewExchangedWithPitArray(RoomInfoResp roomInfoResp) {
mRoomInfoResp = roomInfoResp;
loadSubFragment(qxRoomSeatViewType);
updateChildFragmentViews();
// upView(qxRoomSeatViewType);
}
public void upRoomInfoData(RoomInfoResp roomInfoResp) {
this.mRoomInfoResp = roomInfoResp;
}
public void upRoomInfo(RoomInfoResp roomInfoResp) {
mRoomInfoResp = roomInfoResp;
loadSubFragment(qxRoomSeatViewType);
updateChildFragmentViewsUp();
// upView(qxRoomSeatViewType);
}
private void updateChildFragmentViewsUp() {
@@ -964,88 +1193,128 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
}
}
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void roomInfoEvent(UserInfo messageEvent) {
// mBinding.llInput.setVisibility(View.VISIBLE);
// mBinding.inputMenu1.bringToFront(); // 强制将该 View 置于最上层
// mBinding.inputMenu1.show();
// mBinding.inputMenu1.setText("@" + messageEvent.getNickname());
// }
// TODO: 2025/8/29 拍卖房的方法
// TODO: 2025/8/29 拍卖房的方法
public void handleAuctionMessageEvent(RoomMessageEvent messageEvent) {
RoomAuctionFragment auctionFragment = (RoomAuctionFragment) getChildFragmentManager()
.findFragmentByTag(RoomAuctionFragment.class.getSimpleName());
if (auctionFragment != null) {
auctionFragment.upRoomInfo(mRoomInfoResp);
switch (messageEvent.getMsgType()) {
case 1022:
auctionFragment.event1022(messageEvent);
break;
case 1025:
auctionFragment.event1025(messageEvent);
break;
case 1026:
auctionFragment.event1026(messageEvent);
break;
case 1005:
auctionFragment.event1005(messageEvent);
break;
case 1035:
auctionFragment.event1035(messageEvent);
break;
case 1021:
auctionFragment.event1021(messageEvent);
break;
case 1027:
auctionFragment.event1027(messageEvent);
break;
case 1023:
auctionFragment.event1023(messageEvent);
break;
case 1024:
auctionFragment.event1024(messageEvent);
break;
case 1004:
auctionFragment.event1004(messageEvent);
break;
case 1003:
auctionFragment.event1003(messageEvent);
break;
case 1059:
auctionFragment.event1059(messageEvent);
break;
case 1058:
auctionFragment.event1058(messageEvent);
break;
default:
// 可以添加默认处理或日志记录
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
break;
}
switch (qxRoomSeatViewType) {
case KTV:
break;
case AUCTION:
roomAuctionFragment.upRoomInfo(mRoomInfoResp);
switch (messageEvent.getMsgType()) {
case 1022:
roomAuctionFragment.event1022(messageEvent);
break;
case 1025:
roomAuctionFragment.event1025(messageEvent);
break;
case 1026:
roomAuctionFragment.event1026(messageEvent);
break;
case 1005:
roomAuctionFragment.event1005(messageEvent);
break;
case 1035:
roomAuctionFragment.event1035(messageEvent);
break;
case 1021:
roomAuctionFragment.event1021(messageEvent);
break;
case 1027:
roomAuctionFragment.event1027(messageEvent);
break;
case 1023:
roomAuctionFragment.event1023(messageEvent);
break;
case 1024:
roomAuctionFragment.event1024(messageEvent);
break;
case 1004:
roomAuctionFragment.event1004(messageEvent);
break;
case 1003:
roomAuctionFragment.event1003(messageEvent);
break;
case 1059:
roomAuctionFragment.event1059(messageEvent);
break;
case 1058:
roomAuctionFragment.event1058(messageEvent);
break;
default:
// 可以添加默认处理或日志记录
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
break;
}
break;
case CABIN:
break;
case FRIEND:
break;
case NORMAL:
break;
default:
break;
}
// RoomAuctionFragment auctionFragment = (RoomAuctionFragment) getChildFragmentManager()
// .findFragmentByTag(RoomAuctionFragment.class.getSimpleName());
//
// if (auctionFragment != null) {
//
// }
}
// TODO: 2025/9/12 交友房
public void friendshipRoomFragmentEvent(RoomMessageEvent messageEvent) {
FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager()
.findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
if (friendshipRoomFragment != null) {
friendshipRoomFragment.upRoomInfo(mRoomInfoResp);
switch (messageEvent.getMsgType()) {
case 1059:
friendshipRoomFragment.event1059(messageEvent);
break;
case 1058:
friendshipRoomFragment.event1058(messageEvent);
break;
case 1005:
friendshipRoomFragment.event1005(messageEvent);
break;
default:
break;
}
switch (qxRoomSeatViewType) {
case KTV:
break;
case FRIEND:
friendshipRoomFragment.upRoomInfo(mRoomInfoResp);
switch (messageEvent.getMsgType()) {
case 1059:
friendshipRoomFragment.event1059(messageEvent);
break;
case 1058:
friendshipRoomFragment.event1058(messageEvent);
break;
case 1005:
friendshipRoomFragment.event1005(messageEvent);
break;
case 1003:
friendshipRoomFragment.event1003(messageEvent);
break;
case 1004:
friendshipRoomFragment.event1004(messageEvent);
break;
case 1039:
friendshipRoomFragment.event1039(messageEvent);
break;
case 1035:
friendshipRoomFragment.event1035(messageEvent);
break;
default:
break;
}
break;
case CABIN:
break;
case AUCTION:
break;
case NORMAL:
break;
default:
break;
}
// FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager()
// .findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
// if (friendshipRoomFragment != null) {
//
// }
}
@@ -1057,96 +1326,133 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
cabinFragment.handleMsgType1028(messageEvent);
}
}
// TODO: 2025/8/30 Ktv模式
public void KtvFragmentEvent(RoomMessageEvent messageEvent) {
RoomKtvFragment ktvFragment = (RoomKtvFragment) getChildFragmentManager()
.findFragmentByTag(RoomKtvFragment.class.getSimpleName());
if (ktvFragment != null) {
switch (messageEvent.getMsgType()) {
case 1013:
ktvFragment.event1013(messageEvent);
break;
case 1003:
ktvFragment.event1003(messageEvent);
break;
case 1004:
ktvFragment.event1004(messageEvent);
break;
case 1021:
ktvFragment.event1021(messageEvent);
case 1005:
ktvFragment.event1005(messageEvent);
break;
case 1035:
ktvFragment.event1035(messageEvent);
break;
case 1059:
ktvFragment.event1059(messageEvent);
break;
case 1058:
ktvFragment.event1058(messageEvent);
default:
// 可以添加默认处理或日志记录
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
break;
}
switch (qxRoomSeatViewType) {
case KTV:
ktvFragment.upRoomInfo(mRoomInfoResp);
switch (messageEvent.getMsgType()) {
case 1013:
ktvFragment.event1013(messageEvent);
break;
case 1003:
ktvFragment.event1003(messageEvent);
break;
case 1004:
ktvFragment.event1004(messageEvent);
break;
case 1021:
ktvFragment.event1021(messageEvent);
case 1005:
ktvFragment.event1005(messageEvent);
break;
case 1035:
ktvFragment.event1035(messageEvent);
break;
case 1059:
ktvFragment.event1059(messageEvent);
break;
case 1058:
ktvFragment.event1058(messageEvent);
default:
// 可以添加默认处理或日志记录
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
break;
}
break;
case NORMAL:
break;
case AUCTION:
break;
case CABIN:
break;
case FRIEND:
break;
default:
break;
}
// RoomKtvFragment ktvFragment = (RoomKtvFragment) getChildFragmentManager()
// .findFragmentByTag(RoomKtvFragment.class.getSimpleName());
//
// if (ktvFragment != null) {
//
// }
}
// TODO: 2025/8/30 点唱房模式
public void SingSongEvent(RoomMessageEvent messageEvent) {
switch (qxRoomSeatViewType) {
case NORMAL:
singSongFragment.upRoonInfo(mRoomInfoResp);
switch (messageEvent.getMsgType()) {
case 1037:
singSongFragment.event1037(messageEvent);
break;
case 1003:
singSongFragment.event1003(messageEvent);
break;
case 1004:
singSongFragment.event1004(messageEvent);
break;
case 1005:
singSongFragment.event1005(messageEvent);
break;
case 1015:
singSongFragment.event1015(messageEvent);
break;
case 1030:
singSongFragment.event1030(messageEvent);
break;
case 1031:
singSongFragment.event1031(messageEvent);
break;
case 1032:
singSongFragment.event1032(messageEvent);
break;
case 1033:
singSongFragment.event1033(messageEvent);
break;
case 1035:
singSongFragment.event1035(messageEvent);
break;
case 1021:
singSongFragment.event1021(messageEvent);
break;
case 1059:
singSongFragment.event1059(messageEvent);
break;
case 1058:
singSongFragment.event1058(messageEvent);
break;
case 1039:
singSongFragment.event1039(messageEvent);
break;
default:
// 可以添加默认处理或日志记录
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
break;
}
break;
case KTV:
break;
case FRIEND:
break;
case CABIN:
break;
case AUCTION:
break;
default:
break;
SingSongFragment singSongFragment = (SingSongFragment) getChildFragmentManager()
.findFragmentByTag(SingSongFragment.class.getSimpleName());
if (singSongFragment != null) {
singSongFragment.upRoonInfo(mRoomInfoResp);
switch (messageEvent.getMsgType()) {
case 1037:
singSongFragment.event1037(messageEvent);
break;
case 1003:
singSongFragment.event1003(messageEvent);
break;
case 1004:
singSongFragment.event1004(messageEvent);
break;
case 1005:
singSongFragment.event1005(messageEvent);
break;
case 1015:
singSongFragment.event1015(messageEvent);
break;
case 1030:
singSongFragment.event1030(messageEvent);
break;
case 1031:
singSongFragment.event1031(messageEvent);
break;
case 1032:
singSongFragment.event1032(messageEvent);
break;
case 1033:
singSongFragment.event1033(messageEvent);
break;
case 1035:
singSongFragment.event1035(messageEvent);
break;
case 1021:
singSongFragment.event1021(messageEvent);
break;
case 1059:
singSongFragment.event1059(messageEvent);
break;
case 1058:
singSongFragment.event1058(messageEvent);
break;
default:
// 可以添加默认处理或日志记录
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
break;
}
}
// SingSongFragment singSongFragment = (SingSongFragment) getChildFragmentManager()
// .findFragmentByTag(SingSongFragment.class.getSimpleName());
// if (singSongFragment != null) {
//
// }
}

View File

@@ -130,9 +130,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
protected void initData() {
upDtaView();
}
public void upRoomInfo(RoomInfoResp roomInfoResp) {
this.roomInfoResp = roomInfoResp;
}
private void upDtaView() {
pitList = new ArrayList<>();
if (getActivity() instanceof RoomActivity) {
@@ -338,7 +340,8 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
/**
* 检查是否为快速重复点击
* @param userId 用户ID
*
* @param userId 用户ID
* @param pitNumber 麦位号
* @return true表示是快速重复点击false表示不是
*/
@@ -457,7 +460,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
pitNumber = pitBean.getPit_number();
roomPitBean = pitBean;
showPopupMenu(view); // v 是点击的按钮视图
} else if (pitNumber1 == 10 && isUserHostOfRoom() ) {
} else if (pitNumber1 == 10 && isUserHostOfRoom()) {
RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
} else if (pitNumber1 != 10) {
MvpPre.applyPit(roomId, pitNumber1 + "");
@@ -516,8 +519,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
mBinding.imMkf.setOnClickListener(this::onClick);
}
/**
* 检查当前用户是否是房间的主持人
*
* @return true表示是主持人false表示不是主持人或数据不完整
*/
private boolean isUserHostOfRoom() {
@@ -913,7 +918,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
// 可选:点击事件处理
Log.d("Wheat", "Clicked pit: " + pitNumber);
if (!pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
if (isFastDoubleClick(pitBean.getUser_id(), pitBean.getPit_number())){
if (isFastDoubleClick(pitBean.getUser_id(), pitBean.getPit_number())) {
return;
}
RoomUserInfoFragment.show(roomInfoRespPk.getRoom_info().getRoom_id(), pitBean.getUser_id(), pitNumber + "", getHostUser(), true, 3, isNumberWhether(), getChildFragmentManager());
@@ -1273,12 +1278,12 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
}
// TODO: 2025/9/12 清除个人魅力
public void event1059(RoomMessageEvent message){
public void event1059(RoomMessageEvent message) {
String userId = message.getText().getUser_id();
RoomPitBean pitBean=new RoomPitBean();
for (RoomPitBean roomPitBean : roomInfoResp.getRoom_info().getPit_list()){
if (roomPitBean.getUser_id().equals(userId)){
pitBean=roomPitBean;
RoomPitBean pitBean = new RoomPitBean();
for (RoomPitBean roomPitBean : roomInfoResp.getRoom_info().getPit_list()) {
if (roomPitBean.getUser_id().equals(userId)) {
pitBean = roomPitBean;
pitBean.setCharm("");
break;
}
@@ -1295,10 +1300,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
public void event1058(RoomMessageEvent message) {
String userId = message.getText().getUser_id();
int type = message.getText().getType();
RoomPitBean pitBean=new RoomPitBean();
for (RoomPitBean roomPitBean : roomInfoResp.getRoom_info().getPit_list()){
if (roomPitBean.getUser_id() == null && roomPitBean.getUser_id().equals(userId)){
pitBean=roomPitBean;
RoomPitBean pitBean = new RoomPitBean();
for (RoomPitBean roomPitBean : roomInfoResp.getRoom_info().getPit_list()) {
if (roomPitBean.getUser_id() == null && roomPitBean.getUser_id().equals(userId)) {
pitBean = roomPitBean;
pitBean.setIs_online(type == 1 ? 1 : 2);
break;
}
@@ -1310,6 +1315,17 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
}
}
public void event1039(RoomMessageEvent message) {
if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
wheatLayoutSingManager.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
}
} else {
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
wheatLayoutManager1.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
}
}
}
/// 推送的下麦1003
@@ -1637,7 +1653,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
releaseResources();
}
public void releaseResources(){
public void releaseResources() {
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}

View File

@@ -403,4 +403,36 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
}
});
}
@Override
public void auctionEnd(String auctionId,String roomId) {
api.auctionEnd(auctionId,roomId, new BaseObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(String s) {
// MvpRef.get().auctionEnd();
}
});
}
@Override
public void auctionDelay(String auctionId) {
RetrofitClient.getInstance().auctionDelay(auctionId, new BaseObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(String s) {
// MvpRef.get().auctionDelay();
}
});
}
}

View File

@@ -468,7 +468,8 @@
android:src="@mipmap/room_sound_effects"
app:layout_constraintBottom_toTopOf="@+id/iv_wheat_feeding"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible" />
tools:visibility="visible"
android:visibility="gone"/>
<ImageView
android:id="@+id/iv_wheat_feeding"

View File

@@ -145,19 +145,19 @@
app:layout_constraintTop_toBottomOf="@id/wheat_view9"
app:layout_constraintWidth_percent="1" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/iv_22"
android:layout_width="0dp"
android:layout_height="@dimen/dp_57"
android:visibility="gone"
app:autoPlay="true"
app:layout_constraintBottom_toBottomOf="@id/background_image"
app:layout_constraintEnd_toEndOf="@id/background_image"
app:layout_constraintStart_toStartOf="@id/background_image"
app:layout_constraintTop_toTopOf="@id/background_image"
app:loopCount="0"
app:source="heart_line_31.svga"
tools:visibility="visible" />
<!-- <com.opensource.svgaplayer.SVGAImageView-->
<!-- android:id="@+id/iv_22"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="@dimen/dp_57"-->
<!-- android:visibility="gone"-->
<!-- app:autoPlay="true"-->
<!-- app:layout_constraintBottom_toBottomOf="@id/background_image"-->
<!-- app:layout_constraintEnd_toEndOf="@id/background_image"-->
<!-- app:layout_constraintStart_toStartOf="@id/background_image"-->
<!-- app:layout_constraintTop_toTopOf="@id/background_image"-->
<!-- app:loopCount="0"-->
<!-- app:source="heart_line_31.svga"-->
<!-- tools:visibility="visible" />-->
<ImageView
android:id="@+id/im_x2"
@@ -166,10 +166,10 @@
android:scaleType="fitXY"
android:src="@mipmap/jiaoy_xian"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/background_image"
app:layout_constraintEnd_toEndOf="@id/background_image"
app:layout_constraintStart_toStartOf="@id/background_image"
app:layout_constraintTop_toTopOf="@id/background_image" />
app:layout_constraintBottom_toBottomOf="@id/wheat_view2"
app:layout_constraintEnd_toStartOf="@+id/wheat_view5"
app:layout_constraintStart_toEndOf="@id/wheat_view2"
app:layout_constraintTop_toTopOf="@id/wheat_view2" />
<ImageView
@@ -297,20 +297,20 @@
app:room_make_pic="@mipmap/jiaoy_n"
app:room_make_wheat_number="4" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/iv_11"
android:layout_width="0dp"
android:layout_height="@dimen/dp_57"
android:layout_gravity="center"
android:visibility="gone"
app:autoPlay="true"
app:layout_constraintBottom_toBottomOf="@id/wheat_view1"
app:layout_constraintEnd_toStartOf="@+id/wheat_view6"
app:layout_constraintStart_toEndOf="@+id/wheat_view1"
app:layout_constraintTop_toTopOf="@id/wheat_view1"
app:loopCount="0"
app:source="heart_line_31.svga"
tools:visibility="visible" />
<!-- <com.opensource.svgaplayer.SVGAImageView-->
<!-- android:id="@+id/iv_11"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="@dimen/dp_57"-->
<!-- android:layout_gravity="center"-->
<!-- android:visibility="gone"-->
<!-- app:autoPlay="true"-->
<!-- app:layout_constraintBottom_toBottomOf="@id/wheat_view1"-->
<!-- app:layout_constraintEnd_toStartOf="@+id/wheat_view6"-->
<!-- app:layout_constraintStart_toEndOf="@+id/wheat_view1"-->
<!-- app:layout_constraintTop_toTopOf="@id/wheat_view1"-->
<!-- app:loopCount="0"-->
<!-- app:source="heart_line_31.svga"-->
<!-- tools:visibility="visible" />-->
<ImageView
android:id="@+id/im_x1"
@@ -339,20 +339,20 @@
app:layout_constraintStart_toEndOf="@+id/wheat_view1"
app:layout_constraintTop_toTopOf="@id/wheat_view1" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/iv_33"
android:layout_width="0dp"
android:layout_height="@dimen/dp_57"
android:layout_gravity="center"
android:visibility="gone"
app:autoPlay="true"
app:layout_constraintBottom_toBottomOf="@id/wheat_view3"
app:layout_constraintEnd_toStartOf="@+id/wheat_view4"
app:layout_constraintStart_toEndOf="@+id/wheat_view3"
app:layout_constraintTop_toTopOf="@id/wheat_view3"
app:loopCount="0"
app:source="heart_line_31.svga"
tools:visibility="visible" />
<!-- <com.opensource.svgaplayer.SVGAImageView-->
<!-- android:id="@+id/iv_33"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="@dimen/dp_57"-->
<!-- android:layout_gravity="center"-->
<!-- android:visibility="gone"-->
<!-- app:autoPlay="true"-->
<!-- app:layout_constraintBottom_toBottomOf="@id/wheat_view3"-->
<!-- app:layout_constraintEnd_toStartOf="@+id/wheat_view4"-->
<!-- app:layout_constraintStart_toEndOf="@+id/wheat_view3"-->
<!-- app:layout_constraintTop_toTopOf="@id/wheat_view3"-->
<!-- app:loopCount="0"-->
<!-- app:source="heart_line_31.svga"-->
<!-- tools:visibility="visible" />-->
<ImageView
android:id="@+id/im_x3"

View File

@@ -224,7 +224,7 @@
</RelativeLayout>
<ViewStub
<LinearLayout
android:id="@+id/stub_buttons2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -232,10 +232,30 @@
android:layout_toEndOf="@+id/rl"
android:layout_alignTop="@id/btn_notice"
android:background="@android:color/transparent"
android:layout="@layout/top_overlay_buttons"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible"
/>
>
<ImageView
android:id="@+id/im_action_ys"
android:layout_width="46dp"
android:layout_height="24dp"
android:src="@mipmap/action_ys"
android:layout_marginEnd="10dp"
android:clickable="true"
android:focusable="true"
android:visibility="invisible"/>
<ImageView
android:id="@+id/im_action_js"
android:layout_width="46dp"
android:layout_height="24dp"
android:src="@mipmap/action_js"
android:layout_marginEnd="16dp"
android:clickable="true"
android:focusable="true"
android:visibility="invisible"/>
</LinearLayout>

View File

@@ -4,6 +4,8 @@ import static com.xscm.moduleutil.utils.permission.PermissionUtils.TAG;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.GridLayoutManager;
@@ -27,6 +29,8 @@ import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.moduleutil.utils.SystemUtils;
import com.xscm.moduleutil.widget.EqualSpaceItemDecoration;
import com.xscm.moduleutil.widget.PaymentUtil;
import com.tencent.liteav.base.Log;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
@@ -81,6 +85,11 @@ public class RechargeActivity extends BaseMvpActivity<RechargePresenter, Activit
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvPayment, ColorManager.getInstance().getPrimaryColorInt(), 53);
mBinding.tvPayment.setTextColor(ColorManager.getInstance().getButtonColorInt());
ViewGroup.LayoutParams layoutParams = mBinding.recyclerView.getLayoutParams();
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
layoutParams.height = SystemUtils.getWidth(372); // 示例高度
mBinding.recyclerView.setLayoutParams(layoutParams);
}
private void onClick(View view) {
@@ -140,7 +149,10 @@ public class RechargeActivity extends BaseMvpActivity<RechargePresenter, Activit
mBinding.r4.setVisibility(isVisible ? View.VISIBLE : View.GONE);
}
});
// mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
mBinding.recyclerView.setLayoutManager(new GridLayoutManager(this, 3));
// int spacing = getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_22); // 根据需要调整间距
// mBinding.recyclerView.addItemDecoration(new EqualSpaceItemDecoration(3, spacing));
mBinding.recyclerView.setAdapter(rechargeAdapter);
}

View File

@@ -3,6 +3,7 @@ package com.example.modulevocal.adapter;
import android.graphics.Color;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -14,6 +15,9 @@ import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.ImageLoader;
import java.util.ArrayList;
import java.util.List;
public class UserGiftWallAdapter extends BaseQuickAdapter<CombinedGiftBean, BaseViewHolder> {
@@ -28,7 +32,7 @@ public class UserGiftWallAdapter extends BaseQuickAdapter<CombinedGiftBean, Base
ImageLoader.loadImage(mContext, helper.getView(R.id.iv_gift_pic), item.getBase_image());
TextView tv_number = helper.getView(R.id.tv_number);
if (item.is_liang()) {
helper.getView(R.id.cl_iv_down_on).setBackgroundColor(Color.parseColor("#E6E6E6"));
// helper.getView(R.id.cl_iv_down_on).setBackgroundColor(Color.parseColor("#E6E6E6"));
float[] corners = {0f, 4f, 0f, 4f};
ThemeableDrawableUtils.setThemeableRoundedBackground(tv_number, ColorManager.getInstance().getPrimaryColorInt(), corners);
tv_number.setTextColor(ColorManager.getInstance().getButtonColorInt());
@@ -37,11 +41,32 @@ public class UserGiftWallAdapter extends BaseQuickAdapter<CombinedGiftBean, Base
helper.setVisible(R.id.tv_number, true);
// helper.setVisible(R.id.riv_user_head, true);
helper.setVisible(R.id.iv_gift_pic_overlay, false);
// 显示送礼物的用户列表
RecyclerView recyclerView = helper.getView(R.id.rv_gift_user_list);
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
TopUsersAdapter topUsersAdapter = new TopUsersAdapter(item.getTop_users());
recyclerView.setAdapter(topUsersAdapter);
// recyclerView.setLayoutManager(new GridLayoutManager(mContext,2,LinearLayoutManager.HORIZONTAL,false));
// recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false) {
@Override
public boolean canScrollHorizontally() {
return false; // 禁止水平滑动
}
});
// TopUsersAdapter topUsersAdapter = new TopUsersAdapter(item.getTop_users());
if (item.getTop_users() != null && item.getTop_users().size() > 0) {
List<CombinedGiftBean.TopUsers> displayUsers = new ArrayList<>();
if (item.getTop_users() != null) {
int maxDisplay = Math.min(2, item.getTop_users().size()); // 最多显示2个
for (int i = 0; i < maxDisplay; i++) {
displayUsers.add(item.getTop_users().get(i));
}
}
TopUsersAdapter topUsersAdapter = new TopUsersAdapter(displayUsers);
recyclerView.setAdapter(topUsersAdapter);
}
} else {
// 未点亮的礼物只显示图片、名称和金额,不高亮
helper.setVisible(R.id.tv_number, false);
@@ -49,6 +74,7 @@ public class UserGiftWallAdapter extends BaseQuickAdapter<CombinedGiftBean, Base
helper.setVisible(R.id.iv_gift_pic_overlay, true);
// 隐藏送礼物的用户列表
helper.setVisible(R.id.rv_gift_user_list, false);
helper.getView(R.id.iv_gift_pic).setAlpha(0.2f);
}
}
}

View File

@@ -3,6 +3,8 @@ package com.example.modulevocal.fragment;
import android.os.Bundle;
import androidx.recyclerview.widget.GridLayoutManager;
import com.example.modulevocal.R;
import com.example.modulevocal.activity.UserHomepageActivity;
import com.example.modulevocal.adapter.UserGiftWallAdapter;
@@ -69,11 +71,13 @@ public class UserGiftWallFragment extends BaseMvpFragment<UserGiftWallPresenter,
columns = 4;
mUserGiftWallAdapter = new UserGiftWallAdapter();
PagerGridLayoutManager layoutManager = new PagerGridLayoutManager(rows, columns, PagerGridLayoutManager.VERTICAL);
mBinding.recyclerView.setLayoutManager(layoutManager);
mBinding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 4));
mBinding.recyclerView.setOnFlingListener(null);
// 设置滚动辅助工具
PagerGridSnapHelper pageSnapHelper = new PagerGridSnapHelper();
pageSnapHelper.attachToRecyclerView(mBinding.recyclerView);
// PagerGridSnapHelper pageSnapHelper = new PagerGridSnapHelper();
// pageSnapHelper.attachToRecyclerView(mBinding.recyclerView);
mBinding.recyclerView.setAdapter(mUserGiftWallAdapter);
}

View File

@@ -87,7 +87,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
android:nestedScrollingEnabled="false" />
<RelativeLayout

View File

@@ -14,10 +14,10 @@
android:background="#fff"
tools:visibility="visible">
<!-- <androidx.core.widget.NestedScrollView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:paddingBottom="@dimen/dp_20">-->
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/dp_20">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
@@ -30,7 +30,7 @@
app:spanCount="4"
tools:listitem="@layout/me_item_user_gift_wall" />
<!-- </androidx.core.widget.NestedScrollView>-->
</androidx.core.widget.NestedScrollView>
</FrameLayout>

View File

@@ -2,19 +2,20 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_77"
android:layout_height="@dimen/dp_129"
android:layout_width="@dimen/dp_78"
android:layout_height="@dimen/dp_110"
android:layout_marginTop="@dimen/dp_10"
android:background="@mipmap/gift_bj"
android:background="#E9E9E9"
android:gravity="center_horizontal"
android:orientation="vertical">
android:orientation="vertical"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_iv_down_on"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MissingConstraints">
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:id="@+id/cl_iv_down_on"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- tools:ignore="MissingConstraints">-->
<ImageView
@@ -30,24 +31,21 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:alpha="0.5"
/>
<ImageView
android:id="@+id/iv_gift_pic_overlay"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="9dp"
android:layout_marginTop="5dp"
android:layout_marginRight="9dp"
app:layout_constraintDimensionRatio="1:1.2"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:alpha="0.3"
app:layout_constraintBottom_toBottomOf="parent"
android:alpha="0.5"
android:background="#40000000"
tools:visibility="visible"
android:visibility="gone" />
<ImageView
@@ -90,47 +88,20 @@
android:textSize="11sp"
app:layout_constraintLeft_toLeftOf="@+id/iv_gift_pic"
app:layout_constraintRight_toRightOf="@+id/iv_gift_pic"
app:layout_constraintTop_toBottomOf="@+id/tv_gift_name" />
app:layout_constraintTop_toBottomOf="@+id/tv_gift_name"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
<!-- <RelativeLayout-->
<!-- android:id="@+id/rl_user_head"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- android:padding="@dimen/dp_2"-->
<!-- app:layout_constraintDimensionRatio="1:1"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- android:visibility="gone">-->
<!-- <com.makeramen.roundedimageview.RoundedImageView-->
<!-- android:id="@+id/riv_user_head"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- app:riv_corner_radius="@dimen/dp_13"-->
<!-- tools:src="@color/color_FF5872FF" />-->
<!-- </RelativeLayout>-->
<!-- <TextView-->
<!-- android:id="@+id/tv_gift_name"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="@dimen/dp_2"-->
<!-- android:text="冲浪少年"-->
<!-- android:textColor="@color/color_FF545454"-->
<!-- android:textSize="@dimen/sp_11"-->
<!-- app:layout_constraintEnd_toEndOf="@+id/rl_user_head"-->
<!-- app:layout_constraintStart_toStartOf="@+id/rl_user_head"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/rl_user_head" />-->
<TextView
android:id="@+id/tv_number"
android:layout_width="@dimen/dp_22"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_15"
android:background="@mipmap/text_bj"
android:gravity="center"
android:layout_marginTop="@dimen/dp_5"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:textColor="@color/black"
@@ -141,45 +112,11 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_gift_user_list"
android:layout_width="wrap_content"
android:layout_width="@dimen/dp_30"
android:layout_height="20dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_marginTop="@dimen/dp_5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <LinearLayout-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal"-->
<!-- app:layout_constraintEnd_toEndOf="@+id/rl_user_head"-->
<!-- app:layout_constraintStart_toStartOf="@+id/rl_user_head"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/tv_gift_name">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_price33"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="2dp"-->
<!-- android:text="10000"-->
<!-- android:textColor="@color/color_FFFFBC00"-->
<!-- android:textSize="11sp"-->
<!-- android:drawableStart="@mipmap/jinb"-->
<!-- />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="*"-->
<!-- android:textColor="#9C9C9C"-->
<!-- android:textSize="@dimen/sp_11"-->
<!-- android:visibility="gone" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="1"-->
<!-- android:textColor="@color/color_FF7185FF"-->
<!-- android:textSize="@dimen/sp_11"-->
<!-- android:visibility="gone"/>-->
<!-- </LinearLayout>-->
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -134,17 +134,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
rlMy.setVisibility(View.VISIBLE);
rlMyCp.setVisibility(View.GONE);
slMy.setShadowColor(Color.parseColor("#7AFE969D"));
} else if (index == 3) {
r11.setVisibility(View.VISIBLE);
r12.setVisibility(View.GONE);
r21.setVisibility(View.VISIBLE);
r22.setVisibility(View.GONE);
r31.setVisibility(View.VISIBLE);
r32.setVisibility(View.GONE);
rlMy.setVisibility(View.VISIBLE);
rlMyCp.setVisibility(View.GONE);
slMy.setShadowColor(Color.parseColor("#7AFE969D"));
} else if (index == 4) {
}else if (index == 3){
r11.setVisibility(View.GONE);
r12.setVisibility(View.VISIBLE);
r21.setVisibility(View.GONE);
@@ -155,6 +145,27 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
rlMyCp.setVisibility(View.VISIBLE);
}
// else if (index == 3) {
// r11.setVisibility(View.VISIBLE);
// r12.setVisibility(View.GONE);
// r21.setVisibility(View.VISIBLE);
// r22.setVisibility(View.GONE);
// r31.setVisibility(View.VISIBLE);
// r32.setVisibility(View.GONE);
// rlMy.setVisibility(View.VISIBLE);
// rlMyCp.setVisibility(View.GONE);
// slMy.setShadowColor(Color.parseColor("#7AFE969D"));
// } else if (index == 4) {
// r11.setVisibility(View.GONE);
// r12.setVisibility(View.VISIBLE);
// r21.setVisibility(View.GONE);
// r22.setVisibility(View.VISIBLE);
// r31.setVisibility(View.GONE);
// r32.setVisibility(View.VISIBLE);
// rlMy.setVisibility(View.GONE);
// rlMyCp.setVisibility(View.VISIBLE);
// }
recycleView.setLayoutManager(new LinearLayoutManager(getActivity()));
mAdapter = new BaseQuickAdapter<PlaceholderBean.ListsBean, BaseViewHolder>(R.layout.index_rv_item_ranking_list) {
@@ -168,7 +179,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
helper.setText(R.id.tv_name, item.getRoom_name());
ImageUtils.loadHeadCC(item.getRoom_cover(), helper.getView(R.id.riv_avatar));
helper.setText(R.id.tv_no, String.valueOf(item.getRank()));
} else if (index == 4) {
} else if (index == 3) {
rl.setVisibility(View.VISIBLE);
helper.getView(R.id.riv_avatar).setVisibility(View.GONE);
// ImageUtils.loadHeadCC(item.getHead_picture1(), helper.getView(R.id.iv_three_cp1_head));
@@ -193,13 +204,14 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", item.getUser_id()).navigation();
}
});
} else if (index == 3) {
rl.setVisibility(View.GONE);
helper.getView(R.id.riv_avatar).setVisibility(View.VISIBLE);
helper.setText(R.id.tv_name, item.getGuild_name());
ImageUtils.loadHeadCC(item.getCover(), helper.getView(R.id.riv_avatar));
helper.setText(R.id.tv_no, String.valueOf(item.getRank()));
}
// else if (index == 3) {
// rl.setVisibility(View.GONE);
// helper.getView(R.id.riv_avatar).setVisibility(View.VISIBLE);
// helper.setText(R.id.tv_name, item.getGuild_name());
// ImageUtils.loadHeadCC(item.getCover(), helper.getView(R.id.riv_avatar));
// helper.setText(R.id.tv_no, String.valueOf(item.getRank()));
// }
}
};
recycleView.setAdapter(mAdapter);
@@ -276,7 +288,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
@Override
public void wealthRanking(PlaceholderBean.MyRanking data) {
if (data != null) {
if (index == 4) {
if (index == 3) {
GifAvatarOvalView cp1Head = mBinding.includeTopBar.ivMyCp1Head;
GifAvatarOvalView cp2Head = mBinding.includeTopBar.ivMyCp2Head;
ImageUtils.loadHeadCC(data.getUser_avatar(), cp1Head);
@@ -292,10 +304,14 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
if (index == 0) {
tvName.setText(data.getRoom_name());
ImageUtils.loadHeadCC(data.getRoom_cover(), riv);
} else if (index == 3) {
tvName.setText(data.getGuild_name());
ImageUtils.loadHeadCC(data.getCover(), riv);
} else {
}
// else if (index == 3) {
// tvName.setText(data.getGuild_name());
// ImageUtils.loadHeadCC(data.getCover(), riv);
// }
else {
tvName.setText(data.getNickname());
ImageUtils.loadHeadCC(data.getAvatar(), riv);
}
@@ -360,7 +376,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
return;
}
tvXing1.setText(StringUtil.toWan2(data.getTotal(),1));
tvXing1.setBackgroundResource(type.equals("4") ? com.xscm.moduleutil.R.mipmap.bangdan3 :com.xscm.moduleutil.R.mipmap.bangdan4);
tvXing1.setBackgroundResource(type.equals("3") ? com.xscm.moduleutil.R.mipmap.bangdan3 :com.xscm.moduleutil.R.mipmap.bangdan4);
if (type.equals("0")) {
tvUsername1.setText(data.getRoom_name());
ImageUtils.loadHeadCC(data.getRoom_cover(), imUser1);
@@ -375,11 +391,13 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
tvUsername1.setText(data.getNickname());
ImageUtils.loadHeadCC(data.getAvatar(), imUser1);
tvId1.setText(data.getUser_code() != null ? "ID:" + data.getUser_code() : "");
} else if (type.equals("3")) {
tvUsername1.setText(data.getGuild_name());
ImageUtils.loadHeadCC(data.getCover(), imUser1);
tvId1.setText(data.getGuild_special_id() != null ? "ID:" + data.getGuild_special_id() : "");
} else {
}
// else if (type.equals("3")) {
// tvUsername1.setText(data.getGuild_name());
// ImageUtils.loadHeadCC(data.getCover(), imUser1);
// tvId1.setText(data.getGuild_special_id() != null ? "ID:" + data.getGuild_special_id() : "");
// }
else {
ImageUtils.loadHeadCC(data.getUser_avatar(), ivOneCp1Hhead);
ImageUtils.loadHeadCC(data.getUser_avatar1(), ivOneCp2Hhead);
tvUsername1.setText(data.getNickname());
@@ -413,7 +431,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
return;
}
tvXing2.setText(StringUtil.toWan2(data.getTotal(),1));
tvXing2.setBackgroundResource(type.equals("4") ? com.xscm.moduleutil.R.mipmap.bangdan3 :com.xscm.moduleutil.R.mipmap.bangdan4);
tvXing2.setBackgroundResource(type.equals("3") ? com.xscm.moduleutil.R.mipmap.bangdan3 :com.xscm.moduleutil.R.mipmap.bangdan4);
if (type.equals("0")) {
tvUsername2.setText(data.getRoom_name());
ImageUtils.loadHeadCC(data.getRoom_cover(), imUser2);
@@ -428,11 +446,13 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", data.getUser_id()).navigation();
}
});
} else if (type.equals("3")) {
tvUsername2.setText(data.getGuild_name());
ImageUtils.loadHeadCC(data.getCover(), imUser2);
tvId2.setText(data.getGuild_special_id() != null ? "ID:" + data.getGuild_special_id() : "");
} else {
}
// else if (type.equals("3")) {
// tvUsername2.setText(data.getGuild_name());
// ImageUtils.loadHeadCC(data.getCover(), imUser2);
// tvId2.setText(data.getGuild_special_id() != null ? "ID:" + data.getGuild_special_id() : "");
// }
else {
ImageUtils.loadHeadCC(data.getUser_avatar1(), ivOneCp1Hhead);
ImageUtils.loadHeadCC(data.getUser_avatar1(), ivOneCp2Hhead);
tvUsername2.setText(data.getNickname());
@@ -465,7 +485,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
return;
}
tvXing3.setText(StringUtil.toWan2(data.getTotal(),1));
tvXing3.setBackgroundResource(type.equals("4") ? com.xscm.moduleutil.R.mipmap.bangdan3 :com.xscm.moduleutil.R.mipmap.bangdan4);
tvXing3.setBackgroundResource(type.equals("3") ? com.xscm.moduleutil.R.mipmap.bangdan3 :com.xscm.moduleutil.R.mipmap.bangdan4);
if (type.equals("0")) {
tvUsername3.setText(data.getRoom_name());
ImageUtils.loadHeadCC(data.getRoom_cover(), imUser3);
@@ -481,11 +501,13 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", data.getUser_id()).navigation();
}
});
} else if (type.equals("3")) {
tvUsername3.setText(data.getGuild_name());
ImageUtils.loadHeadCC(data.getCover(), imUser3);
tvId3.setText(data.getGuild_special_id() != null ? "ID:" + data.getGuild_special_id() : "");
} else {
}
// else if (type.equals("3")) {
// tvUsername3.setText(data.getGuild_name());
// ImageUtils.loadHeadCC(data.getCover(), imUser3);
// tvId3.setText(data.getGuild_special_id() != null ? "ID:" + data.getGuild_special_id() : "");
// }
else {
ImageUtils.loadHeadCC(data.getUser_avatar(), ivOneCp1Hhead);
ImageUtils.loadHeadCC(data.getUser_avatar(), ivOneCp2Hhead);
tvUsername3.setText(data.getNickname());

View File

@@ -17,7 +17,8 @@ public class SectionsPagerAdapter extends FragmentPagerAdapter {
@StringRes
private static final int[] TAB_TITLES = new int[]{com.xscm.moduleutil.R.string.room_rank, com.xscm.moduleutil.R.string.wealth_rank,
com.xscm.moduleutil.R.string.charm_rank, com.xscm.moduleutil.R.string.guild_rank, com.xscm.moduleutil.R.string.true_love_rank};
com.xscm.moduleutil.R.string.charm_rank, com.xscm.moduleutil.R.string.true_love_rank};
// com.xscm.moduleutil.R.string.guild_rank,
private final Context mContext;
public SectionsPagerAdapter(Context context, FragmentManager fm) {
@@ -41,6 +42,6 @@ public class SectionsPagerAdapter extends FragmentPagerAdapter {
@Override
public int getCount() {
// Show 2 total pages.
return 5;
return 4;
}
}