1.修改BUG

2.礼物添加一键全送功能
3.转盘修改底部按钮展示、音效和特效功能
This commit is contained in:
2025-09-09 19:18:06 +08:00
parent 6d3f67e53c
commit c54cc692e0
36 changed files with 917 additions and 528 deletions

View File

@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-09-06T07:32:40.687375600Z">
<DropdownSelection timestamp="2025-09-09T08:46:46.893032600Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=3358318f" />
<DeviceId pluginId="PhysicalDevice" identifier="serial=34V0224723026458" />
</handle>
</Target>
</DropdownSelection>

View File

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

View File

@@ -16,6 +16,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -38,6 +39,7 @@ import androidx.databinding.ViewDataBinding;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.BarUtils;
import com.blankj.utilcode.util.LogUtils;
import com.hjq.toast.ToastUtils;
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
import com.xscm.moduleutil.R;
@@ -47,6 +49,7 @@ import com.xscm.moduleutil.event.MqttBean;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.BackgroundManager;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.DialogUtils;
import com.xscm.moduleutil.utils.DisplayUtil;
import com.xscm.moduleutil.utils.ImageUtils;
import com.xscm.moduleutil.utils.LanguageUtil;
@@ -279,6 +282,36 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
@Override
protected void onDestroy() {
// 清理MQTT相关资源
synchronized (mqttQueueLock) {
mqttMessageQueue.clear();
isMqttPlaying = false;
}
// 清理XLH相关资源
synchronized (xlhQueueLock) {
xlhMessageQueue.clear();
isXlhPlaying = false;
}
// 移除当前显示的视图
try {
if (currentMqttView != null && currentMqttView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentMqttView.getParent();
parent.removeView(currentMqttView);
}
currentMqttView = null;
if (currentXlhView != null && currentXlhView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentXlhView.getParent();
parent.removeView(currentXlhView);
}
currentXlhView = null;
} catch (Exception e) {
LogUtils.e("清理飘屏视图失败", e);
}
// 移除背景更新监听器
BackgroundManager.getInstance().removeListener(this);
// 移除颜色变化监听器
@@ -289,6 +322,12 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
try {
unregisterReceiver(mLogoutReceiver);
} catch (Exception e) {
// 忽略异常
}
try {
unregisterReceiver(mLogoutReceiver);
} catch (Exception e) {
@@ -363,372 +402,290 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
// 在类中添加以下成员变量
private final List<MqttBean> messageQueue = new ArrayList<>(); // 消息队列
private boolean isPlaying = false; // 播放状态标志
private boolean isPlaying2 = false; // 播放状态标志
private final Object queueLock = new Object(); // 队列同步锁
/// 礼物特效
// 在类中添加以下成员变量
private final List<MqttBean> mqttMessageQueue = new ArrayList<>(); // MQTT消息队列
private final List<XLHBean> xlhMessageQueue = new ArrayList<>(); // XLH消息队列
private boolean isMqttPlaying = false; // MQTT播放状态标志
private boolean isXlhPlaying = false; // XLH播放状态标志
private final Object mqttQueueLock = new Object(); // MQTT队列同步锁
private final Object xlhQueueLock = new Object(); // XLH队列同步锁
private View currentMqttView = null; // 当前正在播放的MQTT视图
private View currentXlhView = null; // 当前正在播放的XLH视图
/// 礼物特效 - MQTT消息处理
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageReceived(MqttBean mqttBean) {
if (mqttBean == null) {
return;
LogUtils.e("收到MQTT", mqttBean);
if (mqttBean == null) return;
synchronized (mqttQueueLock) {
mqttMessageQueue.add(mqttBean);
if (!isMqttPlaying) {
isMqttPlaying = true;
processNextMqttMessage();
}
}
}
// 将消息添加到队列
synchronized (queueLock) {
messageQueue.add(mqttBean);
}
// 尝试播放下一个消息
processNextMessage();
/// XLH消息处理
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(XLHBean event) {
LogUtils.e("收到XLH", event);
if (event == null) return;
synchronized (xlhQueueLock) {
xlhMessageQueue.add(event);
if (!isXlhPlaying) {
isXlhPlaying = true;
processNextXlhMessage();
}
}
}
private void processNextMessage() {
synchronized (queueLock) {
// 如果正在播放或队列为空,则不处理
if (isPlaying || messageQueue.isEmpty()) {
return;
}
// 标记为正在播放
isPlaying = true;
}
// 处理下一个MQTT消息
private void processNextMqttMessage() {
MqttBean mqttBean;
synchronized (queueLock) {
mqttBean = messageQueue.remove(0); // 取出队列中的第一个消息
synchronized (mqttQueueLock) {
if (mqttMessageQueue.isEmpty()) {
isMqttPlaying = false;
return;
}
mqttBean = mqttMessageQueue.remove(0);
}
// 显示飘屏消息
showFloatingMessage(mqttBean);
}
// 处理下一个XLH消息
private void processNextXlhMessage() {
XLHBean xlhBean;
synchronized (xlhQueueLock) {
if (xlhMessageQueue.isEmpty()) {
isXlhPlaying = false;
return;
}
xlhBean = xlhMessageQueue.remove(0);
}
showPiaoPingMessageXlh(xlhBean);
}
ViewGroup decorView;
ViewGroup decorView1;
private void showFloatingMessage(MqttBean mqttBean) {
ViewGroup decorView = (ViewGroup) this.getWindow().getDecorView();
// 如果浮动视图未创建,则创建一次
View floatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
try {
// 清理之前的视图(如果存在)
if (currentMqttView != null && currentMqttView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentMqttView.getParent();
parent.removeView(currentMqttView);
}
// 设置布局参数
if (decorView == null) {
decorView = (ViewGroup) getWindow().getDecorView();
}
currentMqttView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT
);
FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 70);
layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL;
floatingView.setLayoutParams(layoutParams);
layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
currentMqttView.setLayoutParams(layoutParams);
decorView.addView(currentMqttView);
// 初始化动画监听器
setupAnimationListener(floatingView, decorView);
// 更新视图数据
updateFloatingViewData(floatingView, mqttBean);
// 如果浮动视图未添加到 decorView则添加
decorView.addView(floatingView);
// 重置视图位置并开始动画
resetAndStartAnimation(floatingView);
updateFloatingViewData(currentMqttView, mqttBean);
resetAndStartMqttAnimation(currentMqttView, () -> {
// 清理当前视图
if (currentMqttView != null && currentMqttView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentMqttView.getParent();
parent.removeView(currentMqttView);
}
currentMqttView = null;
private void setupAnimationListener(View floatingView, ViewGroup decorView) {
// 为视图添加一个全局布局监听器,确保在视图完全加载后再设置动画
floatingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// 移除监听器,避免重复调用
floatingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
// 确保初始位置在屏幕右侧外部
floatingView.setTranslationX(floatingView.getWidth());
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
floatingView.getWidth(), 0f);
animator1.setDuration(1500); // 延长动画时间到1.5秒
animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
animator1.start();
// 第二阶段延迟1秒后从当前位置向左滑出
floatingView.postDelayed(() -> {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
0f, -floatingView.getWidth());
animator2.setDuration(1500); // 延长动画时间到1.5秒
animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
animator2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// 动画结束后移除悬浮窗
decorView.removeView(floatingView);
// 标记播放结束并处理下一个消息
synchronized (queueLock) {
isPlaying = false;
}
processNextMessage();
// 处理队列中的下一条消息
synchronized (mqttQueueLock) {
isMqttPlaying = false;
processNextMqttMessage();
}
});
animator2.start();
}, 3000); // 停留1秒
}
});
}
private void resetAndStartAnimation(View floatingView) {
// 重置视图位置并开始动画
floatingView.setTranslationX(floatingView.getWidth());
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
floatingView.getWidth(), 0f);
animator1.setDuration(1500);
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
animator1.start();
// 第二阶段延迟1秒后从当前位置向左滑出
floatingView.postDelayed(() -> {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
0f, -floatingView.getWidth());
animator2.setDuration(1500);
animator2.setInterpolator(new DecelerateInterpolator(2.0f));
animator2.start();
}, 3000);
}
private void updateFloatingViewData(View floatingView, MqttBean mqttBean) {
TextView textView = floatingView.findViewById(R.id.tv_name);
TextView textView2 = floatingView.findViewById(R.id.tv_to_name);
TextView tv_time = floatingView.findViewById(R.id.tv_num);
if (mqttBean.getList() != null) {
if (mqttBean.getList().getToUserName() != null) {
textView2.setText("送给" + mqttBean.getList().getToUserName());
} else {
textView2.setText("送给");
}
if (mqttBean.getList().getFromUserName() != null) {
textView.setText(mqttBean.getList().getFromUserName());
} else {
textView.setText("");
}
if (mqttBean.getList().getGift_picture() != null) {
ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), floatingView.findViewById(R.id.iv_piaoping));
}
if (mqttBean.getList().getNumber() != null) {
tv_time.setText("x" + mqttBean.getList().getNumber());
} else {
tv_time.setText("x1");
}
} else {
textView2.setText("送给");
textView.setText("");
tv_time.setText("x1");
} catch (Exception e) {
LogUtils.e("显示MQTT飘屏失败", e);
// 出现异常时继续处理队列
synchronized (mqttQueueLock) {
isMqttPlaying = false;
processNextMqttMessage();
}
}
// private void showFloatingMessage(MqttBean mqttBean) {
// ViewGroup decorView = (ViewGroup) this.getWindow().getDecorView();
// View floatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
//
// // 设置布局参数使整个布局显示在屏幕顶部并距离顶部100dp
// FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
// FrameLayout.LayoutParams.MATCH_PARENT,
// FrameLayout.LayoutParams.WRAP_CONTENT
// );
// layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 100); // 距离顶部100dp
// layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL; // 顶部居中
// floatingView.setLayoutParams(layoutParams);
//
// TextView textView = floatingView.findViewById(R.id.tv_name);
// TextView textView2 = floatingView.findViewById(R.id.tv_to_name);
// TextView tv_time = floatingView.findViewById(R.id.tv_num);
//
// // 添加对 getList() 返回值的空值检查
// if (mqttBean.getList() != null) {
// // 检查各个字段是否为 null
// if (mqttBean.getList().getToUserName() != null) {
// textView2.setText("送给" + mqttBean.getList().getToUserName());
// } else {
// textView2.setText("送给");
// }
//
// if (mqttBean.getList().getFromUserName() != null) {
// textView.setText(mqttBean.getList().getFromUserName());
// } else {
// textView.setText("");
// }
//
// // 检查礼物图片
// if (mqttBean.getList().getGift_picture() != null) {
// ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), floatingView.findViewById(R.id.iv_piaoping));
// }
//
// // 检查数量
// if (mqttBean.getList().getNumber() != null) {
// tv_time.setText("x" + mqttBean.getList().getNumber());
// } else {
// tv_time.setText("x1");
// }
// } else {
// // 如果 getList() 返回 null设置默认值
// textView2.setText("送给");
// textView.setText("");
// tv_time.setText("x1");
// }
//
// floatingView.setTranslationX(10000); // 先放到屏幕外
//
// floatingView.post(() -> {
// // 确保初始位置在屏幕右侧外部
// floatingView.setTranslationX(floatingView.getWidth());
//
// // 第一阶段:从右到屏幕右侧边缘(缓慢进入)
// ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
// floatingView.getWidth(), 0f);
// animator1.setDuration(1500); // 延长动画时间到1.5秒
// animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
// animator1.start();
//
// // 第二阶段延迟1秒后从当前位置向左滑出
// floatingView.postDelayed(() -> {
// ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
// 0f, -floatingView.getWidth());
// animator2.setDuration(1500); // 延长动画时间到1.5秒
// animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
// animator2.addListener(new AnimatorListenerAdapter() {
// @Override
// public void onAnimationEnd(Animator animation) {
// // 动画结束后移除悬浮窗
// decorView.removeView(floatingView);
//
// // 标记播放结束并处理下一个消息
// synchronized (queueLock) {
// isPlaying = false;
// }
// processNextMessage();
// }
// });
// animator2.start();
// }, 3000); // 停留1秒
// });
// decorView.addView(floatingView);
// }
// 在类中添加新的成员变量
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(XLHBean event) {
showPiaoPingMessageXlh(event);
}
private void showPiaoPingMessageXlh(XLHBean event) {
// 创建 FloatingX 配置
ViewGroup decorView = (ViewGroup) this.getWindow().getDecorView();
try {
// 清理之前的视图(如果存在)
if (currentXlhView != null && currentXlhView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentXlhView.getParent();
parent.removeView(currentXlhView);
}
// 如果XLH浮动视图未创建则创建一次
View xlhFloatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping_xlh, null);
if (decorView1 == null) {
decorView1 = (ViewGroup) getWindow().getDecorView();
}
// 设置布局参数
currentXlhView = LayoutInflater.from(this).inflate(R.layout.item_piaoping_xlh, null);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT
);
FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 100);
layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL;
xlhFloatingView.setLayoutParams(layoutParams);
layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
currentXlhView.setLayoutParams(layoutParams);
decorView1.addView(currentXlhView);
// 初始化动画监听器
setupXlhAnimationListener(xlhFloatingView, decorView);
updateXlhFloatingViewData(xlhFloatingView, event);
// 如果浮动视图未添加到 decorView则添加
decorView.addView(xlhFloatingView);
// 重置视图位置并开始动画
resetAndStartXlhAnimation(xlhFloatingView);
updateXlhFloatingViewData(currentXlhView, event);
resetAndStartXlhAnimation(currentXlhView, () -> {
// 清理当前视图
if (currentXlhView != null && currentXlhView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentXlhView.getParent();
parent.removeView(currentXlhView);
}
currentXlhView = null;
private void setupXlhAnimationListener(View floatingView, ViewGroup decorView) {
// 为视图添加一个全局布局监听器,确保在视图完全加载后再设置动画
floatingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// 移除监听器,避免重复调用
floatingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
// 确保初始位置在屏幕右侧外部
floatingView.setTranslationX(floatingView.getWidth());
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
floatingView.getWidth(), 0f);
animator1.setDuration(1500); // 延长动画时间到1.5秒
animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
animator1.start();
// 第二阶段延迟1秒后从当前位置向左滑出
floatingView.postDelayed(() -> {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
0f, -floatingView.getWidth());
animator2.setDuration(1500); // 延长动画时间到1.5秒
animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
animator2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// 动画结束后移除悬浮窗
decorView.removeView(floatingView);
// 标记播放结束并处理下一个消息
synchronized (queueLock) {
isPlaying = false;
}
processNextMessage();
// 处理队列中的下一条消息
synchronized (xlhQueueLock) {
isXlhPlaying = false;
processNextXlhMessage();
}
});
animator2.start();
}, 3000); // 停留1秒
} catch (Exception e) {
LogUtils.e("显示XLH飘屏失败", e);
// 出现异常时继续处理队列
synchronized (xlhQueueLock) {
isXlhPlaying = false;
processNextXlhMessage();
}
}
});
}
private void resetAndStartXlhAnimation(View floatingView) {
// 重置视图位置并开始动画
floatingView.setTranslationX(floatingView.getWidth());
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
floatingView.getWidth(), 0f);
private void resetAndStartMqttAnimation(View view, Runnable onAnimationEnd) {
try {
view.setTranslationX(view.getWidth());
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
animator1.setDuration(1500);
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
animator1.start();
// 第二阶段延迟1秒后从当前位置向左滑出
floatingView.postDelayed(() -> {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
0f, -floatingView.getWidth());
view.postDelayed(() -> {
try {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", 0f, -view.getWidth());
animator2.setDuration(1500);
animator2.setInterpolator(new DecelerateInterpolator(2.0f));
animator2.start();
}, 3000);
animator2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onAnimationEnd.run();
}
private void updateXlhFloatingViewData(View xlhFloatingView, XLHBean xlhBean) {
TextView textView = xlhFloatingView.findViewById(R.id.tv_name);
ImageView xlh_image = xlhFloatingView.findViewById(R.id.im_xlh);
@Override
public void onAnimationCancel(Animator animation) {
onAnimationEnd.run();
}
});
animator2.start();
} catch (Exception e) {
LogUtils.e("MQTT动画执行失败", e);
onAnimationEnd.run();
}
}, 3000);
} catch (Exception e) {
LogUtils.e("MQTT动画启动失败", e);
onAnimationEnd.run();
}
}
private void resetAndStartXlhAnimation(View view, Runnable onAnimationEnd) {
try {
view.setTranslationX(view.getWidth());
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
animator1.setDuration(1500);
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
animator1.start();
view.postDelayed(() -> {
try {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", 0f, -view.getWidth());
animator2.setDuration(1500);
animator2.setInterpolator(new DecelerateInterpolator(2.0f));
animator2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onAnimationEnd.run();
}
@Override
public void onAnimationCancel(Animator animation) {
onAnimationEnd.run();
}
});
animator2.start();
} catch (Exception e) {
LogUtils.e("XLH动画执行失败", e);
onAnimationEnd.run();
}
}, 3000);
} catch (Exception e) {
LogUtils.e("XLH动画启动失败", e);
onAnimationEnd.run();
}
}
private void updateFloatingViewData(View view, MqttBean mqttBean) {
TextView textView = view.findViewById(R.id.tv_name);
TextView textView2 = view.findViewById(R.id.tv_to_name);
TextView tv_time = view.findViewById(R.id.tv_num);
if (mqttBean.getList() != null) {
textView2.setText("送给" + (mqttBean.getList().getToUserName() != null ? mqttBean.getList().getToUserName() : ""));
textView.setText(mqttBean.getList().getFromUserName() != null ? mqttBean.getList().getFromUserName() : "");
if (mqttBean.getList().getGift_picture() != null) {
ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), view.findViewById(R.id.iv_piaoping));
}
tv_time.setText("x" + (mqttBean.getList().getNumber() != null ? mqttBean.getList().getNumber() : "1"));
} else {
textView2.setText("送给");
textView.setText("");
tv_time.setText("x1");
}
}
private void updateXlhFloatingViewData(View view, XLHBean xlhBean) {
TextView textView = view.findViewById(R.id.tv_name);
ImageView xlh_image = view.findViewById(R.id.im_xlh);
if (xlhBean != null) {
xlh_image.setImageDrawable(xlhBean.getFrom_type() == 1 ? getResources().getDrawable(R.mipmap.xlh_jjks) : getResources().getDrawable(R.mipmap.xlh_zsks));
xlh_image.setImageDrawable(xlhBean.getFrom_type() == 1 ?
getResources().getDrawable(R.mipmap.xlh_jjks) :
getResources().getDrawable(R.mipmap.xlh_zsks));
textView.setText(xlhBean.getText());
} else {
textView.setText("");
}
view.setOnClickListener(v -> {
// 点击时执行跳转操作
handleItemClick(xlhBean);
});
}
private void handleItemClick(XLHBean xlhBean) {
// 这里可以根据实际需求实现跳转逻辑
// 例如:跳转到礼物详情页面、用户主页等
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", xlhBean.getRoom_id()).navigation();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(ChatInfo event) {
String id = event.getId().replace("g", "");

View File

@@ -44,6 +44,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
private List<RoonGiftModel> giftList = new ArrayList<>();
private List<GiftPackBean> giftPackList = new ArrayList<>();
private String roomId;
private String bdgiftId;
public static GiftTwoDetailsFragment newInstance(String id, int type, String roomId) {
@@ -92,6 +93,12 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onString(String giftId){
bdgiftId=giftId;
MvpPre.giftPack();
}
@Override
protected void initData() {
if (id.equals("0")) {
@@ -176,6 +183,15 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Override
public void giftPack(List<GiftPackBean> giftPackBean) {
giftPackList = new ArrayList<>();
if (bdgiftId!=null){
for (GiftPackBean item : giftPackBean){
if (item.getGift_id().equals(bdgiftId)){
item.setChecked(true);
}
}
}
giftPackList.addAll(giftPackBean);
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
@@ -186,6 +202,11 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
}
}
@Override
public void getGiftPack(String s) {
}
@Override
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {

View File

@@ -4,27 +4,23 @@ import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.AssetFileDescriptor;
import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.GridView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftBean;
import com.xscm.moduleutil.bean.RoomMessageEvent;
@@ -35,7 +31,6 @@ import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
import com.xscm.moduleutil.databinding.DialogGiftLotteryBinding;
import com.xscm.moduleutil.dialog.WebViewDialog;
import com.xscm.moduleutil.event.LotteryEvent;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.widget.CircularProgressView;
import com.xscm.moduleutil.widget.GiftCardView;
@@ -94,6 +89,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
private GiftLotteryDialogFragment giftLotteryDialogFragment;
private String blind_box_turntable_id = "";//本次抽奖标识id
private BlindBoxBean.XlhData xlhData;
private int icon;//金币金额
@Override
protected GiftLotteryPresenter bindPresenter() {
@@ -311,7 +307,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
if (id == R.id.ll_one) {
if (!isDrawing) {
isDrawing = true;
init(1);
// init(1);
startType = 1;
MvpPre.drawGiftList(giftBagId, userIds, roomId, "1");
} else {
@@ -321,7 +317,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
} else if (id == R.id.ll_ten) {
if (!isDrawing) {
isDrawing = true;
init(2);
// init(2);
startType = 2;
MvpPre.drawGiftList(giftBagId, userIds, roomId, "10");
@@ -331,7 +327,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
} else if (id == R.id.ll_hundred) {//抽奖100次
if (!isDrawing) {
isDrawing = true;
init(3);
// init(3);
startType = 3;
MvpPre.drawGiftList(giftBagId, userIds, roomId, "100");
} else {
@@ -383,6 +379,77 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
}
}
private void setBackground() {
// 预加载资源
Drawable drawableX = ContextCompat.getDrawable(getContext(), R.mipmap.chou_x);
Drawable drawableW = ContextCompat.getDrawable(getContext(), R.mipmap.chou_w);
if (icon > 0 && box_price > 0) {
if (type == 10) {
updateBackground(mBinding.mirroeSky.llOne, icon > box_price, drawableX, drawableW);
updateBackground(mBinding.mirroeSky.llTen, icon > box_price * 10, drawableX, drawableW);
updateBackground(mBinding.mirroeSky.llHundred, icon > box_price * 100, drawableX, drawableW);
} else if (type == 11) {
updateBackground(mBinding.cityTime.llOne, icon > box_price, drawableX, drawableW);
updateBackground(mBinding.cityTime.llTen, icon > box_price * 10, drawableX, drawableW);
updateBackground(mBinding.cityTime.llHundred, icon > box_price * 100, drawableX, drawableW);
} else if (type == 12) {
updateBackground(mBinding.pinnacleTime.llOne, icon > box_price, drawableX, drawableW);
updateBackground(mBinding.pinnacleTime.llTen, icon > box_price * 10, drawableX, drawableW);
updateBackground(mBinding.pinnacleTime.llHundred, icon > box_price * 100, drawableX, drawableW);
} else {
// 兜底处理:未知 type 时全部设为不可点击 + 默认背景
setAllBackgroundToDefault(drawableW);
}
} else {
// icon 或 box_price <= 0 时全部置灰不可点击
setAllBackgroundToDefault(drawableW);
}
}
private void updateBackground(View view, boolean clickable, Drawable drawableX, Drawable drawableW) {
if (clickable) {
view.setBackground(drawableX);
view.setClickable(true);
} else {
view.setBackground(drawableW);
view.setClickable(false);
}
}
private void setAllBackgroundToDefault(Drawable defaultDrawable) {
switch (type) {
case 10:
mBinding.mirroeSky.llOne.setBackground(defaultDrawable);
mBinding.mirroeSky.llTen.setBackground(defaultDrawable);
mBinding.mirroeSky.llHundred.setBackground(defaultDrawable);
mBinding.mirroeSky.llOne.setClickable(false);
mBinding.mirroeSky.llTen.setClickable(false);
mBinding.mirroeSky.llHundred.setClickable(false);
break;
case 11:
mBinding.cityTime.llOne.setBackground(defaultDrawable);
mBinding.cityTime.llTen.setBackground(defaultDrawable);
mBinding.cityTime.llHundred.setBackground(defaultDrawable);
mBinding.cityTime.llOne.setClickable(false);
mBinding.cityTime.llTen.setClickable(false);
mBinding.cityTime.llHundred.setClickable(false);
break;
case 12:
mBinding.pinnacleTime.llOne.setBackground(defaultDrawable);
mBinding.pinnacleTime.llTen.setBackground(defaultDrawable);
mBinding.pinnacleTime.llHundred.setBackground(defaultDrawable);
mBinding.pinnacleTime.llOne.setClickable(false);
mBinding.pinnacleTime.llTen.setClickable(false);
mBinding.pinnacleTime.llHundred.setClickable(false);
break;
default:
// 忽略未知类型
break;
}
}
private void init(int type) {
if (type == 1) {
mBinding.mirroeSky.llOne.setBackground(getResources().getDrawable(R.mipmap.chou_x));
@@ -515,7 +582,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
finishTargetArrayIndex.add(index);
foundTarget = true;
if (!isOpenSpecial || !isOpenSound) {
playSound("draw.mp3");
playSound("xuanz.mp3");
}
break;
@@ -605,11 +672,12 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
}
private String getRule_url;
private int box_price;//服务器返回的单次抽奖价格
@Override
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
if (blindBoxBean != null && blindBoxBean.getGift_list() != null) {
box_price = blindBoxBean.getBox_price();
upTitle(blindBoxBean.getBox_price());
giftLists = blindBoxBean.getGift_list();
getRule_url = blindBoxBean.getRule_url();
@@ -647,6 +715,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
}
}
}
setBackground();
}
@@ -654,16 +723,16 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
if (type == 10) {
mBinding.mirroeSky.oneTitle.setText(boxPrice + "币一次");
mBinding.mirroeSky.tenTitle.setText((boxPrice * 10) + "币十次");
mBinding.mirroeSky.hundredTitle.setText((boxPrice*100)+"");
mBinding.mirroeSky.hundredTitle.setText((boxPrice * 100) + "");
} else if (type == 11) {
mBinding.cityTime.oneTitle.setText(boxPrice + "币一次");
mBinding.cityTime.tenTitle.setText((boxPrice * 10) + "币十次");
mBinding.cityTime.hundredTitle.setText((boxPrice*100)+"");
mBinding.cityTime.hundredTitle.setText((boxPrice * 100) + "");
} else if (type == 12) {
mBinding.pinnacleTime.oneTitle.setText(boxPrice + "币一次");
mBinding.pinnacleTime.tenTitle.setText((boxPrice * 10) + "币十次");
mBinding.pinnacleTime.hundredTitle.setText((boxPrice*100)+"");
mBinding.pinnacleTime.hundredTitle.setText((boxPrice * 100) + "");
}
}
@@ -713,11 +782,17 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
}
}
@Override
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
if (blindReslutBean != null && blindReslutBean.getReslut_list() != null &&
!blindReslutBean.getReslut_list().isEmpty()) {
for (GiftCardView gridView : allViewsArray) {
gridView.setSelected(false);
gridView.stopPulseAnimationWithLayer();
gridView.setVisibilitymResultTextView(false);
}
// 清空之前的数据
targetArrayIndex.clear();
finishTargetArrayIndex.clear();
@@ -739,7 +814,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
if (!isOpenSpecial) {
giftCardView.setVisibilitymResultTextView(true);
giftCardView.setSelected(true);
playSound("draw.mp3");
playSound("xuanz.mp3");
// 不要设置isDrawing=true这会影响动画控制
MvpPre.wallet();
isDrawing = false;
@@ -775,6 +850,11 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
@Override
public void wallet(WalletBean walletBean) {
if (walletBean != null) {
icon = (int) Double.parseDouble(
(walletBean.getCoin() != null && !walletBean.getCoin().isEmpty())
? walletBean.getCoin()
: "0"
);
if (type == 10) {
mBinding.mirroeSky.tvIcon.setText(walletBean.getCoin());
} else if (type == 11) {
@@ -783,6 +863,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
mBinding.pinnacleTime.tvIcon.setText(walletBean.getCoin());
}
}
setBackground();
}

View File

@@ -763,4 +763,9 @@ public interface ApiServer {
@GET(Constants.GET_XLH_MY_RECORD)
Call<BaseModel<List<GiftBean>>> xlhMyRecord(@Query("room_id") String room_id, @Query("page") String page, @Query("page_size") String page_size);
@FormUrlEncoded
@POST(Constants.POST_GIFT_ALL_CLEAR)
Call<BaseModel<String>> getGiftPack(@Field("room_id") String roomId,@Field("to_uid") String user_id);
}

View File

@@ -457,6 +457,27 @@ public class RetrofitClient {
sApiServer.giftPack().compose(new DefaultTransformer<>()).subscribe(observer);
}
public void getGiftPack(String roomId, String userId,BaseObserver<String> observer){
sApiServer.getGiftPack(roomId,userId).enqueue(new Callback<BaseModel<String>>() {
@Override
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
if (response.code() == 200){
BaseModel<String> baseModel = response.body();
if (baseModel.getCode() == 1){
observer.onNext(baseModel.getMsg());
}else {
observer.onNext(null);
}
}
}
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
t.printStackTrace();
}
});
}
public void tasksLihen(BaseObserver<GiftBoxBean> observer) {
sApiServer.tasksLihen().enqueue(new Callback<ResponseBody>() {
@Override

View File

@@ -27,6 +27,8 @@ public class RewardGiftContacts {
void reward_zone();
void roomAuctionJoin(RoomAuction.AuctionListBean auctionListBean);
void giftPack(List<GiftPackBean> giftPackBean);
void getGiftPack(String s);
}
public interface IIndexPre extends IPresenter {
@@ -48,5 +50,7 @@ public class RewardGiftContacts {
void roomAuctionJoin(String auction_id,String user_id, String gift_id, String num,String type);
void giftPack();
void getGiftPack(String roomId,String userId);
}
}

View File

@@ -208,4 +208,26 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
}
});
}
@Override
public void getGiftPack(String roomId,String userId) {
api.getGiftPack(roomId,userId, new BaseObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(String s) {
if (MvpRef==null){
MvpRef = new WeakReference<>(mView);
}
if (s==null){
MvpRef.get().getGiftPack(null);
}else {
MvpRef.get().getGiftPack(s);
}
}
});
}
}

