Compare commits

...

53 Commits

Author SHA1 Message Date
bcdfe106c2 1.测试 2025-09-26 04:33:54 +08:00
e55effea1a 1.定位的问题 2025-09-26 01:18:18 +08:00
bba729f5d0 1.定位的问题 2025-09-26 01:13:02 +08:00
59eeb1415b 1.添加巡乐会房间展示 2025-09-25 16:13:51 +08:00
a0ecafbbd7 1.修改电影房出现的不能横屏的问题 2025-09-24 18:55:47 +08:00
ea82b59b0a 1:修改拍卖房魅力清除
2:修改发现等待
2025-09-24 17:16:05 +08:00
407b21c33f 1:修改获取网络数据的解析方式
2:修改拍卖房的规则
2025-09-24 15:59:41 +08:00
5f573e607d 1:修改交友房
2:修改拍卖房
3:修改飘屏(没有修改成功)
2025-09-24 00:30:40 +08:00
1c54f0c072 1:修改BUG 2025-09-23 14:39:49 +08:00
f12ed5ef84 1:修改初始的时候更改图标 2025-09-19 19:04:47 +08:00
c446c7bb49 1.修改图片的位置,变更到drawable,清晰度
2.修改点唱房没人隐藏火热值
2025-09-19 18:19:20 +08:00
2551f7cfbc 1、修改背景图、应用log
2、修改房间报错
3、添加青少年模式
2025-09-19 17:40:18 +08:00
867435ee90 1、修改背景图、应用log
2、修改房间报错
3、添加青少年模式
2025-09-19 17:40:02 +08:00
fc544229fe 1、修改包的图片
2、修改房间的所有进出方式
2025-09-19 02:28:02 +08:00
4e0ea44f21 1、修改交友和轮盘bug和优化 2025-09-16 14:18:59 +08:00
a3255c39fb 修改聊天文字背景 2025-09-16 14:16:15 +08:00
72802ef7be 1.添加背包礼物交友功能 2025-09-16 00:56:58 +08:00
e87a368862 1:修改卡顿问题,
2:修改玄镜的动画
3:修改转盘获取数据
4:修改排行榜
2025-09-15 18:22:36 +08:00
joejin0118@163.com
572967ca16 修改转盘,声音会播放两次 2025-09-14 01:49:32 +08:00
joejin0118@163.com
ce8f9c57c4 修改转盘 2025-09-14 00:35:11 +08:00
74b3e6c92d 1:修改头像框出现了布局变更问题 2025-09-13 17:12:57 +08:00
1d348784ea 1:修改播放礼物特效
2:修改特效按照ios方式更改
2025-09-13 15:38:16 +08:00
5635d0c707 1:修改播放礼物特效
2:修改特效按照ios方式更改
2025-09-13 15:36:44 +08:00
d309c10cf7 1:修改进入房间更改火热值 2025-09-12 16:11:09 +08:00
qyy
a3b689c17e Merge branch 'master' of http://132.232.166.92:8089/MIDI/midi-android 2025-09-12 15:12:11 +08:00
qyy
fb2fd4c6f6 fix 修改动画 2025-09-12 15:12:00 +08:00
5ddf6fc638 1:添加在离线展示
2:修改在进入房间后再最小化,从后台进入出现在首页的问题
2025-09-12 11:19:27 +08:00
ea599bb63a 添加在礼物特效使用的bean 2025-09-12 09:18:24 +08:00
748912d3d1 1.修改播放礼物特效代码
2:修改从房间进入其他页面出现不能回到房间的问题
2025-09-12 09:08:14 +08:00
1157e8a545 1:添加快速点击出现的打开多次 2025-09-11 11:06:29 +08:00
c7d4c447dd 1:添加背包一键全清功能
2:添加查看心动值列表
3:修改进入小黑屋出现不能收到消息的问题
2025-09-11 10:20:51 +08:00
c54cc692e0 1.修改BUG
2.礼物添加一键全送功能
3.转盘修改底部按钮展示、音效和特效功能
2025-09-09 19:18:06 +08:00
6d3f67e53c 1:修改礼物背包送礼异常
2:修改添加照片出现错乱问题
3:修改头像框不显示的问题
4:修改我的背包显示不正确的问题
5:修改明细、收支时间问题
2025-09-08 17:23:38 +08:00
54014fe0f6 1:修改礼物背包送礼异常
2:修改添加照片出现错乱问题
3:修改头像框不显示的问题
4:修改我的背包显示不正确的问题
5:修改明细、收支时间问题
2025-09-08 17:22:58 +08:00
77b801cca6 修改点唱页面逻辑
修改背包展示问题
2025-09-06 19:28:18 +08:00
0db678d6a6 修改房间布局,根据宽度计算高度 2025-09-06 16:17:36 +08:00
e47bcfb8ab 添加混淆 2025-09-06 14:19:46 +08:00
3b31ba1dea 1:修改飘屏问题,在BaseActivity中进行监听
2:修改礼物问题
2025-09-06 14:19:23 +08:00
60e2980d89 修改个人主页添加照片、编辑个人添加照片、发布动态添加照片不能多次添加的问题 2025-09-06 00:57:51 +08:00
f387e05286 修改BUG
修改飘屏,飘屏不合适
2025-09-05 22:39:50 +08:00
7217a9e38e 修改BUG
修改飘屏,飘屏不合适
2025-09-05 21:39:42 +08:00
cb3b7aa183 1:修改群了会抽奖的动画
2:动画未完成
2025-09-05 00:46:27 +08:00
c8adbbc590 巡乐会添加榜单和记录
剩余转盘,屏幕适配器
2025-09-04 19:36:35 +08:00
1b8af0e733 巡乐会添加榜单和记录
剩余转盘,屏幕适配器
2025-09-04 19:36:17 +08:00
41c9e9d5d6 1:修改启动方式,
2:修改图标显示
2025-09-04 02:58:19 +08:00
830913e001 修改MQTT使用方式
修改bug
修改盲盒布局
2025-09-04 01:10:07 +08:00
c90b44ebf6 1:修改bug
2:给所有视图添加手动调用销毁的方法
2025-09-03 01:02:15 +08:00
b9c126ba73 修改BUG 2025-09-02 23:03:30 +08:00
101eb87e5f 修改BUG 2025-09-02 23:03:08 +08:00
fe4ff5655a 修改KTV房间编码模式
修改点唱房编码模式
优化展示麦位布局
优化Mqtt,变更成单例模式
2025-08-30 19:02:09 +08:00
04da1917d5 1:优化拍卖房功能
2:剩余选中类型展示问题
2025-08-30 00:02:55 +08:00
177f0f5c77 修改拍卖房结构,目前修改到拍卖者上麦下麦 2025-08-29 19:42:43 +08:00
37745313b9 修改拍卖房结构,目前修改到拍卖者上麦下麦 2025-08-29 19:42:03 +08:00
1367 changed files with 27666 additions and 7886 deletions

View File

@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-08-26T10:07:07.466132Z">
<DropdownSelection timestamp="2025-09-18T12:45:46.137835600Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=52324642" />
<DeviceId pluginId="PhysicalDevice" identifier="serial=6705124a" />
</handle>
</Target>
</DropdownSelection>

View File

@@ -1,6 +1,9 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,android.content.Context,obtainStyledAttributes" />
</inspection_tool>
<inspection_tool class="ComposePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
<option name="composableFile" value="true" />
<option name="previewFile" value="true" />

View File

@@ -1,8 +1,8 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}
}
android {
namespace 'com.xscm.midi'
compileSdk 35
@@ -18,8 +18,8 @@ android {
ndk {
//设置支持的so库
abiFilters 'arm64-v8a' ,'armeabi'
// abiFilters 'armeabi-v7a', 'arm64-v8a'
// abiFilters 'arm64-v8a', 'armeabi','arm64'
abiFilters 'arm64-v8a','armeabi-v7a'
}
javaCompileOptions {
@@ -55,7 +55,7 @@ android {
}
buildTypes {
release {
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
@@ -77,7 +77,7 @@ android {
debug {
debuggable true
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
@@ -148,7 +148,7 @@ dependencies {
implementation files('libs/WbCloudNormal-v5.1.10-4e3e198.aar')
implementation (libs.arouter.api.v150)
implementation(libs.arouter.api.v150)
//annotationProcessor
annotationProcessor libs.arouter.compiler
implementation project(':modulevocal') // 必须

View File

@@ -898,3 +898,37 @@ public static java.lang.String TABLENAME;
-keep class com.xscm.moduleutil.utils.location.** { *; }
-keep class io.agora.**{*;}
# 在proguard-rules.pro中添加
-keep class your.package.name.** {
public protected *;
}
# 或者针对特定方法
-keepclassmembers class * {
public void displayMessage();
}
# 在 proguard-rules.pro 中添加混淆规则
-keep class com.petterp.floatingx.** { *; }
-keep class com.petterp.floatingx.* { *; }
-dontwarn com.petterp.floatingx.**
# 保持MqttBean类不被混淆
-keep class com.xscm.moduleutil.event.MqttBean** {*;}
-keepclassmembers class com.xscm.moduleutil.event.MqttBean** {
*;
}
-keep class com.xscm.moduleutil.bean.XLHBean** {*;}
-keepclassmembers class com.xscm.moduleutil.bean.XLHBean** {
*;
}
# 保持EventBus相关类不被混淆
-keepclassmembers class * {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }

View File

@@ -11,9 +11,9 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 102,
"versionName": "1.0.0",
"outputFile": "秘地_1.0.0_102.apk"
"versionCode": 158,
"versionName": "1.0.5",
"outputFile": "秘地_1.0.5_158.apk"
}
],
"elementType": "File",
@@ -22,14 +22,14 @@
"minApi": 28,
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/秘地_1.0.0_102.dm"
"baselineProfiles/1/秘地_1.0.5_158.dm"
]
},
{
"minApi": 31,
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/秘地_1.0.0_102.dm"
"baselineProfiles/0/秘地_1.0.5_158.dm"
]
}
],

View File

@@ -115,7 +115,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:name=".AppContext"
android:allowBackup="true"
@@ -124,30 +124,33 @@
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:requestLegacyExternalStorage="true"
android:icon="@mipmap/ic_launcher"
android:resizeableActivity="false"
android:icon="@mipmap/ic_launcher_app"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_launcher_round_app"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme_MAIN"
android:networkSecurityConfig="@xml/network_security_config"
android:usesCleartextTraffic="true"
tools:targetApi="tiramisu"
tools:ignore="SelectedPhotoAccess"
tools:replace="android:theme,android:allowBackup"
android:enableOnBackInvokedCallback="true"
android:requestRawExternalStorageAccess="true"
tools:targetApi="tiramisu"
>
<activity
android:name=".LaunchPageActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:screenOrientation="behind"
android:launchMode="singleTask">
android:theme="@style/main_SplashThemeImage">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.xscm.action.LAUNCH_PAGE" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- 配置APP ID -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 142 KiB

View File

@@ -4,19 +4,98 @@ package com.xscm.midi;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.PersistableBundle;
import android.util.Log;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.xscm.modulelogin.activity.ImproveInfoActivity;
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
import com.xscm.moduleutil.base.AppStateListener;
import com.xscm.moduleutil.base.AppStateManager;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.dialog.PolicyDialog;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.midi.databinding.ActivityLaunchPageBinding;
public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPageBinding> {
/**
APP准备启动
*
* _oo0oo_
* o8888888o
* 88" . "88
* (| -_- |)
* 0\ = /0
* ___/`---'\___
* .' \\| |// '.
* / \\||| : |||// \
* / _||||| -卍-|||||- \
* | | \\\ - /// | |
* | \_| ''\---/'' |_/ |
* \ .-\__ '-' ___/-. /
* ___'. .' /--.--\ `. .'___
* ."" '< `.___\_<|>_/___.' >' "".
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
* \ \ `_. \_ __\ /__ _/ .-` / /
*=====`-.____`.___ \_____/___.-`___.-'=====
* `=---='
*
* 佛祖保佑 永无BUG
* 佛曰:
* 写字楼里写字间,写字间里程序员;
* 程序人员写程序,又拿程序换酒钱。
* 酒醒只在网上坐,酒醉还来网下眠;
* 酒醉酒醒日复日,网上网下年复年。
* 但愿老死电脑间,不愿鞠躬老板前;
* 奔驰宝马贵者趣,公交自行程序员。
* 别人笑我忒疯癫,我笑自己命太贱;
* 不见满街漂亮妹,哪个归得程序员?
*/
public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPageBinding> {
private Handler handler;
private PolicyDialog policyDialog;
private AppStateListener appStateListener;
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
// 获取Application实例并设置监听器
CommonAppContext app = (CommonAppContext) getApplication();
appStateListener = AppStateManager.getInstance();
app.setAppStateListener(appStateListener);
if (!isTaskRoot()) {
if (SpUtil.getUnderagePassword() != null && !SpUtil.getUnderagePassword().isEmpty()) {
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken())
.withString("type", "1").navigation();//type==1青少年模式
} else {
// 如果没有设置青少年模式,应该导航到首页
try {
ARouter.getInstance().build(ARouteConstants.ME).navigation();
} catch (Exception e) {
Log.e("LaunchPageActivity", "导航到首页失败", e);
}
}
finish();
return;
}
// if (shouldRestoreRoom()) {
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
// }
}
private boolean shouldRestoreRoom() {
// 检查是否应该恢复房间:
// 1. 应用有正在播放的房间
// 2. 应用应该显示房间
// 3. 应用是从后台恢复的(通过检查 CommonAppContext 状态)
return CommonAppContext.getInstance().isPlaying
&& CommonAppContext.getInstance().isShow;
}
@Override
protected void initData() {
@@ -54,6 +133,7 @@ public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPage
}
@Override
protected void onDestroy() {
// 如果 PolicyDialog 仍在显示,则 dismiss 它
@@ -69,6 +149,7 @@ public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPage
super.onDestroy();
}
@Override
protected void initView() {
@@ -86,14 +167,12 @@ public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPage
}
@Override
protected int getLayoutId() {
return R.layout.activity_launch_page;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -307,11 +307,13 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
bundle.putSerializable("userBean", userBean);
intent.putExtras(bundle);
startActivity(intent);
finish();
} else {
EventBus.getDefault().post(userBean);
startActivity(new Intent(this, MainActivity.class));
finish();
}
finish();
// finish();
}
}

