1:修改时间选择框,根据需要,展示时分秒和不显示时分秒
2:修改展示设备id,在头部信息中,使用第三方的获取设备唯一id 3:优化群聊成员列表展示 4:修改房间封面,上传图片的时候,需要裁剪 5:添加营业时间展示 6:pk修改开始的时候,选择时间去掉1分钟 7:修改声网,添加声卡开关
This commit is contained in:
@@ -137,7 +137,7 @@ public class CommonAppContext extends MultiDexApplication implements Application
|
||||
@Getter
|
||||
public UnreadCountEvent unreadCountEvent;
|
||||
|
||||
public static int selectRelease = 1;
|
||||
public static int selectRelease = -1;
|
||||
|
||||
public int is_open = 0;//主题的开关
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ package com.xscm.moduleutil.bean
|
||||
class GroupBean {
|
||||
var guild_id: String = ""
|
||||
var guild_cover: String = ""
|
||||
var is_deacon: Int = 0 //是否是群主 1:是 ,其他的不是
|
||||
var is_deacon: Int = 0 //是否是群主 1:是 ,其他的不是 2:管理员 3:普通成员
|
||||
var user_list: List<GroupUserBean> = ArrayList()
|
||||
|
||||
var name: String = ""
|
||||
@@ -27,6 +27,7 @@ class GroupBean {
|
||||
var role_str: String = ""
|
||||
var in_room_id: Int = 0 //是否在房间内 1:在 0:不在
|
||||
var is_mute: Int = 0 //是否被禁言 1:是 0:不是
|
||||
var group_role : Int = 0 //群角色 1:群主 2:管理员 3:普通成员
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,4 +19,6 @@ public class PkRoomInfo implements Serializable {
|
||||
private String pk_part;;//2:等待开始、3:进行中、4:惩罚阶段
|
||||
private String pk_end_times;
|
||||
private int receive_pk_user_id = -2;//接受pk的用户id
|
||||
|
||||
private String close_users="";//关闭pk麦克风的用户id
|
||||
}
|
||||
|
||||
@@ -65,6 +65,10 @@ public class RoomSettingBean implements MultiItemEntity {
|
||||
public static final int QXRoomSettingTypeRoomTimeSpace = 34;//时空之巅
|
||||
public static final int QXRoomSettingTypeRoomTimeRedSound = 35;//红包声音
|
||||
|
||||
public static final int QXRoomSettingTypeRoomBusinessTime = 37;//营业时间
|
||||
|
||||
|
||||
|
||||
public static final int ITEM_TYPE_DEFAULT = 0;
|
||||
public static final int ITEM_TYPE_WITH_ICON = 1;
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ public interface ApiServer {
|
||||
@GET(Constants.GET_CUSTOM_GIFT_LIST)
|
||||
Call<BaseModel<List<RoonGiftModel>>> getCustomGiftList(@Query("user_id") String user_id);
|
||||
|
||||
@GET(Constants.GET_NEW_GIFT_LIST)
|
||||
@GET(Constants.GET_NEW_GIFT_LIST) //拍卖位选择拍卖礼物,type=3 label =99
|
||||
Call<BaseModel<List<RoonGiftModel>>> getNewGiftList(@Query("label") int label, @Query("type") String type );
|
||||
|
||||
@GET(Constants.SET_CUSTOM_GIFT)
|
||||
@@ -528,6 +528,10 @@ public interface ApiServer {
|
||||
@POST(Constants.postRoomSwToken)
|
||||
Call<BaseModel<PkSwTokenBean>> postRoomSwToken(@Field("room_id") String roomId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_CLOSE_PK_MIC)
|
||||
Call<BaseModel<String>> closePkMic(@Field("pk_id") String pk_id,@Field("type") String type,@Field("user_id") String user_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.SET_USER_DECORATE)
|
||||
Call<BaseModel<String>> setUserDecorate(@Field("udid") String udid);
|
||||
@@ -749,6 +753,10 @@ public interface ApiServer {
|
||||
@GET(Constants.GET_BLIND_BOX_STATUS)
|
||||
Call<BaseModel<List<BlindBoxStatus>>> blindBoxStatus();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.SET_ROOM_BUSINESS_TIME)
|
||||
Call<BaseModel<String>> setRoomBusinessTime(@Field("room_id") String roomId,@Field("start_time") String startTime,@Field("end_time") String endTime);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_END_SONG)
|
||||
Call<BaseModel<String>> endSong(@Field("room_id") String roomId);
|
||||
@@ -770,7 +778,7 @@ public interface ApiServer {
|
||||
Call<BaseModel<List<RoomCharmRankBean>>> getCharmRank(@Field("room_id") String roomId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_ROOM_RELATION_LIST)
|
||||
@POST(Constants.POST_ROOM_RELATION_LIST) //1:真爱拍 2:亲密拍 3:星球(互娱)
|
||||
Call<BaseModel<List<RoomRelationBean>>> roomRelationList(@Field("type") String type);
|
||||
|
||||
@FormUrlEncoded
|
||||
|
||||
@@ -749,7 +749,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<GroupUserListBean>> call, Response<BaseModel<GroupUserListBean>> response) {
|
||||
if (response.code() == 200) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<GroupUserListBean> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1)
|
||||
observer.onNext(baseModel.getData());
|
||||
@@ -3363,7 +3363,6 @@ public class RetrofitClient {
|
||||
setCode301(indexRecommendRoomBaseModel.getMsg());
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showLong("首页房间推荐异常", response.code());
|
||||
LogUtils.e("首页房间推荐", response.message());
|
||||
}
|
||||
}
|
||||
@@ -4654,6 +4653,33 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void setRoomBusinessTime(String roomId,String start_time,String end_time, BaseObserver<String> observer) {
|
||||
sApiServer.setRoomBusinessTime(roomId,start_time,end_time).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<String> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1)
|
||||
ToastUtils.showLong(baseModel.getMsg());
|
||||
else if (baseModel.getCode() == 301) {
|
||||
setCode301(baseModel.getMsg());
|
||||
}else if (baseModel.getCode() == 0) {
|
||||
ToastUtils.showLong(baseModel.getMsg());
|
||||
}
|
||||
}else {
|
||||
ToastUtils.showLong("设置营业时间失败,", response.code());
|
||||
LogUtils.e("setRoomBusinessTime", response.message());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
LogUtils.e("setRoomBusinessTime", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void endSong(String room_id, BaseObserver<String> observer) {
|
||||
sApiServer.endSong(room_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
@@ -5343,6 +5369,33 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void closePkMic(String pk_id ,String type ,String user_id,BaseObserver<String> observer) {
|
||||
sApiServer.closePkMic(pk_id,type,user_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<String> baseModel = response.body();
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getMsg());
|
||||
} else if (baseModel.getCode() == 301) {
|
||||
setCode301(baseModel.getMsg());
|
||||
} else if (baseModel.getCode() == 0) {
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showLong("数据错误", response.code());
|
||||
LogUtils.e("closePkMic", response.message());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
LogUtils.e("closePkMic", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeBlackList(String user_id, BaseObserver<String> observer) {
|
||||
sApiServer.removeBlackList(user_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
|
||||
@@ -94,7 +94,7 @@ import io.reactivex.disposables.Disposable;
|
||||
public class AgoraManager {
|
||||
|
||||
private static volatile AgoraManager instance;
|
||||
public RtcEngineEx rtcEngine;
|
||||
public RtcEngineEx rtcEngine;
|
||||
// private RtcEngineEx rtcEngineEx;
|
||||
private Context context;
|
||||
private boolean isLocalAudioEnabled = true; // 默认开启麦克风
|
||||
@@ -230,6 +230,9 @@ public class AgoraManager {
|
||||
"}" +
|
||||
"}");
|
||||
rtcEngine.setParameters("{\"che.video.mobile_1080p\":true}");
|
||||
|
||||
setEnable();
|
||||
|
||||
} catch (Exception e) {
|
||||
LogUtils.w("AgoraManager", "Failed to set parameters", e);
|
||||
}
|
||||
@@ -242,6 +245,7 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int calculateScreenAngle(int orientation) {
|
||||
if (orientation >= 315 || orientation < 45) {
|
||||
return 0; // 竖屏(0度)
|
||||
@@ -253,6 +257,7 @@ public class AgoraManager {
|
||||
return 270; // 横屏左(270度)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入语音聊天房间
|
||||
*/
|
||||
@@ -281,6 +286,7 @@ public class AgoraManager {
|
||||
// 在频道中发布屏幕采集的音频
|
||||
options.publishScreenCaptureAudio = true;
|
||||
ClientRole(isCamerJs);
|
||||
|
||||
// options.publishMediaPlayerId = 0;
|
||||
rtcEngine.joinChannel(token, mRoomId, uid, options);
|
||||
|
||||
@@ -289,6 +295,18 @@ public class AgoraManager {
|
||||
|
||||
}
|
||||
|
||||
public void setEnable(){
|
||||
if (SpUtil.getSkService()==1){
|
||||
rtcEngine.setParameters("{\"che.audio.aec.enable\":false}"); // 关闭回音消除
|
||||
rtcEngine.setParameters("{\"che.audio.ans.enable\":false}"); // 关闭降噪
|
||||
rtcEngine.setParameters("{\"che.audio.agc.enable\":false}"); // 关闭增益控制
|
||||
}else {
|
||||
rtcEngine.setParameters("{\"che.audio.aec.enable\":true}"); // 开启回音消除
|
||||
rtcEngine.setParameters("{\"che.audio.ans.enable\":true}"); // 开启降噪
|
||||
rtcEngine.setParameters("{\"che.audio.agc.enable\":true}"); // 开启增益控制
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理资源但保留实例
|
||||
*/
|
||||
@@ -342,14 +360,14 @@ public class AgoraManager {
|
||||
}
|
||||
handlers.clear();
|
||||
}
|
||||
if (disposableA != null && !disposableA.isDisposed()){
|
||||
if (disposableA != null && !disposableA.isDisposed()) {
|
||||
disposableA.dispose();
|
||||
}
|
||||
if (disposableB != null && !disposableB.isDisposed()){
|
||||
disposableB.dispose();
|
||||
if (disposableB != null && !disposableB.isDisposed()) {
|
||||
disposableB.dispose();
|
||||
}
|
||||
if (disposableC != null && !disposableC.isDisposed()){
|
||||
disposableC.dispose();
|
||||
if (disposableC != null && !disposableC.isDisposed()) {
|
||||
disposableC.dispose();
|
||||
}
|
||||
// 关闭线程池
|
||||
if (executorService != null && !executorService.isShutdown()) {
|
||||
@@ -412,7 +430,7 @@ public class AgoraManager {
|
||||
@Override
|
||||
public void onRemoteAudioStateChanged(int uid, int state, int reason, int elapsed) {
|
||||
super.onRemoteAudioStateChanged(uid, state, reason, elapsed);
|
||||
if (state == 0){
|
||||
if (state == 0) {
|
||||
// LogUtils.e("onRemoteAudioStateChanged", "uid------>" + uid, "state------>" + state, "reason------>" + reason, "elapsed------>" + elapsed);
|
||||
for (SoundLevelUpdateListener listener : soundLevelUpdateListeners) {
|
||||
if (listener != null) {
|
||||
@@ -485,7 +503,7 @@ public class AgoraManager {
|
||||
@Override
|
||||
public void onLyricResult(String requestId, long songCode, String lyricUrl, int reason) {
|
||||
if (lyricUrl != null) {
|
||||
LogUtils.e("roomInfoEvent",lyricUrl);
|
||||
LogUtils.e("roomInfoEvent", lyricUrl);
|
||||
getLyricsInstance(lyricUrl);
|
||||
}
|
||||
}
|
||||
@@ -563,7 +581,7 @@ public class AgoraManager {
|
||||
Map<String, Integer> localMap = new HashMap<>();
|
||||
for (AudioVolumeInfo info : speakers) {
|
||||
String userId = (info.uid == 0)
|
||||
? SpUtil.getUserId()+""
|
||||
? SpUtil.getUserId() + ""
|
||||
: String.valueOf(info.uid);
|
||||
localMap.put(userId, info.volume);
|
||||
}
|
||||
@@ -575,6 +593,7 @@ public class AgoraManager {
|
||||
// 2️⃣ 只把“不可变快照”丢给 UI
|
||||
uiHandler.post(() -> dispatchVolume(localMap));
|
||||
}
|
||||
|
||||
private void dispatchVolume(Map<String, Integer> volumeSnapshot) {
|
||||
if (soundLevelUpdateListeners.isEmpty()) return;
|
||||
|
||||
@@ -587,6 +606,7 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalVideoStateChanged(Constants.VideoSourceType source, int state, int reason) {
|
||||
super.onLocalVideoStateChanged(source, state, reason);
|
||||
@@ -658,6 +678,7 @@ public class AgoraManager {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建并返回 IMediaPlayerObserver 实例
|
||||
*/
|
||||
@@ -755,6 +776,7 @@ public class AgoraManager {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void potexao(String page) {
|
||||
ClientRole(true);
|
||||
rtcEngine.playEffect(1, page, 0, 1, 0, 100, true);
|
||||
@@ -770,7 +792,7 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void joinChannelEx(String token, String channelId, int uid,String pkUserIds) {
|
||||
public void joinChannelEx(String token, String channelId, int uid, String pkUserIds) {
|
||||
if (rtcEngine == null) {
|
||||
init(CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId());
|
||||
}
|
||||
@@ -810,17 +832,17 @@ public class AgoraManager {
|
||||
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
Display display = manager.getDefaultDisplay();
|
||||
|
||||
DisplayMetrics outMetrics=new DisplayMetrics();
|
||||
DisplayMetrics outMetrics = new DisplayMetrics();
|
||||
display.getMetrics(outMetrics);
|
||||
|
||||
// // 设置屏幕采集的参数
|
||||
screenCaptureParameters.captureVideo = true;
|
||||
screenCaptureParameters.videoCaptureParameters.width = outMetrics.widthPixels;
|
||||
screenCaptureParameters.videoCaptureParameters.height = outMetrics.heightPixels;
|
||||
screenCaptureParameters.videoCaptureParameters.width = outMetrics.widthPixels;
|
||||
screenCaptureParameters.videoCaptureParameters.height = outMetrics.heightPixels;
|
||||
screenCaptureParameters.videoCaptureParameters.framerate = 15;
|
||||
screenCaptureParameters.captureAudio = true;
|
||||
screenCaptureParameters.audioCaptureParameters.captureSignalVolume =50;
|
||||
screenCaptureParameters.videoCaptureParameters.contentHint=1 ;
|
||||
screenCaptureParameters.audioCaptureParameters.captureSignalVolume = 50;
|
||||
screenCaptureParameters.videoCaptureParameters.contentHint = 1;
|
||||
rtcEngine.setVideoEncoderConfiguration(new VideoEncoderConfiguration(
|
||||
VD_1280x720,
|
||||
FRAME_RATE_FPS_15,
|
||||
@@ -833,12 +855,12 @@ public class AgoraManager {
|
||||
}
|
||||
|
||||
|
||||
public void setExternalMediaProjection(MediaProjection[] mediaProjection){
|
||||
public void setExternalMediaProjection(MediaProjection[] mediaProjection) {
|
||||
rtcEngine.setExternalMediaProjection(mediaProjection[0]);
|
||||
}
|
||||
|
||||
public void isPost(){
|
||||
if (rtcEngine != null){
|
||||
public void isPost() {
|
||||
if (rtcEngine != null) {
|
||||
ScreenCaptureParameters screenCaptureParameters = new ScreenCaptureParameters();
|
||||
|
||||
// 设置新的屏幕共享参数
|
||||
@@ -917,6 +939,7 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//关闭对方的所有推流
|
||||
public void muteAllRemoteAudioStreamsEx(boolean enabled) {
|
||||
if (rtcEngine == null) {
|
||||
@@ -932,10 +955,11 @@ public class AgoraManager {
|
||||
// rtcEngine.muteAllRemoteAudioStreamsEx(enabled, connection);
|
||||
}
|
||||
}
|
||||
|
||||
//打开对方支持的推流
|
||||
public void muteAllRemoteAudioStreamsExUserId(boolean enabled){
|
||||
if (rtcEngine != null){
|
||||
rtcEngine.muteRemoteAudioStreamEx(pkUserId,enabled,connection);
|
||||
public void muteAllRemoteAudioStreamsExUserId(boolean enabled) {
|
||||
if (rtcEngine != null) {
|
||||
rtcEngine.muteRemoteAudioStreamEx(pkUserId, enabled, connection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,7 +1035,7 @@ public class AgoraManager {
|
||||
// }
|
||||
// }
|
||||
public void addSoundLevelListener(SoundLevelUpdateListener listener) {
|
||||
LogUtils.e("AgoraManager", "addSoundLevelListener: " + listener +"============"+soundLevelUpdateListeners.size());
|
||||
LogUtils.e("AgoraManager", "addSoundLevelListener: " + listener + "============" + soundLevelUpdateListeners.size());
|
||||
if (soundLevelUpdateListeners != null) {
|
||||
soundLevelUpdateListeners.add(listener);
|
||||
}
|
||||
@@ -1028,19 +1052,19 @@ public class AgoraManager {
|
||||
soundLevelUpdateListeners.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method searches for music based on a given keyword and page number.
|
||||
* It initializes the music content center if it's not already created.
|
||||
*
|
||||
* @param keyword The keyword to search for music
|
||||
* @param page The page number of the search results
|
||||
*/
|
||||
/**
|
||||
* This method searches for music based on a given keyword and page number.
|
||||
* It initializes the music content center if it's not already created.
|
||||
*
|
||||
* @param keyword The keyword to search for music
|
||||
* @param page The page number of the search results
|
||||
*/
|
||||
public void searchMusic(String keyword, int page) {
|
||||
// Check if musicContentCenter is initialized, if not create it
|
||||
// Check if musicContentCenter is initialized, if not create it
|
||||
if (musicContentCenter == null) {
|
||||
musicContentCenter = IAgoraMusicContentCenter.create(rtcEngine);
|
||||
}
|
||||
// Perform the music search with the keyword, page number and page size (20)
|
||||
// Perform the music search with the keyword, page number and page size (20)
|
||||
musicContentCenter.searchMusic(keyword, page, 20);
|
||||
}
|
||||
|
||||
@@ -1112,8 +1136,8 @@ public class AgoraManager {
|
||||
String result = musicContentCenter.preload(mSongCode);
|
||||
// 使用后台线程池处理预加载检查,避免阻塞UI线程
|
||||
disposableC = Observable.timer(3000, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(aLong -> {
|
||||
isPreload(mSongCode, type);
|
||||
});
|
||||
isPreload(mSongCode, type);
|
||||
});
|
||||
} else {
|
||||
try {
|
||||
musicPlayer.open(mSongCode, 0);
|
||||
@@ -1262,15 +1286,17 @@ public class AgoraManager {
|
||||
public void setPlayoutVolume(int volume) {
|
||||
if (musicPlayer != null) {
|
||||
musicPlayer.adjustPlayoutVolume(volume);//调节本地播放音量。 参数是0-100
|
||||
musicPlayer.adjustPublishSignalVolume(volume*2);//调节远端用户听到的音量。 参数是0-400
|
||||
musicPlayer.adjustPublishSignalVolume(volume * 2);//调节远端用户听到的音量。 参数是0-400
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 伴奏音量
|
||||
*
|
||||
* @param volume
|
||||
*/
|
||||
public void setAdjustPublishSignalVolume(int volume){
|
||||
public void setAdjustPublishSignalVolume(int volume) {
|
||||
musicPlayer.adjustPublishSignalVolume(volume);//调节远端用户听到的音量。 参数是0-400
|
||||
}
|
||||
|
||||
@@ -1362,7 +1388,7 @@ public class AgoraManager {
|
||||
.build();
|
||||
if (StatusUtil.isCompleted(task)) {
|
||||
MusicFileBean musicFileBean = new MusicFileBean();
|
||||
LogUtils.e("roomInfoEvent",convertFileToByteArray(task.getFile()));
|
||||
LogUtils.e("roomInfoEvent", convertFileToByteArray(task.getFile()));
|
||||
musicFileBean.setFileData(convertFileToByteArray(task.getFile()));
|
||||
EventBus.getDefault().post(musicFileBean);
|
||||
} else {
|
||||
@@ -1391,7 +1417,7 @@ public class AgoraManager {
|
||||
@Override
|
||||
public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, @NonNull Listener1Assist.Listener1Model model) {
|
||||
Logger.e("taskEnd", model);
|
||||
LogUtils.e("roomInfoEvent",convertFileToByteArray(task.getFile()));
|
||||
LogUtils.e("roomInfoEvent", convertFileToByteArray(task.getFile()));
|
||||
MusicFileBean musicFileBean = new MusicFileBean();
|
||||
musicFileBean.setFileData(convertFileToByteArray(task.getFile()));
|
||||
EventBus.getDefault().post(musicFileBean);
|
||||
|
||||
@@ -354,6 +354,15 @@ public class SpUtil {
|
||||
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt(SPConstants.TASK_SERVICE);
|
||||
}
|
||||
|
||||
public static int setSkService(int taskService){
|
||||
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put("skService", taskService);
|
||||
return taskService;
|
||||
}
|
||||
public static int getSkService(){
|
||||
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt("skService");
|
||||
}
|
||||
|
||||
|
||||
//获取SharedPreferences音乐轮播方式
|
||||
public static int getPlayPattern() {
|
||||
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt(SPConstants.PLAY_MODE, 1);
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import com.blankj.utilcode.util.AppUtils;
|
||||
import com.blankj.utilcode.util.DeviceUtils;
|
||||
import com.blankj.utilcode.util.MetaDataUtils;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.utils.config.ConfigUtils;
|
||||
@@ -77,7 +78,8 @@ public class SystemUtils {
|
||||
}
|
||||
|
||||
public static String getShortClientID(Context context) {
|
||||
String cid = getClientID("xqipaoandroid");
|
||||
// String cid = getClientID("xqipaoandroid");
|
||||
String cid = DeviceUtils.getUniqueDeviceId();
|
||||
return Md5Utils.get(cid + getUUID(context));
|
||||
}
|
||||
|
||||
|
||||
@@ -317,6 +317,7 @@ public class Constants {
|
||||
public static final String POST_APPLY_SONG = "/api/RoomSong/apply_song";//申请点歌
|
||||
public static final String POST_AGREE_SONG = "/api/RoomSong/agree_song";//同意、拒绝点歌
|
||||
public static final String GET_BLIND_BOX_STATUS = "/api/BlindBoxTurntable/blind_box_status";//盲盒转盘状态
|
||||
public static final String SET_ROOM_BUSINESS_TIME = "/api/Room/set_room_business_time";//设置房间的营业时间
|
||||
public static final String POST_SONG_LIST = "/api/RoomSong/song_list";//获取已点歌曲
|
||||
public static final String POST_SONG = "/api/RoomSong/song";//点歌
|
||||
public static final String POST_UP_SONG = "/api/RoomSong/up_song";//移动歌曲
|
||||
@@ -411,6 +412,7 @@ public class Constants {
|
||||
public static final String GET_INDEX_RECOMMEND_ROOM = "/api/Index/index_recommend_room";//首页弹窗推荐房间
|
||||
public static final String GET_DAY_DROP_GIFT = "/api/Activities/day_drop_gift";//天降好礼列表接口(弹框)
|
||||
public static final String postRoomSwToken = "/api/Room/update_user_sw_token";//获取用户声网token
|
||||
public static final String POST_CLOSE_PK_MIC = "/api/RoomPk/close_pk_mic";//PK闭麦
|
||||
public static final String POST_CANCEL_USER_DECORATE = "/api/Decorate/cancel_user_decorate";//取消装扮
|
||||
public static final String GET_THEME_DATA = "/api/Theme/get_theme_data";//主题接口
|
||||
public static final String START_FRIEND = "/api/Friend/start_friend";//点击开始按钮 交友房
|
||||
|
||||
@@ -20,6 +20,9 @@ import java.util.Date;
|
||||
public class DoubleTimePickerBottomSheet extends BottomSheetDialogFragment {
|
||||
|
||||
private OnTimeRangeSelectedListener listener;
|
||||
private boolean showTime = true; // 默认显示时分秒
|
||||
private boolean showDate = true; // 默认显示日期
|
||||
private boolean showSeconds = true; // 默认显示秒
|
||||
|
||||
public interface OnTimeRangeSelectedListener {
|
||||
void onTimeRangeSelected(Date startDate, Date endDate);
|
||||
@@ -28,6 +31,54 @@ public class DoubleTimePickerBottomSheet extends BottomSheetDialogFragment {
|
||||
public void setOnTimeRangeSelectedListener(OnTimeRangeSelectedListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示时分秒
|
||||
* @param showTime true显示年月日时分秒,false只显示年月日
|
||||
*/
|
||||
public void setShowTime(boolean showTime) {
|
||||
this.showTime = showTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示日期
|
||||
* @param showDate true显示日期,false只显示时间
|
||||
*/
|
||||
public void setShowDate(boolean showDate) {
|
||||
this.showDate = showDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示秒
|
||||
* @param showSeconds true显示秒,false不显示秒
|
||||
*/
|
||||
public void setShowSeconds(boolean showSeconds) {
|
||||
this.showSeconds = showSeconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建实例
|
||||
* @param showTime true显示年月日时分秒,false只显示年月日
|
||||
* @return DoubleTimePickerBottomSheet实例
|
||||
*/
|
||||
public static DoubleTimePickerBottomSheet newInstance(boolean showTime) {
|
||||
DoubleTimePickerBottomSheet fragment = new DoubleTimePickerBottomSheet();
|
||||
fragment.setShowTime(showTime);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建实例
|
||||
* @param showTime true显示年月日时分秒,false只显示年月日
|
||||
* @param showDate true显示日期,false只显示时间
|
||||
* @return DoubleTimePickerBottomSheet实例
|
||||
*/
|
||||
public static DoubleTimePickerBottomSheet newInstance(boolean showTime, boolean showDate) {
|
||||
DoubleTimePickerBottomSheet fragment = new DoubleTimePickerBottomSheet();
|
||||
fragment.setShowTime(showTime);
|
||||
fragment.setShowDate(showDate);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@@ -52,17 +103,77 @@ public class DoubleTimePickerBottomSheet extends BottomSheetDialogFragment {
|
||||
WheelTimePicker wheelStartTime = view.findViewById(R.id.wheel_start_time);
|
||||
WheelDatePicker wheelEndDate = view.findViewById(R.id.wheel_end_date);
|
||||
WheelTimePicker wheelEndTime = view.findViewById(R.id.wheel_end_time);
|
||||
|
||||
// 根据showDate和showTime参数控制日期和时间选择器的显示和布局
|
||||
if (showDate && showTime) {
|
||||
// 显示日期和时间时,使用默认布局
|
||||
wheelStartDate.setVisibility(View.VISIBLE);
|
||||
wheelStartTime.setVisibility(View.VISIBLE);
|
||||
wheelEndDate.setVisibility(View.VISIBLE);
|
||||
wheelEndTime.setVisibility(View.VISIBLE);
|
||||
|
||||
// 重置日期选择器的布局参数为默认值
|
||||
ViewGroup.LayoutParams startDateParams = wheelStartDate.getLayoutParams();
|
||||
startDateParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
wheelStartDate.setLayoutParams(startDateParams);
|
||||
|
||||
ViewGroup.LayoutParams endDateParams = wheelEndDate.getLayoutParams();
|
||||
endDateParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
wheelEndDate.setLayoutParams(endDateParams);
|
||||
} else if (showDate && !showTime) {
|
||||
// 只显示日期时,隐藏时间选择器并让日期选择器铺满宽度
|
||||
wheelStartTime.setVisibility(View.GONE);
|
||||
wheelEndTime.setVisibility(View.GONE);
|
||||
|
||||
// 设置日期选择器铺满宽度
|
||||
ViewGroup.LayoutParams startDateParams = wheelStartDate.getLayoutParams();
|
||||
startDateParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
wheelStartDate.setLayoutParams(startDateParams);
|
||||
|
||||
ViewGroup.LayoutParams endDateParams = wheelEndDate.getLayoutParams();
|
||||
endDateParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
wheelEndDate.setLayoutParams(endDateParams);
|
||||
} else if (!showDate && showTime) {
|
||||
// 只显示时间时,隐藏日期选择器并让时间选择器铺满宽度
|
||||
wheelStartDate.setVisibility(View.GONE);
|
||||
wheelStartTime.setVisibility(View.VISIBLE);
|
||||
wheelEndDate.setVisibility(View.GONE);
|
||||
wheelEndTime.setVisibility(View.VISIBLE);
|
||||
|
||||
// 设置时间选择器铺满宽度
|
||||
ViewGroup.LayoutParams startTimeParams = wheelStartTime.getLayoutParams();
|
||||
startTimeParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
wheelStartTime.setLayoutParams(startTimeParams);
|
||||
|
||||
ViewGroup.LayoutParams endTimeParams = wheelEndTime.getLayoutParams();
|
||||
endTimeParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
wheelEndTime.setLayoutParams(endTimeParams);
|
||||
}
|
||||
|
||||
// 默认设置当前时间
|
||||
Calendar startCal = Calendar.getInstance();
|
||||
wheelStartDate.init(startCal.get(Calendar.YEAR), startCal.get(Calendar.MONTH), startCal.get(Calendar.DAY_OF_MONTH));
|
||||
wheelStartTime.init(startCal.get(Calendar.HOUR_OF_DAY), startCal.get(Calendar.MINUTE),startCal.get(Calendar.SECOND));
|
||||
if (showDate) {
|
||||
wheelStartDate.init(startCal.get(Calendar.YEAR), startCal.get(Calendar.MONTH), startCal.get(Calendar.DAY_OF_MONTH));
|
||||
}
|
||||
if (showTime) {
|
||||
wheelStartTime.init(startCal.get(Calendar.HOUR_OF_DAY), startCal.get(Calendar.MINUTE), showSeconds ? startCal.get(Calendar.SECOND) : 0);
|
||||
wheelStartTime.setShowSeconds(showSeconds);
|
||||
}
|
||||
|
||||
// 设置默认结束时间略晚于开始时间
|
||||
Calendar endCal = (Calendar) startCal.clone();
|
||||
endCal.add(Calendar.HOUR, 1);
|
||||
wheelEndDate.init(endCal.get(Calendar.YEAR), endCal.get(Calendar.MONTH), endCal.get(Calendar.DAY_OF_MONTH));
|
||||
wheelEndTime.init(endCal.get(Calendar.HOUR_OF_DAY), endCal.get(Calendar.MINUTE),endCal.get(Calendar.SECOND));
|
||||
if (showTime) {
|
||||
endCal.add(Calendar.HOUR, 1);
|
||||
} else {
|
||||
endCal.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
if (showDate) {
|
||||
wheelEndDate.init(endCal.get(Calendar.YEAR), endCal.get(Calendar.MONTH), endCal.get(Calendar.DAY_OF_MONTH));
|
||||
}
|
||||
if (showTime) {
|
||||
wheelEndTime.init(endCal.get(Calendar.HOUR_OF_DAY), endCal.get(Calendar.MINUTE), showSeconds ? endCal.get(Calendar.SECOND) : 0);
|
||||
wheelEndTime.setShowSeconds(showSeconds);
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
view.findViewById(R.id.btn_cancel).setOnClickListener(v -> dismiss());
|
||||
@@ -70,16 +181,36 @@ public class DoubleTimePickerBottomSheet extends BottomSheetDialogFragment {
|
||||
// 确定按钮
|
||||
view.findViewById(R.id.btn_sure).setOnClickListener(v -> {
|
||||
Calendar start = Calendar.getInstance();
|
||||
start.set(wheelStartDate.getYear(), wheelStartDate.getMonth(), wheelStartDate.getDay(),
|
||||
wheelStartTime.getHour(), wheelStartTime.getMinute(), wheelStartTime.getSecond());
|
||||
|
||||
Calendar end = Calendar.getInstance();
|
||||
end.set(wheelEndDate.getYear(), wheelEndDate.getMonth(), wheelEndDate.getDay(),
|
||||
wheelEndTime.getHour(), wheelEndTime.getMinute(), wheelEndTime.getSecond());
|
||||
|
||||
if (end.getTime().before(start.getTime())) {
|
||||
Toast.makeText(requireContext(), "结束时间不能早于开始时间", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
if (showDate && showTime) {
|
||||
// 显示日期和时间
|
||||
start.set(wheelStartDate.getYear(), wheelStartDate.getMonth(), wheelStartDate.getDay(),
|
||||
wheelStartTime.getHour(), wheelStartTime.getMinute(), wheelStartTime.getSecond());
|
||||
end.set(wheelEndDate.getYear(), wheelEndDate.getMonth(), wheelEndDate.getDay(),
|
||||
wheelEndTime.getHour(), wheelEndTime.getMinute(), wheelEndTime.getSecond());
|
||||
} else if (showDate && !showTime) {
|
||||
// 只显示日期
|
||||
start.set(wheelStartDate.getYear(), wheelStartDate.getMonth(), wheelStartDate.getDay(),
|
||||
0, 0, 0);
|
||||
end.set(wheelEndDate.getYear(), wheelEndDate.getMonth(), wheelEndDate.getDay(),
|
||||
23, 59, 59);
|
||||
} else if (!showDate && showTime) {
|
||||
// 只显示时间,使用当前日期
|
||||
int currentYear = start.get(Calendar.YEAR);
|
||||
int currentMonth = start.get(Calendar.MONTH);
|
||||
int currentDay = start.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
start.set(currentYear, currentMonth, currentDay,
|
||||
wheelStartTime.getHour(), wheelStartTime.getMinute(), wheelStartTime.getSecond());
|
||||
end.set(currentYear, currentMonth, currentDay,
|
||||
wheelEndTime.getHour(), wheelEndTime.getMinute(), wheelEndTime.getSecond());
|
||||
}
|
||||
if ((showDate && showTime) || (showDate && !showTime) ) {
|
||||
if (end.getTime().before(start.getTime())) {
|
||||
Toast.makeText(requireContext(), "结束时间不能早于开始时间", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (listener != null) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.widget.NumberPicker;
|
||||
public class WheelTimePicker extends LinearLayout {
|
||||
|
||||
private NumberPicker hourPicker, minutePicker, secondPicker;
|
||||
private boolean showSeconds = true; // 默认显示秒
|
||||
|
||||
public WheelTimePicker(Context context) {
|
||||
this(context, null);
|
||||
@@ -33,6 +34,9 @@ public class WheelTimePicker extends LinearLayout {
|
||||
addView(hourPicker);
|
||||
addView(minutePicker);
|
||||
addView(secondPicker);
|
||||
|
||||
// 根据showSeconds参数决定是否显示秒选择器
|
||||
secondPicker.setVisibility(showSeconds ? VISIBLE : GONE);
|
||||
|
||||
// 设置小时范围
|
||||
hourPicker.setMinValue(0);
|
||||
@@ -64,4 +68,15 @@ public class WheelTimePicker extends LinearLayout {
|
||||
public int getSecond() {
|
||||
return secondPicker.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否显示秒
|
||||
* @param showSeconds true显示秒,false不显示秒
|
||||
*/
|
||||
public void setShowSeconds(boolean showSeconds) {
|
||||
this.showSeconds = showSeconds;
|
||||
if (secondPicker != null) {
|
||||
secondPicker.setVisibility(showSeconds ? VISIBLE : GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans, fragmentList, ""));
|
||||
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
||||
mBinding.slidingTabLayout.setCurrentTab(0);
|
||||
refreshCurrentGiftFragment(giftLabelBeans.get(0).getId(), 2, "");
|
||||
refreshCurrentGiftFragment(giftLabelBeans.get(0).getId(), 2, "5");
|
||||
mBinding.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
@@ -226,7 +226,7 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
// 当页面切换时,控制 tv_bb_qs 按钮的显示
|
||||
refreshCurrentGiftFragment(giftLabelBeans.get(position).getId(), 2, "");
|
||||
refreshCurrentGiftFragment(giftLabelBeans.get(position).getId(), 2, "5");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -236,9 +236,9 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshCurrentGiftFragment(String id, int type, String roomId) {
|
||||
private void refreshCurrentGiftFragment(String id, int status, String type) {
|
||||
if (getCurrentGiftFragment() != null) {
|
||||
getCurrentGiftFragment().loadDataIfNeeded(id, type, roomId);
|
||||
getCurrentGiftFragment().loadDataIfNeeded(id, status, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user