View File

@@ -34,7 +34,7 @@ public class MqttInitCallback implements MqttCallback {
@Override
public void connectionLost(Throwable cause) {
Log.d(Tag,"mqtt连接断开,执行重连");
ToastUtils.show("mqtt连接断开,执行重连");
// ToastUtils.show("mqtt连接断开,执行重连");
mqttConnect = MqttConnect.getInstance(context, HOST, clientId);
mqttConnect.mqttClient();
}

View File

@@ -1284,14 +1284,14 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
// 清空队列
clearQueue();
// 释放资源
releaseResources();
// releaseResources();
// 清空队列
// playQueue.clear();
// 关闭动画
// if (mBinding.image != null && isPlaying && mBinding.image.isAnimating()) {
// mBinding.image.setAnimation(null);
// mBinding.image.clearAnimation();
// mBinding.image.stopAnimation();
// if (mBinding.playView != null && isPlaying && mBinding.playView.isRunning()) {
// mBinding.playView.setAnimation(null);
// mBinding.playView.clearAnimation();
// mBinding.playView.stopPlay();
// }
}

View File

@@ -384,6 +384,7 @@ public class Constants {
public static final String POST_DRAW_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh_draw_gift";///巡乐会抽奖
public static final String POST_XLH_ALL_RECORD = "/api/BlindBoxTurntable/get_xlh_all_record";///巡乐会榜单
public static final String GET_XLH_MY_RECORD = "/api/BlindBoxTurntable/get_xlh_my_record";///巡乐会记录
public static final String POST_GIFT_ALL_CLEAR = "/api/Room/room_gift_all_clear";///背包礼物全清

View File

@@ -191,4 +191,9 @@ public class RewardDialogFragment extends BaseMvpDialogFragment<RewardGiftPresen
public void giftPack(List<GiftPackBean> giftPackBean) {
}
@Override
public void getGiftPack(String s) {
}
}