View File

@@ -16,6 +16,7 @@ import com.example.modulevocal.presenter.RealNamePresenter;
import com.xscm.moduleutil.activity.BaseMvpActivity;
import com.xscm.moduleutil.bean.RealNameBean;
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.dialog.ConfirmDialog;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.SpUtil;
@@ -112,6 +113,7 @@ public class RealNameActivity extends BaseMvpActivity<RealNamePresenter, Activit
} else {
Log.d("@@@", "刷脸失败!");
// queren1();
}
}
//刷脸结束后,及时释放资源
@@ -125,15 +127,50 @@ public class RealNameActivity extends BaseMvpActivity<RealNamePresenter, Activit
Log.d("@@@", "刷脸失败!");
//刷脸结束后,及时释放资源
WbCloudFaceVerifySdk.getInstance().release();
// queren1();
}
});
}
@Override
public void sendCodeSuccess() {
// queren();
finish();
}
private void queren() {
// 创建并显示确认对话框
new ConfirmDialog(this,
"温馨提示",
"恭喜您获得内测资格将获得10万金币",
"确认",
"",
v -> {
// 点击“确认”按钮时执行
finish();
},
v -> {
// 点击“取消”按钮时什么都不做
}, true, 0).show();
}
private void queren1() {
// 创建并显示确认对话框
new ConfirmDialog(this,
"温馨提示",
"实名未通过,重新实名",
"确认",
"",
v -> {
// 点击“确认”按钮时执行
finish();
},
v -> {
// 点击“取消”按钮时什么都不做
}, true, 0).show();
}
private void onClick(View view) {
if (view.getId()== R.id.btnSubmit){
if (mBinding.edName.getText().toString().isEmpty()){

View File

@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0.56"
android:scaleY="0.56"
android:translateX="23.76"
android:translateY="23.76">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</group>
</vector>

View File

@@ -1,30 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -10,7 +10,26 @@
<item name="android:windowBackground">@color/color_F9FAFA</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="main_SplashThemeImage" parent="AppTheme.NoActionBar">
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<!--StartActivity Style 冷启动效果-->
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowBackground">@mipmap/screen</item>
</style>
<!-- 在 styles.xml 中添加透明主题 -->
<style name="TransparentTheme" parent="AppTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
<style name="LauncherAppTheme" parent="AppTheme">

View File

@@ -19,6 +19,8 @@ buildscript {
// ✅ 添加 ARouter 插件依赖
classpath 'com.alibaba:arouter-register:1.0.2'
// classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin
}
}
plugins {

View File

@@ -29,8 +29,8 @@ isBuildModule=false
#org.gradle.deamon=false
android.injected.testOnly=false
APP_VERSION_NAME=1.0.0
APP_VERSION_CODE=103
APP_VERSION_NAME=1.1.0
APP_VERSION_CODE=163
org.gradle.jvm.toolchain.useLegacyAdapters=false
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
@@ -48,4 +48,7 @@ beta=false
org.gradle.caching=false
# ??APT????
kapt.incremental.apt=false
kapt.incremental.apt=false
# 或者禁用特定模块的增量编译
#org.gradle.configureondemand=false

View File

@@ -21,6 +21,7 @@ githubRealtimeblurviewVersion = "1.2.1"
githubShadowlayout = "3.3.1"
gradle = "8.8.0"
#gradle = "8.5.0-alpha04"
greendaoGradlePlugin = "3.3.0"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
@@ -97,6 +98,7 @@ github-photoview = { module = "com.github.chrisbanes:PhotoView", version.ref = "
github-shadowlayout = { module = "com.github.lihangleo2:ShadowLayout", version.ref = "githubShadowlayout" }
#glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "githubGlide" }
gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle" }
greendao-gradle-plugin = { module = "org.greenrobot:greendao-gradle-plugin", version.ref = "greendaoGradlePlugin" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
@@ -161,4 +163,5 @@ android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinVersion" }
#kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlinVersion" }
#alibaba-arouter = { id = "com.alibaba.arouter", version.ref = "arouter" }
greendao-plugin = { id = "org.greenrobot.greendao", version.ref = "greendaoGradlePlugin" }

View File

@@ -1,8 +1,6 @@
#Wed May 07 09:31:48 CST 2025
#Mon Sep 22 21:05:11 CST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
#distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=file:///D:/Greadle/gradle-8.10.2-all.zip
distributionUrl=file:///D:/Gradle/gradle-8.10.2-bin.zip
zipStorePath=wrapper/distsl.

View File

@@ -69,7 +69,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
mBinding.edNickName.setText(userBean.getNickname());
}
mBinding.edNickName.setClearIconVisible(true);
ImageUtils.loadHeadCC(userBean.getAvatar(), mBinding.rvUserHead);
// ImageUtils.loadHeadCC(userBean.getAvatar(), mBinding.rvUserHead);
if (!TextUtils.isEmpty(user_no_parent) && !"0".equals(user_no_parent)) {
mBinding.etInviteCode.setText(user_no_parent);
mBinding.etInviteCode.setKeyListener(null);
@@ -203,7 +203,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
.setImageEngine(GlideEngine.createGlideEngine())
.setMaxSelectNum(1)
.isPreviewImage(true)
.isDisplayCamera(true)
.isDisplayCamera(false)
.setOutputCameraDir(Constants.FILE_PATH)
.isOriginalSkipCompress(true)
.forResult(requestCode); //结果回调onActivityResult code

View File

@@ -184,7 +184,7 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
public void loginSuccess(List<UserBean> userBean) {
if (userBean == null) {
ToastUtils.showShort("登录失败请重试");
// ToastUtils.showShort("登录失败请重试");
return;
}
if (userBean.size() == 1) {

View File

@@ -31,32 +31,51 @@
android:textStyle="bold"
android:visibility="gone" />
<com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/rv_user_head"
android:layout_width="@dimen/dp_74"
android:layout_height="@dimen/dp_74"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_10"
android:src="@mipmap/me_img_upld_head"
app:riv_oval="true" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/rv_user_head"
android:layout_width="@dimen/dp_74"
android:layout_height="@dimen/dp_74"
android:layout_gravity="center_horizontal"
android:src="@mipmap/user_wait_header"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:riv_oval="true" />
<ImageView
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:src="@mipmap/zhaop"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="@+id/rv_user_head"
app:layout_constraintEnd_toEndOf="@+id/rv_user_head"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_80"
android:layout_marginLeft="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_54"
android:layout_marginRight="@dimen/dp_40"
>
android:layout_marginTop="@dimen/dp_34"
android:layout_marginRight="@dimen/dp_40">
<TextView
android:id="@+id/tv_ts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:letterSpacing="0.1"
android:text="起个好听的名字"
android:textColor="#73000000"
android:textSize="16sp"
android:textStyle="bold"
android:letterSpacing="0.1"/>
android:textStyle="bold" />
<LinearLayout
android:id="@+id/ll"
@@ -69,13 +88,13 @@
<com.xscm.moduleutil.widget.ClearEditText
android:id="@+id/ed_nick_name"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/bg_r100_hui"
android:hint="请输入昵称"
android:gravity="center|left"
android:paddingStart="10dp"
android:hint="请输入昵称"
android:maxLength="10"
android:paddingStart="10dp"
android:paddingEnd="@dimen/dp_10"
android:singleLine="true"
android:text=""
@@ -85,13 +104,12 @@
<TextView
android:id="@+id/tv_user_name"
android:layout_width="0dp"
android:layout_weight="0.2"
android:layout_height="wrap_content"
android:text="随机"
android:layout_weight="0.2"
android:gravity="center"
android:text="随机"
android:textColor="@color/color_FF6C49E4"
android:textSize="14sp"
/>
android:textSize="14sp" />
</LinearLayout>
@@ -102,6 +120,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_40"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -109,13 +128,13 @@
android:textColor="#73000000"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" (注册成功,不可更改)"
android:textColor="#33000000"
android:textSize="12sp"
/>
android:textSize="12sp" />
</LinearLayout>
@@ -124,27 +143,25 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_72"
android:layout_marginStart="@dimen/dp_40"
android:layout_marginEnd="@dimen/dp_40"
android:layout_marginTop="12dp"
android:orientation="horizontal"
android:background="@drawable/selector_sex_mm">
android:layout_marginEnd="@dimen/dp_40"
android:background="@drawable/selector_sex_mm"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/rl_nv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
>
android:gravity="center">
<ImageView
android:id="@+id/iv_boy"
android:layout_width="@dimen/dp_137"
android:layout_height="@dimen/dp_72"
android:src="@mipmap/check_boy"
android:scaleType="fitCenter"
/>
android:src="@mipmap/check_boy" />
</RelativeLayout>
<RelativeLayout
@@ -152,16 +169,14 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
>
android:gravity="center">
<ImageView
android:id="@+id/iv_girl"
android:layout_width="@dimen/dp_137"
android:layout_height="@dimen/dp_72"
android:src="@mipmap/check_girl"
android:scaleType="fitCenter"
/>
android:src="@mipmap/check_girl" />
</RelativeLayout>
@@ -174,6 +189,7 @@
android:layout_marginStart="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_24"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -195,24 +211,24 @@
<TextView
android:id="@+id/tv_year"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/dp_44"
android:layout_weight="1"
android:background="@drawable/bg_r100_hui"
android:singleLine="true"
android:gravity="center"
android:singleLine="true"
android:text="2001"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold" />
android:textStyle="bold" />
<TextView
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_7"
android:layout_marginEnd="@dimen/dp_7"
android:layout_weight="0.2"
android:gravity="center"
android:text="年"
android:layout_marginStart="@dimen/dp_7"
android:layout_marginEnd="@dimen/dp_7"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold" />
@@ -220,49 +236,49 @@
<TextView
android:id="@+id/tv_month"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/dp_44"
android:layout_weight="1"
android:background="@drawable/bg_r100_hui"
android:gravity="center"
android:singleLine="true"
android:text="12"
android:gravity="center"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold" />
android:textStyle="bold" />
<TextView
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:gravity="center"
android:layout_marginStart="@dimen/dp_7"
android:layout_marginEnd="@dimen/dp_7"
android:layout_weight="0.2"
android:gravity="center"
android:text="月"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold" />
android:textStyle="bold" />
<TextView
android:id="@+id/tv_day"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/dp_44"
android:layout_weight="1"
android:background="@drawable/bg_r100_hui"
android:singleLine="true"
android:gravity="center"
android:singleLine="true"
android:text="1"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold" />
android:textStyle="bold" />
<TextView
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_7"
android:layout_marginEnd="@dimen/dp_7"
android:layout_weight="0.2"
android:gravity="center"
android:text="日"
android:layout_marginStart="@dimen/dp_7"
android:layout_marginEnd="@dimen/dp_7"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold" />
@@ -301,15 +317,14 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_42"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_centerInParent="true"
android:background="@drawable/theme_bg"
android:layout_marginLeft="@dimen/dp_40"
android:layout_marginRight="@dimen/dp_40"
android:layout_marginBottom="@dimen/dp_20"
android:gravity="center"
>
android:background="@drawable/theme_bg"
android:gravity="center">
<ImageView
android:id="@+id/iv_commit_bg"
@@ -317,8 +332,8 @@
android:layout_height="@dimen/dp_75"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:visibility="gone"
android:src="@drawable/theme_bg" />
android:src="@drawable/theme_bg"
android:visibility="gone" />
<TextView
android:layout_width="wrap_content"
@@ -326,19 +341,18 @@
android:layout_gravity="center"
android:enabled="false"
android:gravity="center"
android:text="开启羽声之旅"
android:text="开启秘地之旅"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="gone"/>
android:visibility="gone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="21dp"
android:text="进入秘地"
android:textColor="@color/color_white"
android:textSize="16sp"
/>
android:textSize="16sp" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -156,6 +156,9 @@ dependencies {
api(libs.zcw.togglebutton.library)
//图片模糊
api(libs.com.github.mmin18.realtimeblurview)
api 'com.baoyz.actionsheet:library:1.1.7'
//播放器
//腾讯直播sdk
api('com.tencent.liteav:LiteAVSDK_Professional:10.9.0.13102')
@@ -204,7 +207,13 @@ dependencies {
api 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
api 'io.github.mayzs:paho.mqtt.android:1.2.1'
// api project(':LocalAar')
// room数据库
// def room_version = "2.5.0"
// implementation "androidx.room:room-runtime:$room_version"
// implementation "androidx.room:room-ktx:$room_version"
// annotationProcessor "androidx.room:room-compiler:$room_version"
//2. 云normal SDK
//aar的名称例如WbCloudNormal-v5.1.10-123456789.aar填入 'WbCloudNormal-v5.1.10-123456789.aar'

View File

@@ -6,16 +6,9 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<application android:allowBackup="true">
<service
android:name=".service.MyRoomService"
android:enabled="true"
android:exported="true"/>
<activity
android:name=".activity.QxActivity"
android:exported="false" />
<service
android:name=".http.FloatingWindowService"
@@ -36,14 +29,17 @@
android:name=".activity.news.OfficialNoticeActivity"
android:exported="false" />
<service android:name="org.eclipse.paho.android.service.MqttService" /> <!-- <receiver android:name="org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver" -->
<!-- <service android:name="org.eclipse.paho.android.service.MqttService"-->
<!-- android:exported="false"/> &lt;!&ndash; <receiver android:name="org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver" &ndash;&gt;-->
<!-- android:enabled="true" -->
<!-- android:exported="true" -->
<!-- tools:ignore="Instantiatable" /> -->
<!-- <service android:name=".service.EMqttService" />-->
<service
android:name=".service.MyMqttService"
android:foregroundServiceType="dataSync" />
<!-- <service-->
<!-- android:name=".service.MyMqttService"-->
<!-- android:enabled="true"-->
<!-- android:exported="false"-->
<!-- android:foregroundServiceType="dataSync" />-->
</application>
</manifest>

View File

@@ -1,18 +1,41 @@
package com.xscm.moduleutil.activity;
import static androidx.core.content.ContextCompat.getSystemService;
import static com.xscm.moduleutil.base.CommonAppContext.postDelayed;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
@@ -20,15 +43,22 @@ import androidx.databinding.ViewDataBinding;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.BarUtils;
import com.blankj.utilcode.util.LogUtils;
import com.hjq.toast.ToastUtils;
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.bean.XLHBean;
import com.xscm.moduleutil.event.MqttBean;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.BackgroundManager;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.DisplayUtil;
import com.xscm.moduleutil.utils.LanguageUtil;
import com.xscm.moduleutil.utils.ImageUtils;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.moduleutil.utils.SystemUtils;
import com.xscm.moduleutil.widget.QXGiftDriftView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -44,7 +74,8 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(LanguageUtil.attachBaseContext(newBase));
// 设置字体缩放比例为1.0f,即不跟随系统字体大小变化
super.attachBaseContext(DisplayUtil.attachBaseContext(newBase, 1.0f));
}
protected VDB mBinding;
@@ -73,6 +104,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
ActivityUtils.finishAllActivities();
}
QXGiftDriftView qxGiftDriftView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -115,17 +147,40 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
EventBus.getDefault().register(this);
}
}
// // 设置全屏模式,隐藏状态栏和导航栏
// View decorView = getWindow().getDecorView();
// decorView.setSystemUiVisibility(
// View.SYSTEM_UI_FLAG_LAYOUT_STABLE
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
// | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
// | View.SYSTEM_UI_FLAG_FULLSCREEN
// | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
// 在Activity中
private static final int REQUEST_OVERLAY_PERMISSION = 1001;
private void checkAndRequestOverlayPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!Settings.canDrawOverlays(this)) {
new AlertDialog.Builder(this)
.setTitle("需要悬浮窗权限")
.setMessage("应用需要悬浮窗权限才能显示飘屏效果")
.setPositiveButton("去设置", (dialog, which) -> {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, REQUEST_OVERLAY_PERMISSION);
})
.setNegativeButton("取消", null)
.show();
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_OVERLAY_PERMISSION) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (Settings.canDrawOverlays(this)) {
ToastUtils.show("已获得悬浮窗权限");
} else {
ToastUtils.show("未获得悬浮窗权限");
}
}
}
}
public static void finishAll() {
@@ -226,6 +281,36 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
@Override
protected void onDestroy() {
// 清理MQTT相关资源
synchronized (mqttQueueLock) {
mqttMessageQueue.clear();
isMqttPlaying = false;
}
// 清理XLH相关资源
synchronized (xlhQueueLock) {
xlhMessageQueue.clear();
isXlhPlaying = false;
}
// 移除当前显示的视图
try {
if (currentMqttView != null && currentMqttView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentMqttView.getParent();
parent.removeView(currentMqttView);
}
currentMqttView = null;
if (currentXlhView != null && currentXlhView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentXlhView.getParent();
parent.removeView(currentXlhView);
}
currentXlhView = null;
} catch (Exception e) {
LogUtils.e("清理飘屏视图失败", e);
}
// 移除背景更新监听器
BackgroundManager.getInstance().removeListener(this);
// 移除颜色变化监听器
@@ -236,6 +321,12 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
try {
unregisterReceiver(mLogoutReceiver);
} catch (Exception e) {
// 忽略异常
}
try {
unregisterReceiver(mLogoutReceiver);
} catch (Exception e) {
@@ -307,16 +398,376 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
return false;
}
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void onMessageReceived(MqttBean mqttBean) {
//// PiaoPingManager.getInstance(this).showPiaoPingMessage(mqttBean);
// FxAppHelper fxAppHelper = FxAppHelper.builder().setContext(this).setLayout(R.layout.item_piaoping).build();
// FloatingX.install(fxAppHelper).show();
// }
/// 礼物特效
// 在类中添加以下成员变量
private final List<MqttBean.ListBean> mqttMessageQueue = new ArrayList<>(); // MQTT消息队列
private final List<XLHBean> xlhMessageQueue = new ArrayList<>(); // XLH消息队列
private boolean isMqttPlaying = false; // MQTT播放状态标志
private boolean isXlhPlaying = false; // XLH播放状态标志
private final Object mqttQueueLock = new Object(); // MQTT队列同步锁
private final Object xlhQueueLock = new Object(); // XLH队列同步锁
private View currentMqttView = null; // 当前正在播放的MQTT视图
private View currentXlhView = null; // 当前正在播放的XLH视图
/// 礼物特效 - MQTT消息处理
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageReceived(MqttBean mqttBean) {
LogUtils.e("收到MQTT", mqttBean);
if (mqttBean == null) return;
if (SpUtil.getFloatingScreen() == 1) {
synchronized (mqttQueueLock) {
mqttMessageQueue.addAll(mqttBean.getList());
// if (!isMqttPlaying) {
// isMqttPlaying = true;
processNextMqttMessage();
// }
}
}else {
mqttMessageQueue.clear();
}
}
/// XLH消息处理
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(XLHBean event) {
LogUtils.e("收到XLH", event);
if (event == null) return;
if (SpUtil.getFloatingScreen() == 1) {
synchronized (xlhQueueLock) {
xlhMessageQueue.add(event);
if (!isXlhPlaying) {
isXlhPlaying = true;
processNextXlhMessage();
}
}
} else {
xlhMessageQueue.clear();
}
}
// 处理下一个MQTT消息
private void processNextMqttMessage() {
MqttBean.ListBean mqttBean;
synchronized (mqttQueueLock) {
if (mqttMessageQueue.isEmpty()) {
isMqttPlaying = false;
return;
}
mqttBean = mqttMessageQueue.remove(0);
}
showFloatingMessage(mqttBean);
}
// 处理下一个XLH消息
private void processNextXlhMessage() {
XLHBean xlhBean;
synchronized (xlhQueueLock) {
if (xlhMessageQueue.isEmpty()) {
isXlhPlaying = false;
return;
}
xlhBean = xlhMessageQueue.remove(0);
}
showPiaoPingMessageXlh(xlhBean);
}
ViewGroup decorView;
ViewGroup decorView1;
private void showFloatingMessage(MqttBean.ListBean mqttBean) {
// QXGiftDriftView.getInstance( this).addGiftModel(mqttBean);
try {
// 清理之前的视图(如果存在)
if (currentMqttView != null && currentMqttView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentMqttView.getParent();
parent.removeView(currentMqttView);
}
if (decorView == null) {
decorView = (ViewGroup) getWindow().getDecorView();
}
currentMqttView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 70);
layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
currentMqttView.setLayoutParams(layoutParams);
decorView.addView(currentMqttView);
updateFloatingViewData(currentMqttView, mqttBean);
resetAndStartMqttAnimation(currentMqttView, () -> {
// 清理当前视图
if (currentMqttView != null && currentMqttView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentMqttView.getParent();
parent.removeView(currentMqttView);
}
currentMqttView = null;
// 处理队列中的下一条消息
synchronized (mqttQueueLock) {
isMqttPlaying = false;
processNextMqttMessage();
}
});
} catch (Exception e) {
LogUtils.e("显示MQTT飘屏失败", e);
// 出现异常时继续处理队列
synchronized (mqttQueueLock) {
isMqttPlaying = false;
processNextMqttMessage();
}
}
}
private void showPiaoPingMessageXlh(XLHBean event) {
try {
// 清理之前的视图(如果存在)
if (currentXlhView != null && currentXlhView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentXlhView.getParent();
parent.removeView(currentXlhView);
}
if (decorView1 == null) {
decorView1 = (ViewGroup) getWindow().getDecorView();
}
currentXlhView = LayoutInflater.from(this).inflate(R.layout.item_piaoping_xlh, null);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 100);
layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
currentXlhView.setLayoutParams(layoutParams);
decorView1.addView(currentXlhView);
updateXlhFloatingViewData(currentXlhView, event);
resetAndStartXlhAnimation(currentXlhView, () -> {
// 清理当前视图
if (currentXlhView != null && currentXlhView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentXlhView.getParent();
parent.removeView(currentXlhView);
}
currentXlhView = null;
// 处理队列中的下一条消息
synchronized (xlhQueueLock) {
isXlhPlaying = false;
processNextXlhMessage();
}
});
} catch (Exception e) {
LogUtils.e("显示XLH飘屏失败", e);
// 出现异常时继续处理队列
synchronized (xlhQueueLock) {
isXlhPlaying = false;
processNextXlhMessage();
}
}
}
private void resetAndStartMqttAnimation(View view, Runnable onAnimationEnd) {
try {
int screenWidth = getScreenWidth();
// 设置初始位置:在屏幕右侧外部(完全不可见)
view.setTranslationX(screenWidth);
TranslateAnimation enterAnim = new TranslateAnimation(
Animation.ABSOLUTE, screenWidth,
Animation.ABSOLUTE, (screenWidth - SystemUtils.getWidth(316)) / 2,
Animation.ABSOLUTE, 0,
Animation.ABSOLUTE, 0
);
enterAnim.setDuration(1500);
enterAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
// 停留后退出
postDelayed(() -> {
TranslateAnimation exitAnim = new TranslateAnimation(
Animation.ABSOLUTE, (screenWidth - SystemUtils.getWidth(316)) / 2,
Animation.ABSOLUTE, -screenWidth,
Animation.ABSOLUTE, 0,
Animation.ABSOLUTE, 0
);
exitAnim.setDuration(2000);
exitAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
// 移除视图并处理下一个
// ViewGroup rootView = (ViewGroup) getParent();
// if (rootView != null) {
// rootView.removeView(QXGiftDriftView.this);
// }
//
// if (!dataArray.isEmpty()) {
// dataArray.remove(0);
// }
// isPlaying = false;
//
// if (!dataArray.isEmpty()) {
// giftAction();
// }
onAnimationEnd.run();
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
view.startAnimation(exitAnim);
}, 3000); // 停留1秒
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
view.startAnimation(enterAnim);
// ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
// animator1.setDuration(1500);
// animator1.setInterpolator(new DecelerateInterpolator(1f));
// animator1.start();
// view.postDelayed(() -> {
// try {
// ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", 0f, -view.getWidth());
// animator2.setDuration(3000);
// animator2.setInterpolator(new DecelerateInterpolator(2.0f));
// animator2.addListener(new AnimatorListenerAdapter() {
// @Override
// public void onAnimationEnd(Animator animation) {
// onAnimationEnd.run();
// }
//
// @Override
// public void onAnimationCancel(Animator animation) {
// onAnimationEnd.run();
// }
// });
// animator2.start();
// } catch (Exception e) {
// LogUtils.e("MQTT动画执行失败", e);
// onAnimationEnd.run();
// }
// }, 3000);
} catch (Exception e) {
LogUtils.e("MQTT动画启动失败", e);
onAnimationEnd.run();
}
}
// 添加获取屏幕宽度的方法
private int getScreenWidth() {
DisplayMetrics displayMetrics = new DisplayMetrics();
if (getWindowManager() != null) {
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return displayMetrics.widthPixels;
}
return getResources().getDisplayMetrics().widthPixels;
}
private void resetAndStartXlhAnimation(View view, Runnable onAnimationEnd) {
try {
view.setTranslationX(view.getWidth());
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
animator1.setDuration(1500);
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
animator1.start();
view.postDelayed(() -> {
try {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", 0f, -view.getWidth());
animator2.setDuration(1500);
animator2.setInterpolator(new DecelerateInterpolator(2.0f));
animator2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onAnimationEnd.run();
}
@Override
public void onAnimationCancel(Animator animation) {
onAnimationEnd.run();
}
});
animator2.start();
} catch (Exception e) {
LogUtils.e("XLH动画执行失败", e);
onAnimationEnd.run();
}
}, 3000);
} catch (Exception e) {
LogUtils.e("XLH动画启动失败", e);
onAnimationEnd.run();
}
}
private void updateFloatingViewData(View view, MqttBean.ListBean mqttBean) {
TextView textView = view.findViewById(R.id.tv_name);
TextView textView2 = view.findViewById(R.id.tv_to_name);
TextView tv_time = view.findViewById(R.id.tv_num);
if (mqttBean != null) {
textView2.setText("送给" + (mqttBean.getToUserName() != null ? mqttBean.getToUserName() : ""));
textView.setText(mqttBean.getFromUserName() != null ? mqttBean.getFromUserName() : "");
if (mqttBean.getGift_picture() != null) {
ImageUtils.loadHeadCC(mqttBean.getGift_picture(), view.findViewById(R.id.iv_piaoping));
}
tv_time.setText("x" + (mqttBean.getNumber() != null ? mqttBean.getNumber() : "1"));
} else {
textView2.setText("送给");
textView.setText("");
tv_time.setText("x1");
}
}
private void updateXlhFloatingViewData(View view, XLHBean xlhBean) {
TextView textView = view.findViewById(R.id.tv_name);
ImageView xlh_image = view.findViewById(R.id.im_xlh);
if (xlhBean != null) {
xlh_image.setImageDrawable(xlhBean.getFrom_type() == 1 ?
getResources().getDrawable(R.mipmap.xlh_jjks) :
getResources().getDrawable(R.mipmap.xlh_zsks));
textView.setText(xlhBean.getText());
} else {
textView.setText("");
}
view.setOnClickListener(v -> {
// 点击时执行跳转操作
handleItemClick(xlhBean);
});
}
private void handleItemClick(XLHBean xlhBean) {
// 这里可以根据实际需求实现跳转逻辑
// 例如:跳转到礼物详情页面、用户主页等
// 使用缓存数据进入房间
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), xlhBean.getRoom_id(), "");
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", xlhBean.getRoom_id()).navigation();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(ChatInfo event) {
String id = event.getId().replace("g", "");
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/union/setGroup?id=" + SpUtil.getToken() + "&guildId=" + id).navigation();
}
}

