代码合并 至 2025.11.3 20:29
@@ -67,8 +67,6 @@ dependencies {
|
||||
implementation project(':moduletablayout')
|
||||
implementation libs.activity
|
||||
implementation libs.constraintlayout
|
||||
implementation libs.androidx.appcompat
|
||||
implementation libs.androidx.appcompat
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
@@ -169,14 +167,15 @@ dependencies {
|
||||
|
||||
//播放器
|
||||
//腾讯直播sdk
|
||||
api('com.tencent.liteav:LiteAVSDK_Professional:10.9.0.13102')
|
||||
api('com.google.android.exoplayer:exoplayer-core:2.19.1')
|
||||
api('com.google.android.exoplayer:exoplayer-ui:2.19.1')
|
||||
// api('com.tencent.liteav:LiteAVSDK_Professional:10.9.0.13102')
|
||||
// api('com.google.android.exoplayer:exoplayer-core:2.19.1')
|
||||
// api('com.google.android.exoplayer:exoplayer-ui:2.19.1')
|
||||
api("com.egame.vap:animplayer:2.0.8")
|
||||
api("com.liulishuo.okdownload:okdownload:1.0.7")
|
||||
|
||||
api('com.zlc.glide:webpdecoder:1.6.4.9.0')
|
||||
api('com.jungly:gridPasswordView:0.3')
|
||||
// 带有气泡的提示框,目前没有使用,暂不使用,使用位置是在RoomTipsView
|
||||
api('com.cpiz.bubbleview:bubbleview:1.0.2')
|
||||
|
||||
// 集成音频 SDK声网
|
||||
|
||||
@@ -165,7 +165,11 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
adjustFontScale(getResources().getConfiguration());
|
||||
CrashHandler.init(this);
|
||||
|
||||
|
||||
if (currentEnvironment.getShelf()==1){
|
||||
if (SpUtil.getShelf()!=1) {
|
||||
SpUtil.setShelf(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void adjustFontScale(Configuration configuration) {
|
||||
@@ -438,7 +442,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
initARouter();
|
||||
if (SpUtil.isAgreePolicy()) {
|
||||
checkInEmulator();
|
||||
UtilConfig.checkInEmulator();
|
||||
// UtilConfig.checkInEmulator();
|
||||
AgoraManager.getInstance(this);
|
||||
AgoraManager.init(currentEnvironment.getSwSdkAppId());
|
||||
MessageListenerSingleton.getInstance();
|
||||
|
||||
@@ -18,7 +18,10 @@ public class RoomSettingBean implements MultiItemEntity {
|
||||
public static final int QXRoomSettingTypeRoomTypeGirl = 13;
|
||||
///交友 房
|
||||
public static final int QXRoomSettingTypeRoomTypeJiaoy = 27;
|
||||
//互娱
|
||||
public static final int QXRoomSettingTypeRoomTypeHUYU = 28;
|
||||
//练歌房
|
||||
public static final int QXRoomSettingTypeRoomTypeLianG = 31;
|
||||
|
||||
/// 常用工具
|
||||
/// 房间补贴
|
||||
|
||||
@@ -72,16 +72,50 @@ public class MessageListenerSingleton {
|
||||
|
||||
private List<PublicScreenMessageListener> publicScreenListeners = new ArrayList<>();
|
||||
|
||||
// 添加监听器
|
||||
// 添加监听器 // 替换原有的 addPublicScreenMessageListener 方法
|
||||
public void addPublicScreenMessageListener(PublicScreenMessageListener listener) {
|
||||
if (!publicScreenListeners.contains(listener)) {
|
||||
publicScreenListeners.add(listener);
|
||||
if (listener == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (publicScreenListeners) {
|
||||
if (!publicScreenListeners.contains(listener)) {
|
||||
try {
|
||||
publicScreenListeners.add(listener);
|
||||
} catch (Exception e) {
|
||||
LogUtils.e("MessageListener", "添加 PublicScreenMessageListener 失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 移除监听器
|
||||
// 同时修改 removePublicScreenMessageListener 方法
|
||||
public void removePublicScreenMessageListener(PublicScreenMessageListener listener) {
|
||||
publicScreenListeners.remove(listener);
|
||||
if (listener == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (publicScreenListeners) {
|
||||
try {
|
||||
publicScreenListeners.remove(listener);
|
||||
} catch (Exception e) {
|
||||
LogUtils.e("MessageListener", "移除 PublicScreenMessageListener 失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 修改 notify 方法以增加保护
|
||||
private void notifyPublicScreenListeners(RoomMessageEvent message) {
|
||||
synchronized (publicScreenListeners) {
|
||||
// 创建副本以避免并发修改异常
|
||||
List<PublicScreenMessageListener> listenersCopy = new ArrayList<>(publicScreenListeners);
|
||||
for (PublicScreenMessageListener listener : listenersCopy) {
|
||||
try {
|
||||
listener.onPublicScreenMessageReceived(message);
|
||||
} catch (Exception e) {
|
||||
LogUtils.e("MessageListener", "通知 PublicScreenMessageListener 失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MessageListenerSingleton() {
|
||||
|
||||
@@ -362,6 +362,46 @@ public class AgoraManager {
|
||||
// 填入用于鉴权的 Token
|
||||
contentCenterConfiguration.token = SpUtil.getRtmToken();
|
||||
|
||||
// 创建 IAgoraMusicContentCenterEventHandler,用于 SDK 向客户端发送音乐内容中心事件通知
|
||||
// contentCenterConfiguration.eventHandler = new IMusicContentCenterEventHandler() {
|
||||
// @Override
|
||||
// public void onPreLoadEvent(String requestId, long songCode, int percent, String lyricUrl, int status, int errorCode) {
|
||||
// LogUtils.e("@@@1", "requestId: " + requestId + ", songCode: " + songCode + ", percent: " + percent + ", lyricUrl: " + lyricUrl + ", status: " + status + ", errorCode: " + errorCode);
|
||||
// if (!lyricUrl.isEmpty() && percent == 100 && !isBjMusic) {
|
||||
// getLyricsInstance(lyricUrl);
|
||||
// }
|
||||
//// musicPlayer.open(songCode, 0);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMusicCollectionResult(String requestId, int page, int pageSize, int total, Music[] list, int errorCode) {
|
||||
// LogUtils.e("@@@2", "requestId: " + requestId + ", page: " + page + ", pageSize: " + pageSize + ", total: " + total);
|
||||
// MusicBean musicBean = new MusicBean();
|
||||
// musicBean.setMusicList(Arrays.asList(list));
|
||||
// musicBean.setPage(page);
|
||||
// EventBus.getDefault().post(musicBean);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMusicChartsResult(String requestId, MusicChartInfo[] list, int errorCode) {
|
||||
// LogUtils.e("@@@", "requestId: " + requestId);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLyricResult(String requestId, long songCode, String lyricUrl, int errorCode) {
|
||||
// LogUtils.e("@@@22", "requestId: " + requestId + ", songCode: " + songCode + ", lyricUrl: " + lyricUrl + ", errorCode: " + errorCode);
|
||||
// if (lyricUrl != null && !isBjMusic) {
|
||||
// getLyricsInstance(lyricUrl);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSongSimpleInfoResult(String requestId, long songCode, String simpleInfo, int errorCode) {
|
||||
// LogUtils.e("@@@", "requestId: " + requestId + ", songCode: " + songCode + ", simpleInfo: " + simpleInfo + ", errorCode: " + errorCode);
|
||||
// }
|
||||
// };
|
||||
// 初始化 IAgoraMusicContentCenter
|
||||
|
||||
musicContentCenter.initialize(contentCenterConfiguration);
|
||||
if (musicPlayer != null) {
|
||||
musicPlayer = null;
|
||||
@@ -373,8 +413,15 @@ public class AgoraManager {
|
||||
if (state == 0) {
|
||||
musicPlayer.stop();
|
||||
musicPlayer.open(songCode, 0);
|
||||
// getLyricsInstance(lyricUrl);
|
||||
}
|
||||
LogUtils.e("AgoraManager", "isPreload2: " + songCode, "percent: " + percent);
|
||||
|
||||
// if (!lyricUrl.isEmpty() && percent == 100 && !isBjMusic) {
|
||||
// musicPlayer.stop();
|
||||
// musicPlayer.open(songCode, 0);
|
||||
//// getLyricsInstance(lyricUrl);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -426,12 +473,19 @@ public class AgoraManager {
|
||||
|
||||
@Override
|
||||
public void onUserJoined(int uid, int elapsed) {//远端用户加入频道
|
||||
// for (IRtcEngineEventHandler handler : eventHandlers) {
|
||||
// if (handler != null) {
|
||||
// handler.onUserJoined(uid, elapsed);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
for (SoundLevelUpdateListener listener : soundLevelUpdateListeners) {
|
||||
if (listener != null) {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
// 远程用户音量变化
|
||||
listener.userJoined(uid, elapsed);
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -446,13 +500,19 @@ public class AgoraManager {
|
||||
|
||||
@Override
|
||||
public void onUserOffline(int uid, int reason) {//远端用户离开频道
|
||||
// for (IRtcEngineEventHandler handler : eventHandlers) {
|
||||
// if (handler != null) {
|
||||
// handler.onUserOffline(uid, reason);
|
||||
// }
|
||||
for (SoundLevelUpdateListener listener : soundLevelUpdateListeners) {
|
||||
if (listener != null) {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
// 远程用户音量变化
|
||||
listener.userOffline(uid, reason);
|
||||
// }
|
||||
});
|
||||
}
|
||||
// }
|
||||
}
|
||||
SurfaceView renderView = null;
|
||||
rtcEngine.setupRemoteVideo(new VideoCanvas(null, Constants.RENDER_MODE_FIT, uid));
|
||||
@@ -475,6 +535,7 @@ public class AgoraManager {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
// 远程用户音量变化
|
||||
listener.onRemoteSoundLevelUpdate(uid > 0 ? String.valueOf(uid) : SpUtil.getUserId() + "", volume);
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -644,8 +705,39 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void joinChannelEx(String token, String channelId, int uid,String pkUserIds) {
|
||||
if (rtcEngine == null) {
|
||||
init(CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId());
|
||||
}
|
||||
if (rtcEngine != null) {
|
||||
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);
|
||||
// rtcEngine.joinChannelEx(token, connection, options, getDefaultEventHandler());
|
||||
// muteAllRemoteAudioStreamsEx(true);
|
||||
// muteAllRemoteAudioStreamsExUserId(false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void leaveChannelEx(String mRoomId, int uid) {
|
||||
if (rtcEngine != null) {
|
||||
RtcConnection connection = new RtcConnection();
|
||||
connection.channelId = mRoomId;
|
||||
connection.localUid = uid;
|
||||
// rtcEngine.leaveChannelEx(connection);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateChannelMediaOptions() {
|
||||
|
||||
if (rtcEngine != null) {
|
||||
options.clientRoleType = Constants.CLIENT_ROLE_BROADCASTER;
|
||||
// options.autoSubscribeVideo = true;
|
||||
@@ -665,8 +757,30 @@ public class AgoraManager {
|
||||
|
||||
public void post() {
|
||||
if (rtcEngine != null) {
|
||||
// rtcEngine.setParameters("{\"che.video.mobile_1080p\":true}");
|
||||
// rtcEngine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER);
|
||||
//
|
||||
// /*Enable video module*/
|
||||
// rtcEngine.enableVideo();
|
||||
// // Setup video encoding configs
|
||||
// rtcEngine.setVideoEncoderConfiguration(new VideoEncoderConfiguration(
|
||||
// VD_640x360,
|
||||
// FRAME_RATE_FPS_15,
|
||||
// STANDARD_BITRATE,
|
||||
// ORIENTATION_MODE_ADAPTIVE
|
||||
// ));
|
||||
// /*Set up to play remote sound with receiver*/
|
||||
// rtcEngine.setDefaultAudioRoutetoSpeakerphone(true);
|
||||
|
||||
ScreenCaptureParameters screenCaptureParameters = new ScreenCaptureParameters();
|
||||
// screenCaptureParameters.captureVideo = true;
|
||||
// screenCaptureParameters.videoCaptureParameters.width = 1440;
|
||||
// screenCaptureParameters.videoCaptureParameters.height = 1940;
|
||||
// screenCaptureParameters.videoCaptureParameters.framerate = 15;
|
||||
// screenCaptureParameters.captureAudio = true;
|
||||
// screenCaptureParameters.audioCaptureParameters.captureSignalVolume = 50;
|
||||
//// screenCaptureParameters.videoCaptureParameters.bitrate = 500;
|
||||
// rtcEngine.startScreenCapture(screenCaptureParameters);
|
||||
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
Display display = manager.getDefaultDisplay();
|
||||
|
||||
@@ -693,6 +807,26 @@ public class AgoraManager {
|
||||
}
|
||||
|
||||
|
||||
public void setExternalMediaProjection(MediaProjection[] mediaProjection){
|
||||
rtcEngine.setExternalMediaProjection(mediaProjection[0]);
|
||||
}
|
||||
|
||||
public void isPost(){
|
||||
if (rtcEngine != null){
|
||||
ScreenCaptureParameters screenCaptureParameters = new ScreenCaptureParameters();
|
||||
|
||||
// 设置新的屏幕共享参数
|
||||
screenCaptureParameters.captureVideo = true;
|
||||
screenCaptureParameters.videoCaptureParameters.width = 1280;
|
||||
screenCaptureParameters.videoCaptureParameters.height = 720;
|
||||
screenCaptureParameters.videoCaptureParameters.framerate = 30;
|
||||
|
||||
// 更新屏幕共享参数
|
||||
rtcEngine.updateScreenCaptureParameters(screenCaptureParameters);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void isMute(int index) {
|
||||
if (rtcEngine != null) {
|
||||
}
|
||||
@@ -704,6 +838,13 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void stopMusicPlayer() {
|
||||
if (musicPlayer != null) {
|
||||
musicPlayer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 完全销毁实例(只在应用退出时调用)
|
||||
*/
|
||||
@@ -826,6 +967,23 @@ public class AgoraManager {
|
||||
return isLocalAudioEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加事件监听器(用于全局回调)
|
||||
*/
|
||||
// public void addEventHandler(IRtcEngineEventHandler handler) {
|
||||
// if (handler != null && !eventHandlers.contains(handler)) {
|
||||
// eventHandlers.add(handler);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 移除事件监听器
|
||||
*/
|
||||
// public void removeEventHandler(IRtcEngineEventHandler handler) {
|
||||
// if (handler != null) {
|
||||
// eventHandlers.remove(handler);
|
||||
// }
|
||||
// }
|
||||
public void addSoundLevelListener(SoundLevelUpdateListener listener) {
|
||||
if (soundLevelUpdateListeners != null) {
|
||||
soundLevelUpdateListeners.add(listener);
|
||||
@@ -838,12 +996,6 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAllSoundLevelListener() {
|
||||
if (soundLevelUpdateListeners != null) {
|
||||
soundLevelUpdateListeners.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void searchMusic(String keyword, int page) {
|
||||
if (musicContentCenter == null) {
|
||||
musicContentCenter = IAgoraMusicContentCenter.create(rtcEngine);
|
||||
@@ -966,7 +1118,7 @@ public class AgoraManager {
|
||||
case PLAYER_STATE_OPEN_COMPLETED:
|
||||
LogUtils.e("lxj", "播放");
|
||||
musicPlayer.play();
|
||||
musicPlayer.selectAudioTrack(0);//播放原生
|
||||
// musicPlayer.selectAudioTrack(0);//播放原生
|
||||
break;
|
||||
case PLAYER_STATE_PAUSING_INTERNAL:
|
||||
LogUtils.e("lxj", "关闭");
|
||||
@@ -1105,7 +1257,7 @@ public class AgoraManager {
|
||||
case PLAYER_STATE_OPEN_COMPLETED:
|
||||
LogUtils.e("lxj", "播放");
|
||||
musicPlayer.play();
|
||||
musicPlayer.selectAudioTrack(0);
|
||||
// musicPlayer.selectAudioTrack(0);
|
||||
break;
|
||||
case PLAYER_STATE_PAUSING_INTERNAL:
|
||||
LogUtils.e("lxj", "关闭");
|
||||
@@ -1202,21 +1354,31 @@ public class AgoraManager {
|
||||
*/
|
||||
public void setMusicVolume(int volume) {
|
||||
if (rtcEngine != null) {
|
||||
rtcEngine.adjustRecordingSignalVolume(volume);
|
||||
rtcEngine.adjustRecordingSignalVolume(volume);//调整采集信号音量
|
||||
|
||||
// musicPlayer.adjustPublishSignalVolume(volume);//调节远端用户听到的音量。 参数是0-400
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置伴奏阴凉
|
||||
* 设置伴奏音量
|
||||
*
|
||||
* @param volume
|
||||
*/
|
||||
public void settPlayoutVolume(int volume) {
|
||||
public void setPlayoutVolume(int volume) {
|
||||
if (musicPlayer != null) {
|
||||
musicPlayer.adjustPlayoutVolume(volume);
|
||||
musicPlayer.adjustPublishSignalVolume(volume);
|
||||
musicPlayer.adjustPlayoutVolume(volume);//调节本地播放音量。 参数是0-100
|
||||
musicPlayer.adjustPublishSignalVolume(volume*2);//调节远端用户听到的音量。 参数是0-400
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 伴奏音量
|
||||
* @param volume
|
||||
*/
|
||||
public void setAdjustPublishSignalVolume(int volume){
|
||||
musicPlayer.adjustPublishSignalVolume(volume);//调节远端用户听到的音量。 参数是0-400
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置音效
|
||||
|
||||
@@ -50,11 +50,16 @@ public class DateSelectDialog extends BaseBottomSheetDialog<MeDialogDateSelectBi
|
||||
@Override
|
||||
public void initData() {
|
||||
setYear();
|
||||
mBinding.pickerViewYear.setSelectedItemPosition(yearList.size());
|
||||
setMonth(TimeUtils.getYear());
|
||||
mBinding.pickerViewMonth.setSelectedItemPosition(monthList.size());
|
||||
setDay(TimeUtils.getYear(), TimeUtils.getMonth());
|
||||
mBinding.pickerViewDay.setSelectedItemPosition(dayList.size());
|
||||
int defaultYearPos = yearList.size() - 1; // 默认选中最新的年份(16年前)
|
||||
mBinding.pickerViewYear.setSelectedItemPosition(defaultYearPos);
|
||||
|
||||
// 获取默认年份
|
||||
int defaultYear = yearList.get(defaultYearPos).getDate();
|
||||
setMonth(defaultYear);
|
||||
mBinding.pickerViewMonth.setSelectedItemPosition(0);
|
||||
|
||||
setDay(defaultYear, 1);
|
||||
mBinding.pickerViewDay.setSelectedItemPosition(0);
|
||||
}
|
||||
|
||||
public void setData(String y, String m, String d) {
|
||||
@@ -124,41 +129,56 @@ public class DateSelectDialog extends BaseBottomSheetDialog<MeDialogDateSelectBi
|
||||
|
||||
|
||||
private List<DateBean> getDay(int year, int month) {
|
||||
int day = TimeUtils.getDaysByYearMonth(year, month);
|
||||
if (year == TimeUtils.getYear() && month == TimeUtils.getMonth()) {
|
||||
day = TimeUtils.getDay();
|
||||
int dayLimit = TimeUtils.getDaysByYearMonth(year, month);
|
||||
int currentYear = TimeUtils.getYear();
|
||||
int currentMonth = TimeUtils.getMonth();
|
||||
int currentDay = TimeUtils.getDay();
|
||||
|
||||
// 如果是最大年份且是最大月份,则日期不能超过当前日期
|
||||
if (year == currentYear - 16 && month == currentMonth) {
|
||||
dayLimit = currentDay;
|
||||
}
|
||||
|
||||
List<DateBean> dayList = new ArrayList<>();
|
||||
for (int i = 1; i <= day; i++) {
|
||||
for (int i = 1; i <= dayLimit; i++) {
|
||||
if (i <= 9) {
|
||||
dayList.add(new DateBean("0" + i, i));
|
||||
} else {
|
||||
dayList.add(new DateBean(String.valueOf(i), i));
|
||||
}
|
||||
}
|
||||
|
||||
return dayList;
|
||||
}
|
||||
|
||||
private List<DateBean> getMonth(int year) {
|
||||
List<DateBean> mothList = new ArrayList<>();
|
||||
int month = 12;
|
||||
if (year == TimeUtils.getYear()) {
|
||||
month = TimeUtils.getMonth();
|
||||
List<DateBean> monthList = new ArrayList<>();
|
||||
int currentYear = TimeUtils.getYear();
|
||||
int currentMonth = TimeUtils.getMonth();
|
||||
|
||||
int monthLimit = 12;
|
||||
// 如果是最大年份(16年前),则月份不能超过当前月份
|
||||
if (year == currentYear - 16) {
|
||||
monthLimit = currentMonth;
|
||||
}
|
||||
for (int i = 1; i <= month; i++) {
|
||||
|
||||
for (int i = 1; i <= monthLimit; i++) {
|
||||
if (i <= 9) {
|
||||
mothList.add(new DateBean("0" + i, i));
|
||||
monthList.add(new DateBean("0" + i, i));
|
||||
} else {
|
||||
mothList.add(new DateBean(String.valueOf(i), i));
|
||||
monthList.add(new DateBean(String.valueOf(i), i));
|
||||
}
|
||||
}
|
||||
return mothList;
|
||||
return monthList;
|
||||
}
|
||||
|
||||
private List<DateBean> getYear() {
|
||||
int year = TimeUtils.getYear();
|
||||
int currentYear = TimeUtils.getYear();
|
||||
int minYear = currentYear - 100; // 最小年份设为100年前
|
||||
int maxYear = currentYear - 16; // 最大年份设为16年前
|
||||
|
||||
List<DateBean> yearList = new ArrayList<>();
|
||||
for (int i = 1900; i <= year; i++) {
|
||||
for (int i = minYear; i <= maxYear; i++) {
|
||||
yearList.add(new DateBean(String.valueOf(i), i));
|
||||
}
|
||||
return yearList;
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.xscm.moduleutil.utils;
|
||||
|
||||
import android.Manifest;
|
||||
import android.graphics.Color;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.AbsoluteSizeSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.ConstraintSet;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.luck.picture.lib.interfaces.OnPermissionDescriptionListener;
|
||||
import com.luck.picture.lib.permissions.PermissionConfig;
|
||||
import com.luck.picture.lib.utils.DensityUtil;
|
||||
import com.luck.picture.lib.widget.MediumBoldTextView;
|
||||
|
||||
/**
|
||||
* com.xscm.moduleutil.utils
|
||||
* qx
|
||||
* 2025/10/30
|
||||
*/
|
||||
// PermissionDescriptionHelper.java
|
||||
public class PermissionDescriptionHelper {
|
||||
private static final String TAG_EXPLAIN_VIEW = "TAG_EXPLAIN_VIEW";
|
||||
|
||||
public static class PermissionDescriptionListener implements OnPermissionDescriptionListener {
|
||||
@Override
|
||||
public void onPermissionDescription(Fragment fragment, String[] permissionArray) {
|
||||
View rootView = fragment.requireView();
|
||||
if (rootView instanceof ViewGroup) {
|
||||
addPermissionDescription(false, (ViewGroup) rootView, permissionArray);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(Fragment fragment) {
|
||||
removePermissionDescription((ViewGroup) fragment.requireView());
|
||||
}
|
||||
}
|
||||
|
||||
public static OnPermissionDescriptionListener createListener() {
|
||||
return new PermissionDescriptionListener();
|
||||
}
|
||||
|
||||
public static void addPermissionDescription(boolean isHasSimpleXCamera, ViewGroup viewGroup, String[] permissionArray) {
|
||||
int dp10 = DensityUtil.dip2px(viewGroup.getContext(), 10);
|
||||
int dp15 = DensityUtil.dip2px(viewGroup.getContext(), 15);
|
||||
MediumBoldTextView view = new MediumBoldTextView(viewGroup.getContext());
|
||||
view.setTag(TAG_EXPLAIN_VIEW);
|
||||
view.setTextSize(14);
|
||||
view.setTextColor(Color.parseColor("#333333"));
|
||||
view.setPadding(dp10, dp15, dp10, dp15);
|
||||
view.setBackgroundColor(Color.WHITE); // 添加背景色确保可见
|
||||
|
||||
String title;
|
||||
String explain;
|
||||
|
||||
if (TextUtils.equals(permissionArray[0], PermissionConfig.CAMERA[0])) {
|
||||
title = "相机权限使用说明";
|
||||
explain = "相机权限使用说明\n用户app用于拍照/录视频";
|
||||
} else if (TextUtils.equals(permissionArray[0], Manifest.permission.RECORD_AUDIO)) {
|
||||
if (isHasSimpleXCamera) {
|
||||
title = "麦克风权限使用说明";
|
||||
explain = "麦克风权限使用说明\n用户app用于录视频时采集声音";
|
||||
} else {
|
||||
title = "录音权限使用说明";
|
||||
explain = "录音权限使用说明\n用户app用于采集声音";
|
||||
}
|
||||
}else if (TextUtils.equals(permissionArray[0], Manifest.permission.ACCESS_FINE_LOCATION)){
|
||||
title = "定位权限";
|
||||
explain = "定位权限使用说明\n用户app获取当前位置,方便更好的推荐附近玩乐";
|
||||
}
|
||||
else {
|
||||
title = "存储权限使用说明";
|
||||
explain = "存储权限使用说明\n用户app写入/下载/保存/读取/修改/删除图片、视频、文件等信息";
|
||||
}
|
||||
int startIndex = 0;
|
||||
int endOf = startIndex + title.length();
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(explain);
|
||||
builder.setSpan(new AbsoluteSizeSpan(DensityUtil.dip2px(viewGroup.getContext(), 16)), startIndex, endOf, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(new ForegroundColorSpan(0xFF333333), startIndex, endOf, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
view.setText(builder);
|
||||
view.setBackground(ContextCompat.getDrawable(viewGroup.getContext(), com.xscm.moduleutil.R.drawable.ps_demo_permission_desc_bg));
|
||||
|
||||
// 确保视图可见
|
||||
view.setVisibility(View.VISIBLE);
|
||||
view.setZ(9999); // 提高Z轴确保在最上层
|
||||
|
||||
if (isHasSimpleXCamera) {
|
||||
RelativeLayout.LayoutParams layoutParams =
|
||||
new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||
layoutParams.topMargin = DensityUtil.getStatusBarHeight(viewGroup.getContext());
|
||||
layoutParams.leftMargin = dp10;
|
||||
layoutParams.rightMargin = dp10;
|
||||
viewGroup.addView(view, layoutParams);
|
||||
} else {
|
||||
ConstraintLayout.LayoutParams layoutParams =
|
||||
new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT);
|
||||
// 修改约束设置,确保视图位置正确
|
||||
layoutParams.topToTop = ConstraintSet.PARENT_ID;
|
||||
layoutParams.leftToLeft = ConstraintSet.PARENT_ID;
|
||||
layoutParams.rightToRight = ConstraintSet.PARENT_ID;
|
||||
layoutParams.leftMargin = dp10;
|
||||
layoutParams.rightMargin = dp10;
|
||||
layoutParams.topMargin = DensityUtil.dip2px(viewGroup.getContext(), 50);
|
||||
viewGroup.addView(view, layoutParams);
|
||||
}
|
||||
|
||||
// 强制刷新布局
|
||||
viewGroup.requestLayout();
|
||||
viewGroup.postInvalidate();
|
||||
}
|
||||
|
||||
public static void removePermissionDescription(ViewGroup viewGroup) {
|
||||
if (viewGroup != null) {
|
||||
View tagExplainView = viewGroup.findViewWithTag(TAG_EXPLAIN_VIEW);
|
||||
if (tagExplainView != null) {
|
||||
viewGroup.removeView(tagExplainView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,4 +32,6 @@ public class SPConstants {
|
||||
public static final String USER_INFO = "userInfo";
|
||||
|
||||
public static final String FLOATING_SCREEN = "floatingScreen";
|
||||
|
||||
public static final String SHELF="shelf";
|
||||
}
|
||||
|
||||
@@ -327,7 +327,13 @@ public class SpUtil {
|
||||
String s = SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getString(SPConstants.EMQTT_CLIENT_ID);
|
||||
return s;
|
||||
}
|
||||
|
||||
public static void setShelf(int shelf){
|
||||
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put(SPConstants.SHELF, shelf);
|
||||
}
|
||||
public static int getShelf(){
|
||||
int shelf=SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt(SPConstants.SHELF);
|
||||
return shelf;
|
||||
}
|
||||
|
||||
//获取SharedPreferences音乐轮播方式
|
||||
public static int getPlayPattern() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.xscm.moduleutil.utils.config;
|
||||
|
||||
public enum EnvironmentEnum {
|
||||
// "https://vespa.qxyushen.top/",
|
||||
// "https://vespa.qxyushen.top/",
|
||||
PRODUCTION(//生产环境
|
||||
"https://vespa.qxyushen.top/",
|
||||
"KvNmqZc+VMzO4CfGMd5zmG6w6OFwpFO/19TwXUWfHDOBgmnl9DgIuE+kbrjNNnxqhtP3pH7bBrnSaSeFtunr72q6sgpLsfuswcUroMvz2slaTBcNzCaLi+GSnM3gB/GdO47mwLdk+iYBTvPUOCIuT608Z29z09w+vPeUDoMCHJBGXu6uh7Nj6PtV1dfGoUvByk1ZF0WYVjIqKDcb3tXY4jonFh3XAWhzMy8xKwN6F2nuK2IcdIwaSPsvuMZmhatP6f9kOE+vnfweyCHS3RxiG474WIoZGJM8omrl3/pOVqE=",
|
||||
@@ -14,7 +14,8 @@ public enum EnvironmentEnum {
|
||||
1600096860,
|
||||
"3e8f3add448d4692bc1d04c75ffe801b",
|
||||
"tcp://81.70.45.221",
|
||||
"https://vespa.qxyushen.top/h5"),
|
||||
"https://vespa.qxyushen.top/h5",
|
||||
0),
|
||||
TEST(//测试环境
|
||||
"https://test.vespa.qxyushen.top/",
|
||||
"6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=",
|
||||
@@ -27,7 +28,8 @@ public enum EnvironmentEnum {
|
||||
1600096890,
|
||||
"02f7339ec98947deaeab173599891932",
|
||||
"tcp://1.13.181.248",
|
||||
"https://tmd.xscmmidi.site/h5");
|
||||
"https://test.vespa.qxyushen.top/h5",
|
||||
1);
|
||||
|
||||
private final String serverUrl;//服务器地址
|
||||
private final String ALI_AUTH_KEY;//阿里云授权key
|
||||
@@ -47,10 +49,11 @@ public enum EnvironmentEnum {
|
||||
private final String mqttUrl;//MQTT服务器地址
|
||||
|
||||
private final String H5Url;//h5地址
|
||||
private final int shelf;//是否上架,0:平台更新,1:上架,发布到对应的应用商城
|
||||
|
||||
EnvironmentEnum(String serverUrl, String ALI_AUTH_KEY, String ossEndPoint, String ossaAcessKeyId,
|
||||
String ossAccessKeySecret, String ossBucketName, String ossBaseUrl, String wxAppId,
|
||||
int sdkAppId, String swSdkAppId,String mqttUrl,String H5Url) {
|
||||
int sdkAppId, String swSdkAppId,String mqttUrl,String H5Url,int shelf) {
|
||||
this.serverUrl = serverUrl;
|
||||
this.ALI_AUTH_KEY = ALI_AUTH_KEY;
|
||||
this.ossEndPoint = ossEndPoint;
|
||||
@@ -63,6 +66,11 @@ public enum EnvironmentEnum {
|
||||
this.swSdkAppId = swSdkAppId;
|
||||
this.mqttUrl = mqttUrl;
|
||||
this.H5Url = H5Url;
|
||||
this.shelf = shelf;
|
||||
}
|
||||
|
||||
public int getShelf() {
|
||||
return shelf;
|
||||
}
|
||||
|
||||
public String getH5Url() {
|
||||
|
||||
@@ -30,26 +30,6 @@ public class EnvironmentPrefs {
|
||||
|
||||
// 获取当前选择的环境,默认根据构建变体决定
|
||||
public EnvironmentEnum getSelectedEnvironment() {
|
||||
// // 检查是否是debug版本(开发版本)
|
||||
// if (BuildConfig.DEBUG) {
|
||||
// return EnvironmentEnum.TEST;
|
||||
// }
|
||||
//
|
||||
// // 检查flavor类型
|
||||
// if ("dev".equals(BuildConfig.FLAVOR)) {
|
||||
// return EnvironmentEnum.TEST;
|
||||
// }
|
||||
//
|
||||
// // 检查包名判断是否为开发版本
|
||||
// try {
|
||||
// String packageName = CommonAppContext.getInstance().getPackageName();
|
||||
// if (packageName.contains(".test") || packageName.contains(".dev")) {
|
||||
// return EnvironmentEnum.TEST;
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// // 忽略异常
|
||||
// }
|
||||
|
||||
// 默认使用生产环境
|
||||
String envName = sharedPreferences.getString(KEY_ENV, EnvironmentEnum.TEST.name());
|
||||
try {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class GmsLocationProvider implements LocationProvider {
|
||||
callback.onFailed("无法获取位置");
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(e -> callback.onFailed("Google Play 定位失败:" + e.getMessage()));
|
||||
.addOnFailureListener(e -> callback.onFailed("Google Play 定位失败:" ));
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.xscm.moduleutil.presenter.RewardGiftContacts;
|
||||
import com.xscm.moduleutil.presenter.RewardGiftPresenter;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
||||
import com.xscm.moduleutil.widget.floatingView.IFloatingView;
|
||||
|
||||
@@ -198,6 +199,17 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
||||
|
||||
@Override
|
||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||
|
||||
if (giftLabelBeans == null) return;
|
||||
if (SpUtil.getShelf()==1){
|
||||
for (GiftLabelBean giftLabelBean1 : giftLabelBeans){
|
||||
if (giftLabelBean1.getId().equals("2")){
|
||||
giftLabelBeans.remove(giftLabelBean1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans,fragmentList,""));
|
||||
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
||||
mBinding.slidingTabLayout.setCurrentTab(0);
|
||||
|
||||
BIN
moduleUtil/src/main/res/drawable-xxxhdpi/ic_topbar_back_dark.png
Normal file
|
After Width: | Height: | Size: 705 B |
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:useLevel="false">
|
||||
<corners android:radius="15dp" />
|
||||
<solid android:color="@color/ps_color_white" />
|
||||
|
||||
</shape>
|
||||
BIN
moduleUtil/src/main/res/mipmap-hdpi/accompany_off.webp
Normal file
|
After Width: | Height: | Size: 858 B |
BIN
moduleUtil/src/main/res/mipmap-hdpi/accompany_on.webp
Normal file
|
After Width: | Height: | Size: 822 B |
BIN
moduleUtil/src/main/res/mipmap-hdpi/icon_liang.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
moduleUtil/src/main/res/mipmap-hdpi/muisc_reward.webp
Normal file
|
After Width: | Height: | Size: 738 B |
BIN
moduleUtil/src/main/res/mipmap-hdpi/muisc_switch.webp
Normal file
|
After Width: | Height: | Size: 556 B |
BIN
moduleUtil/src/main/res/mipmap-hdpi/muisc_tyt.webp
Normal file
|
After Width: | Height: | Size: 692 B |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/accompany_off.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/accompany_on.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/icon_liang.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/muisc_reward.webp
Normal file
|
After Width: | Height: | Size: 988 B |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/muisc_switch.webp
Normal file
|
After Width: | Height: | Size: 646 B |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/muisc_tyt.webp
Normal file
|
After Width: | Height: | Size: 754 B |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/accompany_off.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/accompany_on.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/icon_liang.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/muisc_reward.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/muisc_switch.webp
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/muisc_tyt.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
@@ -178,6 +178,7 @@
|
||||
<color name="color_DFFFFE">#DFFFFE</color>
|
||||
<color name="color_F9FAFA">#F9FAFA</color>
|
||||
<color name="color_528AFF">#528AFF</color>
|
||||
<color name="color_EFEFEF">#EFEFEF</color>
|
||||
<color name="color_FF666666">#FF666666</color>
|
||||
<color name="color_FF576FFF">#FF576FFF</color>
|
||||
<color name="color_FF7685D6">#FF7685D6</color>
|
||||
|
||||