View File

@@ -287,6 +287,11 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
}
@Override
public void getGiftPack(String s) {
}
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
private List<GiftLabelBean> list;

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -80,7 +80,7 @@
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_20"/>
android:layout_height="@dimen/dp_45"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

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

View File

@@ -366,6 +366,11 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
@Override
protected void onResume() {
super.onResume();
if (isTaskRoot() &&CommonAppContext.getInstance().isPlaying && CommonAppContext.getInstance().isShow) {
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
}
MvpPre.loginIm();
Logger.i("MainActivity", "onResume");
// Beta.checkAppUpgrade(false, false);
@@ -380,9 +385,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
} else {
mBinding.ll.setVisibility(View.INVISIBLE);
}
if (CommonAppContext.getInstance().isPlaying && CommonAppContext.getInstance().isShow) {
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
}
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
@Override

View File

@@ -159,6 +159,7 @@ import org.greenrobot.eventbus.ThreadMode;
import java.lang.ref.WeakReference;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -212,7 +213,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
private PublicScreenEaseChatFragment publicScreenFragment; // 添加成员变量
// 添加成员变量
private boolean isLayoutAdjusted = false;
private ViewStub stub;
// private ViewStub stub;
private static WeakReference<RoomActivity> sActivityRef;
// 存储当前显示的弹框引用
private List<DialogInterface> activeDialogs = new ArrayList<>();
@@ -457,7 +458,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.roomTop.btnFollow, ColorManager.getInstance().getPrimaryColorInt(), 53);
mBinding.roomTop.btnFollow.setTextColor(ColorManager.getInstance().getButtonColorInt());
initPublicScreenFragment();
stub = mBinding.roomTop.stubButtons.getViewStub();
// stub = mBinding.roomTop.stubButtons.getViewStub();
// 为透明 View 设置触摸监听
mBinding.roomTop.rlTop.setOnTouchListener(new View.OnTouchListener() {
@@ -473,10 +474,10 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
layoutParams.height = SystemUtils.getWidth(74); // 示例高度
mBinding.roomTop.getRoot().setLayoutParams(layoutParams);
ViewGroup.LayoutParams layoutParams2 = mBinding.vpRoomPager.getLayoutParams();
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
layoutParams.height = SystemUtils.getWidth(74); // 示例高度
mBinding.roomTop.getRoot().setLayoutParams(layoutParams);
// ViewGroup.LayoutParams layoutParams2 = mBinding.vpRoomPager.getLayoutParams();
// layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
// layoutParams.height = SystemUtils.getWidth(74); // 示例高度
// mBinding.roomTop.getRoot().setLayoutParams(layoutParams);
}
private void onGiftGiveProgressClcik() {
@@ -919,6 +920,18 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
});
mRoomInfoResp.getRoom_info().setPit_list(pitList);
// 更新当前用户的 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()));
}
}
roomFragment.updateSeatViewExchangedWithPitArray(mRoomInfoResp);
}
@@ -1023,7 +1036,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
customMusicFloatingView.destroy();
}
AgoraManager.getInstance(RoomActivity.this).desMusic();
stub.setVisibility(View.GONE);
// stub.setVisibility(View.GONE);
MvpPre.postRoomInfo(roomId);
}
@@ -1673,6 +1686,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
if (event.isEffectOn()) {//特效开启
mBinding.svgaGift.setVisibility(View.VISIBLE);
} else {
// mBinding.svgaGift.closeEffect();
mBinding.svgaGift.closeEffect();
mBinding.svgaGift.setVisibility(View.GONE);
}
@@ -1712,7 +1726,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
addActiveDialog(roomNoticeDialogFragment);
} else if (id == R.id.btn_ranking) {//排行榜
// RoomChartsFragment.newInstance(roomId).show(getSupportFragmentManager(), "RoomChartsFragment");
RoomChartsFragment fragment = RoomChartsFragment.newInstance(roomId);
RoomChartsFragment fragment = RoomChartsFragment.newInstance(roomId,mRoomInfoResp);
fragment.show(getSupportFragmentManager(), "RoomChartsFragment");
addActiveDialogFragment(fragment);
} else if (id == R.id.btn_close_live) {
@@ -1942,34 +1956,54 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
}
public void setRoleType(int roleType, int pit_number) {
RelativeLayout rl_voive = mBinding.rlVoive;
RelativeLayout rl_voice = mBinding.rlVoive; // 注意:原拼写错误已修正
RelativeLayout rl_mic = mBinding.rlMic;
RelativeLayout rl_more = mBinding.rlMore;
RelativeLayout rl_misc = mBinding.rlMisc;
// 默认隐藏所有按钮
rl_voive.setVisibility(View.GONE);
rl_voice.setVisibility(View.GONE);
rl_more.setVisibility(View.GONE);
rl_misc.setVisibility(View.GONE);
rl_mic.setVisibility(View.GONE);
// 空指针保护
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null || mRoomInfoResp.getUser_info() == null) {
return;
}
String typeId = mRoomInfoResp.getRoom_info().getType_id();
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
int userPitNumber = mRoomInfoResp.getUser_info().getPit_number();
// 特殊房间类型处理(优先级最高)
if ("6".equals(typeId)) {
mBinding.rlMessage.setVisibility(View.GONE);
return; // 全部隐藏,无需继续处理
}
if ("7".equals(typeId)) {
rl_more.setVisibility(View.GONE);
rl_misc.setVisibility(View.GONE);
}
// 根据角色类型显示按钮
switch (roleType) {
case 2: // 主持人
case 1: // 房主
case 2: // 主持人
case 3: // 麦上用户
rl_voive.setVisibility(View.VISIBLE);
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_misc.setVisibility(View.VISIBLE);
break;
case 0: // 观众
rl_voive.setVisibility(View.VISIBLE);
rl_voice.setVisibility(View.VISIBLE);
rl_mic.setVisibility(pit_number != 0 ? View.VISIBLE : View.GONE);
rl_misc.setVisibility(View.VISIBLE);
break;
case 5: // 房间管理员
rl_voive.setVisibility(View.VISIBLE);
rl_voice.setVisibility(View.VISIBLE);
rl_more.setVisibility(View.GONE);
rl_misc.setVisibility(View.GONE);
break;
@@ -1977,24 +2011,24 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
break;
}
if ("2".equals(mRoomInfoResp.getRoom_info().getType_id())) {
// 类型房间规则覆盖
if ("2".equals(typeId)) {
rl_misc.setVisibility(View.GONE);
rl_more.setVisibility(View.GONE);
} else if (roleType != 5) {
rl_misc.setVisibility(View.VISIBLE);
if (mRoomInfoResp.getUser_info().getPit_number() == 9) {
if (userPitNumber == 9) {
rl_more.setVisibility(View.VISIBLE);
}
}
if (("1".equals(mRoomInfoResp.getRoom_info().getType_id()) ||
"4".equals(mRoomInfoResp.getRoom_info().getType_id()) ||
"3".equals(mRoomInfoResp.getRoom_info().getType_id())) &&
"2".equals(mRoomInfoResp.getRoom_info().getLabel_id())) {
// label_id 和 type_id 联合判断
if (Arrays.asList("1", "3", "4").contains(typeId) && "2".equals(labelId)) {
rl_more.setVisibility(View.GONE);
}
if (mRoomInfoResp.getUser_info().getPit_number() > 0) {
// mic 显示逻辑
if (userPitNumber > 0) {
rl_mic.setVisibility(View.VISIBLE);
switchMic(2);
} else {
@@ -2002,25 +2036,15 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
rl_mic.setVisibility(View.VISIBLE);
switchMic(2);
} else if (pit_number == -1) {
rl_mic.setVisibility(View.VISIBLE); // 原代码此处缺少 View. 前缀,已补全
switchMic(1);
rl_mic.setVisibility(VISIBLE);
} else {
switchMic(2);
rl_mic.setVisibility(View.GONE);
switchMic(2);
}
}
}
if ("6".equals(mRoomInfoResp.getRoom_info().getType_id())) {
rl_voive.setVisibility(View.GONE);
rl_more.setVisibility(View.GONE);
rl_misc.setVisibility(View.GONE);
rl_mic.setVisibility(View.GONE);
mBinding.rlMessage.setVisibility(View.GONE);
} else if ("7".equals(mRoomInfoResp.getRoom_info().getType_id())) {
rl_more.setVisibility(View.GONE);
rl_misc.setVisibility(View.GONE);
}
}
public void isMute(int is_mute) {
RoomMessageEvent.text text = new RoomMessageEvent.text();
@@ -2748,6 +2772,14 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
}
AgoraManager.getInstance(this).stopMuisc();
initializeAudio();
if (mRoomInfoResp.getRoom_info().getLabel_id().equals("2") || mRoomInfoResp.getRoom_info().getType_id().equals("7")){
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.rlMisc.setVisibility(VISIBLE);
}
}
@@ -2760,7 +2792,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
}
}else if (mRoomInfoResp.getRoom_info().getType_id().equals("2")){
maxHeightDp=287;
maxHeightDp=297;
} if (mRoomInfoResp.getRoom_info().getType_id().equals("6")){
maxHeightDp=333;
}else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")){