View File

@@ -4,6 +4,9 @@ import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
@@ -11,9 +14,21 @@ import androidx.core.content.ContextCompat;
import androidx.databinding.ViewDataBinding;
import com.blankj.utilcode.util.LogUtils;
import com.tencent.imsdk.v2.V2TIMConversationListener;
import com.tencent.imsdk.v2.V2TIMConversationManager;
import com.tencent.imsdk.v2.V2TIMSDKListener;
import com.tencent.imsdk.v2.V2TIMValueCallback;
import com.tencent.qcloud.tuicore.TUIConfig;
import com.tencent.qcloud.tuicore.TUIConstants;
import com.tencent.qcloud.tuicore.TUICore;
import com.tencent.qcloud.tuicore.interfaces.TUILoginListener;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.bean.UserBean;
import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.dialog.ConfirmDialog;
import com.xscm.moduleutil.event.UnreadCountEvent;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.utils.LanguageUtil;
import com.xscm.moduleutil.utils.location.LocationProvider;
import com.xscm.moduleutil.utils.location.SystemLocationProvider;
@@ -28,13 +43,13 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewDataBinding> extends BaseAppCompatActivity<VDB> implements
IView<Activity> , LocationProvider.LocationCallback
{
IView<Activity> {
protected P MvpPre;
protected abstract P bindPresenter();
private String city1;
@Override
protected void initView() {
@@ -77,78 +92,112 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
@Subscribe(threadMode = ThreadMode.MAIN)
public void logOutEvent(UserBean userBean) {
// 在用户 UI 点击登录的时候调用
TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), "u"+userBean.getUser_id(), userBean.getTencent_im(), new TUICallback() {
TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), "u" + userBean.getUser_id(), userBean.getTencent_im(), new TUICallback() {
@Override
public void onError(final int code, final String desc) {
LogUtils.e("@@@1",code,"描述:",desc);
LogUtils.e("@@@1", code, "描述:", desc);
}
@Override
public void onSuccess() {
LogUtils.e("@@@","成功");
// V2TIMUserFullInfo userFullInfo = new V2TIMUserFullInfo();
// userFullInfo.setNickname(userBean.getNickname());
// userFullInfo.setFaceUrl(userBean.getAvatar());
// userFullInfo.setAllowType(userBean.getSex());
// V2TIMManager.getInstance().setSelfInfo(userFullInfo, new V2TIMCallback() {
// @Override
// public void onSuccess() {
// LogUtils.e("@@@", "成功");
// }
//
// @Override
// public void onError(int code, String desc) {
// LogUtils.e("@@@", "描述"+desc);
// }
// });
initLocation();
LogUtils.e("@@@", "成功");
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
@Override
public void onSuccess(Long aLong) {
// 通知未读数变化
UnreadCountEvent event =CommonAppContext.getInstance().unreadCountEvent;
if (event==null){
event=new UnreadCountEvent();
}
event.setALong(aLong);
// 使用EventBus通知
CommonAppContext.getInstance().setUnreadCountEvent(event);
EventBus.getDefault().post(event);
}
@Override
public void onError(int code, String desc) {
// 错误处理
}
});
//initLocation();
}
});
V2TIMManager.getInstance().addIMSDKListener(imSdkListener);
}
private SystemLocationProvider locationProvider;
private void initLocation() {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// 请求定位权限
ActivityCompat.requestPermissions(
(Activity) this,
new String[]{
android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
},
1001 // 自定义常量,比如 1001
);
}
locationProvider = new SystemLocationProvider();
// 请求一次性的位置信息
locationProvider.getLastKnownLocation(this, this);
}
private final V2TIMSDKListener imSdkListener = new V2TIMSDKListener() {
@Override
public void onLocationReceived(double latitude, double longitude, String city) {
LogUtils.e("当前位置:" + city);
city1=city;
EventBus.getDefault().post(city1);
public void onConnecting() {
}
@Override
public void onFailed(String errorMessage) {
LogUtils.e("定位失败");
public void onConnectSuccess() {//重连成功
if (CommonAppContext.getInstance().playId!=null){
RetrofitClient.getInstance().roomUserReconnect(CommonAppContext.getInstance().playId);
}
}
@Override
public void onConnectFailed(int code, String error) {
}
@Override
public void onKickedOffline() {
// queren1();
}
@Override
public void onUserSigExpired() {
}
@Override
public void onSelfInfoUpdated(V2TIMUserFullInfo info) {
}
};
private void queren1() {
// 创建并显示确认对话框
new ConfirmDialog(this,
"温馨提示",
"您的账号已在别处登录,请确认密码是否已经泄露",
"知道了",
"",
v -> {
// 点击“确认”按钮时执行删除操作
if (CommonAppContext.getInstance().playId!=null){
RoomManager.getInstance().exitRoom(CommonAppContext.getInstance().playId);
}
try {
CommonAppContext.getInstance().clearLoginInfo();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
},
v -> {
// 点击“取消”按钮时什么都不做
}, false, 0).show();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 1001) {
if (locationProvider==null) {
locationProvider = new SystemLocationProvider();
public Resources getResources() {
Resources resources = super.getResources();
if (resources != null) {
Configuration configuration = resources.getConfiguration();
if (configuration != null) {
// 设置字体缩放比例不随系统变化
configuration.fontScale = 1.0f; // 1.0f表示默认大小
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
}
locationProvider.getLastKnownLocation(this, this);
}
return resources;
}
@Subscribe(threadMode = ThreadMode.MAIN)
@@ -169,10 +218,10 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
// }
// });
}
/**
* 显示全局飘屏消息(支持任意位置飘过)
*
*/
/**
* 显示全局飘屏消息(支持任意位置飘过)
*
*/
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void showPiaoPingMessage(MqttBean mqttBean) {
// WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);

View File

@@ -10,7 +10,10 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.GeolocationPermissions;
import android.webkit.JavascriptInterface;
@@ -21,11 +24,16 @@ import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import androidx.annotation.Nullable;
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.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.databinding.ActivityWebViewBinding;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.tencent.imsdk.v2.V2TIMConversation;
@@ -46,6 +54,8 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
public String title;
public String url;
@Autowired
public String type;//type=1:青少年模式
private ValueCallback<Uri> mUploadMessage;
private ValueCallback<Uri[]> mUploadCallbackAboveL;
private final int REQUEST_FILE_PICKER = 1;
@@ -53,6 +63,8 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void initData() {
WebSettings webSettings = mBinding.webView.getSettings();
// 禁用水平滚动
@@ -61,9 +73,9 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
webSettings.setJavaScriptEnabled(true);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
//增加JSBridge
mBinding.webView.addJavascriptInterface(new WebAppInterface(this), "Android");
mBinding.webView.addJavascriptInterface(new WebAppInterface(this, type), "Android");
if (title!=null && !title.isEmpty()){
if (title != null && !title.isEmpty()) {
if (title.contains("协议")) {
webSettings.setDisplayZoomControls(false); // 隐藏默认缩放控件
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL); // 使用正常布局算法
@@ -75,10 +87,10 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
// 设置初始缩放
mBinding.webView.setInitialScale(100);
mBinding.webView.getSettings().setUseWideViewPort(false);
}else {
} else {
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
}
}else {
} else {
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
}
@@ -94,7 +106,6 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
mBinding.webView.setScrollContainer(true);
mBinding.webView.setWebViewClient(new WebViewClient());
mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
@@ -173,6 +184,35 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
});
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getOnBackPressedDispatcher() != null) {
getOnBackPressedDispatcher().addCallback(this, new androidx.activity.OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
// 拦截返回键,显示退出对话框而不是直接退出
showExitRoomDialog();
}
});
}
}
private void showExitRoomDialog() {
if (type != null) {
if (type.equals("1")) {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 1).navigation();
} else {
finish();
}
} else {
finish();
}
}
private void showFileChooser() {
// 这里可以扩展为显示对话框让用户选择“拍照”或“从相册选择”
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
@@ -214,12 +254,74 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
}
}
@Override
public void onBackPressed() {
// 当type==1时禁止返回键和手势返回
// 不执行任何操作,禁止返回
if (type != null) {
if (type.equals("1")) {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 1).navigation();
} else {
finish();
}
return;
} else {
finish();
}
// 正常处理返回键
super.onBackPressed();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
LogUtils.d("MainActivity", "onKeyDown called, keyCode: " + keyCode);
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (type != null) {
if (type.equals("1")) {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 1).navigation();
} else {
finish();
}
} else {
finish();
}
return true; // 消费事件
}
return super.onKeyDown(keyCode, event);
}
// @Override
// public boolean dispatchTouchEvent(MotionEvent ev) {
// // 当type==1时禁止手势滑动返回
// if (type.equals("1")) {
// // 检查是否是边缘滑动返回手势
// if (ev.getAction() == MotionEvent.ACTION_DOWN) {
// // 如果触摸点在屏幕边缘,拦截事件
// if (ev.getX() < 50) { // 左边缘50像素内
// return true; // 拦截事件不传递给子View
// }
// }
// }
// return super.dispatchTouchEvent(ev);
// }
@Override
protected void initView() {
getWindow().getDecorView().setBackgroundResource(com.xscm.moduleutil.R.color.white);
title = getIntent().getStringExtra("title");
url = getIntent().getStringExtra("url");
if (title!=null) {
type = getIntent().getStringExtra("type");
if (type != null) {
// 当type==1时禁用返回手势滑动
if (type.equals("1")) {
// 禁用边缘滑动返回
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
}
}
}
if (title != null) {
if (title.equals("举报") || title.equals("等级") || title.equals("公会") || title.equals("邀请") || title.equals("反馈")) {
mBinding.topBar.setVisibility(GONE);
// mBinding.webView.setPadding(0,20,0,0);
@@ -227,20 +329,18 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle(title);
}
}else {
if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6")){
} else {
if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6")) {
mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle("用户协议");
}else if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4")){
} else if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4")) {
mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle("隐私协议");
}else {
} else {
mBinding.topBar.setVisibility(GONE);
}
}
}
@Override
@@ -250,9 +350,11 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
public class WebAppInterface {
Context mContext;
String type;
WebAppInterface(Context c) {
WebAppInterface(Context c, String type1) {
mContext = c;
type = type1;
}
// 被 H5 调用的方法
@@ -263,8 +365,15 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
@JavascriptInterface
public void closeWeb() {
LogUtils.e("value: ");
finish();
if (type != null) {
if (type.equals("1")) {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 1).navigation();
} else {
finish();
}
} else {
finish();
}
}
@JavascriptInterface
@@ -281,8 +390,11 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
@JavascriptInterface
public void jumpRoomPage(String room_id) {
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), room_id,"");
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
}
@JavascriptInterface
public void jumpWebPage(String objects) {
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).navigation();
@@ -290,22 +402,25 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
}
@JavascriptInterface
public void enterGroupChat(String group_id,String cover,String guild_name) {
public void enterGroupChat(String group_id, String cover, String guild_name) {
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id);
intent.putExtra(TUIConstants.TUIChat.CHAT_NAME, guild_name);
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
mContext.startActivity(intent);
}
@JavascriptInterface
public void chatWithUser(String user_id,String nickname) {
Intent intent = new Intent(mContext, TUIC2CChatActivity.class);
public void chatWithUser(String user_id, String nickname) {
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
intent.putExtra(TUIConstants.TUIChat.CHAT_NAME, nickname);
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
mContext.startActivity(intent);
}
@JavascriptInterface
public void exchange(){
public void exchange() {
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
}
@@ -321,7 +436,7 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
}
@JavascriptInterface
public void Recharge(){
public void Recharge() {
ARouter.getInstance().build(ARouteConstants.RECHARGE_ACTIVITY).navigation();
}
}
@@ -333,6 +448,7 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
// intent.putExtra("menuName", msg);
// startActivity(intent);
LogUtils.e("closeWeb");
}
}

