1:修改pk房
2:修改页面跳转
This commit is contained in:
@@ -66,19 +66,19 @@ android {
|
||||
|
||||
// // 测试版配置
|
||||
beta {
|
||||
// dimension "environment"
|
||||
// // 测试版包名:基础包名 + .beta(com.example.myapp.beta)
|
||||
// applicationIdSuffix ".beta"
|
||||
// // 测试版版本名:1.0-beta
|
||||
// versionNameSuffix "-beta"
|
||||
//
|
||||
// // 【测试版应用名称】动态生成带标识的名称
|
||||
// resValue "string", "app_name", "羽声-测试版"
|
||||
//
|
||||
// // 【测试版图标】替换为测试专用图标
|
||||
// manifestPlaceholders = [
|
||||
// appIcon: "@mipmap/ic_launcher_app_bat" // 需在main/res/mipmap放置该图标
|
||||
// ]
|
||||
dimension "environment"
|
||||
// 测试版包名:基础包名 + .beta(com.example.myapp.beta)
|
||||
applicationIdSuffix ".beta"
|
||||
// 测试版版本名:1.0-beta
|
||||
versionNameSuffix "-beta"
|
||||
|
||||
// 【测试版应用名称】动态生成带标识的名称
|
||||
resValue "string", "app_name", "羽声-测试版"
|
||||
|
||||
// 【测试版图标】替换为测试专用图标
|
||||
manifestPlaceholders = [
|
||||
appIcon: "@mipmap/ic_launcher_app_bat" // 需在main/res/mipmap放置该图标
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 43,
|
||||
"versionName": "1.0.5.3",
|
||||
"outputFile": "羽声_1.0.5.3_43.apk"
|
||||
"versionCode": 45,
|
||||
"versionName": "1.0.5.5",
|
||||
"outputFile": "羽声_1.0.5.5_45.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File",
|
||||
@@ -22,14 +22,14 @@
|
||||
"minApi": 28,
|
||||
"maxApi": 30,
|
||||
"baselineProfiles": [
|
||||
"baselineProfiles/1/羽声_1.0.5.3_43.dm"
|
||||
"baselineProfiles/1/羽声_1.0.5.5_45.dm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"minApi": 31,
|
||||
"maxApi": 2147483647,
|
||||
"baselineProfiles": [
|
||||
"baselineProfiles/0/羽声_1.0.5.3_43.dm"
|
||||
"baselineProfiles/0/羽声_1.0.5.5_45.dm"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -28,8 +28,8 @@ isBuildModule=false
|
||||
#org.gradle.deamon=false
|
||||
android.injected.testOnly=false
|
||||
|
||||
APP_VERSION_NAME=1.0.5.3
|
||||
APP_VERSION_CODE=43
|
||||
APP_VERSION_NAME=1.0.5.5
|
||||
APP_VERSION_CODE=45
|
||||
|
||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||
|
||||
@@ -246,24 +246,28 @@ public class RoomManager {
|
||||
|
||||
@Override
|
||||
public void onNext(RoomInfoResp resp) {
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||
String token = resp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||
String roomId = resp.getRoom_info().getRoom_id(); // 房间 ID
|
||||
String rtm_token = resp.getUser_info().getAgora_rtm_token();
|
||||
SpUtil.setRtmToken(rtm_token);
|
||||
int uid = SpUtil.getUserId(); // 0 表示由 Agora 自动生成 UID
|
||||
boolean enableMic = false; // 是否开启麦克风
|
||||
boolean enableJs = false; // 是否开启角色
|
||||
if (resp.getUser_info().getPit_number() != 0) {
|
||||
enableJs = true;
|
||||
}
|
||||
LogUtils.e("token", token);
|
||||
LogUtils.e("roomId:", roomId);
|
||||
if (resp!=null) {
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||
String token = resp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||
String roomId = resp.getRoom_info().getRoom_id(); // 房间 ID
|
||||
String rtm_token = resp.getUser_info().getAgora_rtm_token();
|
||||
SpUtil.setRtmToken(rtm_token);
|
||||
int uid = SpUtil.getUserId(); // 0 表示由 Agora 自动生成 UID
|
||||
boolean enableMic = false; // 是否开启麦克风
|
||||
boolean enableJs = false; // 是否开启角色
|
||||
if (resp.getUser_info().getPit_number() != 0) {
|
||||
enableJs = true;
|
||||
}
|
||||
LogUtils.e("token", token);
|
||||
LogUtils.e("roomId:", roomId);
|
||||
// 初始化 Agora 并加入房间
|
||||
AgoraManager.getInstance(context)
|
||||
.joinRoom(token, roomId, uid, enableMic, enableJs);
|
||||
cacheRoomData(roomId, resp);
|
||||
navigateToRoom(context, roomId, password, resp, false,taskId);
|
||||
AgoraManager.getInstance(context)
|
||||
.joinRoom(token, roomId, uid, enableMic, enableJs);
|
||||
cacheRoomData(roomId, resp);
|
||||
navigateToRoom(context, roomId, password, resp, false, taskId);
|
||||
}else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -328,6 +332,7 @@ public class RoomManager {
|
||||
ARouter.getInstance()
|
||||
.build(ARouteConstants.ROOM_DETAILS)
|
||||
.with(bundle)
|
||||
.withFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||
.navigation(context);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, "跳转房间页面失败: " + e.getMessage());
|
||||
|
||||
@@ -96,6 +96,7 @@ public class RoomMessageEvent {
|
||||
private String redpacket_id;
|
||||
|
||||
private EmotionDeatils emoji;
|
||||
private String is_pk;//是否是pk
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -18,4 +18,5 @@ public class PkRoomInfo implements Serializable {
|
||||
private String pk_room_value;//对方房间的pk值
|
||||
private String pk_part;;//2:等待开始、3:进行中、4:惩罚阶段
|
||||
private String pk_end_times;
|
||||
private String receive_pk_user_id;//接受pk的用户id
|
||||
}
|
||||
|
||||
@@ -2246,8 +2246,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getRoomUserInfo(String room_id, String
|
||||
user_id, BaseObserver<UserInfo> observer) {
|
||||
public void getRoomUserInfo(String room_id, String user_id, BaseObserver<UserInfo> observer) {
|
||||
sApiServer.getRoomUserInfo(room_id, user_id).enqueue(new Callback<BaseModel<UserInfo>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<UserInfo>> call, Response<BaseModel<UserInfo>> response) {
|
||||
|
||||
@@ -83,7 +83,7 @@ import io.agora.rtc2.video.VideoEncoderConfiguration;
|
||||
public class AgoraManager {
|
||||
|
||||
private static volatile AgoraManager instance;
|
||||
private static RtcEngineEx rtcEngine;
|
||||
public static RtcEngineEx rtcEngine;
|
||||
// private RtcEngineEx rtcEngineEx;
|
||||
private static Context context;
|
||||
private boolean isLocalAudioEnabled = true; // 默认开启麦克风
|
||||
@@ -102,6 +102,16 @@ public class AgoraManager {
|
||||
private String pkRoomId = "";
|
||||
private static String lastRoomId;
|
||||
|
||||
public int pkUserId;
|
||||
|
||||
public int getPkUserId() {
|
||||
return pkUserId;
|
||||
}
|
||||
|
||||
public void setPkUserId(int pkUserId) {
|
||||
this.pkUserId = pkUserId;
|
||||
}
|
||||
|
||||
public void setLastRoomId(String value) {
|
||||
lastRoomId = value;
|
||||
}
|
||||
@@ -212,36 +222,8 @@ public class AgoraManager {
|
||||
Log.w("AgoraManager", "Failed to set parameters", e);
|
||||
}
|
||||
|
||||
/*Enable video module*/
|
||||
rtcEngine.enableVideo();
|
||||
// Setup video encoding configs
|
||||
// rtcEngine.setVideoEncoderConfiguration(new VideoEncoderConfiguration(
|
||||
// VD_640x360,
|
||||
// FRAME_RATE_FPS_30,
|
||||
// STANDARD_BITRATE,
|
||||
// ORIENTATION_MODE_FIXED_PORTRAIT
|
||||
// ));
|
||||
|
||||
|
||||
|
||||
/*Set up to play remote sound with receiver*/
|
||||
rtcEngine.setDefaultAudioRoutetoSpeakerphone(true);
|
||||
|
||||
|
||||
// OrientationEventListener orientationListener = new OrientationEventListener(context,
|
||||
// SensorManager.SENSOR_DELAY_NORMAL) {
|
||||
// @Override
|
||||
// public void onOrientationChanged(int orientation) {
|
||||
// int angle = calculateScreenAngle(orientation);
|
||||
// try {
|
||||
// rtcEngine.setVideoOrientation(angle); // 通知声网引擎调整视频方向
|
||||
// } catch (Exception e) {
|
||||
// Log.e("AgoraManager", "Set video orientation failed", e);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// orientationListener.enable(); // 启用监听
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("AgoraManager", "Failed to configure RtcEngine", e);
|
||||
}
|
||||
@@ -349,6 +331,19 @@ public class AgoraManager {
|
||||
*/
|
||||
private static IRtcEngineEventHandler getDefaultEventHandler() {
|
||||
return new IRtcEngineEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onRemoteAudioStateChanged(int uid, int state, int reason, int elapsed) {
|
||||
super.onRemoteAudioStateChanged(uid, state, reason, elapsed);
|
||||
LogUtils.e("onRemoteAudioStateChanged", "uid------>" + uid, "state------>" + state, "reason------>" + reason, "elapsed------>" + elapsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserMuteAudio(int uid, boolean muted) {
|
||||
super.onUserMuteAudio(uid, muted);
|
||||
LogUtils.e("onUserMuteAudio", "uid------>" + uid, "muted------>" + muted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
|
||||
@@ -710,7 +705,7 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void joinChannelEx(String token, String channelId, int uid) {
|
||||
public void joinChannelEx(String token, String channelId, int uid,String pkUserIds) {
|
||||
if (rtcEngine == null) {
|
||||
init(CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId());
|
||||
}
|
||||
@@ -722,10 +717,12 @@ public class AgoraManager {
|
||||
options.autoSubscribeAudio = true;
|
||||
connection = new RtcConnection();
|
||||
connection.channelId = channelId;
|
||||
connection.localUid = uid;
|
||||
connection.localUid = SpUtil.getUserId();
|
||||
pkRoomId = channelId;
|
||||
rtcEngine.joinChannelEx(token, connection, options, getDefaultEventHandler());
|
||||
|
||||
pkUserId = Integer.parseInt(pkUserIds);
|
||||
// rtcEngine.joinChannelEx(token, connection, options, getDefaultEventHandler());
|
||||
// muteAllRemoteAudioStreamsEx(true);
|
||||
// muteAllRemoteAudioStreamsExUserId(false);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -735,7 +732,7 @@ public class AgoraManager {
|
||||
RtcConnection connection = new RtcConnection();
|
||||
connection.channelId = mRoomId;
|
||||
connection.localUid = uid;
|
||||
rtcEngine.leaveChannelEx(connection);
|
||||
// rtcEngine.leaveChannelEx(connection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,7 +891,7 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//关闭对方的所有推流
|
||||
public void muteAllRemoteAudioStreamsEx(boolean enabled) {
|
||||
if (rtcEngine == null) {
|
||||
init(CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId());
|
||||
@@ -906,7 +903,13 @@ public class AgoraManager {
|
||||
connection = new RtcConnection();
|
||||
connection.channelId = pkRoomId;
|
||||
}
|
||||
rtcEngine.muteAllRemoteAudioStreamsEx(enabled, connection);
|
||||
// rtcEngine.muteAllRemoteAudioStreamsEx(enabled, connection);
|
||||
}
|
||||
}
|
||||
//打开对方支持的推流
|
||||
public void muteAllRemoteAudioStreamsExUserId(boolean enabled){
|
||||
if (rtcEngine != null){
|
||||
// rtcEngine.muteRemoteAudioStreamEx(pkUserId,enabled,connection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -924,17 +927,13 @@ public class AgoraManager {
|
||||
* 启用或者关闭远端音频流
|
||||
*
|
||||
* @param enabled
|
||||
* @param uid
|
||||
*/
|
||||
public void muteLocalAudioStreamEx(boolean enabled, int uid) {
|
||||
// RtcConnection connection = new RtcConnection();
|
||||
// connection.channelId = mRoomId;
|
||||
// connection.localUid = uid;
|
||||
public void muteLocalAudioStreamEx(boolean enabled) {
|
||||
if (rtcEngine == null) {
|
||||
init(CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId());
|
||||
}
|
||||
// 正确做法
|
||||
rtcEngine.muteLocalAudioStreamEx(enabled, connection);
|
||||
// rtcEngine.muteLocalAudioStreamEx(enabled, connection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,354 @@
|
||||
package com.xscm.moduleutil.rtc;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceView;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ThreadUtils;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.event.CabinEvent;
|
||||
import com.xscm.moduleutil.event.ColoseCardEvent;
|
||||
import com.xscm.moduleutil.event.SurfaceEvent;
|
||||
import com.xscm.moduleutil.interfaces.SoundLevelUpdateListener;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import io.agora.musiccontentcenter.*;
|
||||
import io.agora.rtc2.*;
|
||||
import io.agora.rtc2.video.VideoCanvas;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* com.xscm.moduleutil.rtc
|
||||
* qx
|
||||
* 2025/10/29
|
||||
*/
|
||||
public class AgoraManagerEx {
|
||||
|
||||
private static volatile AgoraManagerEx instance;
|
||||
private static RtcEngineEx rtcEngineEx;
|
||||
// private RtcEngineEx rtcEngineEx;
|
||||
private static Context context;
|
||||
private boolean isLocalAudioEnabled = true; // 默认开启麦克风
|
||||
// private final List<IRtcEngineEventHandler> eventHandlers = new ArrayList<>();
|
||||
private static IAgoraMusicContentCenter musicContentCenter;
|
||||
private static IAgoraMusicPlayer musicPlayer;
|
||||
private static MusicContentCenterConfiguration contentCenterConfiguration;
|
||||
private static String mRoomId = "";
|
||||
private static long mSongCode;
|
||||
|
||||
private static List<Music> musicList;
|
||||
private static boolean isBjMusic = false;
|
||||
private static List<SoundLevelUpdateListener> soundLevelUpdateListeners = new CopyOnWriteArrayList<>();
|
||||
private static ChannelMediaOptions options;
|
||||
private static RtcConnection connection;
|
||||
private String pkRoomId = "";
|
||||
private static String lastRoomId;
|
||||
|
||||
public int pkUserId;
|
||||
|
||||
public int getPkUserId() {
|
||||
return pkUserId;
|
||||
}
|
||||
|
||||
public void setPkUserId(int pkUserId) {
|
||||
this.pkUserId = pkUserId;
|
||||
}
|
||||
private static boolean isOnJoin = false;
|
||||
public void setLastRoomId(String value) {
|
||||
lastRoomId = value;
|
||||
}
|
||||
|
||||
public String getLastRoomId() {
|
||||
LogUtils.e("上次的房间id:" + lastRoomId);
|
||||
return lastRoomId;
|
||||
}
|
||||
|
||||
private AgoraManagerEx() {
|
||||
|
||||
}
|
||||
|
||||
public static AgoraManagerEx getInstance(Context con) {
|
||||
if (instance == null) {
|
||||
synchronized (AgoraManagerEx.class) {
|
||||
if (instance == null) {
|
||||
instance = new AgoraManagerEx();
|
||||
context = con.getApplicationContext(); // 使用ApplicationContext避免内存泄漏
|
||||
}
|
||||
}
|
||||
}
|
||||
// 确保引擎已初始化
|
||||
if (rtcEngineEx == null) {
|
||||
synchronized (AgoraManagerEx.class) {
|
||||
if (rtcEngineEx == null) {
|
||||
init(CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void init(String appId) {
|
||||
if (rtcEngineEx != null) {
|
||||
return;
|
||||
};
|
||||
|
||||
synchronized (AgoraManager.class) {
|
||||
if (rtcEngineEx != null) {
|
||||
return;
|
||||
}
|
||||
rtcEngineEx =AgoraManager.getInstance( context).rtcEngine;
|
||||
|
||||
// try {
|
||||
// RtcEngineConfig config = new RtcEngineConfig();
|
||||
// config.mContext = context;
|
||||
// config.mAppId = appId;
|
||||
// config.mEventHandler = getDefaultEventHandler();
|
||||
// config.mChannelProfile = Constants.CHANNEL_PROFILE_LIVE_BROADCASTING;
|
||||
// config.mAudioScenario = Constants.AUDIO_SCENARIO_CHORUS;
|
||||
// config.mAreaCode = 1;
|
||||
//
|
||||
// rtcEngineEx = (RtcEngineEx) RtcEngineEx.create(config);
|
||||
// } catch (Exception e) {
|
||||
// Log.e("AgoraManager", "Failed to create RtcEngine", e);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (rtcEngineEx != null) {
|
||||
// try {
|
||||
// rtcEngineEx.setAudioProfile(Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO,
|
||||
// Constants.AUDIO_SCENARIO_GAME_STREAMING);
|
||||
// rtcEngineEx.enableAudioVolumeIndication(200, 3, true);
|
||||
// rtcEngineEx.setClientRole(Constants.CLIENT_ROLE_BROADCASTER);
|
||||
// rtcEngineEx.muteLocalAudioStream(true); // 默认静音
|
||||
// rtcEngineEx.muteAllRemoteAudioStreams(false); // 监听远端的音频
|
||||
//
|
||||
// // 设置参数时添加异常处理
|
||||
// try {
|
||||
// rtcEngineEx.setParameters("{\"che.audio.custom_payload_type\":73}");
|
||||
// rtcEngineEx.setParameters("{\"che.audio.custom_bitrate\":128000}");
|
||||
// rtcEngineEx.setParameters("{\"rtc.enable_nasa2\": true}");
|
||||
// rtcEngineEx.setParameters("{\"rtc.use_audio4\": true}");
|
||||
// rtcEngineEx.setParameters("{" +
|
||||
// "\"rtc.report_app_scenario\":" +
|
||||
// "{" +
|
||||
// "\"appScenario\":" + 100 + "," +
|
||||
// "\"serviceType\":" + 11 + "," +
|
||||
// "\"appVersion\":\"" + rtcEngineEx.getSdkVersion() + "\"" +
|
||||
// "}" +
|
||||
// "}");
|
||||
// rtcEngineEx.setParameters("{\"che.video.mobile_1080p\":true}");
|
||||
// } catch (Exception e) {
|
||||
// Log.w("AgoraManager", "Failed to set parameters", e);
|
||||
// }
|
||||
// /*Enable video module*/
|
||||
// rtcEngineEx.enableVideo();
|
||||
// /*Set up to play remote sound with receiver*/
|
||||
// rtcEngineEx.setDefaultAudioRoutetoSpeakerphone(true);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// Log.e("AgoraManager", "Failed to configure rtcEngineEx", e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
private static IRtcEngineEventHandler getDefaultEventHandler() {
|
||||
return new IRtcEngineEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onRemoteAudioStateChanged(int uid, int state, int reason, int elapsed) {
|
||||
super.onRemoteAudioStateChanged(uid, state, reason, elapsed);
|
||||
LogUtils.e("onRemoteAudioStateChanged", "uid------>" + uid, "state------>" + state, "reason------>" + reason, "elapsed------>" + elapsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserMuteAudio(int uid, boolean muted) {
|
||||
super.onUserMuteAudio(uid, muted);
|
||||
LogUtils.e("onUserMuteAudio", "uid------>" + uid, "muted------>" + muted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
LogUtils.e("onJoinChannelSuccess", "channel------>" + channel, "uid------>" + uid, "elapsed------>" + elapsed);
|
||||
if (!isOnJoin) {
|
||||
AgoraIsOPen isOPen = new AgoraIsOPen();
|
||||
isOPen.setOpen(true);
|
||||
EventBus.getDefault().post(isOPen);
|
||||
isOnJoin = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserJoined(int uid, int elapsed) {//远端用户加入频道
|
||||
|
||||
for (SoundLevelUpdateListener listener : soundLevelUpdateListeners) {
|
||||
if (listener != null) {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
// 远程用户音量变化
|
||||
listener.userJoined(uid, elapsed);
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserOffline(int uid, int reason) {//远端用户离开频道
|
||||
for (SoundLevelUpdateListener listener : soundLevelUpdateListeners) {
|
||||
if (listener != null) {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
// 远程用户音量变化
|
||||
listener.userOffline(uid, reason);
|
||||
// }
|
||||
});
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioVolumeIndication(AudioVolumeInfo[] speakers, int totalVolume) {
|
||||
super.onAudioVolumeIndication(speakers, totalVolume);
|
||||
|
||||
if (speakers == null || speakers.length == 0) return;
|
||||
|
||||
for (final AudioVolumeInfo info : speakers) {
|
||||
final int uid = info.uid;
|
||||
final int volume = info.volume;
|
||||
|
||||
// 回调所有监听器
|
||||
for (SoundLevelUpdateListener listener : soundLevelUpdateListeners) {
|
||||
if (listener != null) {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
// 远程用户音量变化
|
||||
listener.onRemoteSoundLevelUpdate(uid > 0 ? String.valueOf(uid) : SpUtil.getUserId() + "", volume);
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalVideoStateChanged(Constants.VideoSourceType source, int state, int reason) {
|
||||
super.onLocalVideoStateChanged(source, state, reason);
|
||||
if (state == Constants.LOCAL_VIDEO_STREAM_STATE_CAPTURING && source.getValue() == Constants.VIDEO_SOURCE_SCREEN_PRIMARY) {
|
||||
options.publishScreenCaptureAudio = true;
|
||||
options.publishScreenCaptureVideo = true;
|
||||
options.publishCameraTrack = false;
|
||||
rtcEngineEx.updateChannelMediaOptions(options);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstRemoteAudioFrame(int uid, int elapsed) {
|
||||
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);
|
||||
surfaceEvent.setType(2);
|
||||
rtcEngineEx.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) {
|
||||
super.onRemoteVideoStateChanged(uid, state, reason, elapsed);
|
||||
Log.i("RoomCabinFragment", "onRemoteVideoStateChanged:uid->" + uid + ", state->" + state);
|
||||
if (state == Constants.REMOTE_AUDIO_STATE_STOPPED) {
|
||||
ColoseCardEvent renderView = new ColoseCardEvent();
|
||||
EventBus.getDefault().post(renderView);
|
||||
} else if (state == Constants.REMOTE_AUDIO_STATE_STARTING) {
|
||||
|
||||
SurfaceView renderView = new SurfaceView(context);
|
||||
rtcEngineEx.setupRemoteVideo(new VideoCanvas(renderView, Constants.RENDER_MODE_FIT, uid));
|
||||
SurfaceEvent surfaceEvent = new SurfaceEvent();
|
||||
surfaceEvent.setSurfaceView(renderView);
|
||||
surfaceEvent.setType(2);
|
||||
EventBus.getDefault().post(surfaceEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int err) {
|
||||
super.onError(err);
|
||||
}
|
||||
};
|
||||
}
|
||||
public void joinChannelEx(String token, String channelId, String pkUserIds) {
|
||||
// if (rtcEngineEx == null) {
|
||||
// init(CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId());
|
||||
// }00602f7339ec98947deaeab173599891932IAAe1VwQOurJj57ZCxEJ3SO8VCK6MPKfAjdo5v/oOHPd5BTK+bCVBxwwIgDobHEAn5cDaQQAAQCflwNpAwCflwNpAgCflwNpBACflwNp
|
||||
if (rtcEngineEx != null) {
|
||||
options = new ChannelMediaOptions();
|
||||
options.clientRoleType = Constants.CLIENT_ROLE_BROADCASTER;
|
||||
options.channelProfile = Constants.CHANNEL_PROFILE_LIVE_BROADCASTING;
|
||||
options.publishMicrophoneTrack = true; // 是否发布麦克风音频
|
||||
options.enableAudioRecordingOrPlayout = true;
|
||||
options.autoSubscribeAudio = true;
|
||||
connection = new RtcConnection();
|
||||
connection.channelId = channelId;
|
||||
connection.localUid = SpUtil.getUserId();
|
||||
pkRoomId = channelId;
|
||||
pkUserId = Integer.parseInt(pkUserIds);
|
||||
rtcEngineEx.joinChannelEx(token, connection, options, getDefaultEventHandler());
|
||||
muteAllRemoteAudioStreamsEx(true);
|
||||
muteAllRemoteAudioStreamsExUserId(false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void muteAllRemoteAudioStreamsEx(boolean enabled) {
|
||||
if (rtcEngineEx == null) {
|
||||
init(CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId());
|
||||
}
|
||||
if (rtcEngineEx != null) {
|
||||
// RtcConnection connection = new RtcConnection();
|
||||
// connection.channelId = mRoomId;
|
||||
// if (connection == null) {
|
||||
// connection = new RtcConnection();
|
||||
// connection.channelId = pkRoomId;
|
||||
// }
|
||||
rtcEngineEx.muteAllRemoteAudioStreamsEx(enabled, connection);
|
||||
}
|
||||
}
|
||||
|
||||
public void muteLocalAudioStreamEx(boolean enabled) {
|
||||
if (rtcEngineEx == null) {
|
||||
init(CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId());
|
||||
}
|
||||
// 正确做法
|
||||
rtcEngineEx.muteLocalAudioStreamEx(enabled, connection);
|
||||
}
|
||||
|
||||
public void muteAllRemoteAudioStreamsExUserId(boolean enabled){
|
||||
if (rtcEngineEx != null){
|
||||
rtcEngineEx.muteRemoteAudioStreamEx(pkUserId,enabled,connection);
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveChannelEx(String mRoomId, int uid) {
|
||||
if (rtcEngineEx != null) {
|
||||
RtcConnection connection = new RtcConnection();
|
||||
connection.channelId = mRoomId;
|
||||
connection.localUid = uid;
|
||||
rtcEngineEx.leaveChannelEx(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public enum EnvironmentEnum {
|
||||
"tcp://81.70.45.221",
|
||||
"https://vespa.qxyushen.top/h5"),
|
||||
TEST(//测试环境
|
||||
"http://tmd.xscmmidi.site/",
|
||||
"https://test.vespa.qxyushen.top/",
|
||||
"6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=",
|
||||
"https://oss-cn-beijing.aliyuncs.com/",
|
||||
"LTAI5tKgrfcFQxH46ZwWYgFW",
|
||||
|
||||
@@ -133,8 +133,28 @@ public class RoomDefaultWheatView extends BaseWheatView {
|
||||
}
|
||||
|
||||
// setCardiac(pitBean.getPit_number(), 0.0f);
|
||||
}
|
||||
|
||||
updatePkState(bean);
|
||||
}
|
||||
private void updatePkState(RoomPitBean bean) {
|
||||
if (bean.is_pk()) {
|
||||
String userId = bean.getUser_id();
|
||||
if (userId != null && !userId.equals("0") && !userId.isEmpty()) {
|
||||
tv_time_pk.setVisibility(VISIBLE);
|
||||
setSex(bean.getCharm(), false);
|
||||
mCharmView.setVisibility(GONE);
|
||||
} else {
|
||||
tv_time_pk.setVisibility(GONE);
|
||||
}
|
||||
} else {
|
||||
tv_time_pk.setVisibility(GONE);
|
||||
if (isOn()) {
|
||||
mCharmView.setVisibility(VISIBLE);
|
||||
}else {
|
||||
mCharmView.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void setSex(String value, boolean format) {
|
||||
if (format) {
|
||||
tv_time_pk.setText(value);
|
||||
@@ -153,6 +173,10 @@ public class RoomDefaultWheatView extends BaseWheatView {
|
||||
}
|
||||
}
|
||||
|
||||
public void setTv_time_pk(boolean show){
|
||||
tv_time_pk.setVisibility(show?VISIBLE:GONE);
|
||||
}
|
||||
|
||||
private boolean showSexIcon = false;
|
||||
private String sex;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.widget.LinearLayout;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
|
||||
@@ -170,6 +171,9 @@ public class WheatLayoutManager {
|
||||
|
||||
private void addWheatViewItem(LinearLayout row, int pitNumber, int itemWidth, int layoutType) {
|
||||
RoomDefaultWheatView wheatView = createWheatView(pitNumber);
|
||||
if (layoutType==2){
|
||||
wheatView.setTv_time_pk(false);
|
||||
}
|
||||
|
||||
LinearLayout.LayoutParams params;
|
||||
if (pitNumber == 9 || pitNumber == 10) {
|
||||
@@ -226,25 +230,65 @@ public class WheatLayoutManager {
|
||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
||||
return metrics.widthPixels;
|
||||
}
|
||||
public void setUpData(RoomMessageEvent event,int layoutType){
|
||||
String fromPit=event.getText().getFrom_pit_number()!=null?event.getText().getFrom_pit_number():"";
|
||||
String toPitNumber=event.getText().getTo_pit_number()!=null?event.getText().getTo_pit_number():"";
|
||||
if (fromPit.equals("") || toPitNumber.equals("")){
|
||||
return;
|
||||
}
|
||||
RoomDefaultWheatView fromWheatView = findWheatViewByPitNumber(Integer.parseInt(fromPit));
|
||||
RoomDefaultWheatView toWheatView = findWheatViewByPitNumber(Integer.parseInt(toPitNumber));
|
||||
RoomPitBean fromPitBean=fromWheatView.pitBean;
|
||||
RoomPitBean toPitBean=toWheatView.pitBean;
|
||||
String tmpNumber=fromPitBean.getPit_number();
|
||||
fromPitBean.setPit_number(toPitBean.getPit_number());
|
||||
toPitBean.setPit_number(tmpNumber);
|
||||
|
||||
|
||||
public void updateSingleWheat(RoomPitBean pitBean, int pitNumber) {
|
||||
if (pitList == null || pitList.isEmpty() || pitNumber < 1 || pitNumber > 10) return;
|
||||
if (isSingleMode && this.currentSinglePit != pitNumber) return;
|
||||
toWheatView.setData(fromPitBean);
|
||||
fromWheatView.setData(toPitBean);
|
||||
|
||||
RoomDefaultWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||
if (wheatView != null) {
|
||||
wheatView.setData(pitBean);
|
||||
if (layoutType==2){
|
||||
fromWheatView.setTv_time_pk(false);
|
||||
toWheatView.setTv_time_pk(false);
|
||||
}else if (layoutType==1){
|
||||
fromWheatView.setTv_time_pk(true);
|
||||
toWheatView.setTv_time_pk(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSingleCharm(RoomPitBean pitBean, int pitNumber) {
|
||||
public void updateSingleWheat(RoomPitBean pitBean, int pitNumber,int layoutType) {
|
||||
if (pitList == null || pitList.isEmpty() || pitNumber < 1 || pitNumber > 10) return;
|
||||
if (isSingleMode && this.currentSinglePit != pitNumber) return;
|
||||
|
||||
RoomDefaultWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||
if (wheatView != null) {
|
||||
wheatView.setCharm(pitBean.getCharm());
|
||||
pitBean.set_pk(true);
|
||||
wheatView.setData(pitBean);
|
||||
if (layoutType==2){
|
||||
wheatView.setTv_time_pk(false);
|
||||
}else if (layoutType==1){
|
||||
wheatView.setTv_time_pk(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSingleCharm(RoomPitBean pitBean, int pitNumber,int layoutType) {
|
||||
if (pitList == null || pitList.isEmpty() || pitNumber < 1 || pitNumber > 10) return;
|
||||
if (isSingleMode && this.currentSinglePit != pitNumber) return;
|
||||
|
||||
RoomDefaultWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||
if (wheatView != null) {
|
||||
RoomPitBean bean=wheatView.pitBean;
|
||||
bean=pitBean ;
|
||||
|
||||
if (layoutType==2){
|
||||
wheatView.setTv_time_pk(false);
|
||||
}else if (layoutType==1){
|
||||
wheatView.setTv_time_pk(true);
|
||||
}
|
||||
wheatView.setSex(bean.getCharm(),true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +320,7 @@ public class WheatLayoutManager {
|
||||
public void refreshWheatData(List<RoomPitBean> newPitList, List<Integer> changedPits) {
|
||||
this.pitList = newPitList;
|
||||
for (int pitNumber : changedPits) {
|
||||
updateSingleWheat(pitList.get(pitNumber - 1), pitNumber);
|
||||
updateSingleWheat(pitList.get(pitNumber - 1), pitNumber,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,16 +135,16 @@
|
||||
android:id="@+id/iv_frame"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.98"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.98" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_riv_bottom"
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHeight_default="percent"
|
||||
app:layout_constraintHeight_percent="0.52" />
|
||||
app:layout_constraintHeight_percent="0.5" />
|
||||
|
||||
<com.xscm.moduleutil.widget.AvatarFrameView
|
||||
android:id="@+id/iv_frame"
|
||||
@@ -75,7 +75,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintHeight_default="percent"
|
||||
app:layout_constraintHeight_percent="0.5"
|
||||
app:layout_constraintHeight_percent="0.52"
|
||||
app:loopCount="0"
|
||||
app:source="ripple3695.svga" />
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<activity
|
||||
android:name=".activity.RoomActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:launchMode="singleTask"
|
||||
android:excludeFromRecents="false"
|
||||
android:exported="false"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
|
||||
@@ -32,6 +32,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Autowired
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.blankj.utilcode.util.ActivityUtils
|
||||
import com.blankj.utilcode.util.GsonUtils
|
||||
import com.blankj.utilcode.util.LogUtils
|
||||
import com.blankj.utilcode.util.ThreadUtils
|
||||
@@ -46,7 +47,6 @@ import com.example.moduleroom.fragment.*
|
||||
import com.example.moduleroom.presenter.RoomPresenter
|
||||
import com.example.moduleroom.service.ForegroundService
|
||||
import com.example.moduleroom.service.RoomPlayService
|
||||
import com.google.common.collect.Sets.SetView
|
||||
import com.hjq.toast.ToastUtils
|
||||
import com.liulishuo.okdownload.OkDownloadProvider
|
||||
import com.orhanobut.logger.Logger
|
||||
@@ -83,6 +83,7 @@ import com.xscm.moduleutil.interfaces.OnMusicItemClickListener
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton.OnMessageReceivedListener
|
||||
import com.xscm.moduleutil.rtc.AgoraManager
|
||||
import com.xscm.moduleutil.rtc.AgoraManagerEx
|
||||
import com.xscm.moduleutil.rtc.MusicPlayBean
|
||||
import com.xscm.moduleutil.service.MyRoomSingleton
|
||||
import com.xscm.moduleutil.utils.*
|
||||
@@ -125,6 +126,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
var roomId: String? = null
|
||||
|
||||
var mRoomInfoResp: RoomInfoResp? = null
|
||||
|
||||
@JvmField
|
||||
@Autowired
|
||||
var taskId: String? = null
|
||||
@@ -183,21 +185,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
taskId = intent.getStringExtra("taskId")
|
||||
}
|
||||
|
||||
|
||||
private fun resumeRoomFromMinimize() {
|
||||
// 从最小化状态恢复房间
|
||||
isMinimized = false
|
||||
clearMinimizeState()
|
||||
|
||||
// 恢复房间状态
|
||||
resumeRoomState()
|
||||
|
||||
// 确保UI正确显示
|
||||
if (mBinding != null) {
|
||||
// 恢复UI状态
|
||||
}
|
||||
}
|
||||
|
||||
private var bgEffectView: View? = null
|
||||
|
||||
private fun setupEffectView() {
|
||||
@@ -499,6 +486,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
Log.d("TAG", "=== onDestroy called ===");
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// 在super.onCreate之前设置主题以避免闪白屏
|
||||
setTheme(com.xscm.moduleutil.R.style.BaseAppTheme) // 设置你的主主题
|
||||
@@ -526,7 +517,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// .beginTransaction()
|
||||
// .replace(R.id.vp_room_pager, roomFragment!!)
|
||||
// .commitAllowingStateLoss()
|
||||
// 使用新的 OnBackPressedDispatcher API 来处理返回事件
|
||||
// 使用新的 API 来处理返回事件
|
||||
if (onBackPressedDispatcher != null) {
|
||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
@@ -613,7 +604,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
this.mRoomBean = roomBean
|
||||
this.mRoomUserBean = resp.user_info
|
||||
this.mRoomOwnerBean = resp.room_owner
|
||||
this.mPitList = mRoomBean!!.pit_list
|
||||
this.mPitList = mRoomBean?.pit_list ?: ArrayList()
|
||||
this.roomId = roomBean.room_id
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId) //加入房间im
|
||||
ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
|
||||
@@ -632,16 +623,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
number = roomBean.online_number
|
||||
mBinding!!.roomTop.tvNum.text = number.toString() + ""
|
||||
|
||||
val userIds = StringBuilder()
|
||||
for (i in mRoomInfoResp!!.room_info.pit_list.indices) {
|
||||
val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id
|
||||
if (userId != null && userId != "0" && !userId.isEmpty()) {
|
||||
if (userIds.length > 0) {
|
||||
userIds.append(",")
|
||||
}
|
||||
userIds.append(userId)
|
||||
}
|
||||
}
|
||||
setviewyc(true)
|
||||
initPublicScreenFragment()
|
||||
// 确保Fragment已完全初始化后再调用getUpRoomInfo
|
||||
if (publicScreenFragment != null && publicScreenFragment!!.isAdded && publicScreenFragment!!.view != null) {
|
||||
@@ -654,7 +636,18 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
Log.e("Fragment", "Fragment transaction skipped due to state loss.")
|
||||
}
|
||||
LogUtils.e("加入", roomId)
|
||||
|
||||
val userIds = StringBuilder()
|
||||
if (mRoomInfoResp?.room_info?.pit_list != null) {
|
||||
for (i in mRoomInfoResp?.room_info?.pit_list!!.indices) {
|
||||
val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id
|
||||
if (userId != null && userId != "0" && !userId.isEmpty()) {
|
||||
if (userIds.length > 0) {
|
||||
userIds.append(",")
|
||||
}
|
||||
userIds.append(userId)
|
||||
}
|
||||
}
|
||||
}
|
||||
CommonAppContext.getInstance().isPlaying = true
|
||||
CommonAppContext.getInstance().playId = roomId
|
||||
CommonAppContext.getInstance().playName = mRoomBean!!.room_name
|
||||
@@ -1315,6 +1308,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
)
|
||||
}
|
||||
|
||||
mBinding!!.roomTop.muZc.setOnClickListener { view: View ->
|
||||
this.onClick(
|
||||
view
|
||||
)
|
||||
}
|
||||
|
||||
// SpUtil.saveMyRoomId(roomId);
|
||||
// MvpPre.getRoomIn(roomId, password);
|
||||
// MvpPre.getRoomOnline(roomId, "1", "10");
|
||||
@@ -1438,7 +1437,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
} else if (msgType == 1001) {
|
||||
handleMsgType1001()
|
||||
} else if (msgType == 1002) {
|
||||
handleMsgType1002()
|
||||
handleMsgType1002(messageEvent, text)
|
||||
} else if (msgType == 1029) {
|
||||
handleMsgType1029(messageEvent, text)
|
||||
} else if (msgType == 1021) {
|
||||
@@ -1467,7 +1466,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
setRoleType(3, -11)
|
||||
}
|
||||
} else if (msgType == 125) {
|
||||
handleMsgType125(messageEvent, text)
|
||||
handleMsgType125(messageEvent, text.text)
|
||||
} else if (msgType == 1006) {
|
||||
handleMsgType1006()
|
||||
} else if (msgType == 1007) {
|
||||
@@ -1586,7 +1585,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
xlhDjs(xlhBean.end_time)
|
||||
} else if (xlhBean.from_type == 104) {
|
||||
|
||||
mBinding?.xlhRk?.visibility = View.GONE
|
||||
releaseCountDownTimer1()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1910,13 +1910,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
for (roomPitBean in mRoomInfoResp!!.song_pit_list) {
|
||||
AgoraManager.getInstance(this@RoomActivity).ClientRole(false)
|
||||
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding)
|
||||
mBinding!!.rlMic.visibility = View.GONE
|
||||
mBinding?.rlMic?.visibility = View.GONE
|
||||
}
|
||||
if (mRoomInfoResp!!.song_user_info != null && mRoomInfoResp!!.song_user_info.user_id != null) {
|
||||
if (mRoomInfoResp!!.song_user_info.user_id == SpUtil.getUserId().toString() + "") {
|
||||
AgoraManager.getInstance(this@RoomActivity).ClientRole(false)
|
||||
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding)
|
||||
mBinding!!.rlMic.visibility = View.GONE
|
||||
mBinding?.rlMic?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1987,6 +1987,21 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
} else if ("3" == typeId || "4" == typeId || "1" == typeId || "8" == typeId) {
|
||||
val labelId = mRoomInfoResp!!.room_info.label_id
|
||||
if ("2" == labelId) {
|
||||
// val pitBean = RoomPitBean()
|
||||
// pitBean.pit_number = messageEvent.text.pit_number
|
||||
// pitBean.user_id = messageEvent.text.fromUserInfo.user_id.toString() + ""
|
||||
// pitBean.avatar = messageEvent.text.fromUserInfo.avatar
|
||||
// pitBean.nickname = messageEvent.text.fromUserInfo.nickname
|
||||
// pitBean.sex = messageEvent.text.fromUserInfo.sex.toString() + ""
|
||||
// pitBean.charm = messageEvent.text.fromUserInfo.charm
|
||||
// pitBean.dress = messageEvent.text.fromUserInfo.dress
|
||||
//
|
||||
// if (pitBean.pit_number == "9") {
|
||||
// val roomDefaultWheatView: RoomKtvWheatView = mBinding?.roomTop!!.muZc
|
||||
// roomDefaultWheatView.setData(pitBean)
|
||||
// }
|
||||
|
||||
|
||||
roomFragment!!.KtvFragmentEvent(messageEvent)
|
||||
} else if ("1" == labelId) {
|
||||
mRoomInfoResp!!.room_info.pit_list.set(pitNumber.toInt() - 1, getPitBean(messageEvent))
|
||||
@@ -2064,6 +2079,17 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
} else if ("3" == typeId || "4" == typeId || "1" == typeId || "8" == typeId) {
|
||||
val labelId = mRoomInfoResp!!.room_info.label_id
|
||||
if ("2" == labelId) {
|
||||
// val pitBean = RoomPitBean()
|
||||
// pitBean.pit_number = messageEvent.text.pit_number
|
||||
// pitBean.user_id = ""
|
||||
// pitBean.avatar = ""
|
||||
// pitBean.nickname = ""
|
||||
// pitBean.sex = ""
|
||||
// pitBean.charm = ""
|
||||
// if (pitBean.pit_number == "9") {
|
||||
// val roomDefaultWheatView: RoomKtvWheatView = mBinding?.roomTop!!.muZc
|
||||
// roomDefaultWheatView.setData(pitBean)
|
||||
// }
|
||||
roomFragment!!.KtvFragmentEvent(messageEvent)
|
||||
} else if ("1" == labelId) {
|
||||
mRoomInfoResp!!.room_info.pit_list.set(pitNumber.toInt() - 1, getPitBean2(messageEvent, pitNumber))
|
||||
@@ -2153,6 +2179,9 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
if (text.fromUserInfo.user_id == SpUtil.getUserId()) {
|
||||
LogUtils.e("退出房间")
|
||||
MvpPre!!.quitRoom(roomId, SpUtil.getUserId().toString() + "")
|
||||
MessageListenerSingleton.quitGroup(roomId);
|
||||
quit();
|
||||
performExitRoom(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2161,12 +2190,18 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
mBinding!!.roomTop.tvNum.text = number.toString() + ""
|
||||
}
|
||||
|
||||
private fun handleMsgType1002() {
|
||||
private fun handleMsgType1002(messageEvent: RoomMessageEvent, text: T?) {
|
||||
number--
|
||||
if (number < 0) {
|
||||
number = 0
|
||||
}
|
||||
mBinding!!.roomTop.tvNum.text = number.toString() + ""
|
||||
if (text == null || text.fromUserInfo == null) return
|
||||
if (text.fromUserInfo.user_id == SpUtil.getUserId()) {
|
||||
MessageListenerSingleton.quitGroup(roomId);
|
||||
quit();
|
||||
performExitRoom(1);
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleMsgType1029(messageEvent: RoomMessageEvent, text: T?) {
|
||||
@@ -2369,23 +2404,19 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
return mRoomInfoResp
|
||||
}
|
||||
|
||||
private fun handleMsgType125(messageEvent: RoomMessageEvent, text: T?) {
|
||||
private fun handleMsgType125(messageEvent: RoomMessageEvent, text: String) {
|
||||
if (text == null) return
|
||||
|
||||
try {
|
||||
val parsedText = GsonUtils.fromJson<text>(
|
||||
text.text,
|
||||
text::class.java
|
||||
)
|
||||
val parsedText: RoomMessageEvent.text = GsonUtils.fromJson(text, RoomMessageEvent.text::class.java)
|
||||
if (parsedText.is_mute == 1) {
|
||||
AgoraManager.getInstance(this).ClientRole(false)
|
||||
AgoraManager.getInstance(this).muteLocalAudioStreamEx(false, SpUtil.getUserId())
|
||||
AgoraManagerEx.getInstance(this).muteLocalAudioStreamEx(true)
|
||||
} else {
|
||||
AgoraManager.getInstance(this).ClientRole(true)
|
||||
AgoraManager.getInstance(this).muteLocalAudioStreamEx(true, SpUtil.getUserId())
|
||||
AgoraManagerEx.getInstance(this).muteLocalAudioStreamEx(false)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// Handle exception
|
||||
LogUtils.e("handleMsgType125: " + e.message)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2775,6 +2806,54 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
aBoolean = true
|
||||
}
|
||||
}
|
||||
} else if (id == R.id.mu_zc) {
|
||||
val muZc: RoomKtvWheatView = mBinding!!.roomTop.muZc
|
||||
if (muZc.getUserId() != "") {
|
||||
RoomUserInfoFragment.show(
|
||||
roomId,
|
||||
muZc.getUserId(),
|
||||
muZc.pitNumber,
|
||||
getHostUser(),
|
||||
false,
|
||||
2,
|
||||
isNumberWhether(),
|
||||
supportFragmentManager
|
||||
)
|
||||
} else {
|
||||
MvpPre!!.applyPit(roomId, "9")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun isNumberWhether(): Int {
|
||||
if (mRoomInfoResp!!.getUser_info().getPit_number() == 9) {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
private fun getHostUser(): Int {
|
||||
if (mRoomInfoResp?.getUser_info()?.getPit_number() == 9) {
|
||||
return if (mRoomInfoResp?.getUser_info()?.getIs_room_owner() == 1) {
|
||||
1
|
||||
} else if (mRoomInfoResp?.getUser_info()?.getIs_management() == 1) {
|
||||
2
|
||||
} else if (mRoomInfoResp?.getUser_info()?.getIs_host() == 1) {
|
||||
3
|
||||
} else {
|
||||
4
|
||||
}
|
||||
} else {
|
||||
if (mRoomInfoResp?.getUser_info()?.getIs_room_owner() == 1) {
|
||||
return 1
|
||||
}
|
||||
if (mRoomInfoResp?.getUser_info()?.getIs_management() == 1) {
|
||||
return 2
|
||||
}
|
||||
if (mRoomInfoResp?.getUser_info()?.getIs_host() == 1) {
|
||||
return 3
|
||||
}
|
||||
return 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2873,33 +2952,17 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
appStateListener!!.isAppInBackground = true
|
||||
}
|
||||
QXGiftPlayerManager.getInstance(applicationContext).destroyEffectSvga()
|
||||
ARouter.getInstance()
|
||||
.build(ARouteConstants.ME)
|
||||
.navigation()
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.ME)
|
||||
// .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
// .navigation();
|
||||
|
||||
// 使用Intent启动主Activity,通过ARouter路径
|
||||
// 这样可以避免模块间的直接依赖
|
||||
// try {
|
||||
// val intent = Intent()
|
||||
// intent.setClassName(packageName, "com.xscm.modulemain.activity.MainActivity")
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||
// startActivity(intent)
|
||||
// } catch (e: Exception) {
|
||||
// // 如果直接指定类名失败,则使用默认的Launcher Activity
|
||||
// val startMain = Intent(Intent.ACTION_MAIN)
|
||||
// startMain.addCategory(Intent.CATEGORY_HOME)
|
||||
// startMain.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||
// startActivity(startMain)
|
||||
// }
|
||||
|
||||
// 隐藏Activity而不是销毁它
|
||||
// moveTaskToBack(true);
|
||||
// 使用 moveTaskToBack 将应用最小化
|
||||
// moveTaskToBack(true);
|
||||
if (ActivityUtils.getActivityList().size <= 0) {
|
||||
ARouter.getInstance()
|
||||
.build(ARouteConstants.ME)
|
||||
.navigation()
|
||||
} else {
|
||||
val intent = Intent(this, ActivityUtils.getActivityList()[1]::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
private fun saveMinimizeState() {
|
||||
@@ -3014,12 +3077,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
|
||||
fun setrlMic(voive: Boolean) {
|
||||
mBinding!!.rlMic.visibility =
|
||||
mBinding?.rlMic?.visibility =
|
||||
if (voive) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
fun rlMore(voive: Boolean) {
|
||||
mBinding!!.rlMore.visibility = if (voive) View.GONE else View.GONE
|
||||
mBinding!!.rlMore.visibility = if (voive) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
fun ivMic(inIvMic: Int) {
|
||||
@@ -3027,16 +3090,16 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
|
||||
fun setRoleType(roleType: Int, pit_number: Int) {
|
||||
val rl_voice = mBinding!!.rlVoive // 注意:原拼写错误已修正
|
||||
val rl_mic = mBinding!!.rlMic
|
||||
val rl_more = mBinding!!.rlMore
|
||||
val rl_misc = mBinding!!.rlMisc
|
||||
val rl_voice = mBinding?.rlVoive // 注意:原拼写错误已修正 喇叭
|
||||
val rl_mic = mBinding?.rlMic//麦克风
|
||||
val rl_more = mBinding?.rlMore //PK
|
||||
val rl_misc = mBinding?.rlMisc //音乐
|
||||
|
||||
// 默认隐藏所有按钮
|
||||
rl_voice.visibility = View.GONE
|
||||
rl_more.visibility = View.GONE
|
||||
rl_misc.visibility = View.GONE
|
||||
rl_mic.visibility = View.GONE
|
||||
rl_voice?.visibility = View.GONE
|
||||
rl_more?.visibility = View.GONE
|
||||
rl_misc?.visibility = View.GONE
|
||||
rl_mic?.visibility = View.GONE
|
||||
|
||||
// 空指针保护
|
||||
if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null || mRoomInfoResp!!.user_info == null) {
|
||||
@@ -3049,70 +3112,80 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
// 特殊房间类型处理(优先级最高)
|
||||
if ("6" == typeId) {
|
||||
mBinding!!.rlMessage.visibility = View.GONE
|
||||
mBinding?.rlMessage?.visibility = View.GONE
|
||||
return // 全部隐藏,无需继续处理
|
||||
} else {
|
||||
mBinding?.rlMessage?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
|
||||
// 根据角色类型显示按钮
|
||||
when (roleType) {
|
||||
1, 2, 3 -> {
|
||||
rl_voice.visibility = View.VISIBLE
|
||||
rl_mic.visibility =
|
||||
rl_voice?.visibility = View.VISIBLE
|
||||
rl_mic?.visibility =
|
||||
if (pit_number != 0) View.VISIBLE else View.GONE
|
||||
rl_more.visibility =
|
||||
if (pit_number == 9) View.GONE else View.GONE
|
||||
rl_misc.visibility = View.VISIBLE
|
||||
rl_more?.visibility =
|
||||
if (pit_number == 9) View.VISIBLE else View.GONE
|
||||
rl_misc?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
0 -> {
|
||||
rl_voice.visibility = View.VISIBLE
|
||||
rl_mic.visibility =
|
||||
rl_voice?.visibility = View.VISIBLE
|
||||
rl_mic?.visibility =
|
||||
if (pit_number != 0) View.VISIBLE else View.GONE
|
||||
rl_misc.visibility = View.VISIBLE
|
||||
rl_misc?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
5 -> {
|
||||
rl_voice.visibility = View.VISIBLE
|
||||
rl_more.visibility = View.GONE
|
||||
rl_misc.visibility = View.VISIBLE
|
||||
rl_voice?.visibility = View.VISIBLE
|
||||
rl_more?.visibility = View.GONE
|
||||
rl_misc?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
if (roleType != 5) {
|
||||
rl_misc.visibility = View.VISIBLE
|
||||
rl_misc?.visibility = View.VISIBLE
|
||||
if (userPitNumber == 9) {
|
||||
rl_more.visibility = View.GONE
|
||||
rl_more?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// label_id 和 type_id 联合判断
|
||||
if (mutableListOf<String>("1", "3", "4", "8").contains(typeId) && "2" == labelId) {
|
||||
rl_more.visibility = View.GONE
|
||||
if (mutableListOf<String>("1").contains(typeId) && "1" == labelId) {
|
||||
rl_more?.visibility = View.VISIBLE
|
||||
rl_misc?.visibility = View.VISIBLE
|
||||
}else{
|
||||
rl_more?.visibility = View.GONE
|
||||
rl_misc?.visibility = View.GONE
|
||||
}
|
||||
|
||||
// mic 显示逻辑
|
||||
if (userPitNumber > 0) {
|
||||
rl_mic.visibility = View.VISIBLE
|
||||
switchMic(2)
|
||||
} else {
|
||||
if (pit_number == 888) {
|
||||
rl_mic.visibility = View.VISIBLE
|
||||
switchMic(2)
|
||||
} else if (pit_number == -1) {
|
||||
rl_mic.visibility = View.VISIBLE // 原代码此处缺少 View. 前缀,已补全
|
||||
rl_mic?.visibility = View.VISIBLE
|
||||
if (CommonAppContext.getInstance().isMai) {
|
||||
switchMic(1)
|
||||
} else {
|
||||
rl_mic.visibility = View.GONE
|
||||
switchMic(2)
|
||||
}
|
||||
} else {
|
||||
if (pit_number == 888) {
|
||||
rl_mic?.visibility = View.VISIBLE
|
||||
switchMic(2)
|
||||
} else if (pit_number == -1) {
|
||||
rl_mic?.visibility = View.VISIBLE // 原代码此处缺少 View. 前缀,已补全
|
||||
switchMic(1)
|
||||
} else {
|
||||
rl_mic?.visibility = View.GONE
|
||||
switchMic(2)
|
||||
}
|
||||
}
|
||||
|
||||
if ("7" == typeId || "2" == typeId) {
|
||||
rl_more.visibility = View.GONE
|
||||
rl_misc.visibility = View.GONE
|
||||
rl_more?.visibility = View.GONE
|
||||
rl_misc?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3309,121 +3382,123 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// TODO: 2025/8/26 加入房间
|
||||
override fun roomInfo(resp: RoomInfoResp) {
|
||||
AppStateManager.getInstance().roomInfo = resp
|
||||
this.mRoomInfoResp = resp
|
||||
val roomBean = resp.room_info
|
||||
this.mRoomBean = roomBean
|
||||
this.mRoomUserBean = resp.user_info
|
||||
this.mRoomOwnerBean = resp.room_owner
|
||||
this.mPitList = mRoomBean!!.pit_list
|
||||
this.roomId = roomBean.room_id
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId) //加入房间im
|
||||
ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
|
||||
mBinding!!.roomTop.name.text = roomBean.room_name
|
||||
mBinding!!.roomTop.idVal.text = "ID:" + roomBean.room_number
|
||||
if (mRoomUserBean?.getIs_room_owner() == 1) {
|
||||
mBinding!!.roomTop.btnFollow.visibility = View.GONE
|
||||
} else {
|
||||
mBinding!!.roomTop.btnFollow.visibility = View.VISIBLE
|
||||
if (resp.isCollect) {
|
||||
mBinding!!.roomTop.btnFollow.background =
|
||||
resources.getDrawable(com.xscm.moduleutil.R.mipmap.collected)
|
||||
mBinding!!.roomTop.btnFollow.text = ""
|
||||
}
|
||||
}
|
||||
number = roomBean.online_number
|
||||
mBinding!!.roomTop.tvNum.text = number.toString() + ""
|
||||
setview(resp)
|
||||
|
||||
val userIds = StringBuilder()
|
||||
for (i in mRoomInfoResp!!.room_info.pit_list.indices) {
|
||||
val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id
|
||||
if (userId != null && userId != "0" && !userId.isEmpty()) {
|
||||
if (userIds.length > 0) {
|
||||
userIds.append(",")
|
||||
}
|
||||
userIds.append(userId)
|
||||
}
|
||||
}
|
||||
initPublicScreenFragment()
|
||||
if (!isFinishing && !isDestroyed) {
|
||||
resetFragment()
|
||||
upHeight()
|
||||
} else {
|
||||
Log.e("Fragment", "Fragment transaction skipped due to state loss.")
|
||||
}
|
||||
LogUtils.e("加入", roomId)
|
||||
|
||||
CommonAppContext.getInstance().isPlaying = true
|
||||
CommonAppContext.getInstance().playId = roomId
|
||||
CommonAppContext.getInstance().playName = mRoomBean!!.room_name
|
||||
|
||||
CommonAppContext.getInstance().playCover = resp.room_info.room_cover
|
||||
CommonAppContext.getInstance().showSelf = resp.is_show_self == 1
|
||||
|
||||
if (mRoomUserBean?.getIs_collect() == 1) {
|
||||
mBinding!!.roomTop.btnFollow.background =
|
||||
resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
|
||||
mBinding!!.roomTop.btnFollow.text = ""
|
||||
} else {
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(
|
||||
mBinding!!.roomTop.btnFollow,
|
||||
ColorManager.getInstance().primaryColorInt,
|
||||
53
|
||||
)
|
||||
mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
|
||||
mBinding!!.roomTop.btnFollow.text = "收藏"
|
||||
// mBinding.roomTop.btnFollow.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.collect));
|
||||
}
|
||||
if ((roomBean.type_id == "3" || roomBean.type_id == "1" || roomBean.type_id == "4") && roomBean.label_id == "2") {
|
||||
AgoraManager.getInstance(this).isBjMusic = false
|
||||
} else {
|
||||
AgoraManager.getInstance(this).isBjMusic = true
|
||||
}
|
||||
|
||||
AgoraManager.stopMuisc()
|
||||
initializeAudio()
|
||||
|
||||
|
||||
toutiao()
|
||||
upRoomInfo(resp)
|
||||
|
||||
|
||||
if (userIds.length > 0 && roomId != null) {
|
||||
// MvpPre.userOnlineStatus(userIds.toString(), roomId);
|
||||
}
|
||||
if (publicScreenFragment != null) {
|
||||
publicScreenFragment!!.getUpRoomInfo(resp)
|
||||
}
|
||||
instView()
|
||||
|
||||
if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()
|
||||
.toString() + ""
|
||||
) {
|
||||
mBinding!!.roomTop.rl.visibility = View.VISIBLE
|
||||
ivSoundEffects(true)
|
||||
} else {
|
||||
mBinding!!.roomTop.rl.visibility = View.GONE
|
||||
ivSoundEffects(false)
|
||||
}
|
||||
|
||||
if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
|
||||
mBinding!!.rlMore.visibility = View.GONE
|
||||
mBinding!!.rlMisc.visibility = View.GONE
|
||||
}
|
||||
setupEffectView()
|
||||
|
||||
if (mRoomInfoResp!!.gift_cycle != null && mRoomInfoResp!!.gift_cycle.xlh_info != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status == "1") {
|
||||
mBinding?.xlhRk?.visibility = View.VISIBLE
|
||||
xlhDjs(mRoomInfoResp!!.gift_cycle.xlh_info.end_time)
|
||||
} else {
|
||||
mBinding?.xlhRk?.visibility = View.INVISIBLE
|
||||
releaseCountDownTimer1()
|
||||
}
|
||||
|
||||
if (mRoomInfoResp!!.hour_ranking_open == 1) {
|
||||
mBinding!!.clXsb.visibility = View.VISIBLE
|
||||
} else {
|
||||
mBinding!!.clXsb.visibility = View.GONE
|
||||
}
|
||||
// this.mRoomInfoResp = resp
|
||||
// val roomBean = resp.room_info
|
||||
// this.mRoomBean = roomBean
|
||||
// this.mRoomUserBean = resp.user_info
|
||||
// this.mRoomOwnerBean = resp.room_owner
|
||||
// this.mPitList = mRoomBean!!.pit_list
|
||||
// this.roomId = roomBean.room_id
|
||||
// MessageListenerSingleton.getInstance().joinGroup(roomId) //加入房间im
|
||||
// ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
|
||||
// mBinding!!.roomTop.name.text = roomBean.room_name
|
||||
// mBinding!!.roomTop.idVal.text = "ID:" + roomBean.room_number
|
||||
// if (mRoomUserBean?.getIs_room_owner() == 1) {
|
||||
// mBinding!!.roomTop.btnFollow.visibility = View.GONE
|
||||
// } else {
|
||||
// mBinding!!.roomTop.btnFollow.visibility = View.VISIBLE
|
||||
// if (resp.isCollect) {
|
||||
// mBinding!!.roomTop.btnFollow.background =
|
||||
// resources.getDrawable(com.xscm.moduleutil.R.mipmap.collected)
|
||||
// mBinding!!.roomTop.btnFollow.text = ""
|
||||
// }
|
||||
// }
|
||||
// number = roomBean.online_number
|
||||
// mBinding!!.roomTop.tvNum.text = number.toString() + ""
|
||||
//
|
||||
// val userIds = StringBuilder()
|
||||
// for (i in mRoomInfoResp!!.room_info.pit_list.indices) {
|
||||
// val userId = mRoomInfoResp!!.room_info.pit_list[i].user_id
|
||||
// if (userId != null && userId != "0" && !userId.isEmpty()) {
|
||||
// if (userIds.length > 0) {
|
||||
// userIds.append(",")
|
||||
// }
|
||||
// userIds.append(userId)
|
||||
// }
|
||||
// }
|
||||
// initPublicScreenFragment()
|
||||
// if (!isFinishing && !isDestroyed) {
|
||||
// resetFragment()
|
||||
// upHeight()
|
||||
// } else {
|
||||
// Log.e("Fragment", "Fragment transaction skipped due to state loss.")
|
||||
// }
|
||||
// LogUtils.e("加入", roomId)
|
||||
//
|
||||
// CommonAppContext.getInstance().isPlaying = true
|
||||
// CommonAppContext.getInstance().playId = roomId
|
||||
// CommonAppContext.getInstance().playName = mRoomBean!!.room_name
|
||||
//
|
||||
// CommonAppContext.getInstance().playCover = resp.room_info.room_cover
|
||||
// CommonAppContext.getInstance().showSelf = resp.is_show_self == 1
|
||||
//
|
||||
// if (mRoomUserBean?.getIs_collect() == 1) {
|
||||
// mBinding!!.roomTop.btnFollow.background =
|
||||
// resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
|
||||
// mBinding!!.roomTop.btnFollow.text = ""
|
||||
// } else {
|
||||
// ThemeableDrawableUtils.setThemeableRoundedBackground(
|
||||
// mBinding!!.roomTop.btnFollow,
|
||||
// ColorManager.getInstance().primaryColorInt,
|
||||
// 53
|
||||
// )
|
||||
// mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
|
||||
// mBinding!!.roomTop.btnFollow.text = "收藏"
|
||||
// // mBinding.roomTop.btnFollow.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.collect));
|
||||
// }
|
||||
// if ((roomBean.type_id == "3" || roomBean.type_id == "1" || roomBean.type_id == "4") && roomBean.label_id == "2") {
|
||||
// AgoraManager.getInstance(this).isBjMusic = false
|
||||
// } else {
|
||||
// AgoraManager.getInstance(this).isBjMusic = true
|
||||
// }
|
||||
//
|
||||
// AgoraManager.stopMuisc()
|
||||
// initializeAudio()
|
||||
//
|
||||
//
|
||||
// toutiao()
|
||||
// upRoomInfo(resp)
|
||||
//
|
||||
//
|
||||
// if (userIds.length > 0 && roomId != null) {
|
||||
//// MvpPre.userOnlineStatus(userIds.toString(), roomId);
|
||||
// }
|
||||
// if (publicScreenFragment != null) {
|
||||
// publicScreenFragment!!.getUpRoomInfo(resp)
|
||||
// }
|
||||
// instView()
|
||||
//
|
||||
// if (mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()
|
||||
// .toString() + ""
|
||||
// ) {
|
||||
// mBinding!!.roomTop.rl.visibility = View.VISIBLE
|
||||
// ivSoundEffects(true)
|
||||
// } else {
|
||||
// mBinding!!.roomTop.rl.visibility = View.GONE
|
||||
// ivSoundEffects(false)
|
||||
// }
|
||||
//
|
||||
// if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
|
||||
// mBinding!!.rlMore.visibility = View.GONE
|
||||
// mBinding!!.rlMisc.visibility = View.GONE
|
||||
// }
|
||||
// setupEffectView()
|
||||
//
|
||||
// if (mRoomInfoResp!!.gift_cycle != null && mRoomInfoResp!!.gift_cycle.xlh_info != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status != null && mRoomInfoResp!!.gift_cycle.xlh_info.xlh_status == "1") {
|
||||
// mBinding?.xlhRk?.visibility = View.VISIBLE
|
||||
// xlhDjs(mRoomInfoResp!!.gift_cycle.xlh_info.end_time)
|
||||
// } else {
|
||||
// mBinding?.xlhRk?.visibility = View.INVISIBLE
|
||||
// releaseCountDownTimer1()
|
||||
// }
|
||||
//
|
||||
// if (mRoomInfoResp!!.hour_ranking_open == 1) {
|
||||
// mBinding!!.clXsb.visibility = View.VISIBLE
|
||||
// } else {
|
||||
// mBinding!!.clXsb.visibility = View.GONE
|
||||
// }
|
||||
}
|
||||
|
||||
protected fun tzblChanged() {
|
||||
@@ -3476,7 +3551,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
// }
|
||||
if (mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId()
|
||||
.toString() + "" && mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.room_info.type_id != "2" && mRoomInfoResp!!.room_info.type_id != "6"
|
||||
.toString() + "" && mRoomInfoResp!!.user_info.pit_number == 9 && mRoomInfoResp!!.room_info.type_id == "1" && mRoomInfoResp!!.room_info.label_id != "1"
|
||||
) {
|
||||
rlMore(true)
|
||||
} else {
|
||||
@@ -3527,7 +3602,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
mBinding!!.ivQuanC.setOnClickListener { v: View? ->
|
||||
if (mRoomInfoResp!!.room_info.head_line.room_id != null && mRoomInfoResp!!.room_info.head_line.room_id.isNotEmpty()) {
|
||||
if (mRoomInfoResp!!.room_info.head_line.room_id != roomId) {
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(applicationContext, mRoomInfoResp!!.room_info.head_line.room_id, "",null)
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(
|
||||
applicationContext,
|
||||
mRoomInfoResp!!.room_info.head_line.room_id,
|
||||
"",
|
||||
null
|
||||
)
|
||||
} else {
|
||||
com.blankj.utilcode.util.ToastUtils.showLong("您就在当前房间")
|
||||
}
|
||||
@@ -3746,7 +3826,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
if (isInBackground) {
|
||||
isInBackground = false
|
||||
MvpPre!!.postRoomInfo(CommonAppContext.getInstance().playId)
|
||||
// MvpPre!!.postRoomInfo(CommonAppContext.getInstance().playId)
|
||||
}
|
||||
|
||||
// 检查是否从最小化状态恢复
|
||||
@@ -3757,7 +3837,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
resumeRoomState()
|
||||
setupEffectView()
|
||||
|
||||
MvpPre?.postRoomInfo(CommonAppContext.getInstance().playId)
|
||||
// MvpPre?.postRoomInfo(CommonAppContext.getInstance().playId)
|
||||
}
|
||||
|
||||
// 延迟调整布局,确保视图已经完全加载
|
||||
@@ -3927,93 +4007,93 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
return
|
||||
}
|
||||
this.mRoomInfoResp = resp
|
||||
setview(resp)
|
||||
|
||||
|
||||
val roomBean = resp.room_info
|
||||
if (roomBean!!.type_id.equals("6")) {
|
||||
|
||||
// val roomBean = resp.room_info
|
||||
// if (roomBean!!.type_id.equals("6")) {
|
||||
//
|
||||
//// upHeight()
|
||||
// initPublicScreenFragment()
|
||||
// if (!isFinishing && !isDestroyed) {
|
||||
// resetFragment()
|
||||
// upHeight()
|
||||
// } else {
|
||||
// Log.e("Fragment", "Fragment transaction skipped due to state loss.")
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// this.mRoomBean = roomBean
|
||||
// this.mRoomUserBean = resp.user_info
|
||||
// this.mRoomOwnerBean = resp.room_owner
|
||||
// this.mPitList = mRoomBean!!.pit_list!!
|
||||
//
|
||||
// ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
|
||||
// mBinding!!.roomTop.name.text = roomBean.room_name
|
||||
// mBinding!!.roomTop.idVal.text = roomBean.room_number
|
||||
// if (mRoomUserBean?.getIs_room_owner() == 1) {
|
||||
// mBinding!!.roomTop.btnFollow.visibility = View.GONE
|
||||
// } else {
|
||||
// mBinding!!.roomTop.btnFollow.visibility = View.VISIBLE
|
||||
// if (resp.isCollect) {
|
||||
// mBinding!!.roomTop.btnFollow.background =
|
||||
// resources.getDrawable(com.xscm.moduleutil.R.mipmap.collected)
|
||||
// mBinding!!.roomTop.btnFollow.text = ""
|
||||
// }
|
||||
// }
|
||||
// initPublicScreenFragment()
|
||||
// if (!isFinishing && !isDestroyed) {
|
||||
// resetFragment()
|
||||
// upHeight()
|
||||
initPublicScreenFragment()
|
||||
if (!isFinishing && !isDestroyed) {
|
||||
resetFragment()
|
||||
upHeight()
|
||||
} else {
|
||||
Log.e("Fragment", "Fragment transaction skipped due to state loss.")
|
||||
}
|
||||
return
|
||||
}
|
||||
this.mRoomBean = roomBean
|
||||
this.mRoomUserBean = resp.user_info
|
||||
this.mRoomOwnerBean = resp.room_owner
|
||||
this.mPitList = mRoomBean!!.pit_list!!
|
||||
|
||||
ImageUtils.loadHeadCC(resp.room_info.room_cover, mBinding!!.roomTop.avatar)
|
||||
mBinding!!.roomTop.name.text = roomBean.room_name
|
||||
mBinding!!.roomTop.idVal.text = roomBean.room_number
|
||||
if (mRoomUserBean?.getIs_room_owner() == 1) {
|
||||
mBinding!!.roomTop.btnFollow.visibility = View.GONE
|
||||
} else {
|
||||
mBinding!!.roomTop.btnFollow.visibility = View.VISIBLE
|
||||
if (resp.isCollect) {
|
||||
mBinding!!.roomTop.btnFollow.background =
|
||||
resources.getDrawable(com.xscm.moduleutil.R.mipmap.collected)
|
||||
mBinding!!.roomTop.btnFollow.text = ""
|
||||
}
|
||||
}
|
||||
initPublicScreenFragment()
|
||||
if (!isFinishing && !isDestroyed) {
|
||||
resetFragment()
|
||||
upHeight()
|
||||
} else {
|
||||
Log.e("Fragment", "Fragment transaction skipped due to state loss.")
|
||||
}
|
||||
|
||||
if (mRoomUserBean?.getIs_collect() == 1) {
|
||||
mBinding!!.roomTop.btnFollow.background =
|
||||
resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
|
||||
mBinding!!.roomTop.btnFollow.text = ""
|
||||
} else {
|
||||
// mBinding.roomTop.btnFollow.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.collect));
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(
|
||||
mBinding!!.roomTop.btnFollow,
|
||||
ColorManager.getInstance().primaryColorInt,
|
||||
53
|
||||
)
|
||||
mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
|
||||
mBinding!!.roomTop.btnFollow.text = "收藏"
|
||||
}
|
||||
if ((resp.room_info.type_id == "3" || resp.room_info.type_id == "1" || resp.room_info.type_id == "4") && resp.room_info.label_id == "2") {
|
||||
AgoraManager.getInstance(this).isBjMusic = false
|
||||
} else {
|
||||
AgoraManager.getInstance(this).isBjMusic = true
|
||||
}
|
||||
|
||||
|
||||
AgoraManager.stopMuisc()
|
||||
if (!CommonAppContext.getInstance().isMai) {
|
||||
initializeAudio()
|
||||
}
|
||||
|
||||
if (mRoomInfoResp!!.room_info.label_id == "2" || mRoomInfoResp!!.room_info.type_id == "7") {
|
||||
mBinding!!.rlMore.visibility = View.GONE
|
||||
// mBinding.rlMisc.setVisibility(GONE);
|
||||
} else if (mRoomInfoResp!!.room_info.label_id == "1" || mRoomInfoResp!!.room_info.type_id == "3" || mRoomInfoResp!!.room_info.type_id == "4" ||
|
||||
mRoomInfoResp!!.room_info.type_id == "8"
|
||||
) {
|
||||
mBinding!!.rlMore.visibility = View.GONE
|
||||
mBinding!!.rlMisc.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
|
||||
mBinding!!.rlMore.visibility = View.GONE
|
||||
mBinding!!.rlMisc.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (mRoomInfoResp!!.hour_ranking_open == 1) {
|
||||
mBinding!!.clXsb.visibility = View.VISIBLE
|
||||
} else {
|
||||
mBinding!!.clXsb.visibility = View.GONE
|
||||
}
|
||||
// } else {
|
||||
// Log.e("Fragment", "Fragment transaction skipped due to state loss.")
|
||||
// }
|
||||
//
|
||||
// if (mRoomUserBean?.getIs_collect() == 1) {
|
||||
// mBinding!!.roomTop.btnFollow.background =
|
||||
// resources.getDrawable(com.xscm.moduleutil.R.mipmap.yishouc)
|
||||
// mBinding!!.roomTop.btnFollow.text = ""
|
||||
// } else {
|
||||
//// mBinding.roomTop.btnFollow.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.collect));
|
||||
// ThemeableDrawableUtils.setThemeableRoundedBackground(
|
||||
// mBinding!!.roomTop.btnFollow,
|
||||
// ColorManager.getInstance().primaryColorInt,
|
||||
// 53
|
||||
// )
|
||||
// mBinding!!.roomTop.btnFollow.setTextColor(ColorManager.getInstance().buttonColorInt)
|
||||
// mBinding!!.roomTop.btnFollow.text = "收藏"
|
||||
// }
|
||||
// if ((resp.room_info.type_id == "3" || resp.room_info.type_id == "1" || resp.room_info.type_id == "4") && resp.room_info.label_id == "2") {
|
||||
// AgoraManager.getInstance(this).isBjMusic = false
|
||||
// } else {
|
||||
// AgoraManager.getInstance(this).isBjMusic = true
|
||||
// }
|
||||
//
|
||||
//
|
||||
// AgoraManager.stopMuisc()
|
||||
// if (!CommonAppContext.getInstance().isMai) {
|
||||
// initializeAudio()
|
||||
// }
|
||||
//
|
||||
// if (mRoomInfoResp!!.room_info.label_id == "2" || mRoomInfoResp!!.room_info.type_id == "7") {
|
||||
// mBinding!!.rlMore.visibility = View.GONE
|
||||
// // mBinding.rlMisc.setVisibility(GONE);
|
||||
// } else if (mRoomInfoResp!!.room_info.label_id == "1" || mRoomInfoResp!!.room_info.type_id == "3" || mRoomInfoResp!!.room_info.type_id == "4" ||
|
||||
// mRoomInfoResp!!.room_info.type_id == "8"
|
||||
// ) {
|
||||
// mBinding!!.rlMore.visibility = View.GONE
|
||||
// mBinding!!.rlMisc.visibility = View.VISIBLE
|
||||
// }
|
||||
//
|
||||
// if (resp.room_info.type_id == "7" || resp.room_info.type_id == "2") {
|
||||
// mBinding!!.rlMore.visibility = View.GONE
|
||||
// mBinding!!.rlMisc.visibility = View.GONE
|
||||
// }
|
||||
//
|
||||
// if (mRoomInfoResp!!.hour_ranking_open == 1) {
|
||||
// mBinding!!.clXsb.visibility = View.VISIBLE
|
||||
// } else {
|
||||
// mBinding!!.clXsb.visibility = View.GONE
|
||||
// }
|
||||
}
|
||||
|
||||
fun upHeight() {
|
||||
@@ -4047,7 +4127,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
.replace(R.id.vp_room_pager, roomFragment!!)
|
||||
.commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
if ("7" == typeId) {
|
||||
if (mRoomInfoResp!!.room_info.room_background == null || mRoomInfoResp!!.room_info.room_background == "") {
|
||||
changeBackground(com.xscm.moduleutil.R.mipmap.jiaoy_bj)
|
||||
@@ -4141,7 +4220,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId,
|
||||
// ""
|
||||
// )
|
||||
MvpPre?.getRoomIn(AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId, "")
|
||||
if (AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId != null && !AgoraManager.getInstance(
|
||||
OkDownloadProvider.context
|
||||
).lastRoomId.isEmpty()
|
||||
) {
|
||||
MvpPre?.getRoomIn(AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId, "")
|
||||
}
|
||||
AgoraManager.getInstance(OkDownloadProvider.context).lastRoomId = ""
|
||||
// setviewyc(true);
|
||||
// exitFullScreen()
|
||||
@@ -4242,6 +4326,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
GiftDisplayManager.getInstance().clearAll()
|
||||
mBinding!!.giftContainer.removeAllViews()
|
||||
CommonAppContext.getInstance().isMai = false
|
||||
// 确保父类的 onDestroy 被调用
|
||||
super.finish()
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.PkSwTokenBean;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
|
||||
@@ -22,6 +23,8 @@ public class SingSongContacts {
|
||||
void endPk();
|
||||
|
||||
void userOnlineStatus(List<UserOnlineStatusBean> list);
|
||||
|
||||
void postAgora(PkSwTokenBean pkSwTokenBean);
|
||||
}
|
||||
|
||||
public interface IEmotionRoomPre extends IPresenter {
|
||||
|
||||
@@ -212,7 +212,13 @@ public class RoomPkDialogFragment extends BaseMvpDialogFragment<RoomPkPresenter,
|
||||
|
||||
@Override
|
||||
public void searchPkRoom(List<RoomBean> roomBeans) {
|
||||
mAdapter.setNewData(roomBeans);
|
||||
if (page==1) {
|
||||
mAdapter.setNewData(roomBeans);
|
||||
}else {
|
||||
if (roomBeans!=null) {
|
||||
mAdapter.addData(roomBeans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -846,7 +846,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
int screenWidth = displayMetrics.widthPixels;
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
int popupWidth = (int) (screenWidth * 0.35); // 屏幕宽度的 60%
|
||||
int popupWidth = (int) (screenWidth * 0.25); // 屏幕宽度的 60%
|
||||
int popupHeight = (int) (screenHeight * 0.13); // 屏幕高度的 40%
|
||||
|
||||
|
||||
|
||||
@@ -824,7 +824,11 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
return;
|
||||
}
|
||||
|
||||
if (roomId == null || !message.getRoomId().contains(roomId)) {
|
||||
// if (roomId == null ) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (roomId == null ||(!message.getRoomId().contains(roomId)&&message.getMsgType()!=125)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -931,6 +935,8 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
case 1061:
|
||||
case 1025:
|
||||
case 1058:
|
||||
case 125:
|
||||
|
||||
// EventBus.getDefault().post(message);
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).roomInfoEvent(message);
|
||||
@@ -1013,6 +1019,9 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
private EMMessageInfo createMessageInfoIfNeeded(RoomMessageEvent message) {
|
||||
int msgType = message.getMsgType();
|
||||
RoomMessageEvent.T text = message.getText();
|
||||
if (text.getIs_pk()!=null&&text.getIs_pk().equals("1")){
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (msgType) {
|
||||
case 1001:
|
||||
@@ -1044,6 +1053,9 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
}
|
||||
|
||||
private void addSingleMessage(RoomMessageEvent message) {
|
||||
if (message.getText().getIs_pk()!=null&&message.getText().getIs_pk().equals("1")){
|
||||
return;
|
||||
}
|
||||
if (easeChatAdapter != null) {
|
||||
if (message.getMsgType() == 1049) {
|
||||
if (message.getText().getStep() != 3) {
|
||||
|
||||
@@ -162,7 +162,74 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
protected void initData() {
|
||||
if (roomInfoResp == null) return;
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
}
|
||||
private SharedViewModel sharedViewModel;
|
||||
@@ -694,7 +761,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
((RoomActivity) getActivity()).quitRoom2(roomId);
|
||||
if (label_id!=null && label_id.equals(LABEL_ID_MOVIE)){
|
||||
((RoomActivity) getActivity()).jiaR();
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", AgoraManager.getInstance(getActivity()).getLastRoomId()).navigation();
|
||||
//// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", AgoraManager.getInstance(getActivity()).getLastRoomId()).navigation();
|
||||
return;
|
||||
}else {
|
||||
((RoomActivity) getActivity()).performExitRoom(1);
|
||||
|
||||
@@ -658,7 +658,9 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
|
||||
|
||||
Fragment newFragment = null;
|
||||
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// ((RoomActivity) getActivity()).setviewyc(true);
|
||||
// }
|
||||
if ("1".equals(typeId)) {
|
||||
if ("1".equals(labelId)) {
|
||||
singSongFragment = SingSongFragment.newInstance(mRoomInfoResp);
|
||||
|
||||
@@ -34,6 +34,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.blankj.utilcode.util.ActivityUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ObjectUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.activity.RoomActivity;
|
||||
@@ -49,6 +50,7 @@ import com.hjq.toast.ToastUtils;
|
||||
import com.luck.picture.lib.utils.DoubleUtils;
|
||||
import com.xscm.moduleutil.base.BaseRoomFragment;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.PkSwTokenBean;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
@@ -63,6 +65,7 @@ import com.xscm.moduleutil.event.RoomWheatEvent;
|
||||
import com.xscm.moduleutil.event.UserInfoShowEvent;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.rtc.AgoraManagerEx;
|
||||
import com.xscm.moduleutil.utils.GsonUtils;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
@@ -85,6 +88,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -136,6 +140,13 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
// roomId = roomInfoResp == null ? "" : roomInfoResp.getRoom_info().getRoom_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
mBinding.btSta.setOnClickListener(this);
|
||||
mBinding.btStop.setOnClickListener(this);
|
||||
mBinding.imMkf.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SingSongPresenter bindPresenter() {
|
||||
@@ -144,6 +155,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
// Observable.timer(20, TimeUnit.MILLISECONDS)
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(aLong -> {
|
||||
@@ -154,6 +166,8 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
.subscribe(aLong -> {
|
||||
upDtaView(false);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp) {
|
||||
@@ -166,8 +180,16 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
((RoomActivity) getActivity()).setvisibTop(true);
|
||||
}
|
||||
// 初始化 PopupWindow
|
||||
if (roomInfoResp != null) {
|
||||
if (roomInfoResp.getPk_info() != null) {
|
||||
|
||||
upWheter();
|
||||
updateWheatData();
|
||||
} else {
|
||||
isWhether2(isFirst);
|
||||
}
|
||||
}
|
||||
|
||||
isWhether2(isFirst);
|
||||
parentFragment = (RoomFragment) getParentFragment();
|
||||
|
||||
}
|
||||
@@ -184,7 +206,8 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
// roomInfoUpdate(data);
|
||||
// }
|
||||
// });
|
||||
roomId = roomInfoResp.getRoom_info().getRoom_id(); initPopupWindow();
|
||||
roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
initPopupWindow();
|
||||
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
@@ -231,34 +254,39 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
/// 抱麦、锁麦
|
||||
private void initPopupWindow() {
|
||||
// 加载弹出视图布局
|
||||
View popupView = LayoutInflater.from(getContext()).inflate(R.layout.popup_menu, null, false);
|
||||
// 加载弹出视图布局
|
||||
View popupView = LayoutInflater.from(getContext()).inflate(R.layout.popup_menu, null, false);
|
||||
|
||||
// 创建 PopupWindow
|
||||
// popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
||||
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
// 设置固定宽高(单位是像素)
|
||||
int screenWidth = displayMetrics.widthPixels;
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
// 创建 PopupWindow
|
||||
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
// 设置固定宽高(单位是像素)
|
||||
int screenWidth = displayMetrics.widthPixels;
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
int popupWidth = (int) (screenWidth * 0.35); // 屏幕宽度的 60%
|
||||
int popupHeight = (int) (screenHeight * 0.13); // 屏幕高度的 40%
|
||||
int popupWidth = (int) (screenWidth * 0.25); // 屏幕宽度的 60%
|
||||
int popupHeight = (int) (screenHeight * 0.13); // 屏幕高度的 40%
|
||||
|
||||
// 创建 PopupWindow,使用.WRAP_CONTENT实现自适应
|
||||
// popupWindow = new PopupWindow(popupView,
|
||||
// ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
// ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
// true);
|
||||
|
||||
|
||||
popupWindow = new PopupWindow(popupView, popupWidth, popupHeight, true);
|
||||
popupWindow = new PopupWindow(popupView, popupWidth, popupHeight, true);
|
||||
|
||||
// 必须设置背景,否则布局会压缩
|
||||
popupWindow.setBackgroundDrawable(getResources().getDrawable(com.xscm.moduleutil.R.drawable.bg_r16_fff));
|
||||
// 必须设置背景,否则布局会压缩
|
||||
popupWindow.setBackgroundDrawable(getResources().getDrawable(com.xscm.moduleutil.R.drawable.bg_r16_fff));
|
||||
|
||||
// 设置动画效果(可选)
|
||||
popupWindow.setAnimationStyle(com.xscm.moduleutil.R.style.PopupAnimation);
|
||||
// 设置动画效果(可选)
|
||||
popupWindow.setAnimationStyle(com.xscm.moduleutil.R.style.PopupAnimation);
|
||||
|
||||
// 设置点击外部区域时自动关闭
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setFocusable(true);
|
||||
// 设置点击外部区域时自动关闭
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setFocusable(true);
|
||||
|
||||
// 设置弹出视图中的点击事件
|
||||
setPopupMenuClickListener(popupView, null);
|
||||
// 设置弹出视图中的点击事件
|
||||
setPopupMenuClickListener(popupView, null);
|
||||
}
|
||||
|
||||
private void setPopupMenuClickListener(View popupView, View view) {
|
||||
@@ -405,11 +433,6 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
mBinding.cl.setVisibility(View.GONE);
|
||||
|
||||
|
||||
mBinding.btSta.setOnClickListener(this);
|
||||
mBinding.btStop.setOnClickListener(this);
|
||||
mBinding.imMkf.setOnClickListener(this);
|
||||
|
||||
|
||||
FlexboxLayout flexboxLayout = mBinding.flexboxLayout;
|
||||
wheatLayoutSingManager = new WheatLayoutSingManager(CommonAppContext.getInstance(), flexboxLayout);
|
||||
if (!isFirst) {
|
||||
@@ -475,6 +498,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
} else {
|
||||
mBinding.flexboxLayout.setVisibility(View.GONE);
|
||||
mBinding.cl.setVisibility(View.VISIBLE);
|
||||
|
||||
MvpPre.postRoomInfo(roomInfoResp.getPk_info().getPk_room_id(), roomInfoResp.getUser_info().getPit_number() + "", 1);
|
||||
}
|
||||
if (roomInfoResp.getUser_info().getPit_number() != 9) {
|
||||
@@ -730,7 +754,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
updateWheatData();
|
||||
}
|
||||
|
||||
private boolean aBoolean = false;
|
||||
private boolean aBoolean = true;
|
||||
private int is_mute;
|
||||
|
||||
@Override
|
||||
@@ -739,8 +763,15 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
if (id == R.id.bt_sta) {
|
||||
PkTimeDialogFragment.show(roomInfoRespPk.getPk_info().getPk_id(), getChildFragmentManager());
|
||||
} else if (id == R.id.bt_stop) {
|
||||
if (roomInfoRespPk.getPk_info().getPk_part().equals("3") && pkStatus == 0) {
|
||||
pkStutas();
|
||||
//TODO 多次点击导致闪退
|
||||
if (roomInfoRespPk == null)
|
||||
return;
|
||||
if (pkStatus == 0) {
|
||||
if (roomInfoRespPk.getPk_info().getPk_part().equals("4")) {
|
||||
pkStutas();
|
||||
}else {
|
||||
pkStutasT();
|
||||
}
|
||||
} else {
|
||||
MvpPre.endPk(roomInfoRespPk.getPk_info().getPk_id(), "3", SpUtil.getUserId() + "");
|
||||
}
|
||||
@@ -749,28 +780,29 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
mBinding.imMkf.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone);
|
||||
is_mute = 0;
|
||||
aBoolean = false;
|
||||
AgoraManager.getInstance(getActivity()).muteAllRemoteAudioStreamsEx(false);
|
||||
AgoraManagerEx.getInstance(getActivity()).muteAllRemoteAudioStreamsExUserId(false);
|
||||
} else {
|
||||
mBinding.imMkf.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone_off);
|
||||
is_mute = 1;
|
||||
aBoolean = true;
|
||||
AgoraManager.getInstance(getActivity()).muteAllRemoteAudioStreamsEx(true);
|
||||
AgoraManagerEx.getInstance(getActivity()).muteAllRemoteAudioStreamsExUserId(true);
|
||||
}
|
||||
RoomMessageEvent.text text = new RoomMessageEvent.text();
|
||||
text.setIs_mute(is_mute);
|
||||
String s = com.blankj.utilcode.util.GsonUtils.toJson(text);
|
||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
t.setText(s);
|
||||
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(125, roomInfoResp.getPk_info().getPk_room_id(), t);
|
||||
String json = com.blankj.utilcode.util.GsonUtils.toJson(roomMessageEvent);
|
||||
// 转换为 byte[]
|
||||
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
|
||||
// 创建自定义消息
|
||||
MessageListenerSingleton.getInstance().sendCustomC2CMessage(
|
||||
roomInfoRespPk.getRoom_info().getPit_list().get(8).getUser_id(),
|
||||
binaryData
|
||||
);
|
||||
|
||||
if (roomInfoRespPk!=null && roomInfoRespPk.getPk_info() != null) {
|
||||
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(125, roomInfoResp.getRoom_info().getRoom_id(), t);
|
||||
String json = com.blankj.utilcode.util.GsonUtils.toJson(roomMessageEvent);
|
||||
// 转换为 byte[]
|
||||
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
|
||||
// 创建自定义消息
|
||||
MessageListenerSingleton.getInstance().sendCustomC2CMessage(
|
||||
roomInfoRespPk.getRoom_info().getPit_list().get(8).getUser_id(),
|
||||
binaryData
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -829,12 +861,25 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
@Override
|
||||
public void postRoomInfoUp(RoomInfoResp resp) {
|
||||
roomInfoResp = resp;
|
||||
if (roomInfoRespPk != null) {
|
||||
getToView();
|
||||
}
|
||||
tzblChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endPk() {
|
||||
|
||||
//TODO 有多次进入的现象
|
||||
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null)
|
||||
// return;
|
||||
// //释放定时器
|
||||
releaseCountDownTimer();
|
||||
//
|
||||
// AgoraManager.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId());
|
||||
// MvpPre.postRoomInfo(roomId, "0", 2);
|
||||
// mBinding.imStart2.setVisibility(GONE);
|
||||
// mBinding.imStart.setVisibility(GONE);
|
||||
// roomInfoRespPk = null;
|
||||
}
|
||||
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
@@ -860,7 +905,31 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postAgora(PkSwTokenBean pkSwTokenBean) {
|
||||
String pkUserId = "";
|
||||
String pkRoomId="";
|
||||
if (roomInfoRespPk.getPk_info() != null) {
|
||||
if (roomInfoRespPk.getPk_info().getInvite_pk_user_id().equals(SpUtil.getUserId()+"")) {
|
||||
pkUserId = roomInfoRespPk.getPk_info().getReceive_pk_user_id();
|
||||
|
||||
} else {
|
||||
pkUserId = roomInfoRespPk.getPk_info().getInvite_pk_user_id();
|
||||
}
|
||||
}
|
||||
LogUtils.e("pk_info", ""+pkUserId);
|
||||
LogUtils.e("pk_info", ""+roomInfoRespPk.getRoom_info().getRoom_id());
|
||||
LogUtils.e("pk_info2", ""+roomInfoResp.getRoom_info().getRoom_id());
|
||||
|
||||
AgoraManagerEx.getInstance(CommonAppContext.getInstance())
|
||||
.joinChannelEx(pkSwTokenBean.getAgora_token(), roomInfoRespPk.getRoom_info().getRoom_id(), pkUserId);
|
||||
// AgoraManager.getInstance(getView().getSelfActivity()).muteAllRemoteAudioStreamsExUserId(false, invite_pk_user_id);
|
||||
}
|
||||
|
||||
private void pkView() {
|
||||
if (wheatLayoutSingManager != null) {
|
||||
wheatLayoutSingManager.release();
|
||||
}
|
||||
mBinding.flexboxLayout.setVisibility(View.GONE);
|
||||
mBinding.cl.setVisibility(VISIBLE);
|
||||
FlexboxLayout flexboxLayout = mBinding.flexboxLayout1;
|
||||
@@ -868,7 +937,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
wheatLayoutManager1.setOnWheatClickListener(new WheatLayoutManager.OnWheatClickListener() {
|
||||
@Override
|
||||
public void onWheatClick(RoomDefaultWheatView view, int pitNumber1) {
|
||||
RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(pitNumber1 - 1);
|
||||
RoomPitBean pitBean = view.pitBean;
|
||||
// 可选:点击事件处理
|
||||
Log.d("Wheat", "Clicked pit: " + pitNumber1);
|
||||
if (!pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
@@ -901,7 +970,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
@Override
|
||||
public void onMakeWheatClick(RoomDefaultWheatView view, int pitNumber) {
|
||||
RoomPitBean pitBean = roomInfoRespPk.getRoom_info().getPit_list().get(pitNumber - 1);
|
||||
RoomPitBean pitBean = view.pitBean;
|
||||
|
||||
// 可选:点击事件处理
|
||||
Log.d("Wheat", "Clicked pit: " + pitNumber);
|
||||
@@ -938,7 +1007,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
wheatLayoutManager2.setOnWheatClickListener(new WheatLayoutManager.OnWheatClickListener() {
|
||||
@Override
|
||||
public void onWheatClick(RoomDefaultWheatView view, int pitNumber1) {
|
||||
RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(pitNumber1 - 1);
|
||||
RoomPitBean pitBean = view.pitBean;
|
||||
|
||||
// 可选:点击事件处理
|
||||
Log.d("Wheat", "Clicked pit: " + pitNumber1);
|
||||
@@ -971,7 +1040,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
@Override
|
||||
public void onMakeWheatClick(RoomDefaultWheatView view, int pitNumber) {
|
||||
RoomPitBean pitBean = roomInfoRespPk.getRoom_info().getPit_list().get(pitNumber - 1);
|
||||
RoomPitBean pitBean = view.pitBean;
|
||||
|
||||
// 可选:点击事件处理
|
||||
Log.d("Wheat", "Clicked pit: " + pitNumber);
|
||||
@@ -979,7 +1048,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
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());
|
||||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), pitBean.getUser_id(), pitNumber + "", getHostUser(), true, 3, isNumberWhether(), getChildFragmentManager());
|
||||
// 点击的麦位是当前麦位
|
||||
// 可以执行相应的操作,如显示提示信息或执行其他逻辑
|
||||
}
|
||||
@@ -1015,21 +1084,57 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
// 设置进度
|
||||
mBinding.pkProgress.setAnimProgress(progress);
|
||||
if (roomInfoResp.getUser_info().getPit_number() == 9) {
|
||||
mBinding.btStop.setVisibility(View.VISIBLE);
|
||||
|
||||
LogUtils.e("pk_info_1", "getToView: " + roomInfoRespPk.getPk_info());
|
||||
LogUtils.e("pk_info_2", "getToView: " + roomInfoResp.getPk_info());
|
||||
if (roomInfoResp.getPk_info()==null ){
|
||||
MvpPre.postRoomInfo(roomId, roomInfoResp.getUser_info().getPit_number() + "", 3);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Objects.equals(roomInfoRespPk.getUser_info().getUser_id(), roomInfoRespPk.getPk_info().getInvite_pk_user_id())) {
|
||||
mBinding.btStop.setVisibility(VISIBLE);
|
||||
mBinding.btSta.setVisibility(View.VISIBLE);
|
||||
if (roomInfoRespPk.getPk_info().getPk_part().equals("4")) {
|
||||
mBinding.btStop.setVisibility(INVISIBLE);
|
||||
mBinding.btStop.setVisibility(VISIBLE);
|
||||
}
|
||||
if (roomInfoResp.getPk_info() != null) {
|
||||
if (roomInfoResp.getPk_info().getPk_part().equals("3")) {
|
||||
mBinding.btSta.setVisibility(INVISIBLE);
|
||||
}
|
||||
if (roomInfoRespPk.getPk_info().getPk_part().equals("3")) {
|
||||
mBinding.btSta.setVisibility(INVISIBLE);
|
||||
}
|
||||
if (roomInfoRespPk.getPk_info().getPk_part().equals("2")) {
|
||||
mBinding.btSta.setVisibility(VISIBLE);
|
||||
}
|
||||
}else if (roomInfoRespPk.getUser_info().getPit_number() == 9) {
|
||||
mBinding.btStop.setVisibility(VISIBLE);
|
||||
mBinding.btSta.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
mBinding.btStop.setVisibility(VISIBLE);
|
||||
mBinding.btSta.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
|
||||
if (Objects.equals(roomInfoResp.getUser_info().getUser_id(), roomInfoResp.getPk_info().getInvite_pk_user_id()!=null ? roomInfoResp.getPk_info().getInvite_pk_user_id():"0")) {
|
||||
|
||||
mBinding.btStop.setVisibility(VISIBLE);
|
||||
mBinding.btSta.setVisibility(View.VISIBLE);
|
||||
if (roomInfoRespPk.getPk_info().getPk_part().equals("4")) {
|
||||
mBinding.btStop.setVisibility(VISIBLE);
|
||||
}
|
||||
if (roomInfoRespPk.getPk_info().getPk_part().equals("3")) {
|
||||
mBinding.btSta.setVisibility(INVISIBLE);
|
||||
}
|
||||
if (roomInfoRespPk.getPk_info().getPk_part().equals("2")) {
|
||||
mBinding.btSta.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
} else if (roomInfoResp.getUser_info().getPit_number() == 9) {
|
||||
mBinding.btStop.setVisibility(VISIBLE);
|
||||
mBinding.btSta.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
mBinding.btStop.setVisibility(INVISIBLE);
|
||||
mBinding.btSta.setVisibility(INVISIBLE);
|
||||
mBinding.btSta.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
releaseCountDownTimer();
|
||||
|
||||
if (roomInfoRespPk.getPk_info().getPk_part().equals("2")) {
|
||||
// mBinding.tvPkDjs.setText("等待开始");
|
||||
@@ -1048,6 +1153,9 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
} else if (roomInfoRespPk.getPk_info().getPk_part().equals("4")) {
|
||||
countDownTime(Long.parseLong(roomInfoRespPk.getPk_info().getPk_end_times() != null ? roomInfoRespPk.getPk_info().getPk_end_times() : "0"), 2);
|
||||
}
|
||||
|
||||
mBinding.imMkf.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone);
|
||||
|
||||
}
|
||||
|
||||
// 添加一个方法来启动倒计时
|
||||
@@ -1140,194 +1248,14 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
mCountDownTimer.cancel();
|
||||
mCountDownTimer = null;
|
||||
|
||||
mBinding.tvPkDjs.setVisibility(GONE);
|
||||
|
||||
}
|
||||
if (mCountDownTimersta != null) {
|
||||
mCountDownTimersta.cancel();
|
||||
mCountDownTimersta = null;
|
||||
mBinding.tvPkDjs.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onMessageReceived(RoomMessageEvent message) {
|
||||
// boolean b = false;
|
||||
//
|
||||
// if (message.getMsgType() == 1003) {
|
||||
// RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(message.getText().getPit_number()) - 1);
|
||||
// pitBean.setUser_id(message.getText().getFromUserInfo().getUser_id() + "");
|
||||
// pitBean.setAvatar(message.getText().getFromUserInfo().getAvatar());
|
||||
// pitBean.setNickname(message.getText().getFromUserInfo().getNickname());
|
||||
// pitBean.setSex(message.getText().getFromUserInfo().getSex() + "");
|
||||
// pitBean.setCharm(message.getText().getFromUserInfo().getCharm());
|
||||
// pitBean.setDress(message.getText().getFromUserInfo().getDress());
|
||||
// roomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(message.getText().getPit_number()) - 1, pitBean);
|
||||
//// if (roomInfoResp.getPk_info()==null) {
|
||||
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
|
||||
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
|
||||
// } else {
|
||||
// wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
|
||||
// }
|
||||
//// }else {
|
||||
//// wheatLayoutManager.setWheatDataPk(roomInfoResp.getRoom_info().getPit_list(), 1);
|
||||
//// }
|
||||
// // 通知父 Fragment
|
||||
// if (SpUtil.getUserId() == message.getText().getFromUserInfo().getUser_id()) {
|
||||
// b = true;
|
||||
// AgoraManager.getInstance(getActivity()).ClientRole(true);
|
||||
// AgoraManager.getInstance(getActivity()).muteLocalAudioStream(false);
|
||||
// } else {
|
||||
// b = false;
|
||||
// }
|
||||
// if (parentFragment != null) {
|
||||
// parentFragment.updateWheatStatus(pitBean, Integer.parseInt(message.getText().getPit_number()), true, b);
|
||||
// }
|
||||
// } else if (message.getMsgType() == 1004) {
|
||||
// RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(message.getText().getPit_number()) - 1);
|
||||
// pitBean.setUser_id("");
|
||||
// pitBean.setAvatar("");
|
||||
// pitBean.setNickname("");
|
||||
// pitBean.setSex("");
|
||||
// pitBean.setCharm("");
|
||||
// pitBean.setDress("");
|
||||
// roomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(message.getText().getPit_number()) - 1, pitBean);
|
||||
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
|
||||
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
|
||||
// } else {
|
||||
// wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
|
||||
// }
|
||||
// if (SpUtil.getUserId() == message.getText().getFromUserInfo().getUser_id()) {
|
||||
// b = true;
|
||||
// AgoraManager.getInstance(getActivity()).ClientRole(false);
|
||||
// AgoraManager.getInstance(getActivity()).muteLocalAudioStream(true);
|
||||
// } else {
|
||||
// b = false;
|
||||
// }
|
||||
//// AgoraManager.getInstance(getActivity()).setEnableAudio(b);
|
||||
// if (parentFragment != null) {
|
||||
// parentFragment.updateWheatStatus(pitBean, Integer.parseInt(message.getText().getPit_number()), false, b);
|
||||
// }
|
||||
// } else if (message.getMsgType() == 1005) {
|
||||
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
|
||||
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
||||
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
||||
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for (RoomPitBean pitBean : roomInfoRespPk.getRoom_info().getPit_list()) {
|
||||
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
||||
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
||||
// wheatLayoutManager2.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
||||
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
||||
// wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else if (message.getMsgType() == 1030) {
|
||||
// MvpPre.postRoomInfo(message.getRoomId(), roomInfoResp.getUser_info().getPit_number() + "", 3);
|
||||
// if (message.getText().getType() == 1) {
|
||||
// MvpPre.postRoomInfo(message.getText().getRoom_id(), roomInfoResp.getUser_info().getPit_number() + "", 1);
|
||||
// if (message.getText().getRoom_id().equals(roomId)) {
|
||||
// mBinding.btSta.setVisibility(VISIBLE);
|
||||
// } else {
|
||||
// mBinding.btSta.setVisibility(INVISIBLE);
|
||||
// }
|
||||
//// parentFragment.setRoleType(5, -11);
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// ((RoomActivity) getActivity()).setRoleType(5, -11);
|
||||
// }
|
||||
// }
|
||||
// } else if (message.getMsgType() == 1031) {
|
||||
// countDownTime(Long.parseLong(message.getText().getPk_end_times()), 1);
|
||||
// mBinding.btSta.setVisibility(INVISIBLE);
|
||||
// } else if (message.getMsgType() == 1032) {
|
||||
//// PkResultDialogFragment pkResultDialogFragment = new PkResultDialogFragment(requireContext(), message);
|
||||
//// pkResultDialogFragment.show();
|
||||
// showCountDownDialog(requireContext(), message);
|
||||
// ivitTop(message);
|
||||
//// parentFragment.setRoleType(3, -11);
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// ((RoomActivity) getActivity()).setRoleType(3, -11);
|
||||
// }
|
||||
// } else if (message.getMsgType() == 1033) {
|
||||
// AgoraManager.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId());
|
||||
// MvpPre.postRoomInfo(roomId, "0", 2);
|
||||
// mBinding.imStart2.setVisibility(GONE);
|
||||
// mBinding.imStart.setVisibility(GONE);
|
||||
//// parentFragment.setRoleType(3, -11);
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// ((RoomActivity) getActivity()).setRoleType(3, -11);
|
||||
// }
|
||||
// roomInfoRespPk = null;
|
||||
//
|
||||
// } else if (message.getMsgType() == 1015) {
|
||||
// String roomIdA = message.getText().getRoom_id_a();
|
||||
// String roomIdB = message.getText().getRoom_id_b();
|
||||
// String createValueA = message.getText().getCreate_value_a();
|
||||
// String receiveValueB = message.getText().getReceive_value_b();
|
||||
//
|
||||
// if (roomIdA.equals(roomId)) {
|
||||
// // 当前 roomId 与 roomIdA 相同
|
||||
// mBinding.tvPkLeftValue.setText(createValueA);
|
||||
// mBinding.tvPkRightValue.setText(receiveValueB);
|
||||
// mBinding.pkProgress.setAnimProgress(100f * Integer.parseInt(createValueA) / (Integer.parseInt(createValueA) + Integer.parseInt(receiveValueB)));
|
||||
//
|
||||
// } else if (roomIdB.equals(roomId)) {
|
||||
// // 当前 roomId 与 roomIdB 相同
|
||||
// mBinding.tvPkLeftValue.setText(receiveValueB);
|
||||
// mBinding.tvPkRightValue.setText(createValueA);
|
||||
// mBinding.pkProgress.setAnimProgress(100f * Integer.parseInt(receiveValueB) / (Integer.parseInt(createValueA) + Integer.parseInt(receiveValueB)));
|
||||
//
|
||||
// }
|
||||
// } else if (message.getMsgType() == 125) {
|
||||
// RoomMessageEvent.text text = com.blankj.utilcode.util.GsonUtils.fromJson(message.getText().getText(), RoomMessageEvent.text.class);
|
||||
// if (text.getIs_mute() == 1) {
|
||||
// AgoraManager.getInstance(getContext()).ClientRole(false);
|
||||
// AgoraManager.getInstance(getContext()).muteLocalAudioStreamEx(false, SpUtil.getUserId());
|
||||
// } else {
|
||||
// AgoraManager.getInstance(getContext()).ClientRole(true);
|
||||
// AgoraManager.getInstance(getContext()).muteLocalAudioStreamEx(true, SpUtil.getUserId());
|
||||
//
|
||||
// }
|
||||
// } else if (message.getMsgType() == 1007) {
|
||||
// roomInfoResp.getUser_info().setIs_host(1);
|
||||
// } else if (message.getMsgType() == 1018) {
|
||||
// roomInfoResp.getUser_info().setIs_host(0);
|
||||
// } else if (message.getMsgType() == 126) {
|
||||
// AgoraManager.getInstance(getContext()).setLocalAudioEnabled(false, message.getText().getFromUserInfo().getUser_id() + "");
|
||||
// } else if (message.getMsgType() == 1021) {
|
||||
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
// pitBean.setCharm("0");
|
||||
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
// }
|
||||
// } else if (message.getMsgType() == 1037) {
|
||||
|
||||
/// / 对方想结束本次pk,是否同意
|
||||
// if (message.getText().getPit_number().equals("9") && message.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||||
// queren();
|
||||
// }
|
||||
// } else if (message.getMsgType() == 1035) {
|
||||
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
// if (pitBean.getUser_id().equals(message.getText().getFromUserInfo().getUser_id() + "")) {
|
||||
// pitBean.setCharm(message.getText().getFromUserInfo().getCharm());
|
||||
// pitBean.setAvatar(message.getText().getFromUserInfo().getAvatar());
|
||||
// pitBean.setNickname(message.getText().getFromUserInfo().getNickname());
|
||||
// pitBean.setSex(message.getText().getFromUserInfo().getSex() + "");
|
||||
// pitBean.setDress(message.getText().getFromUserInfo().getDress());
|
||||
// wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
public void event1021(RoomMessageEvent message) {
|
||||
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
pitBean.setCharm("0");
|
||||
@@ -1356,7 +1284,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
}
|
||||
wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
} else {
|
||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1377,7 +1305,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number() != null ? roomPitBean.getPit_number() : "0"));
|
||||
}
|
||||
} else {
|
||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1389,9 +1317,15 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
wheatLayoutSingManager.setUpData(message);
|
||||
} else {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
wheatLayoutManager1.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
|
||||
if (message.getText().getIs_pk() == null) {
|
||||
wheatLayoutManager1.setUpData(message, 1);
|
||||
} else {
|
||||
wheatLayoutManager2.setUpData(message, 2);
|
||||
|
||||
}
|
||||
// for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
// wheatLayoutManager1.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1420,7 +1354,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
// ((RoomActivity) getActivity()).ivSoundEffects(true);
|
||||
// }
|
||||
// }
|
||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
|
||||
if (message.getText().getIs_pk() == null) {
|
||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()), 1);
|
||||
} else {
|
||||
wheatLayoutManager2.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()), 2);
|
||||
}
|
||||
}
|
||||
// 通知父 Fragment
|
||||
if (SpUtil.getUserId() == message.getText().getFromUserInfo().getUser_id()) {
|
||||
@@ -1459,7 +1397,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
// ((RoomActivity) getActivity()).ivSoundEffects(false);
|
||||
// }
|
||||
// }
|
||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()));
|
||||
if (message.getText().getIs_pk() == null) {
|
||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()), 1);
|
||||
} else {
|
||||
wheatLayoutManager2.updateSingleWheat(pitBean, Integer.parseInt(message.getText().getPit_number()), 2);
|
||||
}
|
||||
}
|
||||
if (SpUtil.getUserId() == message.getText().getFromUserInfo().getUser_id()) {
|
||||
b = true;
|
||||
@@ -1488,28 +1430,6 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
updateCharmForUser(toUserInfo);
|
||||
}
|
||||
}
|
||||
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
|
||||
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
||||
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
||||
// wheatLayoutSingManager.upDataCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for (RoomPitBean pitBean : roomInfoRespPk.getRoom_info().getPit_list()) {
|
||||
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
||||
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
||||
// wheatLayoutManager2.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
// if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
|
||||
// pitBean.setCharm(message.getText().getToUserInfo().getCharm());
|
||||
// wheatLayoutManager1.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1536,7 +1456,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
for (RoomPitBean pitBean : roomInfoRespPk.getRoom_info().getPit_list()) {
|
||||
if (pitBean.getUser_id().equals(userId)) {
|
||||
pitBean.setCharm(charm);
|
||||
wheatLayoutManager2.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
wheatLayoutManager2.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()), 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1545,7 +1465,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
if (pitBean.getUser_id().equals(userId)) {
|
||||
pitBean.setCharm(charm);
|
||||
wheatLayoutManager1.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
wheatLayoutManager1.updateSingleCharm(pitBean, Integer.parseInt(pitBean.getPit_number()), 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1554,14 +1474,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
/// 1030
|
||||
public void event1030(RoomMessageEvent message) {
|
||||
MvpPre.postRoomInfo(message.getRoomId(), roomInfoResp.getUser_info().getPit_number() + "", 3);
|
||||
|
||||
MvpPre.postRoomInfo(message.getRoomId(), roomInfoResp.getUser_info().getPit_number() + "", 3);
|
||||
if (message.getText().getType() == 1) {
|
||||
MvpPre.postRoomInfo(message.getText().getRoom_id(), roomInfoResp.getUser_info().getPit_number() + "", 1);
|
||||
if (message.getText().getRoom_id().equals(roomId)) {
|
||||
mBinding.btSta.setVisibility(VISIBLE);
|
||||
} else {
|
||||
mBinding.btSta.setVisibility(INVISIBLE);
|
||||
}
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setRoleType(5, -11);
|
||||
}
|
||||
@@ -1582,7 +1498,14 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
/// 1033
|
||||
public void event1033(RoomMessageEvent message) {
|
||||
AgoraManager.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId());
|
||||
//TODO 有多次进入的现象
|
||||
if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null)
|
||||
return;
|
||||
//释放定时器
|
||||
releaseCountDownTimer();
|
||||
if (roomInfoRespPk.getRoom_info() != null && roomInfoRespPk.getRoom_info().getRoom_id() != null) {
|
||||
AgoraManagerEx.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId());
|
||||
}
|
||||
MvpPre.postRoomInfo(roomId, "0", 2);
|
||||
mBinding.imStart2.setVisibility(GONE);
|
||||
mBinding.imStart.setVisibility(GONE);
|
||||
@@ -1591,7 +1514,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
/// 1037
|
||||
public void event1037(RoomMessageEvent message) {
|
||||
if (message.getText().getPit_number().equals("9") && message.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||||
if (roomInfoResp.getUser_info().getPit_number() == 9 && roomInfoRespPk.getPk_info().getInvite_pk_user_id().equals(message.getText().getFromUserInfo().getUser_id()+"")) {
|
||||
queren();
|
||||
}
|
||||
}
|
||||
@@ -1667,6 +1590,22 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
}, false, 0).show();
|
||||
}
|
||||
|
||||
private void pkStutasT() {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(getActivity(),
|
||||
"提示",
|
||||
"是否提前结束本场PK?",
|
||||
"确认",
|
||||
"取消",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
MvpPre.endPk(roomInfoRespPk.getPk_info().getPk_id(), "3", SpUtil.getUserId() + "");
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
}, false, 0).show();
|
||||
}
|
||||
|
||||
private int pkStatus;
|
||||
|
||||
private void ivitTop(RoomMessageEvent message) {
|
||||
@@ -1686,6 +1625,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
mBinding.imStart.setImageResource(com.xscm.moduleutil.R.mipmap.ping);
|
||||
mBinding.imStart2.setImageResource(com.xscm.moduleutil.R.mipmap.ping);
|
||||
}
|
||||
roomInfoRespPk.getPk_info().setPk_part("4");
|
||||
countDownTime(Long.parseLong(message.getText().getEnd_time()), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.example.moduleroom.contacts.SingSongContacts;
|
||||
import com.xscm.moduleutil.base.BaseRoomPresenter;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
@@ -11,6 +12,7 @@ import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.rtc.AgoraManagerEx;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -93,8 +95,9 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||
String token = roomInfoResp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||
if (roomInfoResp==null){
|
||||
return;
|
||||
}
|
||||
String roomId = roomInfoResp.getRoom_info().getRoom_id(); // 房间 ID
|
||||
String rtm_token = roomInfoResp.getUser_info().getAgora_rtm_token();
|
||||
SpUtil.setRtmToken(rtm_token);
|
||||
@@ -103,16 +106,18 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
if (type==1) {
|
||||
if (roomInfoResp.getPk_info() != null) {
|
||||
if (number.equals("9")) {
|
||||
postRoomSwToken(roomId,uid);
|
||||
LogUtils.e("pk_info", ""+number);
|
||||
postRoomSwToken(roomId,uid,roomInfoResp.getPk_info().getInvite_pk_user_id());
|
||||
///添加多频道
|
||||
}
|
||||
}
|
||||
MvpRef.get().postRoomInfoPk(roomInfoResp);
|
||||
// postRoomInfo(SpUtil.getMyRoomId(),"9",3);
|
||||
}else if (type==3){
|
||||
AgoraManager.getInstance(getView().getSelfActivity()).leaveChannelEx(roomInfoResp.getRoom_info().getLast_pk_room_id()+"", uid);
|
||||
// AgoraManagerEx.getInstance(getView().getSelfActivity()).leaveChannelEx(roomInfoResp.getRoom_info().getLast_pk_room_id()+"", uid);
|
||||
MvpRef.get().postRoomInfoUp(roomInfoResp);
|
||||
}else {
|
||||
AgoraManager.getInstance(getView().getSelfActivity()).leaveChannelEx(roomInfoResp.getRoom_info().getLast_pk_room_id()+"", uid);
|
||||
// AgoraManagerEx.getInstance(getView().getSelfActivity()).leaveChannelEx(roomInfoResp.getRoom_info().getLast_pk_room_id()+"", uid);
|
||||
MvpRef.get().postRoomInfo(roomInfoResp);
|
||||
}
|
||||
|
||||
@@ -156,7 +161,7 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
});
|
||||
}
|
||||
|
||||
public void postRoomSwToken(String roomId,int uid) {
|
||||
public void postRoomSwToken(String roomId,int uid,String invite_pk_user_id) {
|
||||
RetrofitClient.getInstance().postRoomSwToken(roomId, new BaseObserver<PkSwTokenBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
@@ -167,8 +172,14 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
||||
public void onNext(PkSwTokenBean pkSwTokenBean) {
|
||||
if (pkSwTokenBean!=null){
|
||||
if (pkSwTokenBean.getAgora_token() != null){
|
||||
AgoraManager.getInstance(getView().getSelfActivity())
|
||||
.joinChannelEx(pkSwTokenBean.getAgora_token(), roomId, uid);
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().postAgora(pkSwTokenBean);
|
||||
|
||||
// AgoraManager.getInstance(getView().getSelfActivity())
|
||||
// .joinChannelEx(pkSwTokenBean.getAgora_token(), roomId, uid);
|
||||
// AgoraManager.getInstance(getView().getSelfActivity()).muteAllRemoteAudioStreamsExUserId(false, invite_pk_user_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".fragment.RoomKtvFragment">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".fragment.RoomKtvFragment">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_277"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_13"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:clipChildren="false">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_277"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_13"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:clipChildren="false">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_bj"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_r8_tm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1.4:1.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:id="@+id/cl_bj"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_r8_tm"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1.4:1.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/music_poster"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0.3"
|
||||
android:background="#4d000000"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:id="@+id/music_poster"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0.3"
|
||||
android:background="#4d000000"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<!-- <View-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
@@ -50,259 +50,259 @@
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_jz"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_70"
|
||||
android:text="正在加载..."
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_u_b"
|
||||
android:id="@+id/tv_jz"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_70"
|
||||
android:text="正在加载..."
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_u_b"
|
||||
|
||||
/>
|
||||
/>
|
||||
|
||||
<io.agora.karaoke_view.v11.LyricsView
|
||||
android:id="@+id/lyrics_view"
|
||||
android:layout_width="@dimen/dp_184"
|
||||
android:layout_height="@dimen/dp_130"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:visibility="gone"
|
||||
app:currentLineTextColor="@color/white"
|
||||
app:currentLineTextSize="@dimen/sp_14"
|
||||
app:labelWhenNoLyrics="暂无歌词"
|
||||
app:layout_constraintBottom_toTopOf="@+id/mu_x_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_u_b"
|
||||
app:lineSpacing="8dp"
|
||||
app:startOfVerseIndicatorPaddingTop="6dp"
|
||||
app:startOfVerseIndicatorRadius="4dp"
|
||||
app:textSize="@dimen/sp_12" />
|
||||
android:id="@+id/lyrics_view"
|
||||
android:layout_width="@dimen/dp_184"
|
||||
android:layout_height="@dimen/dp_130"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:visibility="gone"
|
||||
app:currentLineTextColor="@color/white"
|
||||
app:currentLineTextSize="@dimen/sp_14"
|
||||
app:labelWhenNoLyrics="暂无歌词"
|
||||
app:layout_constraintBottom_toTopOf="@+id/mu_x_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_u_b"
|
||||
app:lineSpacing="8dp"
|
||||
app:startOfVerseIndicatorPaddingTop="6dp"
|
||||
app:startOfVerseIndicatorRadius="4dp"
|
||||
app:textSize="@dimen/sp_12"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mu_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:text="当前播放歌曲:"
|
||||
android:textColor="@color/color_FFFFF0F0"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:id="@+id/mu_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:text="当前播放歌曲:"
|
||||
android:textColor="@color/color_FFFFF0F0"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mu_name"
|
||||
android:layout_width="@dimen/dp_70"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_72"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/color_FFFFF0F0"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintStart_toEndOf="@+id/mu_title"
|
||||
app:layout_constraintTop_toTopOf="@+id/mu_title"
|
||||
tools:text="歌曲名称" />
|
||||
android:id="@+id/mu_name"
|
||||
android:layout_width="@dimen/dp_70"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_72"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/color_FFFFF0F0"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintStart_toEndOf="@+id/mu_title"
|
||||
app:layout_constraintTop_toTopOf="@+id/mu_title"
|
||||
tools:text="歌曲名称"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/ll_u_b"
|
||||
android:layout_width="@dimen/dp_55"
|
||||
android:layout_height="@dimen/dp_55"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_80"
|
||||
android:background="@mipmap/muis_bj"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mu_title">
|
||||
android:id="@+id/ll_u_b"
|
||||
android:layout_width="@dimen/dp_55"
|
||||
android:layout_height="@dimen/dp_55"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginEnd="@dimen/dp_80"
|
||||
android:background="@mipmap/muis_bj"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mu_title">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/mu_bj"
|
||||
android:layout_width="@dimen/dp_25"
|
||||
android:layout_height="@dimen/dp_25"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/default_avatar"
|
||||
app:riv_oval="true" />
|
||||
android:id="@+id/mu_bj"
|
||||
android:layout_width="@dimen/dp_25"
|
||||
android:layout_height="@dimen/dp_25"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/default_avatar"
|
||||
app:riv_oval="true"/>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mu_x_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
android:text="下一首:"
|
||||
android:textColor="@color/color_FFFFF0F0"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
android:id="@+id/mu_x_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
android:text="下一首:"
|
||||
android:textColor="@color/color_FFFFF0F0"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mu_x_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:ellipsize="none"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/color_FFFFF0F0"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintStart_toEndOf="@+id/mu_x_title"
|
||||
app:layout_constraintTop_toTopOf="@+id/mu_x_title"
|
||||
tools:text="歌曲名称" />
|
||||
android:id="@+id/mu_x_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:ellipsize="none"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/color_FFFFF0F0"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintStart_toEndOf="@+id/mu_x_title"
|
||||
app:layout_constraintTop_toTopOf="@+id/mu_x_title"
|
||||
tools:text="歌曲名称"/>
|
||||
|
||||
<com.xscm.moduleutil.widget.RoomKtvWheatView
|
||||
android:id="@+id/mu_yc"
|
||||
android:layout_width="@dimen/dp_62"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:room_wheat_number="-1" />
|
||||
android:id="@+id/mu_yc"
|
||||
android:layout_width="@dimen/dp_62"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:room_wheat_number="-1"/>
|
||||
|
||||
<com.google.android.flexbox.FlexboxLayout
|
||||
android:id="@+id/fl_pit_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:flexDirection="column"
|
||||
app:flexWrap="nowrap"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="@+id/mu_yc"
|
||||
app:layout_constraintTop_toBottomOf="@id/mu_yc">
|
||||
android:id="@+id/fl_pit_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:flexDirection="column"
|
||||
app:flexWrap="nowrap"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="@+id/mu_yc"
|
||||
app:layout_constraintTop_toBottomOf="@id/mu_yc">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_bz"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/ll_bz"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_bz"
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/accompany_on" />
|
||||
android:id="@+id/im_bz"
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/accompany_on"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_bz"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="原唱"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:id="@+id/tv_bz"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="原唱"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_ds"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/ll_ds"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/muisc_reward" />
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/muisc_reward"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="打赏"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="打赏"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_qg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/ll_qg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/muisc_switch" />
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/muisc_switch"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="切歌"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="切歌"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_js"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/ll_js"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/muisc_end" />
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/muisc_end"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="结束"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="结束"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_sz"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
android:id="@+id/ll_sz"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/muisc_set_up" />
|
||||
android:layout_width="@dimen/dp_13"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/muisc_set_up"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="设置"
|
||||
android:textColor="@color/color_0DFFB9"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="设置"
|
||||
android:textColor="@color/color_0DFFB9"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
@@ -311,21 +311,22 @@
|
||||
|
||||
|
||||
<com.xscm.moduleutil.widget.RoomKtvWheatView
|
||||
android:id="@+id/mu_zc"
|
||||
android:layout_width="@dimen/dp_62"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginTop="-55dp"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:clickable="true"
|
||||
android:elevation="9999dp"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:translationZ="30dp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_bj"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:room_wheat_number="9" />
|
||||
android:id="@+id/mu_zc"
|
||||
android:layout_width="@dimen/dp_62"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginTop="-25dp"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:clickable="true"
|
||||
android:elevation="9999dp"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:translationZ="30dp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_bj"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:room_wheat_number="9"
|
||||
/>
|
||||
<!-- 在 mu_zc 视图后面添加 -->
|
||||
<!-- <View-->
|
||||
<!-- android:id="@+id/mu_zc_touch_overlay"-->
|
||||
@@ -342,25 +343,29 @@
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/cl_bj" />-->
|
||||
|
||||
<com.xscm.moduleutil.widget.RoomKtvWheatView
|
||||
android:id="@+id/mu_jb"
|
||||
android:layout_width="@dimen/dp_62"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_bj"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mu_zc"
|
||||
app:room_wheat_number="10" />
|
||||
android:id="@+id/mu_jb"
|
||||
android:layout_width="@dimen/dp_62"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_bj"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mu_zc"
|
||||
app:room_wheat_number="10"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="@dimen/dp_62"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_default="wrap"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_bj"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mu_jb" />
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="@dimen/dp_58"
|
||||
android:layout_height="0dp"
|
||||
android:paddingEnd="@dimen/dp_5"
|
||||
android:layout_marginBottom="-100dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_bj"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mu_jb"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bt_stop"
|
||||
android:text="未开始:04:25"
|
||||
tools:text="未开始:04:25"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/white"
|
||||
android:background="@mipmap/pk_djs"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
android:id="@+id/mu_rank"
|
||||
android:layout_width="@dimen/dp_62"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
app:layout_constraintDimensionRatio="1:1.2"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?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_width="@dimen/dp_152"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
@@ -256,6 +256,21 @@
|
||||
android:visibility="invisible"/>
|
||||
</LinearLayout>
|
||||
|
||||
<com.xscm.moduleutil.widget.RoomKtvWheatView
|
||||
android:id="@+id/mu_zc"
|
||||
android:layout_width="@dimen/dp_62"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_35"
|
||||
android:clickable="true"
|
||||
android:elevation="9999dp"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:translationZ="30dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
app:room_wheat_number="9"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/cl_xsb"-->
|
||||
|
||||
@@ -254,7 +254,7 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
||||
|
||||
@Override
|
||||
public void checkTxtSuccess(String result) {
|
||||
ARouter.getInstance().build(ARouteConstants.MY_ROOM).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.MY_ROOM).withFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).navigation();
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
||||
|
||||
@Override
|
||||
public void editRoom() {
|
||||
ARouter.getInstance().build(ARouteConstants.MY_ROOM).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.MY_ROOM).withFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).navigation();
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.example.modulevocal.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.util.SparseArray;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@@ -15,6 +18,7 @@ import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.ActivityUtils;
|
||||
import com.example.modulevocal.R;
|
||||
import com.example.modulevocal.conacts.MyRoomListContacts;
|
||||
import com.example.modulevocal.databinding.RoomActivityMyRoomBinding;
|
||||
@@ -58,6 +62,22 @@ public class MyRoomActivity extends BaseMvpActivity<MyRoomPresenter, RoomActivit
|
||||
return new MyRoomPresenter(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// 添加返回键拦截处理
|
||||
if (getOnBackPressedDispatcher() != null) {
|
||||
getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
|
||||
@Override
|
||||
public void handleOnBackPressed() {
|
||||
// 拦截返回键,导航到个人中心页面而不是直接退出
|
||||
ARouter.getInstance().build(ARouteConstants.ME).withFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).navigation();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
mBinding.viewPager.setAdapter(new MyFragmentAdapter(getSupportFragmentManager()));
|
||||
@@ -194,6 +214,15 @@ public class MyRoomActivity extends BaseMvpActivity<MyRoomPresenter, RoomActivit
|
||||
isShowLoading(true);
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), CommonAppContext.getInstance().playId, "",null);
|
||||
});
|
||||
|
||||
mBinding.topBar.getIvBack().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ARouter.getInstance().build(ARouteConstants.ME).withFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).navigation();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.ivGuanbi.setOnClickListener(v -> {
|
||||
mBinding.ll.setVisibility(View.INVISIBLE);
|
||||
CommonAppContext.getInstance().isShow = false;
|
||||
@@ -203,6 +232,17 @@ public class MyRoomActivity extends BaseMvpActivity<MyRoomPresenter, RoomActivit
|
||||
initListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
// 拦截返回键,显示退出对话框而不是直接退出
|
||||
ARouter.getInstance().build(ARouteConstants.ME).withFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).navigation();
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void isShowLoading(boolean b) {
|
||||
if (b) {
|
||||
mBinding.coolWaitView.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.example.modulevoice.fragment;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
@@ -46,13 +45,8 @@ import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.stx.xhb.xbanner.XBanner;
|
||||
import com.xscm.moduleutil.utils.logger.DataLogger;
|
||||
import com.zhpan.bannerview.constants.PageStyle;
|
||||
import com.zhpan.bannerview.utils.BannerUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Logger;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -75,9 +69,10 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
|
||||
CarouselBannerAdapter carouselBannerAdapter;
|
||||
|
||||
private VoiceFragment voiceFragment;
|
||||
|
||||
private VoiceCategoryFragment (){}
|
||||
|
||||
// 添加无参构造函数(必须是 public)
|
||||
public VoiceCategoryFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
private VoiceCategoryFragment (VoiceFragment voiceFragment){
|
||||
this.voiceFragment = voiceFragment;
|
||||
@@ -215,7 +210,7 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
|
||||
});
|
||||
|
||||
mBinding.myHome.setOnClickListener(v -> {
|
||||
ARouter.getInstance().build(ARouteConstants.MY_ROOM).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.MY_ROOM).withFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).navigation();
|
||||
});
|
||||
|
||||
mBinding.homeGg.setOnClickListener(v -> {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class VoiceFragment extends BaseMvpFragment<VoicePresenter, FragmentVoice
|
||||
|
||||
mBinding.ivRoom.setOnClickListener(v -> {
|
||||
//我的房间
|
||||
ARouter.getInstance().build(ARouteConstants.MY_ROOM).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.MY_ROOM).withFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).navigation();
|
||||
});
|
||||
|
||||
// mBinding.ivRoom2.setOnClickListener(v -> {
|
||||
|
||||
Reference in New Issue
Block a user