View File

@@ -92,12 +92,29 @@ public class GiftUserAdapter extends BaseQuickAdapter<RewardUserBean, BaseViewHo
int count = 1;
List<RewardUserBean> data = getData();
for (RewardUserBean item : data) {
if (!item.getUser_id().equals(SpUtil.getUserId() + "")) {
if (item.isSelect()) {
count++;
}
}
}
return count;
}
///获取当前选中的人数
public int getUserIdCount(){
int count = 0;
List<RewardUserBean> data = getData();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.size(); i++) {
if (!data.get(i).getUser_id().equals(SpUtil.getUserId() + "")) {
if (data.get(i).isSelect()) {
count++;
}
}
}
return count;
}
public List<RewardUserBean> getSelectRoomPitUserModel() {
List<RewardUserBean> selects = getData();

View File

@@ -13,6 +13,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -35,6 +36,7 @@ import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import com.hjq.toast.ToastUtils;
import com.xscm.moduleutil.adapter.GiftTwoDetailsFragment;
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftNumBean;
@@ -58,6 +60,7 @@ import com.xscm.moduleutil.presenter.RewardGiftPresenter;
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.dialog.KeyboardPopupWindow;
import com.xscm.moduleutil.widget.dialog.SelectGiftNumPopupWindow;
@@ -245,7 +248,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
for (RoomPitBean bean : pitList) {
if (bean.getPit_number().equals(targetPit) &&
!bean.getUser_id().equals("0") && !bean.getUser_id().equals("") &&
!bean.getUser_id().equals(SpUtil.getUserId())) {
!bean.getUser_id().equals(SpUtil.getUserId()+"")) {
RewardUserBean rewardUserBean = new RewardUserBean();
rewardUserBean.setUser_id(bean.getUser_id());
@@ -299,6 +302,18 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
mBinding.tvGive.setTextColor(ColorManager.getInstance().getButtonColorInt());
mBinding.cz.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
ViewGroup.LayoutParams layoutParams = mBinding.llGiftRule.getLayoutParams();
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
layoutParams.height = SystemUtils.getWidth(74); // 示例高度
mBinding.llGiftRule.setLayoutParams(layoutParams);
float[] corners2 = {56f, 56f, 56f, 56f};
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvBbQs, ColorManager.getInstance().getPrimaryColorInt(), corners2);
mBinding.tvBbQs.setTextColor(ColorManager.getInstance().getButtonColorInt());
mBinding.tvBbQs.setOnClickListener(this::onClisk);
}
private void onClisk(View view1) {
@@ -352,6 +367,17 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
all = !all;
oldSelectedIds.clear();
oldSelectedIds.addAll(gifyuseradapter.getAllSelectedIds());
}else if (view1.getId() == R.id.tv_bb_qs){
int count =gifyuseradapter.getSelectCount();
if (count<0){
ToastUtils.show("请选择打赏的用户");
return;
}
if (gifyuseradapter.getUserIdCount()>1){
ToastUtils.show("一键全送只能选择一个用户");
return;
}
MvpPre.getGiftPack(roomId,gifyuseradapter.getUserIdToString());
}
}
@@ -541,7 +567,9 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
}
} else if (currentItem == 0) {
giftNumber = num;
beibaoId = roonGiftModel.getGift_id();
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "2", pit, heart_id);
} else {
//背包礼物打赏
// giftNumber = num;
@@ -555,6 +583,8 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
}
}
private String beibaoId;
@Override
protected int getLayoutId() {
return R.layout.room_gift_dialog;
@@ -572,7 +602,9 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
mBinding.rvGiftUser.setVisibility(View.INVISIBLE);
}
}
private List<GiftLabelBean> giftLabelBeanList;
@Override
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
giftLabelBeanList = new ArrayList<>();
@@ -585,25 +617,43 @@ private List<GiftLabelBean> giftLabelBeanList;
mBinding.viewPager.setOffscreenPageLimit(0);
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
mBinding.slidingTabLayout.setCurrentTab(1);
mBinding.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// // 在 initView() 方法中添加
// mBinding.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
// @Override
// public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// }
//
// @Override
// public void onPageSelected(int position) {
// // 页面切换时更新选中状态
// updateGiftSelection(position);
// }
//
// @Override
// public void onPageScrollStateChanged(int state) {
// }
// });
}
@Override
public void onPageSelected(int position) {
// 当页面切换时,控制 tv_bb_qs 按钮的显示
updateTvBbQsVisibility(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
// 初始化时设置按钮可见性
updateTvBbQsVisibility(1);
}
// 控制 tv_bb_qs 按钮显示的方法
private void updateTvBbQsVisibility(int currentPosition) {
// 假设你希望在特定位置例如位置1显示按钮
if (currentPosition == 0) { // 根据你的需求调整位置
// 显示按钮
if (mBinding.tvBbQs != null) {
mBinding.tvBbQs.setVisibility(View.VISIBLE);
}
} else {
// 隐藏按钮
if (mBinding.tvBbQs != null) {
mBinding.tvBbQs.setVisibility(View.GONE);
}
}
}
@Override
public void setGiftList(List<RoonGiftModel> roonGiftModels, int type) {
@@ -612,6 +662,13 @@ private List<GiftLabelBean> giftLabelBeanList;
@Override
public void giveGift() {
// dismiss();
if (mBinding.viewPager.getCurrentItem() == 0) {
MvpPre.wallet();
EventBus.getDefault().post(beibaoId);
return;
}
if (roomGiftGiveEvent != null) {
EventBus.getDefault().post(roomGiftGiveEvent);
roomGiftGiveEvent = null;
@@ -649,7 +706,17 @@ private List<GiftLabelBean> giftLabelBeanList;
}
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
@Override
public void getGiftPack(String s) {
if (s!=null){
com.hjq.toast.ToastUtils.show( s);
dismiss();
}else {
com.hjq.toast.ToastUtils.show("一键全清背包礼物失败");
}
}
private class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
private List<GiftLabelBean> list;
private List<Fragment> fragmentList;
@@ -678,11 +745,9 @@ private List<GiftLabelBean> giftLabelBeanList;
if (position < fragmentList.size() && fragmentList.get(position) != null) {
return fragmentList.get(position);
}
// 创建新的 Fragment
GiftLabelBean model = list.get(position);
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 1, roomId);
// 确保 fragmentList 有足够的空间
while (fragmentList.size() <= position) {
fragmentList.add(null);

View File

@@ -126,16 +126,12 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
} else {
mBinding.roomDian.setVisibility(View.VISIBLE);
}
}
@SuppressLint("UseCompatLoadingForDrawables")
@Override
protected void initView() {
mBinding.ivAvatar.setOnClickListener(this::onClick);
mBinding.roomMCz.setOnClickListener(this::onClick);
mBinding.roomDian.setOnClickListener(this::onClick);
@@ -151,6 +147,7 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
mBinding.textView1.setOnClickListener(this::onClick);
mBinding.textView2.setOnClickListener(this::onClick);
mBinding.moreButton.setOnClickListener(this::onClick);
mBinding.imQml.setOnClickListener(this::onClick);
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.roomMCz, ColorManager.getInstance().getPrimaryColorInt(), 65);
mBinding.roomMCz.setTextColor(ColorManager.getInstance().getButtonColorInt());
@@ -224,6 +221,8 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
dianj(1);
}else if (id==R.id.textView2){
dianj(2);
}else if (id==R.id.im_qml){
}
}