View File

@@ -14,6 +14,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.activity.BaseMvpActivity;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.bean.NewsMessageList;
import com.xscm.moduleutil.databinding.ActivityOfficialNoticeBinding;
import com.xscm.moduleutil.utils.ARouteConstants;
@@ -75,7 +76,8 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
@Override
public void onClick(View view) {
if (item.getRoom_id()>0){
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("room_id", item.getRoom_id() + "").navigation();
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id()+"","");
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("roomId", item.getRoom_id() + "").navigation();
}else if (item.getRoom_id() == 0 && item.getUrl() != null && !item.getUrl().isEmpty()){
ARouter.getInstance().build(ARouteConstants.H5).withString("url", item.getUrl()).navigation();
}

View File

@@ -63,7 +63,7 @@ public class AppUpdateDialog extends BaseDialog<DialogAppUpdateBinding> implemen
};
mProgressDialog.setMax(100);//设置最大值
mProgressDialog.setTitle("安装包下载");//设置标题
mProgressDialog.setIcon(R.mipmap.ic_launcher);//设置标题小图标
mProgressDialog.setIcon(R.mipmap.ic_launcher_app);//设置标题小图标
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);//设置样式为横向显示进度的样式
mProgressDialog.incrementProgressBy(0);//设置初始值为0其实可以不用设置默认就是0
mProgressDialog.setIndeterminate(false);//是否精确显示对话框flase为是反之为否

