修改MQTT使用方式
修改bug 修改盲盒布局
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-09-02T13:10:06.742287700Z">
|
||||
<DropdownSelection timestamp="2025-09-03T02:25:58.699909400Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=6705124a" />
|
||||
<DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=da0b71f9" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 9.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 9.2 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 16 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 13 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 25 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 18 KiB |
@@ -30,7 +30,7 @@ isBuildModule=false
|
||||
android.injected.testOnly=false
|
||||
|
||||
APP_VERSION_NAME=1.0.0
|
||||
APP_VERSION_CODE=108
|
||||
APP_VERSION_CODE=110
|
||||
|
||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||
|
||||
@@ -326,7 +326,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:enabled="false"
|
||||
android:gravity="center"
|
||||
android:text="开启羽声之旅"
|
||||
android:text="开启秘地之旅"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
|
||||
@@ -29,17 +29,17 @@
|
||||
android:name=".activity.news.OfficialNoticeActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<service android:name="org.eclipse.paho.android.service.MqttService"
|
||||
android:exported="false"/> <!-- <receiver android:name="org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver" -->
|
||||
<!-- <service android:name="org.eclipse.paho.android.service.MqttService"-->
|
||||
<!-- android:exported="false"/> <!– <receiver android:name="org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver" –>-->
|
||||
<!-- android:enabled="true" -->
|
||||
<!-- android:exported="true" -->
|
||||
<!-- tools:ignore="Instantiatable" /> -->
|
||||
<!-- <service android:name=".service.EMqttService" />-->
|
||||
<service
|
||||
android:name=".service.MyMqttService"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="dataSync" />
|
||||
<!-- <service-->
|
||||
<!-- android:name=".service.MyMqttService"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:foregroundServiceType="dataSync" />-->
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -31,6 +31,7 @@ import com.xscm.moduleutil.event.AppLifecycleEvent;
|
||||
import com.xscm.moduleutil.interfaces.AppLifecycleUtil;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.service.MqttConnect;
|
||||
import com.xscm.moduleutil.service.MyMqttService;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.UtilConfig;
|
||||
@@ -50,6 +51,7 @@ import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.tencent.qcloud.tuicore.TUILogin;
|
||||
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -84,7 +86,7 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
public String playName;
|
||||
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
|
||||
private ScheduledExecutorService scheduledExecutorServiceRoom = null;
|
||||
|
||||
private MqttConnect mqttConnect=null;
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
@@ -110,12 +112,15 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
MessageListenerSingleton.getInstance();
|
||||
CrashReport.initCrashReport(this, "ac3ed4d89f", true);/*bugly初始化*/
|
||||
// // 启动 MQTT 服务
|
||||
Intent mqttServiceIntent = new Intent(this, MyMqttService.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(mqttServiceIntent);
|
||||
} else {
|
||||
startService(mqttServiceIntent);
|
||||
}
|
||||
// Intent mqttServiceIntent = new Intent(this, MyMqttService.class);
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// startForegroundService(mqttServiceIntent);
|
||||
// } else {
|
||||
// startService(mqttServiceIntent);
|
||||
// }
|
||||
|
||||
mqttConnect=MqttConnect.getInstance(this,"tcp://62.234.12.147","android-"+ MqttClient.generateClientId());
|
||||
mqttConnect.mqttClient();
|
||||
|
||||
// 每次启动应用时重置状态
|
||||
SpUtil.getInstance().setBooleanValue("youth_model_shown", false);
|
||||
|
||||
@@ -159,7 +159,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
// 设置高度为屏幕高度的100%(全屏)
|
||||
int heightInPx = (int) (screenHeight * 0.9);
|
||||
int heightInPx = (int) (screenHeight * 0.79);
|
||||
;
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||
@@ -304,6 +304,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
int id = view.getId();
|
||||
if (id == R.id.ll_one) {
|
||||
if (!isDrawing) {
|
||||
isDrawing=true;
|
||||
init(1);
|
||||
startType = 1;
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "1");
|
||||
@@ -313,14 +314,17 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
}
|
||||
} else if (id == R.id.ll_ten) {
|
||||
if (!isDrawing) {
|
||||
isDrawing=true;
|
||||
init(2);
|
||||
startType = 2;
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "10");
|
||||
|
||||
} else {
|
||||
com.hjq.toast.ToastUtils.show("正在抽奖中...");
|
||||
}
|
||||
} else if (id == R.id.ll_hundred) {//抽奖100次
|
||||
if (!isDrawing) {
|
||||
isDrawing=true;
|
||||
init(3);
|
||||
startType = 3;
|
||||
MvpPre.drawGiftList(giftBagId, userIds, roomId, "100");
|
||||
@@ -504,6 +508,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
|
||||
MvpPre.giftSend(blind_box_turntable_id);
|
||||
MvpPre.wallet();
|
||||
isDrawing = false;
|
||||
stopFastAnimate();
|
||||
return;
|
||||
}
|
||||
@@ -524,7 +529,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
}
|
||||
|
||||
public void stopFastAnimate() {
|
||||
isDrawing = false;
|
||||
|
||||
if (handler != null) {
|
||||
// 移除特定的 Runnable(更精确)
|
||||
if (timerRunnable != null) {
|
||||
@@ -719,7 +724,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
playSound("draw.mp3");
|
||||
// 不要设置isDrawing=true,这会影响动画控制
|
||||
MvpPre.wallet();
|
||||
|
||||
isDrawing=false;
|
||||
MvpPre.giftSend(blind_box_turntable_id);
|
||||
}
|
||||
giftCardView.bindGiftData(giftBean);
|
||||
@@ -731,6 +736,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
startFastAnimate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -772,6 +772,14 @@ public class AgoraManager {
|
||||
super.onFirstRemoteAudioFrame(uid, elapsed);
|
||||
Log.i("RoomCabinFragment", "onFirstRemoteAudioFrame: uid->" + uid);
|
||||
|
||||
|
||||
}
|
||||
// 可继续扩展其他回调...
|
||||
|
||||
|
||||
@Override
|
||||
public void onFirstRemoteVideoFrame(int uid, int width, int height, int elapsed) {
|
||||
super.onFirstRemoteVideoFrame(uid, width, height, elapsed);
|
||||
SurfaceView renderView = new SurfaceView(context);
|
||||
SurfaceEvent surfaceEvent = new SurfaceEvent();
|
||||
surfaceEvent.setSurfaceView(renderView);
|
||||
@@ -779,7 +787,6 @@ public class AgoraManager {
|
||||
rtcEngine.setupRemoteVideo(new VideoCanvas(renderView, Constants.RENDER_MODE_FIT, uid));
|
||||
EventBus.getDefault().post(surfaceEvent);
|
||||
}
|
||||
// 可继续扩展其他回调...
|
||||
|
||||
@Override
|
||||
public void onRemoteVideoStateChanged(int uid, int state, int reason, int elapsed) {
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.xscm.moduleutil.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.google.android.gms.common.api.Api;
|
||||
import com.xscm.moduleutil.utils.logger.DataLogger;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
import org.eclipse.paho.client.mqttv3.MqttDeliveryToken;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.eclipse.paho.client.mqttv3.MqttTopic;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MqttConnect {
|
||||
private String HOST;
|
||||
private String Tag = "MQTT";
|
||||
private String clientId = "";
|
||||
private static MqttClient mqttClient = null;
|
||||
private Context context;
|
||||
|
||||
// 订阅主题
|
||||
public static String shutdown = "";
|
||||
public static String update_app = "";
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
String[] topic;
|
||||
int[] qos = {1,2,3,0,0,0,0,0,0,0,0,0,0}; // 消息质量
|
||||
private static MqttConnect instance;
|
||||
|
||||
public MqttConnect(Context context, String host, String clientId) {
|
||||
this.HOST = host;
|
||||
this.context = context;
|
||||
this.clientId = clientId;
|
||||
|
||||
// 这里是你自己需要订阅的主题
|
||||
shutdown = "qx_room_topic"; // 关机
|
||||
update_app = "qx_xunlehui"; // 发送更新APP
|
||||
|
||||
ArrayList<String> topicList = new ArrayList<>();
|
||||
topicList.add(shutdown);
|
||||
topicList.add(update_app);
|
||||
topic = topicList.toArray(new String[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单列模式,只能实例化一次
|
||||
* @param context
|
||||
* @param host
|
||||
* @param clientId
|
||||
* @return
|
||||
*/
|
||||
public static synchronized MqttConnect getInstance(Context context, String host, String clientId) {
|
||||
if (instance == null) {
|
||||
instance = new MqttConnect(context, host, clientId);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户端connect连接mqtt服务器
|
||||
**/
|
||||
public void mqttClient()
|
||||
{
|
||||
close();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
MqttConnectOptions options = mqttConnectOptions();
|
||||
mqttClient.setCallback(new MqttInitCallback(context, HOST, clientId));
|
||||
mqttClient.connect(options);
|
||||
// sub(topic,qos);
|
||||
sub(shutdown);
|
||||
sub(update_app);
|
||||
uiTip("MQTT连接成功");
|
||||
}catch (MqttException e){
|
||||
uiTip("MQTT连接失败,准备重连。。。:"+e.getMessage());
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.e(Tag,"开始重连。。。");
|
||||
mqttClient();
|
||||
}
|
||||
},3000);
|
||||
}
|
||||
}
|
||||
},200);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在主线程弹出消息
|
||||
* @param msg
|
||||
*/
|
||||
private void uiTip(String msg){
|
||||
Log.d(Tag,msg);
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
|
||||
LogUtils.e("mqtt","连接成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* MQTT连接参数设置
|
||||
*/
|
||||
private MqttConnectOptions mqttConnectOptions()
|
||||
throws MqttException {
|
||||
mqttClient = new MqttClient(HOST, clientId, new MemoryPersistence());
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setUserName("public");
|
||||
options.setConnectionTimeout(10);
|
||||
options.setCleanSession(true);
|
||||
options.setConnectionTimeout(10);
|
||||
options.setKeepAliveInterval(10);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭MQTT连接
|
||||
*/
|
||||
public void close(){
|
||||
if(mqttClient != null && mqttClient.isConnected()){
|
||||
try {
|
||||
mqttClient.close();
|
||||
mqttClient.disconnect();
|
||||
mqttClient = null;
|
||||
} catch (MqttException e) {
|
||||
Log.e(Tag,"关闭MQTT连接报错:"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
Log.d(Tag,"Mqtt已关闭");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向某个主题发布消息 默认qos:1
|
||||
*/
|
||||
public static void pub(String topic, String msg) throws MqttException {
|
||||
MqttMessage mqttMessage = new MqttMessage();
|
||||
mqttMessage.setPayload(msg.getBytes());
|
||||
MqttTopic mqttTopic = mqttClient.getTopic(topic);
|
||||
MqttDeliveryToken token = mqttTopic.publish(mqttMessage);
|
||||
token.waitForCompletion();
|
||||
}
|
||||
|
||||
/**
|
||||
* 向某个主题发布消息
|
||||
*
|
||||
* @param topic: 发布的主题
|
||||
* @param msg: 发布的消息
|
||||
* @param qos: 消息质量 Qos:0、1、2
|
||||
*/
|
||||
public void pub(String topic, String msg, int qos) throws MqttException {
|
||||
MqttMessage mqttMessage = new MqttMessage();
|
||||
mqttMessage.setQos(qos);
|
||||
mqttMessage.setPayload(msg.getBytes());
|
||||
MqttTopic mqttTopic = mqttClient.getTopic(topic);
|
||||
MqttDeliveryToken token = mqttTopic.publish(mqttMessage);
|
||||
token.waitForCompletion();
|
||||
}
|
||||
|
||||
/**
|
||||
* 订阅某一个主题 ,此方法默认的的Qos等级为:1
|
||||
*
|
||||
* @param topic 主题
|
||||
*/
|
||||
public void sub(String topic){
|
||||
try {
|
||||
mqttClient.subscribe(topic);
|
||||
} catch (MqttException e) {
|
||||
Log.e(Tag,"MQTT主题订阅失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订阅某一个主题,可携带Qos
|
||||
*
|
||||
* @param topic 所要订阅的主题
|
||||
* @param qos
|
||||
* 消息质量:0最多发送一次,不保证消息能够到达接收端,也不负责重发
|
||||
* 1至少发送一次,确保消息能够到达接收端,但可能会导致消息重复
|
||||
* 2确保消息恰好被接收一次
|
||||
*/
|
||||
public void sub(String[] topic, int[] qos){
|
||||
try {
|
||||
mqttClient.subscribe(topic, qos);
|
||||
}catch (MqttException e){
|
||||
Log.e(Tag,"订阅主题失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 原文链接:https://blog.csdn.net/Fyx1987496919/article/details/140516525
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.xscm.moduleutil.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.xscm.moduleutil.bean.XLHBean;
|
||||
import com.xscm.moduleutil.event.RoomGiftRunable;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
public class MqttInitCallback implements MqttCallback {
|
||||
private String Tag = "MqttInitCallback";
|
||||
private String HOST;
|
||||
private String clientId = "";
|
||||
private MqttConnect mqttConnect = null;
|
||||
private Context context = null;
|
||||
MqttInitCallback(Context context, String host, String clientId){
|
||||
this.context = context;
|
||||
this.HOST = host;
|
||||
this.clientId = clientId;
|
||||
}
|
||||
/**
|
||||
* 连接丢失
|
||||
*/
|
||||
@Override
|
||||
public void connectionLost(Throwable cause) {
|
||||
Log.d(Tag,"mqtt连接断开,执行重连");
|
||||
mqttConnect = MqttConnect.getInstance(context, HOST, clientId);
|
||||
mqttConnect.mqttClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* subscribe订阅后得到的消息会执行到这里
|
||||
*/
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage message){
|
||||
// Log.d(Tag,"topic");
|
||||
// Log.d(Tag,topic);
|
||||
|
||||
String messageStr = message.toString();
|
||||
Logger.e("MQTT", "收到的消息", "主题:" + topic + " 收到的消息:" + messageStr);
|
||||
if (topic.equals("qx_room_topic")) {
|
||||
receiveMessage(topic, messageStr);
|
||||
} else if (topic.equals("qx_xunlehui")) {
|
||||
receiveXlhMessage(messageStr);
|
||||
}
|
||||
}
|
||||
private void receiveMessage(String topic, String data) {
|
||||
try {
|
||||
JSONObject jsonObject = JSON.parseObject(data);
|
||||
int type = jsonObject.getIntValue("type");
|
||||
String message = jsonObject.getString("msg");
|
||||
|
||||
// 将事件处理放到主线程执行
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
processMessageType(type, message);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Log.e("MQTT", "解析MQTT消息异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void processMessageType(int type, String message) {
|
||||
switch (type) {
|
||||
case 5019://推送所有人-横幅礼物通知
|
||||
new RoomGiftRunable(message).run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void receiveXlhMessage(String messageStr) {
|
||||
try {
|
||||
JSONObject jsonObject = JSON.parseObject(messageStr);
|
||||
int type = jsonObject.getIntValue("type");
|
||||
String message = jsonObject.getString("msg");
|
||||
XLHBean xlhBean=JSON.parseObject(message, XLHBean.class);
|
||||
// 将事件处理放到主线程执行
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
// processMessageType(type, message);
|
||||
EventBus.getDefault().post(xlhBean);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Log.e("MQTT", "解析MQTT消息异常", e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* publish发布成功后会执行到这里
|
||||
*/
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 原文链接:https://blog.csdn.net/Fyx1987496919/article/details/140516525
|
||||
}
|
||||
@@ -129,9 +129,10 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
public enum RenderType {SVGA, MP4}
|
||||
|
||||
private RenderType renderType;
|
||||
private ExoPlayer exoPlayer;
|
||||
private PlayerView playerView;
|
||||
// private ExoPlayer exoPlayer;
|
||||
// private PlayerView playerView;
|
||||
private SVGAImageView svgaSurface;
|
||||
private SVGAImageView svgaSurface2;
|
||||
private GLSurfaceView glSurfaceView;
|
||||
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
private ChannelSplitRenderer1 renderer;
|
||||
@@ -168,16 +169,20 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
private void initViews() {
|
||||
// if (isDestroyed) return;
|
||||
// 初始化 ExoPlayer View
|
||||
playerView = new PlayerView(getContext());
|
||||
playerView.setUseController(false);
|
||||
playerView.setVisibility(View.GONE);
|
||||
addView(playerView);
|
||||
// playerView = new PlayerView(getContext());
|
||||
// playerView.setUseController(false);
|
||||
// playerView.setVisibility(View.GONE);
|
||||
// addView(playerView);
|
||||
|
||||
// 初始化 SVGA View
|
||||
svgaSurface = new SVGAImageView(getContext());
|
||||
svgaSurface.setVisibility(View.GONE);
|
||||
addView(svgaSurface);
|
||||
|
||||
svgaSurface2 = new SVGAImageView(getContext());
|
||||
svgaSurface2.setVisibility(View.GONE);
|
||||
addView(svgaSurface2);
|
||||
|
||||
// // 初始化 GLSurfaceView
|
||||
// glSurfaceView = new GLSurfaceView(getContext());
|
||||
// glSurfaceView.setEGLContextClientVersion(2);
|
||||
@@ -189,12 +194,13 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
|
||||
// 初始化 ExoPlayer
|
||||
// if (!isDestroyed) {
|
||||
try {
|
||||
exoPlayer = new ExoPlayer.Builder(getContext()).build();
|
||||
playerView.setPlayer(exoPlayer);
|
||||
} catch (Exception e) {
|
||||
LogUtils.e("AvatarFrameView", "Failed to initialize ExoPlayer: " + e.getMessage());
|
||||
}
|
||||
|
||||
// try {
|
||||
// exoPlayer = new ExoPlayer.Builder(getContext()).build();
|
||||
// playerView.setPlayer(exoPlayer);
|
||||
// } catch (Exception e) {
|
||||
// LogUtils.e("AvatarFrameView", "Failed to initialize ExoPlayer: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
if (mBinding != null) {
|
||||
@@ -748,34 +754,34 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadMP4(String url) {
|
||||
svgaSurface.setVisibility(View.GONE);
|
||||
playerView.setVisibility(View.GONE);
|
||||
|
||||
glSurfaceView.setVisibility(View.VISIBLE);
|
||||
glSurfaceView.onResume();
|
||||
glSurfaceView.requestRender();
|
||||
// 使用 post 确保 GLSurfaceView 已完成 layout
|
||||
glSurfaceView.post(() -> {
|
||||
Log.d("@@@", "GLSurfaceView size after layout: " + glSurfaceView.getWidth() + "x" + glSurfaceView.getHeight());
|
||||
|
||||
glSurfaceView.onResume();
|
||||
glSurfaceView.requestRender();
|
||||
|
||||
renderer.setOnSurfaceTextureReadyListener(surfaceTexture -> {
|
||||
mainHandler.post(() -> {
|
||||
Surface surface = new Surface(surfaceTexture);
|
||||
|
||||
MediaItem mediaItem = MediaItem.fromUri(Uri.parse(url));
|
||||
exoPlayer.setMediaItem(mediaItem);
|
||||
exoPlayer.setVideoSurface(surface);
|
||||
exoPlayer.prepare();
|
||||
exoPlayer.play();
|
||||
Log.d("@@@", "ExoPlayer state after play: " + exoPlayer.getPlaybackState());
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
// private void loadMP4(String url) {
|
||||
// svgaSurface.setVisibility(View.GONE);
|
||||
// playerView.setVisibility(View.GONE);
|
||||
//
|
||||
// glSurfaceView.setVisibility(View.VISIBLE);
|
||||
// glSurfaceView.onResume();
|
||||
// glSurfaceView.requestRender();
|
||||
// // 使用 post 确保 GLSurfaceView 已完成 layout
|
||||
// glSurfaceView.post(() -> {
|
||||
// Log.d("@@@", "GLSurfaceView size after layout: " + glSurfaceView.getWidth() + "x" + glSurfaceView.getHeight());
|
||||
//
|
||||
// glSurfaceView.onResume();
|
||||
// glSurfaceView.requestRender();
|
||||
//
|
||||
// renderer.setOnSurfaceTextureReadyListener(surfaceTexture -> {
|
||||
// mainHandler.post(() -> {
|
||||
// Surface surface = new Surface(surfaceTexture);
|
||||
//
|
||||
// MediaItem mediaItem = MediaItem.fromUri(Uri.parse(url));
|
||||
// exoPlayer.setMediaItem(mediaItem);
|
||||
// exoPlayer.setVideoSurface(surface);
|
||||
// exoPlayer.prepare();
|
||||
// exoPlayer.play();
|
||||
// Log.d("@@@", "ExoPlayer state after play: " + exoPlayer.getPlaybackState());
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
private void clearPrevious() {
|
||||
// if (isDestroyed) return;
|
||||
@@ -790,25 +796,25 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
}
|
||||
try {
|
||||
// 停止并清理 ExoPlayer
|
||||
if (exoPlayer != null) {
|
||||
try {
|
||||
exoPlayer.stop(); // 这里可能会在错误线程中调用
|
||||
exoPlayer.clearVideoSurface();
|
||||
} catch (Exception e) {
|
||||
Logger.e("Error stopping ExoPlayer: " + e.getMessage());
|
||||
// 如果在错误线程中,切换到主线程重试
|
||||
mainHandler.post(() -> {
|
||||
try {
|
||||
if (exoPlayer != null) {
|
||||
exoPlayer.stop();
|
||||
exoPlayer.clearVideoSurface();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.e("Error stopping ExoPlayer on main thread: " + ex.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (exoPlayer != null) {
|
||||
// try {
|
||||
// exoPlayer.stop(); // 这里可能会在错误线程中调用
|
||||
// exoPlayer.clearVideoSurface();
|
||||
// } catch (Exception e) {
|
||||
// Logger.e("Error stopping ExoPlayer: " + e.getMessage());
|
||||
// // 如果在错误线程中,切换到主线程重试
|
||||
// mainHandler.post(() -> {
|
||||
// try {
|
||||
// if (exoPlayer != null) {
|
||||
// exoPlayer.stop();
|
||||
// exoPlayer.clearVideoSurface();
|
||||
// }
|
||||
// } catch (Exception ex) {
|
||||
// Logger.e("Error stopping ExoPlayer on main thread: " + ex.getMessage());
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// 停止并清理 SVGA 动画
|
||||
if (svgaSurface != null && svgaSurface.getDrawable() instanceof SVGADrawable) {
|
||||
SVGADrawable drawable = (SVGADrawable) svgaSurface.getDrawable();
|
||||
@@ -821,7 +827,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
}
|
||||
|
||||
// 隐藏所有视图
|
||||
if (playerView != null) playerView.setVisibility(View.GONE);
|
||||
// if (playerView != null) playerView.setVisibility(View.GONE);
|
||||
if (svgaSurface != null) svgaSurface.setVisibility(View.GONE);
|
||||
mBinding.playView.setVisibility(View.GONE);
|
||||
|
||||
@@ -867,7 +873,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
// 在后台线程处理文件操作和大对象清理
|
||||
performHeavyCleanup();
|
||||
// performHeavyCleanup();
|
||||
|
||||
// 回到主线程处理 UI 相关的清理
|
||||
mainHandler.post(() -> {
|
||||
@@ -944,22 +950,24 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
}
|
||||
|
||||
// 清理 ExoPlayer 资源
|
||||
if (exoPlayer != null) {
|
||||
try {
|
||||
// 使用异步停止避免阻塞
|
||||
exoPlayer.stop();
|
||||
exoPlayer.clearVideoSurface();
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, "Error releasing ExoPlayer resources: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
// if (exoPlayer != null) {
|
||||
// try {
|
||||
// // 使用异步停止避免阻塞
|
||||
// exoPlayer.stop();
|
||||
// exoPlayer.clearVideoSurface();
|
||||
// } catch (Exception e) {
|
||||
// Logger.e(TAG, "Error releasing ExoPlayer resources: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
// 清理 SVGA 资源
|
||||
if (svgaSurface != null) {
|
||||
try {
|
||||
svgaSurface.pauseAnimation();
|
||||
svgaSurface.clearAnimation();
|
||||
svgaSurface.setImageDrawable(null);
|
||||
// svgaSurface.pauseAnimation();
|
||||
// svgaSurface.clearAnimation();
|
||||
// svgaSurface.setImageDrawable(null);
|
||||
svgaSurface.stopAnimation(true);
|
||||
svgaSurface.clear();
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, "Error releasing SVGA resources: " + e.getMessage());
|
||||
}
|
||||
@@ -976,10 +984,10 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
Logger.d("AvatarFrameView", "Public release called");
|
||||
// if (isDestroyed) return;
|
||||
// 确保在主线程中执行
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
mainHandler.post(this::release);
|
||||
return;
|
||||
}
|
||||
// if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
// mainHandler.post(this::release);
|
||||
// return;
|
||||
// }
|
||||
isDestroyed = true;
|
||||
|
||||
try {
|
||||
@@ -990,28 +998,28 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
releaseResources();
|
||||
|
||||
// 延迟清理 ExoPlayer(避免主线程阻塞)
|
||||
mainHandler.postDelayed(() -> {
|
||||
if (exoPlayer != null) {
|
||||
try {
|
||||
exoPlayer.release();
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, "Error releasing ExoPlayer: " + e.getMessage());
|
||||
}
|
||||
exoPlayer = null;
|
||||
}
|
||||
}, 50);
|
||||
// mainHandler.postDelayed(() -> {
|
||||
// if (exoPlayer != null) {
|
||||
// try {
|
||||
// exoPlayer.release();
|
||||
// } catch (Exception e) {
|
||||
// Logger.e(TAG, "Error releasing ExoPlayer: " + e.getMessage());
|
||||
// }
|
||||
// exoPlayer = null;
|
||||
// }
|
||||
// }, 50);
|
||||
|
||||
// 延迟清理其他资源
|
||||
mainHandler.postDelayed(() -> {
|
||||
// 清理 PlayerView
|
||||
if (playerView != null) {
|
||||
try {
|
||||
playerView.setPlayer(null);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, "Error releasing PlayerView: " + e.getMessage());
|
||||
}
|
||||
playerView = null;
|
||||
}
|
||||
// if (playerView != null) {
|
||||
// try {
|
||||
// playerView.setPlayer(null);
|
||||
// } catch (Exception e) {
|
||||
// Logger.e(TAG, "Error releasing PlayerView: " + e.getMessage());
|
||||
// }
|
||||
// playerView = null;
|
||||
// }
|
||||
|
||||
// 清理 binding
|
||||
if (mBinding != null) {
|
||||
@@ -1020,25 +1028,12 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
}, 100);
|
||||
|
||||
|
||||
// 清理 SVGAImageView
|
||||
if (svgaSurface != null) {
|
||||
try {
|
||||
svgaSurface.pauseAnimation();
|
||||
svgaSurface.clearAnimation();
|
||||
svgaSurface.setImageDrawable(null);
|
||||
} catch (Exception e) {
|
||||
LogUtils.e(TAG, "Error releasing SVGAImageView: " + e.getMessage());
|
||||
}
|
||||
svgaSurface = null;
|
||||
}
|
||||
|
||||
// 清理 binding
|
||||
if (mBinding != null) {
|
||||
mBinding = null;
|
||||
}
|
||||
|
||||
// 清理队列
|
||||
playQueue.clear();
|
||||
|
||||
} catch (Exception e) {
|
||||
LogUtils.e(TAG, "Error in AvatarFrameView release: " + e.getMessage());
|
||||
@@ -1083,4 +1078,56 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
// mBinding.image.stopAnimation();
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始循环播放SVGA动画
|
||||
*/
|
||||
public void startLoopingSvga(String assetName) {
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
mainHandler.post(() -> startLoopingSvga(assetName));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
clearPrevious(); // 清除之前的动画
|
||||
svgaSurface.setVisibility(View.VISIBLE);
|
||||
new SVGAParser(getContext()).decodeFromAssets(assetName, new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity svgaVideoEntity) {
|
||||
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity);
|
||||
svgaSurface.setImageDrawable(drawable);
|
||||
svgaSurface.setLoops(0); // 0表示无限循环
|
||||
svgaSurface.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Log.e(TAG, "解析SVGA文件失败: " + assetName);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "播放SVGA动画出错", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止并销毁当前SVGA动画
|
||||
*/
|
||||
public void stopSvga() {
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
mainHandler.post(() -> stopSvga());
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (svgaSurface2 != null) {
|
||||
svgaSurface2.stopAnimation(true);
|
||||
svgaSurface2.setImageDrawable(null);
|
||||
svgaSurface2.setVisibility(View.GONE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "停止SVGA动画出错", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomWheatModel;
|
||||
import com.xscm.moduleutil.event.RoomBanWheatEvent;
|
||||
import com.xscm.moduleutil.event.RoomBeckoningEvent;
|
||||
import com.xscm.moduleutil.event.RoomCardiacValueChangedEvent;
|
||||
import com.xscm.moduleutil.event.RoomFaceEvent;
|
||||
import com.xscm.moduleutil.interfaces.IBaseWheat;
|
||||
import com.xscm.moduleutil.interfaces.SoundLevelUpdateListener;
|
||||
@@ -233,14 +232,16 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
if (userId.equals(pitBean.getUser_id())) {
|
||||
if (soundLevel == 0) {
|
||||
mIvRipple.post(() -> {
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
mIvRipple.setVisibility(GONE);
|
||||
});
|
||||
mIvRipple.setVisibility(GONE);
|
||||
} else {
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mIvRipple.post(() -> {
|
||||
mIvRipple.startAnimation();
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
}
|
||||
iv_on_line.setVisibility(GONE);
|
||||
// mIvRipple.setSource(getResources().getResourceName(R.raw.ripple3695), 2);
|
||||
|
||||
@@ -269,7 +270,9 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
} else {
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mIvRipple.post(() -> {
|
||||
mIvRipple.startAnimation();
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
}
|
||||
iv_on_line.setVisibility(GONE);
|
||||
// mIvRipple.setSource(getResources().getResourceName(R.raw.ripple3695), 2);
|
||||
|
||||
@@ -451,7 +454,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
// mCharmView.setSex(pitBean.getSex(), pitBean.getUser_id(), pitBean.getXin_dong(), false);
|
||||
// }
|
||||
// }
|
||||
EventBus.getDefault().post(new RoomCardiacValueChangedEvent(pitNumber, pitBean.getCharm()));
|
||||
// EventBus.getDefault().post(new RoomCardiacValueChangedEvent(pitNumber, pitBean.getCharm()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +466,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
if (mCharmView != null) {
|
||||
pitBean.setCharm("0");
|
||||
mCharmView.setSex(pitBean.getSex(), pitBean.getUser_id(), pitBean.getCharm(), true);
|
||||
EventBus.getDefault().post(new RoomCardiacValueChangedEvent(pitNumber, pitBean.getCharm()));
|
||||
// EventBus.getDefault().post(new RoomCardiacValueChangedEvent(pitNumber, pitBean.getCharm()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class RoomDefaultWheatView extends BaseWheatView {
|
||||
sex = bean.getSex();
|
||||
if (isOn()) {
|
||||
//开启声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mTvName.setText(bean.getNickname());
|
||||
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
|
||||
@@ -100,7 +100,7 @@ public class RoomDefaultWheatView extends BaseWheatView {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
mIvFace.remove();
|
||||
//停止声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation( true);
|
||||
mIvRipple.setVisibility(GONE);
|
||||
}
|
||||
if (showSexIcon) {
|
||||
@@ -112,19 +112,19 @@ public class RoomDefaultWheatView extends BaseWheatView {
|
||||
mCharmView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
if (pitBean.is_pk() ){
|
||||
if (pitBean.getUser_id()!=null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (pitBean.is_pk()) {
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
tv_time_pk.setVisibility(VISIBLE);
|
||||
setSex(pitBean.getCharm(),false);
|
||||
setSex(pitBean.getCharm(), false);
|
||||
mCharmView.setVisibility(GONE);
|
||||
}else {
|
||||
} else {
|
||||
tv_time_pk.setVisibility(GONE);
|
||||
}
|
||||
// ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mCharmView.getLayoutParams();
|
||||
// params.width = 35;
|
||||
// mCharmView.setLayoutParams(params);
|
||||
|
||||
}else {
|
||||
} else {
|
||||
tv_time_pk.setVisibility(GONE);
|
||||
mCharmView.setVisibility(VISIBLE);
|
||||
// ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mCharmView.getLayoutParams();
|
||||
@@ -134,7 +134,8 @@ public class RoomDefaultWheatView extends BaseWheatView {
|
||||
|
||||
// setCardiac(pitBean.getPit_number(), 0.0f);
|
||||
}
|
||||
public void setSex( String value, boolean format) {
|
||||
|
||||
public void setSex(String value, boolean format) {
|
||||
if (format) {
|
||||
tv_time_pk.setText(value);
|
||||
} else {
|
||||
@@ -221,17 +222,18 @@ public class RoomDefaultWheatView extends BaseWheatView {
|
||||
|
||||
@Override
|
||||
public void onLocalSoundLevelUpdate(int volume) {
|
||||
if (volume==0){
|
||||
mIvRipple.stopAnimation();
|
||||
if (volume == 0) {
|
||||
mIvRipple.stopAnimation( true);
|
||||
} else {
|
||||
if (pitBean.getUser_id().equals(SpUtil.getUserId()) && closePhone) {
|
||||
mIvRipple.stopAnimation();
|
||||
}else {
|
||||
mIvRipple.stopAnimation( true);
|
||||
} else {
|
||||
mIvRipple.post(() -> {
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
}
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -247,4 +249,8 @@ public class RoomDefaultWheatView extends BaseWheatView {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegister(Object obj) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
||||
sex = bean.getSex();
|
||||
if (isOn()) {
|
||||
//开启声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mTvName.setText(bean.getNickname());
|
||||
ImageUtils.loadCenterCrop(bean.getAvatar(), mRiv);
|
||||
@@ -113,7 +113,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
mIvFace.remove();
|
||||
//停止声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation( true);
|
||||
mIvRipple.setVisibility(GONE);
|
||||
}
|
||||
if (showSexIcon) {
|
||||
@@ -301,6 +301,11 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
||||
this.mOnZhulClickListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegister(Object obj) {
|
||||
|
||||
}
|
||||
|
||||
public interface OnZhulClickListener {
|
||||
void onZhulClick(RoomFriendshipWheatView view, RoomPitBean pitBean);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class RoomKtvWheatView extends BaseWheatView {
|
||||
sex = bean.getSex();
|
||||
if (isOn()) {
|
||||
//开启声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mTvName.setText(bean.getNickname());
|
||||
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
|
||||
@@ -96,7 +96,7 @@ public class RoomKtvWheatView extends BaseWheatView {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
mIvFace.remove();
|
||||
//停止声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
mIvRipple.setVisibility(GONE);
|
||||
}
|
||||
if (showSexIcon) {
|
||||
@@ -218,10 +218,10 @@ public class RoomKtvWheatView extends BaseWheatView {
|
||||
@Override
|
||||
public void onLocalSoundLevelUpdate(int volume) {
|
||||
if (volume==0){
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
} else {
|
||||
if (pitBean.getUser_id().equals(SpUtil.getUserId()) && closePhone) {
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
}else {
|
||||
mIvRipple.post(() -> {
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
@@ -251,4 +251,8 @@ public class RoomKtvWheatView extends BaseWheatView {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegister(Object obj) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class RoomMakeWheatView extends BaseWheatView {
|
||||
sex = bean.getSex();
|
||||
if (isOn()) {
|
||||
//开启声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mTvName.setText(bean.getNickname());
|
||||
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
|
||||
@@ -96,7 +96,7 @@ public class RoomMakeWheatView extends BaseWheatView {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
mIvFace.remove();
|
||||
//停止声浪
|
||||
mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
mIvRipple.setVisibility(GONE);
|
||||
}
|
||||
if (showSexIcon) {
|
||||
@@ -211,4 +211,9 @@ public class RoomMakeWheatView extends BaseWheatView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegister(Object obj) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class RoomSingSongWheatView extends BaseWheatView {
|
||||
|
||||
sex = bean.getSex();
|
||||
pitBean = bean; // 统一使用参数 bean
|
||||
|
||||
stopAndClearAnimation(); // 清理之前的动画资源
|
||||
if (isOn()) {
|
||||
handleOnState(bean);
|
||||
} else {
|
||||
@@ -78,7 +78,7 @@ public class RoomSingSongWheatView extends BaseWheatView {
|
||||
}
|
||||
|
||||
private void handleOnState(RoomPitBean bean) {
|
||||
stopAndClearAnimation(); // 清理之前的动画资源
|
||||
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mTvName.setText(bean.getNickname());
|
||||
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
|
||||
@@ -96,7 +96,6 @@ public class RoomSingSongWheatView extends BaseWheatView {
|
||||
}
|
||||
|
||||
private void handleOffState(RoomPitBean bean) {
|
||||
stopAndClearAnimation(); // 下麦时停止并清理动画
|
||||
mTvName.setText(getPitNumberText());
|
||||
|
||||
if (showBoss && TextUtils.equals(WHEAT_BOSS, pitNumber)) {
|
||||
@@ -261,9 +260,10 @@ public class RoomSingSongWheatView extends BaseWheatView {
|
||||
// 停止并清理动画资源
|
||||
private void stopAndClearAnimation() {
|
||||
if (mIvRipple != null) {
|
||||
mIvRipple.stopAnimation();
|
||||
// mIvRipple.stopAnimation();
|
||||
mIvRipple.stopAnimation(true);
|
||||
// 清理SVGA资源,避免内存泄漏
|
||||
mIvRipple.clear();
|
||||
// mIvRipple.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,28 +281,23 @@ public class RoomSingSongWheatView extends BaseWheatView {
|
||||
|
||||
@Override
|
||||
public void onLocalSoundLevelUpdate(int volume) {
|
||||
if (mIvRipple == null) {
|
||||
return;
|
||||
}
|
||||
if (volume == 0) {
|
||||
if (mIvRipple != null) {
|
||||
mIvRipple.stopAnimation();
|
||||
}
|
||||
mIvRipple.setVisibility(GONE);
|
||||
mIvRipple.stopAnimation(true);
|
||||
} else {
|
||||
// 增加空指针检查
|
||||
if (pitBean != null && pitBean.getUser_id() != null &&
|
||||
pitBean.getUser_id().equals(SpUtil.getUserId()) && closePhone) {
|
||||
if (mIvRipple != null) {
|
||||
mIvRipple.stopAnimation();
|
||||
}
|
||||
mIvRipple.stopAnimation(true);
|
||||
} else {
|
||||
if (mIvRipple != null) {
|
||||
mIvRipple.post(() -> {
|
||||
if (mIvRipple != null && !mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
}
|
||||
if (mIvRipple != null) {
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
mIvRipple.post(() -> {
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mIvRipple.startAnimation();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,4 +311,9 @@ public class RoomSingSongWheatView extends BaseWheatView {
|
||||
public void userOffline(int userId, int reason) {
|
||||
// 暂无实现
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegister(Object obj) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -26,6 +27,7 @@ public class WheatLayoutSingManager {
|
||||
private boolean isSingleMode = false;
|
||||
private int currentSinglePit = -1;
|
||||
private RoomSingSongWheatView singleWheatView;
|
||||
private List<RoomSingSongWheatView> multiWheatViews=new ArrayList<>();
|
||||
|
||||
private final int[] pitIndexMap = {9, 10, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
|
||||
@@ -129,6 +131,8 @@ public class WheatLayoutSingManager {
|
||||
return;
|
||||
}
|
||||
|
||||
multiWheatViews.clear();
|
||||
|
||||
int screenWidth = getScreenWidth();
|
||||
int itemWidth = screenWidth / 4; // 每个控件宽度为屏幕宽度的 1/4
|
||||
|
||||
@@ -140,7 +144,7 @@ public class WheatLayoutSingManager {
|
||||
RoomSingSongWheatView wheatView = new RoomSingSongWheatView(context);
|
||||
wheatView.pitNumber = String.valueOf(pitNumber);
|
||||
wheatView.setData(pitList.get(pitNumber - 1));
|
||||
|
||||
multiWheatViews.add(wheatView);
|
||||
LinearLayout.LayoutParams params;
|
||||
|
||||
if (i == 0) {
|
||||
@@ -440,22 +444,30 @@ public class WheatLayoutSingManager {
|
||||
// 添加资源清理方法
|
||||
public void release() {
|
||||
try {
|
||||
|
||||
if (multiWheatViews!=null){
|
||||
for (RoomSingSongWheatView wheatView : multiWheatViews) {
|
||||
wheatView.releaseResources();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (container != null) {
|
||||
// 清理所有子视图的资源
|
||||
for (int i = 0; i < container.getChildCount(); i++) {
|
||||
View child = container.getChildAt(i);
|
||||
if (child instanceof LinearLayout) {
|
||||
LinearLayout linearLayout = (LinearLayout) child;
|
||||
for (int j = 0; j < linearLayout.getChildCount(); j++) {
|
||||
View view = linearLayout.getChildAt(j);
|
||||
if (view instanceof RoomSingSongWheatView) {
|
||||
((RoomSingSongWheatView) view).releaseResources();
|
||||
}
|
||||
}
|
||||
} else if (child instanceof RoomSingSongWheatView) {
|
||||
((RoomSingSongWheatView) child).releaseResources();
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < container.getChildCount(); i++) {
|
||||
// View child = container.getChildAt(i);
|
||||
// if (child instanceof LinearLayout) {
|
||||
// LinearLayout linearLayout = (LinearLayout) child;
|
||||
// for (int j = 0; j < linearLayout.getChildCount(); j++) {
|
||||
// View view = linearLayout.getChildAt(j);
|
||||
// if (view instanceof RoomSingSongWheatView) {
|
||||
// ((RoomSingSongWheatView) view).releaseResources();
|
||||
// }
|
||||
// }
|
||||
// } else if (child instanceof RoomSingSongWheatView) {
|
||||
// ((RoomSingSongWheatView) child).releaseResources();
|
||||
// }
|
||||
// }
|
||||
container.removeAllViews();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.blankj.utilcode.util.ImageUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.CircleListBean;
|
||||
import com.xscm.moduleutil.databinding.RoomDialogShareBinding;
|
||||
import com.xscm.moduleutil.utils.BaseBottomSheetDialog;
|
||||
@@ -142,12 +143,12 @@ public class ShareDialog extends BaseBottomSheetDialog<RoomDialogShareBinding> {
|
||||
} else if (R.id.tv_jub == id) {
|
||||
if (types == 3) {
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", "https://vespa.qxmier.com/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + types + "&fromId=" + bean.getId());
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + types + "&fromId=" + bean.getId());
|
||||
intent.putExtra("title", "举报");
|
||||
startActivity(intent);
|
||||
}else if (types == 1){
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", "https://vespa.qxmier.com/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + types + "&fromId=" + bean.getUser_id());
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + types + "&fromId=" + bean.getUser_id());
|
||||
intent.putExtra("title", "举报");
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
android:id="@+id/lottery_buttons_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_16"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
android:id="@+id/lottery_buttons_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_16"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -43,6 +43,19 @@
|
||||
app:loopCount="0"
|
||||
app:source="ripple3695.svga" />
|
||||
|
||||
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
|
||||
<!-- android:id="@+id/iv_ripple"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_8"-->
|
||||
<!-- app:autoPlay="false"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintDimensionRatio="1:1.05"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- />-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sex"
|
||||
android:layout_width="0dp"
|
||||
|
||||
@@ -40,6 +40,16 @@
|
||||
app:loopCount="0"
|
||||
app:source="ripple3695.svga" />
|
||||
|
||||
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
|
||||
<!-- android:id="@+id/iv_ripple"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@id/riv"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@id/riv"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@id/riv"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@id/riv"-->
|
||||
<!-- />-->
|
||||
|
||||
<!-- 头像框,与头像大小相同,覆盖在头像上 -->
|
||||
<com.xscm.moduleutil.widget.AvatarFrameView
|
||||
android:id="@+id/iv_frame"
|
||||
|
||||
@@ -27,7 +27,17 @@
|
||||
app:layout_constraintHeight_percent="0.5"
|
||||
app:loopCount="0"
|
||||
app:source="ripple3695.svga" />
|
||||
|
||||
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
|
||||
<!-- android:id="@+id/iv_ripple"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintDimensionRatio="1:1"-->
|
||||
<!-- app:layout_constraintHeight_default="percent"-->
|
||||
<!-- app:layout_constraintHeight_percent="0.5"-->
|
||||
<!-- />-->
|
||||
<!--头像 - 占整体高度的一半-->
|
||||
<com.xscm.moduleutil.widget.GifAvatarOvalView
|
||||
android:id="@+id/riv"
|
||||
|
||||
@@ -44,6 +44,19 @@
|
||||
app:source="ripple3695.svga"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
|
||||
<!-- android:id="@+id/iv_ripple"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintDimensionRatio="1:1"-->
|
||||
<!-- app:layout_constraintHeight_percent="0.8"-->
|
||||
<!-- app:layout_constraintWidth_percent="0.8"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- />-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sex"
|
||||
android:layout_width="0dp"
|
||||
|
||||
@@ -29,6 +29,18 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
|
||||
<!-- android:id="@+id/iv_ripple"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_8"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintHeight_percent="0.99"-->
|
||||
<!-- app:layout_constraintWidth_percent="0.99"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- />-->
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/iv_ripple"
|
||||
android:layout_width="0dp"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<activity
|
||||
android:name=".activity.RoomActivity"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTask"
|
||||
android:launchMode="singleInstance"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:enableOnBackInvokedCallback="false"
|
||||
android:theme="@style/TransparentActivityTheme"
|
||||
|
||||
@@ -316,7 +316,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
// EMqttService.cleanSubscribeRoom(roomId);
|
||||
CommonAppContext.getInstance().isPlaying = false;
|
||||
CommonAppContext.getInstance().isShow = false;
|
||||
cleanupResources();
|
||||
// cleanupResources();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -798,6 +798,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
handleMsgType1016(messageEvent, text);
|
||||
} else if (msgType == 1039) {
|
||||
handleMsgType1039(messageEvent, text);
|
||||
}else if (msgType==1028){
|
||||
roomFragment.handleMsgType1028(messageEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -926,7 +928,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
} else if ("1".equals(labelId)) {
|
||||
roomFragment.SingSongEvent(messageEvent);
|
||||
}
|
||||
} else {
|
||||
} else if ("7".equals(typeId)){
|
||||
for (RoomPitBean roomPitBean : pitList) {
|
||||
if (roomPitBean.getUser_id().equals(toUserInfo.getUser_id() + "")) {
|
||||
roomPitBean.setCharm(toUserInfo.getCharm());
|
||||
@@ -1676,8 +1678,14 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
@Override
|
||||
public void onMinimize() {
|
||||
// 处理最小化逻辑,比如不销毁 Activity,仅移至后台
|
||||
// CommonAppContext.getInstance().isShow = false;
|
||||
// ARouter.getInstance().build(ARouteConstants.ME).navigation();//栈顶复用
|
||||
// moveTaskToBack(true);
|
||||
|
||||
CommonAppContext.getInstance().isShow = false;
|
||||
ARouter.getInstance().build(ARouteConstants.ME).navigation();//栈顶复用
|
||||
ARouter.getInstance().build(ARouteConstants.ME)
|
||||
.withFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.navigation();
|
||||
// moveTaskToBack(true);
|
||||
}
|
||||
|
||||
@@ -2688,6 +2696,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
MyRoomSingleton.getInstance().onExitRoom();
|
||||
MessageListenerSingleton.reset(roomId);
|
||||
ARouter.getInstance().build(ARouteConstants.ME).navigation();//栈顶复用
|
||||
cleanupResources();
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,26 +5,31 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.example.moduleroom.R;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/26
|
||||
*@description: 底部弹框,退出房间选择
|
||||
* @author qx
|
||||
* @data 2025/6/26
|
||||
* @description: 底部弹框,退出房间选择
|
||||
*/
|
||||
public class ExitRoomBottomSheet extends BottomSheetDialogFragment {
|
||||
|
||||
public interface OnOptionSelectedListener {
|
||||
void onMinimize(); // 最小化
|
||||
|
||||
void onExitRoom(); // 退出房间
|
||||
|
||||
void onCancel(); // 取消
|
||||
}
|
||||
|
||||
private OnOptionSelectedListener listener;
|
||||
private TextView tv_minimize;
|
||||
|
||||
public static ExitRoomBottomSheet newInstance() {
|
||||
return new ExitRoomBottomSheet();
|
||||
@@ -42,7 +47,7 @@ public class ExitRoomBottomSheet extends BottomSheetDialogFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.dialog_exit_room_bottom_sheet, container, false);
|
||||
|
||||
tv_minimize = view.findViewById(R.id.tv_minimize);
|
||||
view.findViewById(R.id.tv_minimize).setOnClickListener(v -> {
|
||||
if (listener != null) listener.onMinimize();
|
||||
dismiss();
|
||||
@@ -61,6 +66,10 @@ public class ExitRoomBottomSheet extends BottomSheetDialogFragment {
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setViewUp(boolean isUp) {
|
||||
tv_minimize.setVisibility(isUp ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public void setOnOptionSelectedListener(OnOptionSelectedListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -383,16 +384,25 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
|
||||
return;
|
||||
}
|
||||
this.dismiss();
|
||||
FragmentManager fm = getParentFragmentManager();
|
||||
GiftLotteryDialog newDialog = GiftLotteryDialog.newInstance(gift.getGift_bag() + "", roomId, userId);
|
||||
newDialog.show(fm, "GiftLotteryDialog");
|
||||
// this.dismiss();
|
||||
// FragmentManager fm = getParentFragmentManager();
|
||||
// GiftLotteryDialog newDialog = GiftLotteryDialog.newInstance(gift.getGift_bag() + "", roomId, userId);
|
||||
// newDialog.show(fm, "GiftLotteryDialog");
|
||||
|
||||
fm.beginTransaction()
|
||||
.replace(getId(), newDialog)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
try {
|
||||
// 直接显示对话框,移除有问题的 FragmentTransaction
|
||||
this.dismissAllowingStateLoss(); // 使用 dismissAllowingStateLoss 更安全
|
||||
|
||||
FragmentManager fm = getParentFragmentManager();
|
||||
if (fm != null && !fm.isDestroyed()) {
|
||||
GiftLotteryDialog newDialog = GiftLotteryDialog.newInstance(
|
||||
String.valueOf(gift.getGift_bag()), roomId, userId);
|
||||
newDialog.show(fm, "GiftLotteryDialog");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("RoomGiftDialogFragment", "Error in showGiftLotteryDialog", e);
|
||||
ToastUtils.show("操作失败,请重试");
|
||||
}
|
||||
|
||||
// 如果当前dialog存在且正在显示,先关闭
|
||||
// if (currentDialog != null && currentDialog.isVisible()) {
|
||||
|
||||
@@ -300,6 +300,8 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
|
||||
}
|
||||
if (paim==1){
|
||||
contentView.findViewById(R.id.action_kick_out).setVisibility(GONE);
|
||||
}else {
|
||||
contentView.findViewById(R.id.action_kick_out).setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,7 +479,7 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
|
||||
mBinding.roomDian.setVisibility(View.GONE);
|
||||
mBinding.roomJb.setVisibility(View.VISIBLE);
|
||||
mBinding.roomLh.setVisibility(View.VISIBLE);
|
||||
mBinding.roomBo.setVisibility(View.GONE);
|
||||
mBinding.roomBo.setVisibility(VISIBLE);
|
||||
mBinding.roomMCz.setVisibility(GONE);
|
||||
|
||||
}else {
|
||||
|
||||
@@ -209,6 +209,10 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
initPopupWindow();
|
||||
}
|
||||
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp) {
|
||||
this.roomInfoResp = roomInfoResp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 麦位视图点击事件处理
|
||||
*
|
||||
|
||||
@@ -218,7 +218,7 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
toChatUsername = roomInfoResp.getRoom_info().getChatrooms();
|
||||
this.roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
t.setText("羽声严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||
t.setText("秘地严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||
// 加入群组成功
|
||||
handleRoomMessage(new RoomMessageEvent(1000, roomId, t));
|
||||
onChatRoomViewCreation();
|
||||
@@ -515,6 +515,9 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
public void handleRoomMessage(RoomMessageEvent message) {
|
||||
LogUtils.e("@@@", "handleRoomMessage: " + message);
|
||||
LogUtils.e("@@@", "handleRoomMessage: roomId" + roomId);
|
||||
if (easeChatAdapter==null){
|
||||
easeChatAdapter=new EaseChatAdapter();
|
||||
}
|
||||
if (message.getRoomId() == null){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,9 +85,8 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
private final ScreenCaptureParameters screenCaptureParameters = new ScreenCaptureParameters();
|
||||
|
||||
|
||||
public static RoomCabinFragment newInstance(RoomInfoResp roomInfoResp) {
|
||||
public static RoomCabinFragment newInstance() {
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("roomInfoResp", (Serializable) roomInfoResp);
|
||||
RoomCabinFragment fragment = new RoomCabinFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
@@ -96,12 +95,12 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
roomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfoResp");
|
||||
if (roomInfoResp != null) {
|
||||
roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
cpUserBean = roomInfoResp.getCp_user();
|
||||
label_id = roomInfoResp.getRoom_info().getLabel_id();
|
||||
}
|
||||
// roomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfoResp");
|
||||
// if (roomInfoResp != null) {
|
||||
// roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
// cpUserBean = roomInfoResp.getCp_user();
|
||||
// label_id = roomInfoResp.getRoom_info().getLabel_id();
|
||||
// }
|
||||
}
|
||||
private boolean isLandscape;
|
||||
|
||||
@@ -146,63 +145,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
@Override
|
||||
protected void initData() {
|
||||
if (roomInfoResp == null) return;
|
||||
mBinding.ivExit.setOnClickListener(this::onHeartLineClicked);
|
||||
|
||||
// 获取当前用户 ID
|
||||
String currentUserId = SpUtil.getUserId() + "";
|
||||
|
||||
// 定义两个 RoomPitBean 对象,分别用于显示在 roomMakeWheat1 和 roomMakeWheat2
|
||||
RoomPitBean selfBean = new RoomPitBean(); // 自己的 bean
|
||||
RoomPitBean otherBean = new RoomPitBean(); // 另一个用户的 bean
|
||||
|
||||
boolean isSelfFirst = false;
|
||||
|
||||
// 判断当前用户是 user_id 还是 user_id1
|
||||
if (cpUserBean != null) {
|
||||
if (currentUserId.equals(cpUserBean.getUser_id())) {
|
||||
// 当前用户是 user_id
|
||||
selfBean.setUser_id(cpUserBean.getUser_id());
|
||||
selfBean.setUser_code(cpUserBean.getUser_code());
|
||||
selfBean.setNickname(cpUserBean.getNickname());
|
||||
selfBean.setAvatar(cpUserBean.getAvatar());
|
||||
selfBean.setDress(cpUserBean.getDress());
|
||||
selfBean.setPit_number("000");
|
||||
|
||||
otherBean.setUser_id(cpUserBean.getUser_id1());
|
||||
otherBean.setUser_code(cpUserBean.getUser_code1());
|
||||
otherBean.setNickname(cpUserBean.getNickname1());
|
||||
otherBean.setAvatar(cpUserBean.getAvatar1());
|
||||
otherBean.setDress(cpUserBean.getDress1());
|
||||
otherBean.setPit_number("000");
|
||||
|
||||
|
||||
} else if (currentUserId.equals(cpUserBean.getUser_id1())) {
|
||||
// 当前用户是 user_id1,则交换位置
|
||||
selfBean.setUser_id(cpUserBean.getUser_id1());
|
||||
selfBean.setUser_code(cpUserBean.getUser_code1());
|
||||
selfBean.setNickname(cpUserBean.getNickname1());
|
||||
selfBean.setAvatar(cpUserBean.getAvatar1());
|
||||
selfBean.setDress(cpUserBean.getDress1());
|
||||
selfBean.setPit_number("000");
|
||||
|
||||
otherBean.setUser_id(cpUserBean.getUser_id());
|
||||
otherBean.setUser_code(cpUserBean.getUser_code());
|
||||
otherBean.setNickname(cpUserBean.getNickname());
|
||||
otherBean.setAvatar(cpUserBean.getAvatar());
|
||||
otherBean.setDress(cpUserBean.getDress());
|
||||
otherBean.setPit_number("000");
|
||||
}
|
||||
}
|
||||
// 不论谁是自己,始终将自己放在 roomMakeWheat1
|
||||
mBinding.roomMakeWheat1.setData(selfBean);
|
||||
// 将另一个用户的数据放在 roomMakeWheat2
|
||||
mBinding.roomMakeWheat2.setData(otherBean);
|
||||
mBinding.tvMainTitle.setText(roomInfoResp.getRoom_info().getRoom_name());
|
||||
mBinding.tvHeartValue2.setText(roomInfoResp.getRoom_info().getHot_value());
|
||||
if (cpUserBean != null) {
|
||||
countDownTime(Long.parseLong(cpUserBean.getTime_day()));
|
||||
}
|
||||
mediaProjectionManager = (MediaProjectionManager) getContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
|
||||
|
||||
}
|
||||
|
||||
@@ -227,7 +170,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
public void onClick(View v) {
|
||||
RoomPitBean roomPitBean = mBinding.roomMakeWheat2.pitBean;
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setUser_id(Integer.parseInt(roomPitBean.getUser_id()));
|
||||
userInfo.setUser_id(Integer.parseInt(roomPitBean.getUser_id()!=null ? roomPitBean.getUser_id() : "0"));
|
||||
userInfo.setNickname(roomPitBean.getNickname());
|
||||
userInfo.setAvatar(roomPitBean.getAvatar());
|
||||
userInfo.setPit_number("");
|
||||
@@ -258,7 +201,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
|
||||
if (roomInfoResp != null && roomInfoResp.getRoom_owner().getUser_id().equals(SpUtil.getUserId()+"")){
|
||||
mBinding.im3.setVisibility(VISIBLE);
|
||||
setvkk(false);
|
||||
// setvkk(false);
|
||||
}else {
|
||||
mBinding.im3.setVisibility(GONE);
|
||||
}
|
||||
@@ -268,6 +211,84 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
// }
|
||||
}
|
||||
|
||||
public void handleMsgType1028(RoomMessageEvent messageEvent){
|
||||
if (messageEvent.getMsgType()==1028){
|
||||
mBinding.tvHeartValue2.setText(messageEvent.getText().getHot_value());
|
||||
}
|
||||
}
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp){
|
||||
this.roomInfoResp = roomInfoResp;
|
||||
// if (roomInfoResp != null) {
|
||||
// roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
// cpUserBean = roomInfoResp.getCp_user();
|
||||
// label_id = roomInfoResp.getRoom_info().getLabel_id();
|
||||
// }
|
||||
// if (roomInfoResp != null && roomInfoResp.getRoom_owner().getUser_id().equals(SpUtil.getUserId()+"")){
|
||||
// mBinding.im3.setVisibility(VISIBLE);
|
||||
//// setvkk(false);
|
||||
// }else {
|
||||
// mBinding.im3.setVisibility(GONE);
|
||||
// }
|
||||
//
|
||||
// mBinding.ivExit.setOnClickListener(this::onHeartLineClicked);
|
||||
//
|
||||
// // 获取当前用户 ID
|
||||
// String currentUserId = SpUtil.getUserId() + "";
|
||||
//
|
||||
//// 定义两个 RoomPitBean 对象,分别用于显示在 roomMakeWheat1 和 roomMakeWheat2
|
||||
// RoomPitBean selfBean = new RoomPitBean(); // 自己的 bean
|
||||
// RoomPitBean otherBean = new RoomPitBean(); // 另一个用户的 bean
|
||||
//
|
||||
// boolean isSelfFirst = false;
|
||||
//
|
||||
//// 判断当前用户是 user_id 还是 user_id1
|
||||
// if (cpUserBean != null) {
|
||||
// if (currentUserId.equals(cpUserBean.getUser_id())) {
|
||||
// // 当前用户是 user_id
|
||||
// selfBean.setUser_id(cpUserBean.getUser_id());
|
||||
// selfBean.setUser_code(cpUserBean.getUser_code());
|
||||
// selfBean.setNickname(cpUserBean.getNickname());
|
||||
// selfBean.setAvatar(cpUserBean.getAvatar());
|
||||
// selfBean.setDress(cpUserBean.getDress());
|
||||
// selfBean.setPit_number("000");
|
||||
//
|
||||
// otherBean.setUser_id(cpUserBean.getUser_id1());
|
||||
// otherBean.setUser_code(cpUserBean.getUser_code1());
|
||||
// otherBean.setNickname(cpUserBean.getNickname1());
|
||||
// otherBean.setAvatar(cpUserBean.getAvatar1());
|
||||
// otherBean.setDress(cpUserBean.getDress1());
|
||||
// otherBean.setPit_number("000");
|
||||
//
|
||||
//
|
||||
// } else if (currentUserId.equals(cpUserBean.getUser_id1())) {
|
||||
// // 当前用户是 user_id1,则交换位置
|
||||
// selfBean.setUser_id(cpUserBean.getUser_id1());
|
||||
// selfBean.setUser_code(cpUserBean.getUser_code1());
|
||||
// selfBean.setNickname(cpUserBean.getNickname1());
|
||||
// selfBean.setAvatar(cpUserBean.getAvatar1());
|
||||
// selfBean.setDress(cpUserBean.getDress1());
|
||||
// selfBean.setPit_number("000");
|
||||
//
|
||||
// otherBean.setUser_id(cpUserBean.getUser_id());
|
||||
// otherBean.setUser_code(cpUserBean.getUser_code());
|
||||
// otherBean.setNickname(cpUserBean.getNickname());
|
||||
// otherBean.setAvatar(cpUserBean.getAvatar());
|
||||
// otherBean.setDress(cpUserBean.getDress());
|
||||
// otherBean.setPit_number("000");
|
||||
// }
|
||||
// }
|
||||
//// 不论谁是自己,始终将自己放在 roomMakeWheat1
|
||||
// mBinding.roomMakeWheat1.setData(selfBean);
|
||||
//// 将另一个用户的数据放在 roomMakeWheat2
|
||||
// mBinding.roomMakeWheat2.setData(otherBean);
|
||||
// mBinding.tvMainTitle.setText(roomInfoResp.getRoom_info().getRoom_name());
|
||||
// mBinding.tvHeartValue2.setText(roomInfoResp.getRoom_info().getHot_value());
|
||||
// if (cpUserBean != null) {
|
||||
// countDownTime(Long.parseLong(cpUserBean.getTime_day()));
|
||||
// }
|
||||
// mediaProjectionManager = (MediaProjectionManager) getContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
|
||||
}
|
||||
|
||||
public void upCabinFragment(long time){
|
||||
countDownTime( time);
|
||||
}
|
||||
@@ -299,7 +320,6 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void roomInfoEvent(RoomMessageEvent messageEvent) {
|
||||
if (messageEvent.getMsgType() == 1028) {
|
||||
mBinding.tvHeartValue2.setText(messageEvent.getText().getHot_value());
|
||||
@@ -311,6 +331,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
// EventBus.getDefault().post(new RoomOutEvent());
|
||||
// ARouter.getInstance().build(ARouteConstants.LIVE_ROOM).withString("form","首页热门列表").withString("roomId", item.getRoom_id()).navigation();
|
||||
ExitRoomBottomSheet bottomSheet = ExitRoomBottomSheet.newInstance();
|
||||
bottomSheet.setViewUp(false);
|
||||
bottomSheet.setOnOptionSelectedListener(new ExitRoomBottomSheet.OnOptionSelectedListener() {
|
||||
@Override
|
||||
public void onMinimize() {
|
||||
@@ -473,6 +494,76 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
public void roomInfoUpdate(RoomInfoResp resp) {
|
||||
roomInfoResp = resp;
|
||||
// updateWheatData();
|
||||
|
||||
if (roomInfoResp != null) {
|
||||
roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
cpUserBean = roomInfoResp.getCp_user();
|
||||
label_id = roomInfoResp.getRoom_info().getLabel_id();
|
||||
}
|
||||
if (roomInfoResp != null && roomInfoResp.getRoom_owner().getUser_id().equals(SpUtil.getUserId()+"")){
|
||||
mBinding.im3.setVisibility(VISIBLE);
|
||||
// setvkk(false);
|
||||
}else {
|
||||
mBinding.im3.setVisibility(GONE);
|
||||
}
|
||||
|
||||
mBinding.ivExit.setOnClickListener(this::onHeartLineClicked);
|
||||
|
||||
// 获取当前用户 ID
|
||||
String currentUserId = SpUtil.getUserId() + "";
|
||||
|
||||
// 定义两个 RoomPitBean 对象,分别用于显示在 roomMakeWheat1 和 roomMakeWheat2
|
||||
RoomPitBean selfBean = new RoomPitBean(); // 自己的 bean
|
||||
RoomPitBean otherBean = new RoomPitBean(); // 另一个用户的 bean
|
||||
|
||||
boolean isSelfFirst = false;
|
||||
|
||||
// 判断当前用户是 user_id 还是 user_id1
|
||||
if (cpUserBean != null) {
|
||||
if (currentUserId.equals(cpUserBean.getUser_id())) {
|
||||
// 当前用户是 user_id
|
||||
selfBean.setUser_id(cpUserBean.getUser_id());
|
||||
selfBean.setUser_code(cpUserBean.getUser_code());
|
||||
selfBean.setNickname(cpUserBean.getNickname());
|
||||
selfBean.setAvatar(cpUserBean.getAvatar());
|
||||
selfBean.setDress(cpUserBean.getDress());
|
||||
selfBean.setPit_number("000");
|
||||
|
||||
otherBean.setUser_id(cpUserBean.getUser_id1());
|
||||
otherBean.setUser_code(cpUserBean.getUser_code1());
|
||||
otherBean.setNickname(cpUserBean.getNickname1());
|
||||
otherBean.setAvatar(cpUserBean.getAvatar1());
|
||||
otherBean.setDress(cpUserBean.getDress1());
|
||||
otherBean.setPit_number("000");
|
||||
|
||||
|
||||
} else if (currentUserId.equals(cpUserBean.getUser_id1())) {
|
||||
// 当前用户是 user_id1,则交换位置
|
||||
selfBean.setUser_id(cpUserBean.getUser_id1());
|
||||
selfBean.setUser_code(cpUserBean.getUser_code1());
|
||||
selfBean.setNickname(cpUserBean.getNickname1());
|
||||
selfBean.setAvatar(cpUserBean.getAvatar1());
|
||||
selfBean.setDress(cpUserBean.getDress1());
|
||||
selfBean.setPit_number("000");
|
||||
|
||||
otherBean.setUser_id(cpUserBean.getUser_id());
|
||||
otherBean.setUser_code(cpUserBean.getUser_code());
|
||||
otherBean.setNickname(cpUserBean.getNickname());
|
||||
otherBean.setAvatar(cpUserBean.getAvatar());
|
||||
otherBean.setDress(cpUserBean.getDress());
|
||||
otherBean.setPit_number("000");
|
||||
}
|
||||
}
|
||||
// 不论谁是自己,始终将自己放在 roomMakeWheat1
|
||||
mBinding.roomMakeWheat1.setData(selfBean);
|
||||
// 将另一个用户的数据放在 roomMakeWheat2
|
||||
mBinding.roomMakeWheat2.setData(otherBean);
|
||||
mBinding.tvMainTitle.setText(roomInfoResp.getRoom_info().getRoom_name());
|
||||
mBinding.tvHeartValue2.setText(roomInfoResp.getRoom_info().getHot_value());
|
||||
if (cpUserBean != null) {
|
||||
countDownTime(Long.parseLong(cpUserBean.getTime_day()));
|
||||
}
|
||||
mediaProjectionManager = (MediaProjectionManager) getContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -276,7 +276,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
mRoomInfoResp = resp;
|
||||
loadSubFragment();
|
||||
// 更新子Fragment视图
|
||||
updateChildFragmentViews();
|
||||
// updateChildFragmentViews();
|
||||
}
|
||||
|
||||
private <T extends Fragment> T findFragmentByTag(Class<T> fragmentClass) {
|
||||
@@ -317,6 +317,11 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
singSongFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
}
|
||||
}
|
||||
}else if ("6".equals(typeId)){
|
||||
RoomCabinFragment roomCabinFragment = findFragmentByTag(RoomCabinFragment.class);
|
||||
if (roomCabinFragment != null && roomCabinFragment.isAdded()) {
|
||||
roomCabinFragment.roomInfoUpdate(mRoomInfoResp);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -386,7 +391,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
} else if ("2".equals(typeId)) {
|
||||
newFragment = RoomAuctionFragment.newInstance();
|
||||
} else if ("6".equals(typeId)) {
|
||||
newFragment = RoomCabinFragment.newInstance(mRoomInfoResp);
|
||||
newFragment = RoomCabinFragment.newInstance();
|
||||
setviewyc();
|
||||
} else if ("3".equals(typeId)) {
|
||||
if ("1".equals(labelId)) {
|
||||
@@ -407,7 +412,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
if (newFragment != null) {
|
||||
replaceNestedFragment(newFragment, R.id.container);
|
||||
}
|
||||
// instView();
|
||||
|
||||
setview();
|
||||
|
||||
if (mRoomInfoResp.getUser_info().getPit_number() != 0) {
|
||||
@@ -514,6 +519,50 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp) {
|
||||
mRoomInfoResp = roomInfoResp;
|
||||
updateChildFragmentViewsUp();
|
||||
}
|
||||
|
||||
private void updateChildFragmentViewsUp() {
|
||||
// 使用弱引用避免内存泄漏
|
||||
if (getActivity() == null || !isAdded()) {
|
||||
return;
|
||||
}
|
||||
// 使用 post 方法确保在 UI 线程执行
|
||||
getView().post(() -> {
|
||||
if (mRoomInfoResp != null && mRoomInfoResp.getRoom_info() != null) {
|
||||
String typeId = mRoomInfoResp.getRoom_info().getType_id();
|
||||
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
|
||||
|
||||
if ("7".equals(typeId)) {
|
||||
FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
|
||||
if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) {
|
||||
friendshipRoomFragment.upRoomInfo(mRoomInfoResp);
|
||||
}
|
||||
} else if ("2".equals(typeId)) {
|
||||
RoomAuctionFragment auctionRoomFragment = findFragmentByTag(RoomAuctionFragment.class);
|
||||
if (auctionRoomFragment != null && auctionRoomFragment.isAdded()) {
|
||||
auctionRoomFragment.upRoomInfo(mRoomInfoResp);
|
||||
}
|
||||
} else if ("1".equals(typeId) || "3".equals(typeId) || "4".equals(typeId)) {
|
||||
if ("2".equals(labelId)) {
|
||||
RoomKtvFragment roomKtvFragment = findFragmentByTag(RoomKtvFragment.class);
|
||||
if (roomKtvFragment != null && roomKtvFragment.isAdded()) {
|
||||
roomKtvFragment.upRoomInfo(mRoomInfoResp);
|
||||
}
|
||||
} else if ("1".equals(labelId)) {
|
||||
SingSongFragment singSongFragment = findFragmentByTag(SingSongFragment.class);
|
||||
if (singSongFragment != null && singSongFragment.isAdded()) {
|
||||
singSongFragment.upRoomInfo(mRoomInfoResp);
|
||||
}
|
||||
}
|
||||
}else if ("6".equals(typeId)){
|
||||
RoomCabinFragment roomCabinFragment = findFragmentByTag(RoomCabinFragment.class);
|
||||
if (roomCabinFragment != null && roomCabinFragment.isAdded()) {
|
||||
roomCabinFragment.upRoomInfo(mRoomInfoResp);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setview() {//这里是当进入电影放房的时候,如果是排麦模式,并且不是电影放的时候,就隐藏排麦视图
|
||||
@@ -966,6 +1015,15 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2025/9/3 小黑屋火热值更新
|
||||
public void handleMsgType1028(RoomMessageEvent messageEvent){
|
||||
RoomCabinFragment cabinFragment = (RoomCabinFragment) getChildFragmentManager()
|
||||
.findFragmentByTag(RoomCabinFragment.class.getSimpleName());
|
||||
if (cabinFragment != null){
|
||||
cabinFragment.handleMsgType1028(messageEvent);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2025/8/30 Ktv模式
|
||||
public void KtvFragmentEvent(RoomMessageEvent messageEvent) {
|
||||
RoomKtvFragment ktvFragment = (RoomKtvFragment) getChildFragmentManager()
|
||||
|
||||
@@ -80,7 +80,9 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
super.onAttach(context);
|
||||
// roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfo");
|
||||
}
|
||||
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp) {
|
||||
this.roomInfoResp = roomInfoResp;
|
||||
}
|
||||
public void roomInfoUpdate(RoomInfoResp resp) {
|
||||
roomInfoResp = resp;
|
||||
upData();
|
||||
|
||||
@@ -4,6 +4,7 @@ import static android.view.View.GONE;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
@@ -128,7 +129,9 @@ 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) {
|
||||
@@ -326,6 +329,33 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
return R.layout.fragment_sing_song;
|
||||
}
|
||||
|
||||
// 添加防重复点击的时间戳
|
||||
private static final long CLICK_INTERVAL = 500; // 500ms内不允许重复点击
|
||||
private long lastClickTime = 0;
|
||||
private String lastClickedUserId = ""; // 记录上次点击的用户ID
|
||||
private String lastClickedPitNumber = ""; // 记录上次点击的麦位号
|
||||
|
||||
/**
|
||||
* 检查是否为快速重复点击
|
||||
* @param userId 用户ID
|
||||
* @param pitNumber 麦位号
|
||||
* @return true表示是快速重复点击,false表示不是
|
||||
*/
|
||||
private boolean isFastDoubleClick(String userId, String pitNumber) {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (currentTime - lastClickTime < CLICK_INTERVAL &&
|
||||
userId.equals(lastClickedUserId) &&
|
||||
pitNumber.equals(lastClickedPitNumber)) {
|
||||
return true; // 是快速重复点击
|
||||
}
|
||||
|
||||
// 更新上次点击信息
|
||||
lastClickTime = currentTime;
|
||||
lastClickedUserId = userId;
|
||||
lastClickedPitNumber = pitNumber;
|
||||
return false; // 不是快速重复点击
|
||||
}
|
||||
|
||||
private void isWhether2() {
|
||||
mBinding.flexboxLayout.setVisibility(View.VISIBLE);
|
||||
mBinding.cl.setVisibility(View.GONE);
|
||||
@@ -339,6 +369,9 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
// 可选:点击事件处理
|
||||
Log.d("Wheat", "Clicked pit: " + pitNumber1);
|
||||
if (!pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (isFastDoubleClick(pitBean.getUser_id(), pitBean.getPit_number())) {
|
||||
return; // 快速重复点击,直接返回
|
||||
}
|
||||
RoomUserInfoFragment.show(roomId, pitBean.getUser_id(), pitBean.getPit_number(), getHostUser(), false, 3, isNumberWhether(), getChildFragmentManager());
|
||||
// 点击的麦位是当前麦位
|
||||
// 可以执行相应的操作,如显示提示信息或执行其他逻辑
|
||||
@@ -351,7 +384,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
roomPitBean = pitBean;
|
||||
showPopupMenu(view); // v 是点击的按钮视图
|
||||
} else if (pitNumber1 == 10) {
|
||||
RoomOnlineDialogFragment.show(roomId, pitNumber1 - 1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
if (!isFastDoubleClick("online_dialog", pitNumber1 + "")) {
|
||||
RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
}
|
||||
// RoomOnlineDialogFragment.show(roomId, pitNumber1 - 1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
} else {
|
||||
MvpPre.applyPit(roomId, pitNumber1 - 1 + "");
|
||||
}
|
||||
@@ -739,6 +775,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
// 可选:点击事件处理
|
||||
Log.d("Wheat", "Clicked pit: " + pitNumber1);
|
||||
if (!pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (isFastDoubleClick(pitBean.getUser_id(), pitBean.getPit_number())) {
|
||||
return; // 快速重复点击,直接返回
|
||||
}
|
||||
|
||||
RoomUserInfoFragment.show(roomId, pitBean.getUser_id(), pitBean.getPit_number(), getHostUser(), false, 3, isNumberWhether(), getChildFragmentManager());
|
||||
// 点击的麦位是当前麦位
|
||||
// 可以执行相应的操作,如显示提示信息或执行其他逻辑
|
||||
@@ -751,7 +791,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
roomPitBean = pitBean;
|
||||
showPopupMenu(view); // v 是点击的按钮视图
|
||||
} else if (pitNumber1 == 10) {
|
||||
RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
// 添加防重复点击检查
|
||||
if (!isFastDoubleClick("online_dialog", pitNumber1 + "")) {
|
||||
RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
}
|
||||
// RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
} else {
|
||||
MvpPre.applyPit(roomId, pitNumber1 + "");
|
||||
}
|
||||
@@ -765,6 +809,9 @@ 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())) {
|
||||
return; // 快速重复点击,直接返回
|
||||
}
|
||||
RoomUserInfoFragment.show(roomInfoRespPk.getRoom_info().getRoom_id(), pitBean.getUser_id(), pitNumber + "", getHostUser(), true, 3, isNumberWhether(), getChildFragmentManager());
|
||||
// 点击的麦位是当前麦位
|
||||
// 可以执行相应的操作,如显示提示信息或执行其他逻辑
|
||||
@@ -799,6 +846,9 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
// 可选:点击事件处理
|
||||
Log.d("Wheat", "Clicked pit: " + pitNumber1);
|
||||
if (!pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (isFastDoubleClick(pitBean.getUser_id(), pitBean.getPit_number())) {
|
||||
return; // 快速重复点击,直接返回
|
||||
}
|
||||
RoomUserInfoFragment.show(roomId, pitBean.getUser_id(), pitBean.getPit_number(), getHostUser(), false, 3, isNumberWhether(), getChildFragmentManager());
|
||||
// 点击的麦位是当前麦位
|
||||
// 可以执行相应的操作,如显示提示信息或执行其他逻辑
|
||||
@@ -811,7 +861,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
roomPitBean = pitBean;
|
||||
showPopupMenu(view); // v 是点击的按钮视图
|
||||
} else if (pitNumber1 == 10) {
|
||||
RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
// 添加防重复点击检查
|
||||
if (!isFastDoubleClick("online_dialog", pitNumber1 + "")) {
|
||||
RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
}
|
||||
// RoomOnlineDialogFragment.show(roomId, pitNumber1 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||||
} else {
|
||||
MvpPre.applyPit(roomId, pitNumber1 + "");
|
||||
}
|
||||
@@ -825,6 +879,9 @@ 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())){
|
||||
return;
|
||||
}
|
||||
RoomUserInfoFragment.show(roomInfoRespPk.getRoom_info().getRoom_id(), pitBean.getUser_id(), pitNumber + "", getHostUser(), true, 3, isNumberWhether(), getChildFragmentManager());
|
||||
// 点击的麦位是当前麦位
|
||||
// 可以执行相应的操作,如显示提示信息或执行其他逻辑
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.7" />
|
||||
app:layout_constraintGuide_percent="0.6" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/vp_room_pager"
|
||||
|
||||
@@ -498,7 +498,6 @@
|
||||
android:layout="@layout/top_overlay_buttons"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="-30dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/dp_172"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
|
||||
@@ -196,7 +196,8 @@
|
||||
android:layout_alignTop="@id/btn_notice"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:background="@drawable/bg_r73_33fffff"
|
||||
android:layout_toEndOf="@id/btn_notice">
|
||||
android:layout_toEndOf="@id/btn_notice"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_qc"
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.example.modulevocal.presenter.DailyTasksPresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.GiftBoxBean;
|
||||
import com.xscm.moduleutil.bean.GiftName;
|
||||
import com.xscm.moduleutil.bean.TaskItem;
|
||||
@@ -74,7 +75,7 @@ public class DailyTasksActivity extends BaseMvpActivity<DailyTasksPresenter, Act
|
||||
|
||||
mBinding.imGz.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(this, WebViewActivity.class);
|
||||
intent.putExtra("url", "https://vespa.qxmier.com/web/index.html#/pages/other/taskDesc");
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/other/taskDesc");
|
||||
intent.putExtra("title", "规则 ");
|
||||
startActivity(intent);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.example.modulevocal.presenter.PersonalityPresenter;
|
||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.adapter.MyPagerAdapter;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.PersonaltyBean;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
@@ -116,7 +117,7 @@ public class PersonalityActivity extends BaseMvpActivity<PersonalityPresenter, A
|
||||
mBinding.topBar.setRightColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
mBinding.topBar.getTvRight().setOnClickListener(v -> {
|
||||
Intent intent=new Intent(this, WebViewActivity.class);
|
||||
intent.putExtra("url", "https://vespa.qxmier.com/web/index.html#/pages/prop/propMall?id="+SpUtil.getToken());
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/prop/propMall?id="+SpUtil.getToken());
|
||||
intent.putExtra("title", "道具商城");
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.example.modulevocal.databinding.FragmentVocalRangeBinding;
|
||||
import com.example.modulevocal.presenter.MePresenter;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
@@ -130,12 +131,12 @@ public class VocalRangeFragment extends BaseMvpFragment<MePresenter, FragmentVoc
|
||||
startActivity(intent);
|
||||
}else if (id==R.id.me_my_guild){
|
||||
Intent intent=new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", " https://vespa.qxmier.com/web/index.html#/pages/union/index?id="+SpUtil.getToken());
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/union/index?id="+SpUtil.getToken());
|
||||
intent.putExtra("title", "公会");
|
||||
startActivity(intent);
|
||||
}else if (id==R.id.tv_my_shopping){
|
||||
Intent intent=new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", "https://vespa.qxmier.com/web/index.html#/pages/prop/propMall?id="+SpUtil.getToken());
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/prop/propMall?id="+SpUtil.getToken());
|
||||
intent.putExtra("title", "道具商城");
|
||||
startActivity(intent);
|
||||
}
|
||||
@@ -186,18 +187,18 @@ public class VocalRangeFragment extends BaseMvpFragment<MePresenter, FragmentVoc
|
||||
startActivity(new Intent(getContext(), SettingActivity.class));
|
||||
}else if (id == R.id.me_my_dan){//等级
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", "https://vespa.qxmier.com/web/index.html#/pages/other/grade?id=" + SpUtil.getToken());
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/other/grade?id=" + SpUtil.getToken());
|
||||
intent.putExtra("title", "等级");
|
||||
startActivity(intent);
|
||||
}else if (id == R.id.iv_kf){//反馈
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", "https://vespa.qxmier.com/web/index.html#/pages/feedback/help?id=" + SpUtil.getToken());
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/feedback/help?id=" + SpUtil.getToken());
|
||||
// intent.putExtra("url", "http://192.168.110.17:8080/web/index.html#/pages/feedback/help?id=" + SpUtil.getToken());
|
||||
intent.putExtra("title", "反馈");
|
||||
startActivity(intent);
|
||||
}else if (id == R.id.iv_hb){//邀请
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", " https://vespa.qxmier.com/web/index.html#/pages/other/income?id=" + SpUtil.getToken());
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/other/income?id=" + SpUtil.getToken());
|
||||
intent.putExtra("title", "邀请");
|
||||
startActivity(intent);
|
||||
}else if (id==R.id.beautiful_view_copy){
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
android:background="@mipmap/mony_cz"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -107,7 +106,6 @@
|
||||
android:background="@mipmap/mony_tx"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_38"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.SpanUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
@@ -24,6 +25,7 @@ import com.lihang.ShadowLayout;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.bean.PlaceholderBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.StringUtil;
|
||||
@@ -188,7 +190,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
|
||||
// if (type == RankingFragment.TYPE_WEALTH) {
|
||||
// return;
|
||||
// }
|
||||
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", item.getUser_id()).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", item.getUser_id()).navigation();
|
||||
}
|
||||
});
|
||||
} else if (index == 3) {
|
||||
@@ -366,7 +368,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
|
||||
imUser1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", listsBean.getUser_id()).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", data.getUser_id()).navigation();
|
||||
}
|
||||
});
|
||||
} else if (type.equals("1") || type.equals("2")) {
|
||||
@@ -423,7 +425,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
|
||||
imUser2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", listsBean.getUser_id()).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", data.getUser_id()).navigation();
|
||||
}
|
||||
});
|
||||
} else if (type.equals("3")) {
|
||||
@@ -476,6 +478,7 @@ public class PlaceholderFragment extends BaseMvpFragment<PlaceholderPresenter, F
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", listsBean.getUser_id()).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", data.getUser_id()).navigation();
|
||||
}
|
||||
});
|
||||
} else if (type.equals("3")) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class HotAdapter extends BaseMultiItemQuickAdapter<TopRoom, BaseViewHolde
|
||||
ImageView iv = helper.getView(R.id.iv_play);
|
||||
if (item.getUser_list()!=null && item.getUser_list().size() > 0) {
|
||||
iv.setVisibility(View.VISIBLE);
|
||||
ImageUtils.loadRes(com.xscm.moduleutil.R.drawable.voice_play, iv);
|
||||
// ImageUtils.loadRes(com.xscm.moduleutil.R.drawable.voice_play, iv);
|
||||
}else {
|
||||
iv.setVisibility(GONE);
|
||||
}
|
||||
|
||||
@@ -23,19 +23,6 @@
|
||||
android:paddingRight="16dp"
|
||||
app:layout_scrollFlags="scroll|enterAlways">
|
||||
|
||||
<!-- <com.stx.xhb.xbanner.XBanner-->
|
||||
<!-- android:id="@+id/banner"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- app:AutoPlayTime="3000"-->
|
||||
<!-- app:isAutoPlay="true"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintDimensionRatio="340:96"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:pointsVisibility="false"-->
|
||||
<!-- android:visibility="gone"/>-->
|
||||
|
||||
|
||||
<com.zhpan.bannerview.BannerViewPager
|
||||
|
||||