View File

@@ -215,6 +215,11 @@ public class RoomWheatGiftSettingFragment extends BaseMvpDialogFragment<RewardGi
}
@Override
public void getGiftPack(String s) {
}
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
private List<Fragment> fragmentList;

View File

@@ -11,14 +11,18 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.moduleroom.R;
import com.example.moduleroom.adapter.RankingCharmListAdapter;
import com.example.moduleroom.contacts.DataListContacts;
import com.example.moduleroom.databinding.RoomRankingChildBinding;
import com.example.moduleroom.dialog.RoomUserInfoFragment;
import com.example.moduleroom.presenter.DataListPresenter;
import com.xscm.moduleutil.base.BaseMvpFragment;
import com.xscm.moduleutil.bean.CharmRankingResp;
import com.xscm.moduleutil.bean.room.RoomInfoResp;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.ImageUtils;
import com.xscm.moduleutil.widget.CommonEmptyView;
@@ -43,18 +47,20 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
private RankingCharmListAdapter wAdapter;//财富适配器
// private RankingWealthListAdapter wAdapter;//财富适配器
private CommonEmptyView commonEmptyView;
private RoomInfoResp roomInfoResp;
/**
* newInstance 初始化fragment
*
* @return
*/
public static RankingChildFragment newInstance(String roomId, int dataType, int rankType) {
public static RankingChildFragment newInstance(String roomId, int dataType, int rankType, RoomInfoResp roomInfoResp) {
RankingChildFragment rankingChildFragment = new RankingChildFragment();
Bundle bundle = new Bundle();
bundle.putString("roomId", roomId);
bundle.putInt("dataType", dataType);
bundle.putInt("rankType", rankType);
bundle.putSerializable("roomInfoResp", roomInfoResp);
rankingChildFragment.setArguments(bundle);
return rankingChildFragment;
}
@@ -70,6 +76,7 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
roomId = getArguments().getString("roomId");
dataType = getArguments().getInt("dataType");
rankType = getArguments().getInt("rankType");
roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfoResp");
}
@Override
@@ -114,7 +121,10 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
if (view.getId() == R.id.room_item_head) {
CharmRankingResp item = cAdapter.getItem(position);
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", item.getUser_id()).withBoolean("returnRoom", true).navigation();
RoomUserInfoFragment.show(roomId,item.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", item.getUser_id()).withBoolean("returnRoom", true).navigation();
}
}
});
@@ -123,6 +133,9 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
if (view.getId() == R.id.room_item_head) {
CharmRankingResp item = wAdapter.getItem(position);
RoomUserInfoFragment.show(roomId,item.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
// WealthRankingResp.ListsBean item = wAdapter.getItem(position);
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", item.getUser_id()).withBoolean("returnRoom", true).navigation();
}
@@ -130,7 +143,38 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
});
}
}
/**
* 这是判断当前用户是否是麦上房主、管理员、主持,不在主持麦的都是不同用户
* 2025-7-31 10:42:37新添加的要求根据角色不同显示不同的按钮
* 房主不论麦上麦下,有全部权限 管理员、主持:不论麦上麦下,有部分权限 用户:只有举报拉黑权限
* 所有的是从下往上看数据的时候,只有举报和拉黑
*
* @return
*/
private int getHostUser() {
if (roomInfoResp.getUser_info().getPit_number() == 9) {
if (roomInfoResp.getUser_info().getIs_room_owner() == 1) {
return 1;
} else if (roomInfoResp.getUser_info().getIs_management() == 1) {
return 2;
} else if (roomInfoResp.getUser_info().getIs_host() == 1) {
return 3;
} else {
return 4;
}
} else {
if (roomInfoResp.getUser_info().getIs_room_owner() == 1) {
return 1;
}
if (roomInfoResp.getUser_info().getIs_management() == 1) {
return 2;
}
if (roomInfoResp.getUser_info().getIs_host() == 1) {
return 3;
}
return 4;
}
}
@Override
protected int getLayoutId() {
@@ -148,6 +192,8 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
mBinding.roomRankTop1HeadIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RoomUserInfoFragment.show(roomId,listsBean.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", listsBean.getUser_id()).withBoolean("returnRoom", true).navigation();
}
});
@@ -162,6 +208,8 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
mBinding.roomRankTop2HeadIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RoomUserInfoFragment.show(roomId,listsBean.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", listsBean.getUser_id()).withBoolean("returnRoom", true).navigation();
}
});
@@ -198,6 +246,8 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
mBinding.roomRankTop3HeadIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RoomUserInfoFragment.show(roomId,listsBean.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", listsBean.getUser_id()).withBoolean("returnRoom", true).navigation();
}
});