View File

@@ -1,11 +1,16 @@
package com.xscm.moduleutil.adapter;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.bean.RechargeBean;
import com.xscm.moduleutil.utils.SystemUtils;
import java.util.List;
@@ -36,7 +41,10 @@ public class BalanceRechargeAdapter extends BaseMultiItemQuickAdapter<RechargeBe
@Override
protected void convert(BaseViewHolder helper, RechargeBean item) {
int type = helper.getItemViewType();
// ConstraintLayout constraintLayout = helper.getView(R.id.cl_item);
// ViewGroup.LayoutParams layoutParams =constraintLayout.getLayoutParams();
// layoutParams.width = ( com.blankj.utilcode.util.ScreenUtils.getScreenWidth()-32-24)/3-24; // 使用你定义的getWidth方法
// constraintLayout.setLayoutParams(layoutParams);
if (type == ITEM_TYPE_NORMAL) {
// 正常 item 显示逻辑
helper.setText(R.id.tv_gold_num, item.getCoins());

View File

@@ -121,7 +121,7 @@ public class GiftPackAdapter extends BaseAdapter {
viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift);
viewHolder.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on);
viewHolder.cl_iv_down_on = (ConstraintLayout) convertView.findViewById(R.id.cl_iv_down_on);
viewHolder.integral = (TextView) convertView.findViewById(R.id.integral);
convertView.setTag(viewHolder);
} else {
viewHolder = (GiftPackAdapter.ViewHolder) convertView.getTag();
@@ -129,10 +129,11 @@ public class GiftPackAdapter extends BaseAdapter {
viewHolder.item_layout.setOnClickListener(v -> {
// RoonGiftModel clickedModel = (RoonGiftModel) v.getTag();
EventBus.getDefault().post(new RoomGiftPackToEvent(this, giftModel, 1));
EventBus.getDefault().post(new RoomGiftPackToEvent(this, giftModel, 2));
});
viewHolder.integral.setVisibility(View.VISIBLE);
viewHolder.integral.setText("x"+giftModel.getNum());
//设置礼物名字
viewHolder.tv_gift_name.setText(giftModel.getGift_name());
//设置礼物价格
@@ -162,7 +163,7 @@ public class GiftPackAdapter extends BaseAdapter {
static class ViewHolder {
public ConstraintLayout item_layout;
public TextView tv_gift_name, tv_gift_price, tv_gift_num;
public TextView tv_gift_name, tv_gift_price, integral;
public ImageView iv_gift_pic;
public TextView tv_gift_change_love_values;
public ImageView ivDownOn;

View File

@@ -100,6 +100,16 @@ public class GiftRoomAdapter extends BaseAdapter {
}
}
public void updateData(List<RoonGiftModel> newData) {
this.mDatas.clear();
// 确保新数据都不处于选中状态
for (RoonGiftModel model : newData) {
model.setChecked(false);
}
this.mDatas.addAll(newData);
}
// private static class MyGestureDetector extends GestureDetector {
// private GiftRoomAdapter mAdapter;
// private RoonGiftModel mGiftModel;
@@ -146,18 +156,6 @@ public class GiftRoomAdapter extends BaseAdapter {
viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift);
viewHolder.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on);
viewHolder.cl_iv_down_on = (ConstraintLayout) convertView.findViewById(R.id.cl_iv_down_on);
// viewHolder.tv_gift_num = convertView.findViewById(R.id.tv_gift_num);
// viewHolder.tv_gift_change_love_values = convertView.findViewById(R.id.tv_gift_change_love_values);
// viewHolder.item_layout.setOnTouchListener((v, event) -> {
// gestureDetector.setGiftModel(GiftRoomAdapter.this, giftModel);
// gestureDetector.onTouchEvent(event);
//
// return true;
// });
convertView.setTag(viewHolder);
} else {

View File

@@ -158,7 +158,10 @@ public class GiftTwoAdapter extends BaseAdapter {
viewHolder.ivDownOn.setVisibility(View.GONE);
viewHolder.cl_iv_down_on.setBackgroundResource(0);
}
viewHolder.tv_gift_num.setText(String.format("x%s", giftModel.getNum()));
if (giftModel.getNum()==0){
viewHolder.tv_gift_num.setVisibility(View.GONE);
}
viewHolder.tv_gift_num.setText(String.format("x%s", (giftModel.getNum()!=0?giftModel.getNum():"")));
//设置

View File

@@ -12,6 +12,8 @@ import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.BaseMvpFragment;
import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftPackBean;
import com.xscm.moduleutil.bean.GiftPackEvent;
import com.xscm.moduleutil.bean.GiftPackListCount;
import com.xscm.moduleutil.bean.RewardUserBean;
import com.xscm.moduleutil.bean.RoonGiftModel;
import com.xscm.moduleutil.bean.WalletBean;
@@ -41,14 +43,17 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
private int pageSize = 100;//一页显示的礼物个数
private int pageCount;//页数
private int type;//1:房间点击进入的2打赏进入的
private List<RoonGiftModel> giftList=new ArrayList<>();
private List<GiftPackBean> giftPackList=new ArrayList<>();
private List<RoonGiftModel> giftList = new ArrayList<>();
private List<GiftPackBean> giftPackList = new ArrayList<>();
private String roomId;
private String bdgiftId;
public static GiftTwoDetailsFragment newInstance(String id,int type) {
public static GiftTwoDetailsFragment newInstance(String id, int type, String roomId) {
Bundle args = new Bundle();
args.putString("id", id);
args.putInt("type", type);
args.putString("roomId", roomId);
GiftTwoDetailsFragment fragment = new GiftTwoDetailsFragment();
fragment.setArguments(args);
return fragment;
@@ -59,8 +64,10 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
super.initArgs(arguments);
id = arguments.getString("id");
type = arguments.getInt("type");
roomId = arguments.getString("roomId");
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
@@ -72,20 +79,50 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
return new RewardGiftPresenter(this, getActivity());
}
@Override
protected void initData() {
if (id.equals("0")){
public void loadDataIfNeeded(String id, int type, String roomId) {
if (MvpPre==null){
MvpPre = new RewardGiftPresenter(this, getActivity());
}
if (id.equals("0")) {
MvpPre.giftPack();
}else {
if (type==0) {
MvpPre.getGiftList("0", type);
}else {
MvpPre.getGiftList(id, type);
} else {
if (type == 0) {
MvpPre.getGiftList("0", type, roomId);
} else {
if (id == null) {
id = "0";
}
MvpPre.getGiftList(id, type, roomId);
}
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onString(GiftPackEvent event) {
if (event!=null && event.getBdid()!=null) {
bdgiftId = event.getBdid();
MvpPre.giftPack();
}
}
@Override
protected void initData() {
if (type==0){
MvpPre.getGiftList("0", type, roomId);
}
// if (id.equals("0")) {
// MvpPre.giftPack();
// } else {
// if (type == 0) {
// MvpPre.getGiftList("0", type, roomId);
// } else {
// MvpPre.getGiftList(id, type, roomId);
// }
//
// }
}
@Override
protected void initView() {
@@ -118,30 +155,21 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
}
return null;
}
@Override
public void setGiftList(List<RoonGiftModel> data,int type) {
if (type == 1){
giftList=new ArrayList<>();
giftList.addAll(data);
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
roomAdapter = new GiftRoomAdapter(getActivity(), data, j, "0");
mBinding.rvGift.setAdapter(roomAdapter);
}
}else {
giftList=new ArrayList<>();
giftList.addAll(data);
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
// mAdapter = new GiftTwoAdapter(getActivity(), data, j, "0");
// mBinding.rvGift.setAdapter(mAdapter);
roomAdapter = new GiftRoomAdapter(getActivity(), data, j, "0");
mBinding.rvGift.setAdapter(roomAdapter);
}
public void setGiftList(List<RoonGiftModel> data, int type) {
giftList = new ArrayList<>();
giftList.addAll(data);
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
// 只需要创建一次Adapter并设置循环设置没有意义
if (pageCount > 0) {
roomAdapter = new GiftRoomAdapter(getActivity(), data, 0, "0");
mBinding.rvGift.setAdapter(roomAdapter);
}
// EventBus.getDefault().post(new RoomGiftEvent(data));
}
@Override
public void giveGift() {
@@ -164,15 +192,44 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Override
public void giftPack(List<GiftPackBean> giftPackBean) {
giftPackList=new ArrayList<>();
giftPackList.addAll(giftPackBean);
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
giftPackList = new ArrayList<>();
if (giftPackBean != null && giftPackBean.size() > 0) {
if (bdgiftId != null) {
for (GiftPackBean item : giftPackBean) {
if (item.getGift_id().equals(bdgiftId)) {
item.setChecked(true);
}
}
}
giftPackList.addAll(giftPackBean);
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
// mAdapter = new GiftTwoAdapter(getActivity(), data, j, "0");
// mBinding.rvGift.setAdapter(mAdapter);
packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, j, "0");
packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, j, "0");
mBinding.rvGift.setAdapter(packAdapter);
}
} else {
giftPackBean = new ArrayList<>();
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, 0, "0");
mBinding.rvGift.setAdapter(packAdapter);
}
}
@Override
public void getGiftPack(String s) {
}
@Override
public void getGiftPackListCount(GiftPackListCount giftPackListCount) {
}
@Override
@@ -187,7 +244,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Subscribe(threadMode = ThreadMode.MAIN)
public void onGiftClicRoomkEvent(RoomGiftClickEvent event) {
if (giftList == null){
if (giftList == null) {
giftList = new ArrayList<>();
giftList.add(event.gift);
}
@@ -197,7 +254,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
RoonGiftModel giftModel = giftList.get(i);
if (giftModel.getGift_id().equals(id)) {
if (!giftModel.isChecked()) {
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type,event.gift));
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type, event.gift));
giftModel.setChecked(true);
}
} else {
@@ -215,7 +272,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
if (giftModel.getGift_id().equals(id)) {
selGift = giftModel;
if (!giftModel.isChecked()) {
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type,event.gift));
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type, event.gift));
giftModel.setChecked(true);
}
} else {
@@ -237,7 +294,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
giftPackList = new ArrayList<>();
giftPackList.add(event.gift);
}
if (event.type == 1){
if (event.type == 1) {
String id = event.gift.getGift_id();
for (int i = 0; i < giftPackList.size(); i++) {
GiftPackBean giftModel = giftPackList.get(i);
@@ -249,7 +306,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
roonGiftModel.setNum(Integer.parseInt(giftModel.getNum()));
if (giftModel.getGift_id().equals(id)) {
if (!giftModel.isChecked()) {
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,roonGiftModel));
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
giftModel.setChecked(true);
}
} else {
@@ -259,7 +316,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
if (event.adapter != null && event.adapter.get() != null) {
event.adapter.get().notifyDataSetChanged();
}
}else {
} else {
String id = event.gift.getGift_id();
GiftPackBean selGift = null;
for (int i = 0; i < giftPackList.size(); i++) {
@@ -273,12 +330,12 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
if (giftModel.getGift_id().equals(id)) {
selGift = giftModel;
if (!giftModel.isChecked()) {
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,roonGiftModel));
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
giftModel.setChecked(true);
}
} else {
giftModel.setChecked(false);
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null));
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, null));
}
}
if (event.adapter != null && event.adapter.get() != null) {
@@ -293,7 +350,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Subscribe(threadMode = ThreadMode.MAIN)
public void onGiftClicRoomkTEvent(RoomGiftClickToEvent event) {
if (giftList == null){
if (giftList == null) {
giftList = new ArrayList<>();
giftList.add(event.gift);
}
@@ -304,10 +361,10 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
if (giftModel.getGift_id().equals(id)) {
if (giftModel.isChecked()) {
giftModel.setChecked(false);
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null));
}else {
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, null));
} else {
giftModel.setChecked(true);
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,event.gift));
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, event.gift));
}
} else {
giftModel.setChecked(false);
@@ -325,10 +382,10 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
selGift = giftModel;
if (giftModel.isChecked()) {
giftModel.setChecked(false);
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null));
}else {
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, null));
} else {
giftModel.setChecked(true);
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type,event.gift));
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type, event.gift));
}
} else {
giftModel.setChecked(false);

View File

@@ -18,9 +18,11 @@ public class UserPhotoWallAdapter extends BaseQuickAdapter<String, BaseViewHolde
protected void convert(BaseViewHolder helper, String item) {
helper.setGone(R.id.iv_close, false);
if (item.equals(ADD_PHOTO)) {
helper.setVisible(R.id.iv_close, false);
// 显示加号图片
helper.setImageResource(R.id.riv_user_head, com.xscm.moduleutil.R.mipmap.add_img);
} else {
helper.setVisible(R.id.iv_close, true);
ImageUtils.loadCenterCrop(item, helper.getView(R.id.riv_user_head));
}

View File

@@ -0,0 +1,24 @@
package com.xscm.moduleutil.base;
import android.app.Activity;
/**
*@author qx
*@data 2025/9/20
*@description: 模块之间的通讯接口
*/
public interface AppStateListener {
void onAppForeground();
void onAppBackground();
void onRoomActivityCreated(Activity roomActivity);
void onRoomActivityDestroyed();
boolean isRoomActivityActive();
void setFloatingWindowVisible(boolean visible);
boolean isFloatingWindowVisible();
// 新增方法
boolean shouldShowSplash();
void setShouldShowSplash(boolean shouldShow);
boolean isAppInBackground();
void setAppInBackground(boolean inBackground);
}

View File

@@ -0,0 +1,112 @@
package com.xscm.moduleutil.base;
import android.app.Activity;
import com.xscm.moduleutil.bean.room.RoomInfoResp;
import java.lang.ref.WeakReference;
/**
*@author qx
*@data 2025/9/20
*@description: 应用状态管理的单例类
*/
// 在 common 模块中
public class AppStateManager implements AppStateListener {
private static AppStateManager instance;
private boolean isAppInBackground = true;
private boolean shouldShowSplash = true;
private WeakReference<Activity> roomActivityRef;
private boolean isFloatingWindowVisible = false;
private boolean isRoomActivityMinimized = false;
private AppStateManager() {
// 私有构造函数
}
public static synchronized AppStateManager getInstance() {
if (instance == null) {
instance = new AppStateManager();
}
return instance;
}
@Override
public boolean shouldShowSplash() {
return shouldShowSplash;
}
@Override
public void setShouldShowSplash(boolean shouldShow) {
this.shouldShowSplash = shouldShow;
}
@Override
public boolean isAppInBackground() {
return isAppInBackground;
}
@Override
public void setAppInBackground(boolean inBackground) {
this.isAppInBackground = inBackground;
}
@Override
public void onRoomActivityCreated(Activity roomActivity) {
roomActivityRef = new WeakReference<>(roomActivity);
}
@Override
public void onRoomActivityDestroyed() {
roomActivityRef = null;
}
@Override
public boolean isRoomActivityActive() {
Activity activity = getRoomActivity();
return activity != null && !activity.isFinishing();
}
private Activity getRoomActivity() {
return roomActivityRef != null ? roomActivityRef.get() : null;
}
@Override
public void setFloatingWindowVisible(boolean visible) {
this.isFloatingWindowVisible = visible;
}
@Override
public boolean isFloatingWindowVisible() {
return isFloatingWindowVisible;
}
@Override
public void onAppForeground() {
// 应用进入前台时的处理
setAppInBackground(false);
}
@Override
public void onAppBackground() {
// 应用进入后台时的处理
setAppInBackground(true);
}
// 新增方法设置RoomActivity为最小化状态
public void setRoomActivityMinimized(boolean minimized) {
this.isRoomActivityMinimized = minimized;
}
// 新增方法检查RoomActivity是否处于最小化状态
public boolean isRoomActivityMinimized() {
return isRoomActivityMinimized;
}
private RoomInfoResp roomInfoResp;
public void setRoomInfo(RoomInfoResp roomInfoResp) {
// 处理RoomInfoResp对象
this.roomInfoResp = roomInfoResp;
}
public RoomInfoResp getRoomInfo() {
return roomInfoResp;
}
}

View File

@@ -3,17 +3,25 @@ package com.xscm.moduleutil.base;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Application;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;
@@ -22,22 +30,29 @@ import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ProcessUtils;
import com.blankj.utilcode.util.ServiceUtils;
import com.lahm.library.EasyProtectorLib;
import com.lahm.library.EmulatorCheckCallback;
import com.xscm.moduleutil.R;
import com.tencent.imsdk.v2.V2TIMAdvancedMsgListener;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMMessage;
import com.tencent.imsdk.v2.V2TIMMessageManager;
import com.tencent.imsdk.v2.V2TIMMessageReceipt;
import com.tencent.imsdk.v2.V2TIMValueCallback;
import com.xscm.moduleutil.bean.UserBean;
import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.event.AppLifecycleEvent;
import com.xscm.moduleutil.event.UnreadCountEvent;
import com.xscm.moduleutil.interfaces.AppLifecycleUtil;
import com.xscm.moduleutil.listener.MessageListenerSingleton;
import com.xscm.moduleutil.rtc.AgoraManager;
import com.xscm.moduleutil.service.MyMqttService;
import com.xscm.moduleutil.service.MqttConnect;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.CrashHandler;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.moduleutil.utils.UtilConfig;
import com.xscm.moduleutil.utils.config.EnvironmentEnum;
import com.xscm.moduleutil.utils.config.EnvironmentPrefs;
import com.xscm.moduleutil.widget.CommonAppConfig;
import com.xscm.moduleutil.widget.PiaoPingManager;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
@@ -50,21 +65,22 @@ import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.qcloud.tuicore.TUILogin;
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.greenrobot.eventbus.EventBus;
import java.lang.reflect.Method;
import java.security.MessageDigest;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
/**
* Created by cxf on 2017/8/3.
*/
public class CommonAppContext extends MultiDexApplication {
public class CommonAppContext extends MultiDexApplication implements Application.ActivityLifecycleCallbacks {
private static CommonAppContext sInstance;
private static Handler sMainThreadHandler;
@@ -79,11 +95,41 @@ public class CommonAppContext extends MultiDexApplication {
public boolean isPlaying;
public String playId;
public String lable_id;
public boolean isMicPlace;
public boolean isShowAg;
public boolean isRoomJoininj=false;
public String playCover;
public boolean showSelf;//盲盒是否能送自己
public String playName;
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
private ScheduledExecutorService scheduledExecutorServiceRoom = null;
private MqttConnect mqttConnect=null;
// 添加后台状态标记
private boolean wasInBackground = false;
public void onAppBackground() {
wasInBackground = true;
}
public void onAppForeground() {
wasInBackground = false;
}
public boolean wasInBackground() {
return wasInBackground;
}
private int activityCount = 0;
private AppStateListener appStateListener;
private boolean isListeningUnreadCount = false;
@Setter
@Getter
public UnreadCountEvent unreadCountEvent;
@Override
public void onCreate() {
@@ -91,35 +137,344 @@ public class CommonAppContext extends MultiDexApplication {
sInstance = this;
sMainThreadHandler = new Handler();
EnvironmentPrefs prefs = new EnvironmentPrefs(this);
// 添加内存优化配置
optimizeMemorySettings();
currentEnvironment = prefs.getSelectedEnvironment();
initialization();
piaoPingManager = PiaoPingManager.getInstance(this);
registerActivityLifecycleCallbacks(this);
appStateListener = AppStateManager.getInstance();
startListeningUnreadMessageCount();
// 全局设置字体不缩放
adjustFontScale(getResources().getConfiguration());
CrashHandler.init(this);
}
public void adjustFontScale(Configuration configuration) {
if (configuration.fontScale != 1.0f) {
configuration.fontScale = 1.0f;
DisplayMetrics metrics = getResources().getDisplayMetrics();
getResources().updateConfiguration(configuration, metrics);
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// 配置变化时重新应用字体设置
adjustFontScale(newConfig);
}
// 在适当的位置如onCreate或onResume添加实时监听
protected void startListeningUnreadMessageCount() {
if (!isListeningUnreadCount) {
// 添加未读消息数变化监听器
V2TIMMessageManager messageManager = V2TIMManager.getMessageManager();
messageManager.addAdvancedMsgListener(new V2TIMAdvancedMsgListener() {
@Override
public void onRecvNewMessage(V2TIMMessage msg) {
// 收到新消息时更新未读数
updateUnreadMessageCount();
}
@Override
public void onRecvC2CReadReceipt(List<V2TIMMessageReceipt> receiptList) {
// 收到C2C消息已读回执时更新未读数
updateUnreadMessageCount();
}
});
isListeningUnreadCount = true;
// 首次获取未读数
updateUnreadMessageCount();
}
}
// 更新未读消息数的方法
private void updateUnreadMessageCount() {
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
@Override
public void onSuccess(Long aLong) {
// 通知未读数变化
notifyUnreadCountChanged(aLong != null ? aLong : 0L);
}
@Override
public void onError(int code, String desc) {
// 错误处理
notifyUnreadCountChanged(0L);
}
});
}
// 通知未读数变化的方法可以发送广播或EventBus事件
private void notifyUnreadCountChanged(long unreadCount) {
UnreadCountEvent event =unreadCountEvent;
if (event==null){
event=new UnreadCountEvent();
}
event.setALong(unreadCount);
// 使用EventBus通知
CommonAppContext.getInstance().setUnreadCountEvent(event);
EventBus.getDefault().post(event);
}
/**
* 检查网络是否可用
* @return true表示网络可用false表示网络不可用
*/
public boolean isNetworkAvailable() {
try {
// 获取网络连接管理器
android.net.ConnectivityManager connectivityManager =
(android.net.ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// Android 6.0及以上版本
android.net.Network network = connectivityManager.getActiveNetwork();
if (network != null) {
android.net.NetworkCapabilities capabilities =
connectivityManager.getNetworkCapabilities(network);
if (capabilities != null) {
// 检查是否有网络连接并且可以访问互联网
return capabilities.hasCapability(android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET) &&
capabilities.hasCapability(android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED);
}
}
} else {
// Android 6.0以下版本
android.net.NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
}
} catch (Exception e) {
LogUtils.e("Network availability check failed: " + e.getMessage());
}
return false;
}
/**
* 检查网络是否可用(简化版本)
* @return true表示网络可用false表示网络不可用
*/
public boolean isNetworkConnected() {
try {
android.net.ConnectivityManager connectivityManager =
(android.net.ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
android.net.Network network = connectivityManager.getActiveNetwork();
return network != null;
} else {
android.net.NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
}
} catch (Exception e) {
LogUtils.e("Network connection check failed: " + e.getMessage());
}
return false;
}
/**
* 优化内存设置
*/
private void optimizeMemorySettings() {
try {
// 请求降低内存负载
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// 启用自动内存管理优化
registerComponentCallbacks(new ComponentCallbacks2() {
@Override
public void onTrimMemory(int level) {
handleMemoryTrim(level);
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {}
@Override
public void onLowMemory() {
// 内存极低时的处理
releaseNonEssentialResources();
}
});
}
} catch (Exception e) {
LogUtils.e("Memory optimization setup failed: " + e.getMessage());
}
}
/**
* 处理内存削减事件
* @param level 削减级别
*/
private void handleMemoryTrim(int level) {
switch (level) {
case TRIM_MEMORY_RUNNING_MODERATE:
// 应用正在运行,内存开始紧张
LogUtils.d("Memory trim: moderate");
break;
case TRIM_MEMORY_RUNNING_LOW:
// 应用正在运行,内存更加紧张
LogUtils.d("Memory trim: low");
releaseNonEssentialResources();
break;
case TRIM_MEMORY_RUNNING_CRITICAL:
// 应用仍在运行,但系统已开始杀死后台进程
LogUtils.d("Memory trim: critical");
releaseAllNonEssentialResources();
break;
case TRIM_MEMORY_UI_HIDDEN:
// 应用UI已隐藏可以释放UI相关资源
LogUtils.d("Memory trim: UI hidden");
releaseUIResources();
break;
case TRIM_MEMORY_BACKGROUND:
// 应用处于LRU列表中较远位置
LogUtils.d("Memory trim: background");
break;
case TRIM_MEMORY_MODERATE:
// 应用处于LRU列表中间位置
LogUtils.d("Memory trim: moderate background");
releaseAllNonEssentialResources();
break;
case TRIM_MEMORY_COMPLETE:
// 应用处于LRU列表中最远位置即将被杀死
LogUtils.d("Memory trim: complete");
releaseAllResources();
break;
}
}
/**
* 释放非必要资源
*/
private void releaseNonEssentialResources() {
try {
// 清理图片缓存
// Glide.get(this).clearMemory();
// 释放MQTT资源
if (mqttConnect != null) {
mqttConnect.close();
}
// 通知各个组件释放资源
// EventBus.getDefault().post(new MemoryTrimEvent());
} catch (Exception e) {
LogUtils.e("Error releasing non-essential resources: " + e.getMessage());
}
}
/**
* 释放所有非必要资源
*/
private void releaseAllNonEssentialResources() {
try {
releaseNonEssentialResources();
// 进行垃圾回收
System.gc();
System.runFinalization();
} catch (Exception e) {
LogUtils.e("Error releasing all non-essential resources: " + e.getMessage());
}
}
/**
* 释放UI相关资源
*/
private void releaseUIResources() {
try {
// 可以在这里通知UI组件释放资源
} catch (Exception e) {
LogUtils.e("Error releasing UI resources: " + e.getMessage());
}
}
/**
* 释放所有资源
*/
private void releaseAllResources() {
try {
releaseAllNonEssentialResources();
releaseUIResources();
} catch (Exception e) {
LogUtils.e("Error releasing all resources: " + e.getMessage());
}
}
public void setAppStateListener(AppStateListener listener) {
this.appStateListener = listener;
}
public void initialization(){
UtilConfig.init(this);
registerActivityLifecycleCallbacks();
// registerActivityLifecycleCallbacks();
initWebView();
if (ProcessUtils.isMainProcess()) {
initARouter();
if (SpUtil.isAgreePolicy()) {
checkInEmulator();
UtilConfig.checkInEmulator();
AgoraManager.getInstance(this).init(currentEnvironment.getSwSdkAppId());
AgoraManager.getInstance(this);
AgoraManager.init(currentEnvironment.getSwSdkAppId());
MessageListenerSingleton.getInstance();
CrashReport.initCrashReport(this, "ac3ed4d89f", true);/*bugly初始化*/
ServiceUtils.startService(MyMqttService.class);/*Mqtt初始化*/
// // 启动 MQTT 服务
// Intent mqttServiceIntent = new Intent(this, MyMqttService.class);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// startForegroundService(mqttServiceIntent);
// } else {
// startService(mqttServiceIntent);
// }
mqttConnect=MqttConnect.getInstance(this,"tcp://62.234.12.147","android-"+ MqttClient.generateClientId());
mqttConnect.mqttClient();
// 每次启动应用时重置状态
SpUtil.getInstance().setBooleanValue("youth_model_shown", false);
startInitSdk();
}
}
// piaoPingManager = PiaoPingManager.getInstance(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, 100);
}
}
// requestBatteryOptimizationExemption();
}
private void requestBatteryOptimizationExemption() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Intent intent = new Intent();
String packageName = getPackageName();
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
if (pm != null && !pm.isIgnoringBatteryOptimizations(packageName)) {
intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + packageName));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
startActivity(intent);
} catch (Exception e) {
LogUtils.e("Failed to request battery optimization exemption: " + e.getMessage());
}
}
}
}
private void startActivityForResult(Intent intent, int i) {
}
private PiaoPingManager piaoPingManager;
// private PiaoPingManager piaoPingManager;
private void initARouter() {
if (true) {
@@ -218,9 +573,9 @@ public class CommonAppContext extends MultiDexApplication {
// 确保在主线程中订阅
if (activity != null && !activity.isFinishing()) {
activity.runOnUiThread(() -> {
if (piaoPingManager != null) {
piaoPingManager.subscribe();
}
// if (piaoPingManager != null) {
// piaoPingManager.subscribe();
// }
});
}
}
@@ -248,9 +603,9 @@ public class CommonAppContext extends MultiDexApplication {
AppLifecycleUtil.onAppBackGround();
if (activity != null && !activity.isFinishing()) {
activity.runOnUiThread(() -> {
if (piaoPingManager != null) {
piaoPingManager.unsubscribe();
}
// if (piaoPingManager != null) {
// piaoPingManager.unsubscribe();
// }
});
}
}
@@ -354,6 +709,11 @@ public class CommonAppContext extends MultiDexApplication {
return mUserBean;
}
public UserInfo getUserInfo() {
UserInfo userInfo = SpUtil.getUserInfo();
return userInfo;
}
public void setUserBean(UserBean bean) {
mUserBean = bean;
}
@@ -370,9 +730,7 @@ public class CommonAppContext extends MultiDexApplication {
SpUtil.saveUserId(-1);
SpUtil.saveUserBean(new UserBean());
SpUtil.putToken("");
Intent intent = new Intent("com.xscm.action.LAUNCH_PAGE");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
// piaoPingManager.unsubscribe();
FileUtils.deleteAllInDir(getCacheDir());
FileUtils.deleteAllInDir(getExternalCacheDir());
@@ -383,7 +741,9 @@ public class CommonAppContext extends MultiDexApplication {
// 发送广播通知所有Activity刷新状态
Intent refreshIntent = new Intent("com.xscm.moduleutil.ACTION_USER_LOGOUT");
sendBroadcast(refreshIntent);
Intent intent = new Intent("com.xscm.action.LAUNCH_PAGE");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
}
public static boolean isAlipayInstalled(Context context) {
@@ -420,4 +780,109 @@ public class CommonAppContext extends MultiDexApplication {
}
});
}
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
}
@Override
public void onActivityStarted(@NonNull Activity activity) {
}
@Override
public void onActivityResumed(@NonNull Activity activity) {
if (activityCount == 0) {
// 应用从后台回到前台
if (appStateListener != null) {
appStateListener.onAppForeground();
}
// handleAppForeground(activity);
// AppStateManager.setRoomActivityMinimized(false);
}
activityCount++;
}
@Override
public void onActivityPaused(@NonNull Activity activity) {
activityCount--;
if (activityCount == 0) {
// 应用切换到后台
if (appStateListener != null) {
appStateListener.onAppBackground();
}
// handleAppBackground(activity);
// AppStateManager.setRoomActivityMinimized( true);
}
}
private void handleAppBackground(Activity activity) {
String className = activity.getClass().getName();
if (className.contains("RoomActivity") && appStateListener != null) {
// RoomActivity进入后台时显示悬浮窗
appStateListener.setFloatingWindowVisible(true);
}
}
private void handleAppForeground(Activity activity) {
// 获取当前Activity的类名避免直接引用类
String className = activity.getClass().getName();
if (className.contains("LaunchPageActivity")) {
// 对于启动页,我们需要检查是否应该跳转到主页面
if (appStateListener != null && appStateListener.isFloatingWindowVisible()) {
// 有悬浮窗,直接回到首页
ARouter.getInstance().build(ARouteConstants.ME).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP).navigation();
} else if (appStateListener != null && appStateListener.shouldShowSplash()) {
// 需要显示启动页,但已经在启动页了,不需要额外操作
return;
} else {
// 默认情况下,跳转到主页面
ARouter.getInstance().build(ARouteConstants.ME).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP).navigation();
}
return; // 启动页或引导页不需要特殊处理
}
if (appStateListener != null && appStateListener.isFloatingWindowVisible()) {
// 有悬浮窗,直接回到首页
// if (!className.contains("MainActivity")) {
ARouter.getInstance().build(ARouteConstants.ME).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP).navigation();
// }
} else if (appStateListener != null && appStateListener.shouldShowSplash()) {
// 需要显示启动页
try {
Class<?> splashActivityClass = Class.forName("com.xscm.modulemain.activity.LaunchPageActivity");
Intent intent = new Intent(activity, splashActivityClass);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
private void showFloatingWindow(Activity activity) {
// 这里实现显示悬浮窗的逻辑
AppStateManager.getInstance().setFloatingWindowVisible(true);
// 实际显示悬浮窗的代码,已实现
}
@Override
public void onActivityStopped(@NonNull Activity activity) {
}
@Override
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
}
@Override
public void onActivityDestroyed(@NonNull Activity activity) {
// String className = activity.getClass().getName();
// if (className.contains("RoomActivity") && appStateListener != null) {
// appStateListener.onRoomActivityDestroyed();
// }
}
}

