77 加入房间前判断上一个房间是否游戏中,日志上传后删除之前的日志数据。
This commit is contained in:
@@ -133,6 +133,8 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
|||||||
@Getter
|
@Getter
|
||||||
public UnreadCountEvent unreadCountEvent;
|
public UnreadCountEvent unreadCountEvent;
|
||||||
|
|
||||||
|
public static int statusRelease = 11;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
@@ -161,7 +163,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
|||||||
//设置mqtt环境 false 测试环境 true 正式环境
|
//设置mqtt环境 false 测试环境 true 正式环境
|
||||||
// ExternalResConstants.INSTANCE.setIS_MQTT_RELEASE(false);
|
// ExternalResConstants.INSTANCE.setIS_MQTT_RELEASE(false);
|
||||||
//设置http环境 false 测试环境 true 正式环境
|
//设置http环境 false 测试环境 true 正式环境
|
||||||
ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(true);
|
ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(statusRelease == 1);
|
||||||
currentEnvironment = ExternalResConstants.INSTANCE.HTTP_PATH();
|
currentEnvironment = ExternalResConstants.INSTANCE.HTTP_PATH();
|
||||||
|
|
||||||
initialization();
|
initialization();
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.xscm.moduleutil.bean
|
||||||
|
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
class BeforeJoinRoomCheckBean :Serializable {
|
||||||
|
var room_id:String? = null
|
||||||
|
var msg:String? = null
|
||||||
|
}
|
||||||
@@ -498,6 +498,9 @@ public interface ApiServer {
|
|||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST(Constants.JOIN_ROOM)
|
@POST(Constants.JOIN_ROOM)
|
||||||
Call<BaseModel<RoomInfoResp>> roomGetIn(@Field("room_id") String roomId, @Field("password") String password);
|
Call<BaseModel<RoomInfoResp>> roomGetIn(@Field("room_id") String roomId, @Field("password") String password);
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST(Constants.BEFORE_JOIN_ROOM_CHECK)
|
||||||
|
Call<BaseModel<BeforeJoinRoomCheckBean>> beforeJoinRoomCheck(@Field("room_id") String roomId);
|
||||||
|
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST(Constants.TASK_JUMP_ROOM)
|
@POST(Constants.TASK_JUMP_ROOM)
|
||||||
|
|||||||
@@ -2322,6 +2322,29 @@ public class RetrofitClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void beforeJoinRoomCheck(String roomId, BaseObserver<BeforeJoinRoomCheckBean> observer) {
|
||||||
|
sApiServer.beforeJoinRoomCheck(roomId).enqueue(new Callback<BaseModel<BeforeJoinRoomCheckBean>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<BaseModel<BeforeJoinRoomCheckBean>> call, Response<BaseModel<BeforeJoinRoomCheckBean>> response) {
|
||||||
|
if (response.code() == 200) {
|
||||||
|
BaseModel<BeforeJoinRoomCheckBean> beforeJoinRoomCheckBeanBaseModel = response.body();
|
||||||
|
if (beforeJoinRoomCheckBeanBaseModel.getCode() == 202) {
|
||||||
|
observer.onNext(beforeJoinRoomCheckBeanBaseModel.getData());
|
||||||
|
}else {
|
||||||
|
observer.onNext(new BeforeJoinRoomCheckBean());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<BaseModel<BeforeJoinRoomCheckBean>> call, Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void taskJumpRoomId(String taskId, BaseObserver<String> observer) {
|
public void taskJumpRoomId(String taskId, BaseObserver<String> observer) {
|
||||||
sApiServer.taskJumpRoomId(taskId).enqueue(new Callback<BaseModel<String>>() {
|
sApiServer.taskJumpRoomId(taskId).enqueue(new Callback<BaseModel<String>>() {
|
||||||
|
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ public class Constants {
|
|||||||
public static final String GET_DECORATE = "/api/Decorate/user_decorate";//装扮详情
|
public static final String GET_DECORATE = "/api/Decorate/user_decorate";//装扮详情
|
||||||
public static final String SET_USER_DECORATE = "/api/Decorate/set_user_decorate";//用户装扮
|
public static final String SET_USER_DECORATE = "/api/Decorate/set_user_decorate";//用户装扮
|
||||||
public static final String JOIN_ROOM = "/api/Room/join_room";//加入房间
|
public static final String JOIN_ROOM = "/api/Room/join_room";//加入房间
|
||||||
|
public static final String BEFORE_JOIN_ROOM_CHECK = "/api/Room/before_join_room_check";//加入房间前检查
|
||||||
public static final String TASK_JUMP_ROOM = "/api/Room/task_jump_room";//师徒任务 加入房间
|
public static final String TASK_JUMP_ROOM = "/api/Room/task_jump_room";//师徒任务 加入房间
|
||||||
|
|
||||||
public static final String UPDATEPASSWORD = "/api/room/setRoomPassword";//更新房间秘密啊
|
public static final String UPDATEPASSWORD = "/api/room/setRoomPassword";//更新房间秘密啊
|
||||||
|
|||||||
@@ -288,5 +288,12 @@ open class Application : CommonAppContext() {
|
|||||||
return APP_CONTENT
|
return APP_CONTENT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getAppLogPath(): String {
|
||||||
|
return LOGUTILS_SAVE_PATH
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getAppCrashPath(): String {
|
||||||
|
return CRASHUTILS_SAVE_PATH
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -111,12 +111,11 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefPitchUpdate(float refPitch, int numberOfRefPitches) {
|
public void onRefPitchUpdate(float refPitch, int numberOfRefPitches) {
|
||||||
mKaraokeView.setPitch(refPitch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLineFinished(KaraokeView view, LyricsLineModel line, int score, int cumulativeScore, int index, int numberOfLines) {
|
public void onLineFinished(KaraokeView view, LyricsLineModel line, int score, int cumulativeScore, int index, int numberOfLines) {
|
||||||
LogUtils.e("onLineFinished :" + score + " " + cumulativeScore + " " + index + " " + numberOfLines);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.blankj.utilcode.util.ActivityUtils;
|
|||||||
import com.blankj.utilcode.util.LogUtils;
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
import com.xscm.modulemain.activity.room.contacts.RoomContacts;
|
import com.xscm.modulemain.activity.room.contacts.RoomContacts;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.bean.BeforeJoinRoomCheckBean;
|
||||||
import com.xscm.moduleutil.bean.RedPacketInfo;
|
import com.xscm.moduleutil.bean.RedPacketInfo;
|
||||||
import com.xscm.moduleutil.bean.RoomCharmRankBean;
|
import com.xscm.moduleutil.bean.RoomCharmRankBean;
|
||||||
import com.xscm.moduleutil.bean.TasksMessage;
|
import com.xscm.moduleutil.bean.TasksMessage;
|
||||||
@@ -40,7 +41,24 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
|||||||
// TODO: 2025/6/10 加入房间
|
// TODO: 2025/6/10 加入房间
|
||||||
@Override
|
@Override
|
||||||
public void getRoomIn(String roomId, String password) {
|
public void getRoomIn(String roomId, String password) {
|
||||||
|
RetrofitClient.getInstance().beforeJoinRoomCheck(roomId, new BaseObserver<BeforeJoinRoomCheckBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(BeforeJoinRoomCheckBean beforeJoinRoomCheckBean) {
|
||||||
|
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||||
|
joinRoom(roomId, password);
|
||||||
|
}else {
|
||||||
|
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void joinRoom(String roomId, String password){
|
||||||
api.roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
|
api.roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
|
|||||||
@@ -109,6 +109,14 @@ public class SettingPresenter extends BasePresenter<SettingConacts.View> impleme
|
|||||||
boolean isZip = ZipUtils.zipFile(Application.Companion.getInstance().getAppContent(),
|
boolean isZip = ZipUtils.zipFile(Application.Companion.getInstance().getAppContent(),
|
||||||
file.getParent() + "/DataInfo.zip");
|
file.getParent() + "/DataInfo.zip");
|
||||||
if (isZip) {
|
if (isZip) {
|
||||||
|
File fileLog = new File(Application.Companion.getInstance().getAppLogPath());
|
||||||
|
File fileCrash = new File(Application.Companion.getInstance().getAppCrashPath());
|
||||||
|
if (FileUtils.isFileExists(fileLog)) {
|
||||||
|
FileUtils.delete(fileLog);
|
||||||
|
}
|
||||||
|
if (FileUtils.isFileExists(fileCrash)) {
|
||||||
|
FileUtils.delete(fileCrash);
|
||||||
|
}
|
||||||
emitter.onNext(file.getParent() + "/DataInfo.zip");
|
emitter.onNext(file.getParent() + "/DataInfo.zip");
|
||||||
} else {
|
} else {
|
||||||
emitter.onNext("");
|
emitter.onNext("");
|
||||||
@@ -144,6 +152,9 @@ public class SettingPresenter extends BasePresenter<SettingConacts.View> impleme
|
|||||||
public void onNext(String s) {
|
public void onNext(String s) {
|
||||||
MvpRef.get().disLoadings();
|
MvpRef.get().disLoadings();
|
||||||
ToastUtils.showShort(s);
|
ToastUtils.showShort(s);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.xscm.modulemain.activity.room.activity.RoomActivity;
|
|||||||
import com.xscm.modulemain.activity.user.activity.DailyTasksActivity;
|
import com.xscm.modulemain.activity.user.activity.DailyTasksActivity;
|
||||||
import com.xscm.modulemain.activity.user.activity.MyRoomActivity;
|
import com.xscm.modulemain.activity.user.activity.MyRoomActivity;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.bean.BeforeJoinRoomCheckBean;
|
||||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||||
import com.xscm.moduleutil.bean.room.RoomOnline;
|
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||||
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
||||||
@@ -77,17 +78,27 @@ public class RoomManager {
|
|||||||
* @param password 房间密码
|
* @param password 房间密码
|
||||||
*/
|
*/
|
||||||
public void fetchRoomDataAndEnter(Context context, String roomId, String password, String taskId) {
|
public void fetchRoomDataAndEnter(Context context, String roomId, String password, String taskId) {
|
||||||
|
RetrofitClient.getInstance().beforeJoinRoomCheck(roomId, new BaseObserver<BeforeJoinRoomCheckBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(BeforeJoinRoomCheckBean beforeJoinRoomCheckBean) {
|
||||||
|
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||||
|
joinRoom(context, roomId, password, taskId);
|
||||||
|
}else {
|
||||||
|
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void joinRoom(Context context, String roomId, String password, String taskId) {
|
||||||
this.taskId=taskId;
|
this.taskId=taskId;
|
||||||
this.context=context;
|
this.context=context;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 显示加载提示
|
|
||||||
// 这里可以根据需要添加加载对话框
|
|
||||||
// if (CommonAppContext.getInstance().isRoomJoininj) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// CommonAppContext.getInstance().isRoomJoininj = true;
|
|
||||||
// 检查是否有有效的缓存数据
|
// 检查是否有有效的缓存数据
|
||||||
RoomInfoResp roomInfo = getCachedRoomData(roomId);
|
RoomInfoResp roomInfo = getCachedRoomData(roomId);
|
||||||
//加入房间
|
//加入房间
|
||||||
@@ -116,6 +127,7 @@ public class RoomManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void upInfo(Context context, String roomId, String password, boolean isOnline, RoomInfoResp roomInfo, boolean isCurrentRoom, String taskId) {
|
private void upInfo(Context context, String roomId, String password, boolean isOnline, RoomInfoResp roomInfo, boolean isCurrentRoom, String taskId) {
|
||||||
if (isOnline) {
|
if (isOnline) {
|
||||||
RetrofitClient.getInstance().postRoomInfo(roomId, new BaseObserver<RoomInfoResp>() {
|
RetrofitClient.getInstance().postRoomInfo(roomId, new BaseObserver<RoomInfoResp>() {
|
||||||
@@ -396,15 +408,32 @@ public class RoomManager {
|
|||||||
new ConfirmDialog(ActivityUtils.getTopActivity(),
|
new ConfirmDialog(ActivityUtils.getTopActivity(),
|
||||||
"提示",
|
"提示",
|
||||||
msg,
|
msg,
|
||||||
CommonAppContext.getInstance().playId.equals(roomId) ?"":"去上一个房间",
|
isCurrRoom(roomId) ?"":"去上一个房间",
|
||||||
CommonAppContext.getInstance().playId.equals(roomId) ?"取消":"在想想",
|
isCurrRoom(roomId) ?"取消":"在想想",
|
||||||
v -> {
|
v -> {
|
||||||
MessageListenerSingleton.getInstance().joinGroup(roomId);
|
// MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||||
// 点击“确认”按钮时执行删除操作
|
// 点击“确认”按钮时执行删除操作
|
||||||
fetchAndJoinRoom(ActivityUtils.getTopActivity(),roomId,"",taskId);
|
fetchAndJoinRoom(ActivityUtils.getTopActivity(),roomId,"",taskId);
|
||||||
},
|
},
|
||||||
v -> {
|
v -> {
|
||||||
|
if (ActivityUtils.getTopActivity() instanceof MainActivity){
|
||||||
|
((MainActivity) ActivityUtils.getTopActivity()).isShowLoading(false);
|
||||||
|
}else if (ActivityUtils.getTopActivity() instanceof MyRoomActivity){
|
||||||
|
((MyRoomActivity) ActivityUtils.getTopActivity()).isShowLoading(false);
|
||||||
|
} else if (ActivityUtils.getTopActivity() instanceof DailyTasksActivity){
|
||||||
|
((DailyTasksActivity) ActivityUtils.getTopActivity()).isShowLoading(false);
|
||||||
|
}
|
||||||
// 点击“取消”按钮时什么都不做
|
// 点击“取消”按钮时什么都不做
|
||||||
}, false, 0).show();
|
}, false, 0).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCurrRoom(String roomId){
|
||||||
|
if(CommonAppContext.getInstance().playId == null) {
|
||||||
|
return false;
|
||||||
|
}else if (CommonAppContext.getInstance().playId.equals(roomId)){
|
||||||
|
return true;
|
||||||
|
}else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public class LaunchPageActivity extends BaseMvpActivity<IPresenter,ActivityLaunc
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 设置视频路径,从raw资源中
|
// 设置视频路径,从raw资源中
|
||||||
String videoPath = "android.resource://" + getPackageName() + "/" + R.raw.app_start;
|
String videoPath = "android.resource://" + getPackageName() + "/" + R.raw.launch_mp4;
|
||||||
|
|
||||||
// 设置播放完成监听器
|
// 设置播放完成监听器
|
||||||
videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||||
|
|||||||
Reference in New Issue
Block a user