View File

@@ -10,6 +10,7 @@ import com.example.moduleroom.databinding.RoomRankingParentBinding;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
import com.xscm.moduleutil.base.BaseMvpFragment;
import com.xscm.moduleutil.bean.room.RoomInfoResp;
import java.util.ArrayList;
import java.util.List;
@@ -28,12 +29,13 @@ public class RankingParentFragment extends BaseMvpFragment<IPresenter, RoomRanki
private static String mRoomId;//房间ID
private static int rankType = 1;//统计类型(魅力 / 财富)
// private static int dataType = 1;//统计周期(日/周/月)
private RoomInfoResp roomInfoResp;
public static RankingParentFragment newInstance(String roomId,int rankType) {
public static RankingParentFragment newInstance(String roomId,int rankType,RoomInfoResp roomInfoResp) {
Bundle args = new Bundle();
args.putString("roomId", roomId);
args.putInt("rankType", rankType);
args.putSerializable("roomInfoResp", roomInfoResp);
RankingParentFragment fragment = new RankingParentFragment();
fragment.setArguments(args);
return fragment;
@@ -44,6 +46,7 @@ public class RankingParentFragment extends BaseMvpFragment<IPresenter, RoomRanki
super.initArgs(arguments);
mRoomId = arguments.getString("roomId");
rankType = arguments.getInt("rankType");
roomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfoResp");
}
@Override
@@ -54,9 +57,9 @@ public class RankingParentFragment extends BaseMvpFragment<IPresenter, RoomRanki
@Override
protected void initData() {
List<Fragment> fragments = new ArrayList<>();
fragments.add(RankingChildFragment.newInstance(mRoomId, TYPE_DATA, rankType));
fragments.add(RankingChildFragment.newInstance(mRoomId, TYPE_WEEK, rankType));
fragments.add(RankingChildFragment.newInstance(mRoomId, TYPE_MON, rankType));
fragments.add(RankingChildFragment.newInstance(mRoomId, TYPE_DATA, rankType, roomInfoResp));
fragments.add(RankingChildFragment.newInstance(mRoomId, TYPE_WEEK, rankType, roomInfoResp));
fragments.add(RankingChildFragment.newInstance(mRoomId, TYPE_MON, rankType, roomInfoResp));
MyFragmentPagerAdapter myFragmentPagerAdapter = new MyFragmentPagerAdapter(fragments, getChildFragmentManager());
mBinding.vpRankChild.setAdapter(myFragmentPagerAdapter);
String[] title = new String[]{"日榜", "周榜", "月榜"};

View File

@@ -132,6 +132,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
if (roomPitBean.getUser_id() != null && !roomPitBean.getUser_id().isEmpty() && !roomPitBean.getUser_id().equals("0")) {
roomPitBean.setIs_pm(1);
wheatView.setData(roomPitBean);
if (imActionJs != null)
imActionJs.setVisibility(VISIBLE);
} else {
@@ -143,12 +144,13 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
pitBean.setSex("");
pitBean.setCharm("");
wheatView.setData(pitBean);
}
parentFragment = (RoomFragment) getParentFragment();
roomAuction = roomInfoResp.getRoom_auction();
if (roomAuction != null) {
if (roomAuction.getAuction_user() != null && roomAuction.getAuction_user().getAuction_id() != null) {
if (roomAuction.getAuction_user() != null ) {
auctionUserBean = roomAuction.getAuction_user();
RoomPitBean roomPitBean1 = new RoomPitBean();
roomPitBean1.setUser_id(auctionUserBean.getUser_id());
@@ -184,9 +186,17 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
mBinding.ivJp.setVisibility(VISIBLE);
}
if (auctionUserBean.getAuction_id()!=null) {
mBinding.ivJp.setVisibility(VISIBLE);
gengv();
auctionId = auctionUserBean.getAuction_id();
SpUtil.setAuctionId(auctionId);
}else {
SpUtil.setAuctionId("");
mBinding.ivJp.setVisibility(INVISIBLE);
}
}
if (roomAuction.getAuction_list() != null && roomAuction.getAuction_list().size() > 0) {
auctionList = roomAuction.getAuction_list();
@@ -207,7 +217,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
auctionId = "";
SpUtil.setAuctionId("");
}
tzblChanged();
tzblChanged();//获取在线列表数据
RoomPitBean roomPitBean2 = wheatView.pitBean;
if (roomPitBean2 != null && roomPitBean2.getUser_id() != null && !roomPitBean2.getUser_id().equals("0")) {
if (roomPitBean2.getUser_id().equals(SpUtil.getUserId() + "")) {
@@ -359,10 +369,10 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
RoomOnlineDialogFragment.show(roomInfoResp.getRoom_info().getRoom_id(), 888 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
}
} else {
if (roomInfoResp.getRoom_auction().getAuction_user() != null) {
// if (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 if (id == R.id.im_action_js) {//延时
MvpPre.auctionDelay(SpUtil.getauctionId());
@@ -1299,6 +1309,10 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
if (stub!=null) {
stub.setVisibility(GONE);
stub = null;
}
isButtonsInflated = false;
releaseCountDownTimer();
}

View File

@@ -18,6 +18,7 @@ import com.example.moduleroom.presenter.RoomChartsPresenter;
import com.example.moduletablayout.listener.CustomTabEntity;
import com.example.moduletablayout.listener.OnTabSelectListener;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.room.RoomInfoResp;
import java.util.ArrayList;
@@ -32,11 +33,13 @@ public class RoomChartsFragment extends BaseMvpDialogFragment<RoomChartsPresente
public static final int TYPE_WEALTH = 2;//魅力榜
private int type = TYPE_CHARM;
private int childType = RankingChildFragment.TYPE_DATA;
private RoomInfoResp mRoomInfoResp;
public static RoomChartsFragment newInstance(String roomId) {
public static RoomChartsFragment newInstance(String roomId,RoomInfoResp roomInfoResp) {
RoomChartsFragment roomRankingFragment = new RoomChartsFragment();
Bundle bundle = new Bundle();
bundle.putString("roomId", roomId);
bundle.putSerializable("roomInfoResp", roomInfoResp);
roomRankingFragment.setArguments(bundle);
return roomRankingFragment;
}
@@ -63,12 +66,13 @@ public class RoomChartsFragment extends BaseMvpDialogFragment<RoomChartsPresente
public void onAttach(@NonNull Context context) {
super.onAttach(context);
mRoomId = getArguments().getString("roomId");
mRoomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfoResp");
}
@Override
protected void initData() {
FragmentUtils.add(getChildFragmentManager(), RankingChildFragment.newInstance(mRoomId, childType, type), R.id.fl_content);
FragmentUtils.add(getChildFragmentManager(), RankingChildFragment.newInstance(mRoomId, childType, type, mRoomInfoResp), R.id.fl_content);
}
@Override
@@ -106,7 +110,7 @@ public class RoomChartsFragment extends BaseMvpDialogFragment<RoomChartsPresente
mBinding.tvWealth.setOnClickListener(this::onViewClicked);
}
private void refresh() {
FragmentUtils.replace(getChildFragmentManager(), RankingChildFragment.newInstance(mRoomId, childType, type), R.id.fl_content);
FragmentUtils.replace(getChildFragmentManager(), RankingChildFragment.newInstance(mRoomId, childType, type, mRoomInfoResp), R.id.fl_content);
}
public static class TabItem implements CustomTabEntity {

View File

@@ -451,7 +451,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
pitNumber = pitBean.getPit_number();
roomPitBean = pitBean;
showPopupMenu(view); // v 是点击的按钮视图
} else if (pitNumber1 == 10 && roomInfoResp.getUser_info().getPit_number() == 9) {
} else if (pitNumber1 == 10 && isUserHostOfRoom() ) {
RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
} else if (pitNumber1 != 10) {
MvpPre.applyPit(roomId, pitNumber1 + "");
@@ -504,6 +504,28 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
mBinding.imMkf.setOnClickListener(this::onClick);
}
/**
* 检查当前用户是否是房间的主持人
* @return true表示是主持人false表示不是主持人或数据不完整
*/
private boolean isUserHostOfRoom() {
// 先检查列表是否为空或大小不足
if (ObjectUtils.isEmpty(roomInfoResp.getRoom_info().getPit_list()) ||
roomInfoResp.getRoom_info().getPit_list().size() < 10) {
return false;
}
// 检查第9个麦位(索引为8)的用户ID是否存在且与当前用户ID匹配
RoomPitBean hostPitBean = roomInfoResp.getRoom_info().getPit_list().get(8);
if (hostPitBean == null) {
return false;
}
String hostUserId = hostPitBean.getUser_id();
return hostUserId != null &&
!hostUserId.isEmpty() &&
hostUserId.equals(SpUtil.getUserId() + "");
}
public void onWheatClicked(View ii) {
RoomDefaultWheatView view = (RoomDefaultWheatView) ii;

View File

@@ -120,8 +120,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

View File

@@ -111,6 +111,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/im_qml"
android:layout_width="@dimen/dp_66"
android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_22"
android:layout_marginTop="@dimen/dp_25"
android:src="@mipmap/qgrml"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/kb" />
<ImageView
android:id="@+id/im_gs"
android:layout_width="@dimen/dp_66"
@@ -120,7 +131,24 @@
android:src="@mipmap/gsui"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/kb" />
app:layout_constraintTop_toBottomOf="@+id/im_qml"
tools:visibility="visible"/>
<ImageView
android:id="@+id/im_qing"
android:layout_width="@dimen/dp_66"
android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_22"
android:layout_marginTop="@dimen/dp_25"
android:src="@mipmap/gsui"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/kb"
/>
<TextView
android:id="@+id/room_m_cz"

View File

@@ -179,6 +179,20 @@
android:textSize="@dimen/sp_12" />
<TextView
android:id="@+id/tv_bb_qs"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_32"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/ll_gift_num"
android:background="@drawable/bg_r53_0dffb9"
android:layout_marginEnd="@dimen/dp_8"
android:gravity="center"
android:text="一键全送"
android:textColor="#0DFFB9"
android:textSize="@dimen/sp_14" />
<LinearLayout
android:id="@+id/ll_gift_num"
android:layout_width="@dimen/dp_100"

View File

@@ -224,7 +224,7 @@
</RelativeLayout>
<ViewStub
android:id="@+id/stub_buttons"
android:id="@+id/stub_buttons2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"

View File

@@ -10,7 +10,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<com.xscm.moduleutil.widget.CustomTopBar
android:id="@+id/top_bar"
@@ -242,9 +242,9 @@
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- <androidx.core.widget.NestedScrollView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->
<androidx.recyclerview.widget.RecyclerView
@@ -254,7 +254,7 @@
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_6"
android:layout_marginEnd="@dimen/dp_16" />
</androidx.core.widget.NestedScrollView>
<!-- </androidx.core.widget.NestedScrollView>-->
</LinearLayout>
<com.xscm.moduleutil.widget.GifAvatarOvalView

View File

@@ -74,6 +74,14 @@
android:layout_weight="1"
app:srlEnableLoadMore="true"
app:srlEnableRefresh="true">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/revenue_view"
@@ -87,12 +95,14 @@
android:background="@color/color_FFF5F5F5"
android:orientation="vertical"
tools:listitem="@layout/item_revenue" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:background="@color/transparent" />
android:layout_height="@dimen/dp_45"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
</layout>

View File

@@ -87,25 +87,23 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
>
android:paddingEnd="@dimen/dp_1"
android:gravity="center_horizontal">
<com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/im_user2"
android:layout_width="@dimen/dp_44"
android:layout_height="@dimen/dp_44"
android:layout_centerInParent="true"
android:src="@mipmap/ic_launcher"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_12"
app:riv_oval="true" />
<ImageView
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:layout_gravity="center_horizontal"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:layout_centerInParent="true"
android:background="@mipmap/huangg2"
android:layout_marginStart="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_10" />
android:scaleType="fitCenter" />
</RelativeLayout>
<RelativeLayout
@@ -218,30 +216,31 @@
android:layout_gravity="center"
android:src="@mipmap/guanb1" />
<RelativeLayout
android:id="@+id/r_1_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|top"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:paddingEnd="@dimen/dp_1"
android:gravity="center_horizontal"
>
<com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/im_user1"
android:layout_width="@dimen/dp_44"
android:layout_height="@dimen/dp_44"
android:layout_centerInParent="true"
android:src="@mipmap/ic_launcher"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_12"
app:riv_oval="true" />
<ImageView
android:id="@+id/im1"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:layout_gravity="center_horizontal|top|center"
android:layout_marginStart="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_10"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:layout_centerInParent="true"
android:scaleType="fitCenter"
android:src="@mipmap/huangg1" />
</RelativeLayout>
@@ -350,12 +349,14 @@
android:scaleType="centerCrop"
android:src="@mipmap/guanb3" />
<RelativeLayout
android:id="@+id/r_3_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|top"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:paddingEnd="@dimen/dp_1"
android:gravity="center_horizontal"
>
@@ -363,19 +364,16 @@
android:id="@+id/im_user3"
android:layout_width="@dimen/dp_44"
android:layout_height="@dimen/dp_44"
android:layout_centerInParent="true"
android:src="@mipmap/ic_launcher"
android:layout_marginStart="@dimen/dp_17"
android:layout_marginTop="@dimen/dp_12"
app:riv_oval="true"/>
<ImageView
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:layout_gravity="center_horizontal"
android:layout_centerInParent="true"
android:src="@mipmap/huangg3"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_5"/>
android:scaleType="fitCenter"/>
</RelativeLayout>
@@ -398,7 +396,7 @@
android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="10dp"
android:rotation="-20"
android:src="@mipmap/ic_launcher" />
tools:src="@mipmap/ic_launcher" />
<com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/iv_three_cp2_head"
@@ -410,7 +408,7 @@
android:layout_marginBottom="10dp"
android:layout_toEndOf="@+id/iv_three_cp1_head"
android:rotation="20"
android:src="@mipmap/ic_launcher" />
tools:src="@mipmap/ic_launcher" />
<ImageView
android:layout_width="@dimen/dp_98"
@@ -818,7 +816,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:ignore="MissingConstraints"
android:visibility="gone">
>
<com.xscm.moduleutil.widget.GifAvatarOvalView
@@ -873,27 +871,30 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:ignore="MissingConstraints">
tools:ignore="MissingConstraints"
android:visibility="gone">
<com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/iv_my_cp1_head"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"
android:src="@mipmap/ic_launcher" />
android:src="@mipmap/ic_launcher"
android:scaleType="fitCenter"/>
<com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/iv_my_cp2_head"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"
android:layout_toEndOf="@+id/iv_my_cp1_head"
android:src="@mipmap/ic_launcher" />
android:src="@mipmap/ic_launcher"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/v_my_cp1_head"
android:layout_width="@dimen/dp_60"
android:layout_height="@dimen/dp_35"
android:paddingBottom="@dimen/dp_7"
android:layout_height="@dimen/dp_30"
android:src="@mipmap/cp_pt"
android:scaleType="fitCenter"
android:visibility="visible" />
<TextView