View File

@@ -0,0 +1,537 @@
package com.xscm.moduleutil.base;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.bean.room.RoomInfoResp;
import com.xscm.moduleutil.bean.room.RoomOnline;
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
import com.xscm.moduleutil.event.RoomOutEvent;
import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.listener.MessageListenerSingleton;
import com.xscm.moduleutil.rtc.AgoraManager;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.moduleutil.utils.logger.Logger;
import org.greenrobot.eventbus.EventBus;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import io.reactivex.disposables.Disposable;
/**
* 房间管理器
* 统一处理房间数据获取、进入房间和退出房间的逻辑
*/
public class RoomManager {
private static final String TAG = "RoomManager";
private static RoomManager instance;
// 房间数据缓存
private Map<String, RoomInfoResp> roomDataCache = new ConcurrentHashMap<>();
private Map<String, Long> cacheTimestamps = new ConcurrentHashMap<>();
// 缓存有效期5分钟
private static final long CACHE_DURATION = 5 * 60 * 1000;
private RoomManager() {
}
public static synchronized RoomManager getInstance() {
if (instance == null) {
instance = new RoomManager();
}
return instance;
}
/**
* 进入房间 - 自动获取房间数据
*
* @param context 上下文
* @param roomId 房间ID
*/
public void enterRoom(Context context, String roomId) {
enterRoom(context, roomId, null, null);
}
/**
* 进入房间 - 使用密码
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
*/
public void enterRoom(Context context, String roomId, String password) {
enterRoom(context, roomId, password, null);
}
/**
* 进入房间 - 使用缓存数据
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
* @param cachedData 缓存的房间数据
*/
public void enterRoom(Context context, String roomId, String password, RoomInfoResp cachedData) {
if (TextUtils.isEmpty(roomId)) {
ToastUtils.showShort("房间ID不能为空");
return;
}
// 检查是否有有效的缓存数据
RoomInfoResp roomInfo = cachedData != null ? cachedData : getCachedRoomData(roomId);
if (roomInfo != null) {
// 使用缓存数据直接进入房间
navigateToRoom(context, roomId, password, roomInfo, false);
} else {
// 获取房间数据后进入房间
fetchRoomDataAndEnter(context, roomId, password);
}
}
/**
* 获取房间数据并进入房间
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
*/
public void fetchRoomDataAndEnter(Context context, String roomId, String password) {
// 显示加载提示
// 这里可以根据需要添加加载对话框
if (CommonAppContext.getInstance().isRoomJoininj){
return;
}
CommonAppContext.getInstance().isRoomJoininj=true;
// 检查是否有有效的缓存数据
// RoomInfoResp roomInfo = getCachedRoomData(roomId);
// 检查是否是当前房间且用户在线
// boolean isCurrentRoom = isCurrentRoom(roomId);
if (CommonAppContext.getInstance().playId == null) {
fetchAndJoinRoom(context, roomId, password);
} else {
if (!CommonAppContext.getInstance().playId.equals(roomId)) {
MessageListenerSingleton.getInstance().joinGroup(roomId);
exitRoom(CommonAppContext.getInstance().playId);
} else if (CommonAppContext.getInstance().lable_id.equals("6")) {
upInfo(context, roomId, password, true, null, true);
return;
}
isUserOnline(context, roomId, password, null);
}
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// }
// 如果是当前房间且用户在线,直接跳转到房间页面,仅更新数据
// // 获取房间数据
// MessageListenerSingleton.getInstance().joinGroup(roomId);
// // 等待一段时间确保退出完成
// try {
// Thread.sleep(500);
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// }
// RetrofitClient.getInstance().roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
//
// @Override
// public void onSubscribe(Disposable d) {
// }
//
// @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);
//// 初始化 Agora 并加入房间
// AgoraManager.getInstance(context)
// .joinRoom(token, roomId, uid, enableMic,enableJs);
// cacheRoomData(roomId, resp);
// navigateToRoom(context, roomId, password, resp);
// }
// });
// 临时实现 - 直接跳转(因为缺少具体的网络请求代码)
// navigateToRoom(context, roomId, password, null);
}
private void upInfo(Context context, String roomId, String password, boolean isOnline, RoomInfoResp roomInfo, boolean isCurrentRoom) {
if (isOnline) {
navigateToRoom(context, roomId, password, roomInfo, isOnline);
} else {
// CommonAppContext.getInstance().isShow = false;
// CommonAppContext.getInstance().isPlaying = false;
// EventBus.getDefault().post(new RoomOutEvent());
// try {
// Thread.sleep(300);
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// }
fetchAndJoinRoom(context, roomId, password);
}
// if (isCurrentRoom&& isOnline) {
// if (roomInfo != null) {
// navigateToRoom(context, roomId, password, roomInfo);
// } else {
// // 即使在线,如果没有缓存数据,也需要获取数据
// fetchAndJoinRoom(context, roomId, password);
// }
// return;
// }
// 如果有缓存数据且用户在线,使用缓存数据进入房间
// if (roomInfo != null && isOnline) {
// RetrofitClient.getInstance().postRoomInfo(roomId, new BaseObserver<RoomInfoResp>() {
//
// @Override
// public void onSubscribe(Disposable d) {
//
// }
//
// @Override
// public void onNext(RoomInfoResp roomInfoResp) {
//// cacheRoomData(roomId, roomInfo);
// navigateToRoom(context, roomId, password, roomInfoResp);
// }
// });
// cacheRoomData(roomId, roomInfo);
// navigateToRoom(context, roomId, password, roomInfo);
return;
// }
// 其他情况,获取新的房间数据并加入房间
// fetchAndJoinRoom(context, roomId, password);
}
/**
* 获取新的房间数据并加入房间
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
*/
private void fetchAndJoinRoom(Context context, String roomId, String password) {
// 获取房间数据
// 等待一段时间确保退出完成
try {
Thread.sleep(300);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
navigateToRoom(context, roomId, password, null, false);
// RetrofitClient.getInstance().roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
//
// @Override
// public void onSubscribe(Disposable d) {
// }
//
// @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);
//// 初始化 Agora 并加入房间
// AgoraManager.getInstance(context)
// .joinRoom(token, roomId, uid, enableMic,enableJs);
// cacheRoomData(roomId, resp);
// navigateToRoom(context, roomId, password, resp);
// }
// });
}
/**
* 检查是否是当前房间
*
* @param roomId 房间ID
* @return true表示是当前房间false表示不是
*/
private boolean isCurrentRoom(String roomId) {
// 这里应该实现检查是否是当前房间的逻辑
// 可以通过检查当前Activity或者通过全局变量等方式实现
// 目前返回false需要根据实际需求实现具体逻辑
RoomInfoResp roomInfo = getCachedRoomData(roomId);
if (roomInfo != null) {
if (roomInfo.getRoom_info().getRoom_id().equals(roomId)) {
return true;
} else {
return false;
}
}
return false;
}
/**
* 跳转到房间页面
*
* @param context 上下文
* @param roomId 房间ID
* @param password 房间密码
* @param roomInfo 房间信息
*/
private void navigateToRoom(Context context, String roomId, String password, RoomInfoResp roomInfo, boolean isOnline) {
try {
// 构建跳转参数
Bundle bundle = new Bundle();
bundle.putString("roomId", roomId);
bundle.putBoolean("isOnline", isOnline);
if (!TextUtils.isEmpty(password)) {
bundle.putString("password", password);
}
if (roomInfo != null) {
// bundle.putSerializable("roomInfo", roomInfo);
}
// 使用ARouter跳转到房间页面
ARouter.getInstance()
.build(ARouteConstants.ROOM_DETAILS)
.with(bundle)
.withFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
.navigation(context);
} catch (Exception e) {
Logger.e(TAG, "跳转房间页面失败: " + e.getMessage());
}
}
/**
* 缓存房间数据
*
* @param roomId 房间ID
* @param roomInfo 房间信息
*/
public void cacheRoomData(String roomId, RoomInfoResp roomInfo) {
if (TextUtils.isEmpty(roomId) || roomInfo == null) {
return;
}
// 清除所有现有的缓存数据
roomDataCache.clear();
cacheTimestamps.clear();
roomDataCache.put(roomId, roomInfo);
cacheTimestamps.put(roomId, System.currentTimeMillis());
}
/**
* 获取缓存的房间数据
*
* @param roomId 房间ID
* @return 房间信息如果缓存无效则返回null
*/
public RoomInfoResp getCachedRoomData(String roomId) {
if (TextUtils.isEmpty(roomId)) {
return null;
}
Long timestamp = cacheTimestamps.get(roomId);
if (timestamp == null) {
return null;
}
// 检查缓存是否过期
if (System.currentTimeMillis() - timestamp > CACHE_DURATION) {
// 缓存过期,清除数据
roomDataCache.remove(roomId);
cacheTimestamps.remove(roomId);
return null;
}
return roomDataCache.get(roomId);
}
/**
* 检查用户是否在线
*
* @param roomId 房间ID
* @return true表示用户在线false表示不在线
*/
private boolean isUserOnline(Context context, String roomId, String password, RoomInfoResp roomInfo) {
// 这里应该实现检查用户是否在线的逻辑
// 可以通过检查Agora是否还在房间中或者通过服务端接口查询用户状态等方式实现
// 目前返回false需要根据实际需求实现具体逻辑
// boolean isCurrentRoom=isCurrentRoom(roomId);
// try {
// Thread.sleep(300);
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// }
final boolean[] isOnline = {false};
RetrofitClient.getInstance().getRoomOnline(roomId, "1", "50", new BaseObserver<RoomOnline>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(RoomOnline roomOnline) {
try {
if (roomOnline != null) {
if (roomOnline.getOn_pit() != null) {
for (RoomOnlineBean roomOnlineBean : roomOnline.getOn_pit()) {
if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
isOnline[0] = true;
break;
}
}
}
if (roomOnline.getOff_pit() != null) {
for (RoomOnlineBean roomOnlineBean : roomOnline.getOff_pit()) {
if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
isOnline[0] = true;
break;
}
}
}
upInfo(context, roomId, password, isOnline[0], roomInfo, true);
} else {
isOnline[0] = false;
}
} catch (Exception e) {
// 捕获所有可能的异常,避免崩溃
e.printStackTrace();
isOnline[0] = false;
// 即使出现异常也继续执行
upInfo(context, roomId, password, isOnline[0], roomInfo, true);
}
}
});
return isOnline[0];
}
/**
* 清除指定房间的缓存数据
*
* @param roomId 房间ID
*/
public void clearRoomCache(String roomId) {
if (!TextUtils.isEmpty(roomId)) {
roomDataCache.remove(roomId);
cacheTimestamps.remove(roomId);
}
}
/**
* 清除所有房间缓存数据
*/
public void clearAllRoomCache() {
roomDataCache.clear();
cacheTimestamps.clear();
}
/**
* 退出房间
*
* @param roomId 房间ID
*/
public void exitRoom(String roomId) {
// 清除该房间的缓存数据
clearRoomCache(roomId);
// 可以在这里添加其他退出房间的逻辑
// 例如:通知服务器用户已退出、清理房间相关资源等
RetrofitClient.getInstance().quitRoom(roomId, SpUtil.getUserId() + "", new BaseObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(String s) {
}
});
Logger.d(TAG, "退出房间: " + roomId);
}
/**
* 批量退出房间
*
* @param roomIds 房间ID列表
*/
public void exitRooms(String... roomIds) {
if (roomIds != null) {
for (String roomId : roomIds) {
exitRoom(roomId);
}
}
}
/**
* 获取房间缓存状态
*
* @param roomId 房间ID
* @return 缓存状态信息
*/
public String getRoomCacheStatus(String roomId) {
if (TextUtils.isEmpty(roomId)) {
return "无效的房间ID";
}
Long timestamp = cacheTimestamps.get(roomId);
if (timestamp == null) {
return "未缓存";
}
long elapsed = System.currentTimeMillis() - timestamp;
if (elapsed > CACHE_DURATION) {
return "缓存已过期";
}
RoomInfoResp data = roomDataCache.get(roomId);
if (data == null) {
return "缓存数据为空";
}
return String.format("已缓存 (%d秒前)", elapsed / 1000);
}
}

View File

@@ -0,0 +1,22 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
/**
*@author qx
*@data 2025/9/25
*@description: 绑定详情
*/
@Data
public class BindDetail {
private String id;
private String alipay_name;//支付宝姓名
private String alipay_account;//支付宝账户
private String bank_card_number;//银行卡号
private String bank_user_name;//姓名
private String bank_card;//所属行
private String open_bank;//开户行
}

View File

@@ -0,0 +1,4 @@
package com.xscm.moduleutil.bean;
public class GiftAvatarBean {
}

View File

@@ -21,6 +21,8 @@ public class GiftBean {
private int number;
private String createtime;
private String nickname;
private String count;
private int count;
private String user_id;
private int num;
private boolean is_paly =false;
}

View File

@@ -0,0 +1,8 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
@Data
public class GiftPackEvent {
private String bdid;
}

View File

@@ -0,0 +1,13 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
/**
*@author qx
*@data 2025/9/15
*@description: 背包礼物总价值
*/
@Data
public class GiftPackListCount {
private String count;
}

View File

@@ -0,0 +1,8 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
@Data
public class MqttXlhEnd {
private String message;
}

View File

@@ -13,7 +13,7 @@ public class MusicSongBean implements Serializable {
private String did;//歌曲id
private String room_id;
private String song_code;//歌曲唯一标识
private String song_code="";//歌曲唯一标识
private String song_name;//歌曲名称
private String singer;//歌手
private String poster;//封面

View File

@@ -4,9 +4,10 @@ import lombok.Data;
@Data
public class MyBagDataBean {
private String title;
private String giftName;
private String time;
private String base_image;
private String remarks; //收入说明
private String gift_num;//礼物数量
private String gift_name;//礼物名称
private String gift_image;//礼物图片
private String time;//时间
}

View File

@@ -53,13 +53,16 @@ public class PlaceholderBean {
@Data
public static class ListsBean {
private String user_id;
private String user_code;
private String nickname;
private String nickname1;
private String avatar;
private String total;
private String rank;
private List<String> icon;
private String room_name;
private String room_id;
private String room_number;
private String room_cover;
private int id;//公会id

View File

@@ -1,5 +1,6 @@
package com.xscm.moduleutil.bean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.room.FriendInfo;
import com.xscm.moduleutil.bean.room.FriendUserBean;
import com.xscm.moduleutil.bean.room.RoomAuction;
@@ -34,7 +35,9 @@ public class RoomMessageEvent {
private String jia_jia;
private UserInfo FromUserInfo;
private UserInfo ToUserInfo;
private List<UserInfo> ToUserInfos;
private GiftBean GiftInfo;
private List<GiftBean> GiftInfos;
private int room_up_pit_type;
private MusicSongBean songInfo;
private MusicSongBean nextInfo;
@@ -51,7 +54,7 @@ public class RoomMessageEvent {
private String AcceptRoomId;//接收者所在的房间id
private String PkId;
private String room_id;//当type==1的时候。这个roomId是对方的房间id
private String user_id;
private String user_id="";
private String pk_end_times;//pk结束时间
private List<RoomPitBean> userCharmList;
@@ -86,6 +89,13 @@ public class RoomMessageEvent {
private long time_day;
private int online_number;//在线人数
private BlindBoxBean.XlhData xlh_data;
private String from_pit_number;
private String to_pit_number;
private String gift_num;
}
@Data

View File

@@ -0,0 +1,21 @@
package com.xscm.moduleutil.bean;
import java.util.List;
import lombok.Data;
/**
*@author qx
*@data 2025/9/10
*@description: 魅力详情列表
*/
@Data
public class RoomUserCharmListBean {
private int user_id;
private String total_price;
private String nickname;
private String avatar;
private String user_code;
private int charm;
private List<String> icon ;
}

View File

@@ -19,6 +19,8 @@ public class UserBean implements Serializable {
private String mobile;
private int sex;
private int auth;
private int is_can_chat;//是否可以私聊1可以0不可以
private int can_chat_money;//需要充值的金额
private List<MultiUserBean> multi_user;

View File

@@ -55,6 +55,9 @@ public class UserInfo implements Serializable {
private String red_status;
private String gift_num;
private int is_can_chat;//是否可以私聊1可以0不可以
private int can_chat_money;//需要充值的金额
private RelationshipBean qinmi;
private RelationshipBean zhenai;

View File

@@ -0,0 +1,16 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
/**
*@author qx
*@data 2025/9/2
*@description: 巡乐会开始后推送的信息
*/
@Data
public class XLHBean {
private String text;
private String room_id;
private int from_type ;
}

View File

@@ -21,16 +21,24 @@ public class BlindBoxBean {
private String title;
private String rule_url;
private String rule;
private String box_price ;
private int box_price ;///每一次抽奖的价格
private String xlh_end_time;///巡乐会结束时间
private int is_xlh; ///是否开启巡乐会 0 关闭 1 开启
private Object xlh_data;
private List<GiftBean> gift_list;
private String end_time;//巡乐会结束时间
private GiveGift give_homeowner_gift;//房主礼物
private GiveGift locking_gift;//锁定礼物
private xlhUser xlh_user;//巡乐会中奖用户
public boolean isXlhDataArray() {
return xlh_data instanceof JsonArray || xlh_data instanceof List;
}
public boolean isXlhDataObject() {
return xlh_data instanceof JsonObject || xlh_data instanceof XlhData;
return xlh_data instanceof JsonObject || xlh_data instanceof Map || xlh_data instanceof XlhData;
}
public List<XlhData> getXlhDataAsList() {
@@ -43,7 +51,88 @@ public class BlindBoxBean {
public XlhData getXlhDataAsObject() {
if (isXlhDataObject()) {
return (XlhData) xlh_data;
// 如果已经是XlhData类型直接返回
if (xlh_data instanceof XlhData) {
return (XlhData) xlh_data;
}
// 如果是Map类型Gson解析后的LinkedTreeMap手动转换
else if (xlh_data instanceof Map) {
Map<String, Object> map = (Map<String, Object>) xlh_data;
XlhData xlhData = new XlhData();
// 安全地转换各个字段
Object waitingStartNum = map.get("waiting_start_num");
if (waitingStartNum != null) {
xlhData.setWaiting_start_num(waitingStartNum.toString());
}
Object startNum = map.get("start_num");
if (startNum != null) {
xlhData.setStart_num(startNum.toString());
}
Object currentNum = map.get("current_num");
if (currentNum != null) {
if (currentNum instanceof Number) {
xlhData.setCurrent_num(((Number) currentNum).intValue());
} else {
try {
xlhData.setCurrent_num(Integer.parseInt(currentNum.toString()));
} catch (NumberFormatException e) {
xlhData.setCurrent_num(0);
}
}
}
Object status = map.get("status");
if (status != null) {
if (status instanceof Number) {
xlhData.setStatus(((Number) status).intValue());
} else {
try {
xlhData.setStatus(Integer.parseInt(status.toString()));
} catch (NumberFormatException e) {
xlhData.setStatus(0);
}
}
}
Object endTime = map.get("end_time");
if (endTime != null) {
if (endTime instanceof String){
xlhData.setEnd_time(endTime.toString());
}else {
xlhData.setEnd_time(endTime.toString());
}
}
return xlhData;
}
// 如果是JsonObject也需要转换
else if (xlh_data instanceof JsonObject) {
JsonObject jsonObject = (JsonObject) xlh_data;
XlhData xlhData = new XlhData();
if (jsonObject.has("waiting_start_num")) {
xlhData.setWaiting_start_num(jsonObject.get("waiting_start_num").getAsString());
}
if (jsonObject.has("start_num")) {
xlhData.setStart_num(jsonObject.get("start_num").getAsString());
}
if (jsonObject.has("current_num")) {
xlhData.setCurrent_num(jsonObject.get("current_num").getAsInt());
}
if (jsonObject.has("status")) {
xlhData.setStatus(jsonObject.get("status").getAsInt());
}
if (jsonObject.has("end_time")){
xlhData.setEnd_time(jsonObject.get("end_time").getAsString());
}
return xlhData;
}
}
return null;
}
@@ -53,5 +142,21 @@ public class BlindBoxBean {
private String start_num;//巡乐会开启需要达到的次数
private int current_num;//当前已抽奖次数
private int status;
private String end_time;
}
@Data
public static class GiveGift {
private int gift_id;
private String gift_name;
private String base_image;
private String gift_num;
private String gift_price;
}
@Data
public static class xlhUser {
private String user_id;
private String nickname;
private String avatar;
}
}

Some files were not shown because too many files have changed in this diff Show More