1:羽声新版本

This commit is contained in:
2025-10-24 17:52:11 +08:00
parent 437a623f81
commit a809b02ebb
827 changed files with 25795 additions and 1193698 deletions

View File

@@ -1,14 +1,22 @@
plugins { plugins {
alias(libs.plugins.android.application) alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.android)
} }
android { android {
namespace 'com.xscm.midi' // 1. 定义渠道维度(必须配置,否则报错)
compileSdk 35 flavorDimensions "environment"
namespace 'com.qxcm.qxlive'
compileSdk 35
bundle {
language {
enableSplit = false
}
}
defaultConfig { defaultConfig {
applicationId "com.xscm.midi" applicationId "com.qxcm.qxlive"
minSdk 24 minSdk 24
targetSdk 33 targetSdk 33
versionCode Integer.parseInt(project.findProperty("APP_VERSION_CODE")) versionCode Integer.parseInt(project.findProperty("APP_VERSION_CODE"))
@@ -18,8 +26,8 @@ android {
ndk { ndk {
//设置支持的so库 //设置支持的so库
abiFilters 'arm64-v8a' ,'armeabi' // abiFilters 'arm64-v8a', 'armeabi','arm64'
// abiFilters 'armeabi-v7a', 'arm64-v8a' abiFilters 'arm64-v8a', 'armeabi-v7a'
} }
javaCompileOptions { javaCompileOptions {
@@ -29,33 +37,72 @@ android {
] ]
} }
} }
// 【默认图标占位符】后续会被渠道配置覆盖
manifestPlaceholders = [
icon: "@mipmap/ic_launcher" // 默认图标main目录下的图标
]
// signingConfig signingConfigs.release // signingConfig signingConfigs.release
// proguardFiles 'proguard-rules.pro' // proguardFiles 'proguard-rules.pro'
} }
// 2. 配置测试版和正式版渠道
productFlavors {
// 正式版配置
releas {
dimension "environment"
// 正式版包名使用基础包名com.example.myapp
applicationIdSuffix ""
// 【正式版应用名称】通过resValue动态生成string资源
resValue "string", "app_name", "羽声语音"
// 【正式版图标】替换manifest中的占位符使用main目录下的正式图标
manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher" // 需在main/res/mipmap放置该图标
]
}
// // 测试版配置
beta {
// dimension "environment"
// // 测试版包名:基础包名 + .betacom.example.myapp.beta
// applicationIdSuffix ".beta"
// // 测试版版本名1.0-beta
// versionNameSuffix "-beta"
//
// // 【测试版应用名称】动态生成带标识的名称
// resValue "string", "app_name", "羽声-测试版"
//
// // 【测试版图标】替换为测试专用图标
// manifestPlaceholders = [
// appIcon: "@mipmap/ic_launcher_app_bat" // 需在main/res/mipmap放置该图标
// ]
}
}
signingConfigs { signingConfigs {
debug { debug {
storeFile file("midi.jks") storeFile file("my-release-key.jks")
storePassword "123456" storePassword "123456"
keyAlias "key0" keyAlias "mykey"
keyPassword "123456" keyPassword "123456"
} }
release { release {
storeFile file("midi.jks") storeFile file("my-release-key.jks")
storePassword "123456" storePassword "123456"
keyAlias "key0" keyAlias "mykey"
keyPassword "123456" keyPassword "123456"
} }
} }
buildTypes { buildTypes {
release { release {
minifyEnabled true minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release signingConfig signingConfigs.release
@@ -77,7 +124,7 @@ android {
debug { debug {
debuggable true debuggable true
minifyEnabled true minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug signingConfig signingConfigs.debug
@@ -118,11 +165,11 @@ android {
kotlinOptions { kotlinOptions {
jvmTarget = '17' jvmTarget = '17'
} }
dexOptions { // dexOptions {
dexInProcess true // dexInProcess true
preDexLibraries true // preDexLibraries true
javaMaxHeapSize "6g" // javaMaxHeapSize "6g"
} // }
} }
@@ -148,7 +195,7 @@ dependencies {
implementation files('libs/WbCloudNormal-v5.1.10-4e3e198.aar') implementation files('libs/WbCloudNormal-v5.1.10-4e3e198.aar')
implementation (libs.arouter.api.v150) implementation(libs.arouter.api.v150)
//annotationProcessor //annotationProcessor
annotationProcessor libs.arouter.compiler annotationProcessor libs.arouter.compiler
implementation project(':modulevocal') // 必须 implementation project(':modulevocal') // 必须

View File

@@ -898,3 +898,50 @@ public static java.lang.String TABLENAME;
-keep class com.xscm.moduleutil.utils.location.** { *; } -keep class com.xscm.moduleutil.utils.location.** { *; }
-keep class io.agora.**{*;} -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** {
*;
}
-keep class com.xscm.moduleutil.bean.RedBean** {*;}
-keepclassmembers class com.xscm.moduleutil.bean.RedBean** {
*;
}
-keep class com.xscm.moduleutil.bean.HourlyBean** {*;}
-keepclassmembers class com.xscm.moduleutil.bean.HourlyBean** {
*;
}
# 保持EventBus相关类不被混淆
-keepclassmembers class * {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
-keep class **.R$string { *; }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +0,0 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.xscm.midi",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 101,
"versionName": "1.0.5",
"outputFile": "秘地_1.0.5_101.apk"
}
],
"elementType": "File",
"baselineProfiles": [
{
"minApi": 28,
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/秘地_1.0.5_101.dm"
]
},
{
"minApi": 31,
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/秘地_1.0.5_101.dm"
]
}
],
"minSdkVersionForDexing": 24
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.xscm.midi"> package="com.qxcm.qxlive">
<!-- Features --> <!-- Features -->
<!-- Features --> <!-- Features -->
@@ -115,45 +115,48 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" /> <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_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application <application
android:name=".AppContext" android:name="com.qxcm.qxlive.AppContext"
android:allowBackup="true" android:allowBackup="true"
android:extractNativeLibs="true" android:extractNativeLibs="true"
android:largeHeap="true" android:largeHeap="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:icon="@mipmap/ic_launcher" android:resizeableActivity="true"
android:icon="@mipmap/ic_launcher_app"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_foreground"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme_MAIN"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
tools:targetApi="tiramisu"
tools:ignore="SelectedPhotoAccess" tools:ignore="SelectedPhotoAccess"
tools:replace="android:theme,android:allowBackup" tools:replace="android:theme,android:allowBackup,android:roundIcon,android:icon"
android:enableOnBackInvokedCallback="true" android:enableOnBackInvokedCallback="true"
android:requestRawExternalStorageAccess="true" android:requestRawExternalStorageAccess="true"
tools:targetApi="tiramisu"
> >
<activity <activity
android:name=".LaunchPageActivity" android:name=".LaunchPageActivity"
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true" android:exported="true"
android:screenOrientation="behind" android:screenOrientation="behind"
android:launchMode="singleTask"> android:theme="@style/main_SplashThemeImage">
<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" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="com.qxcm.qxlive.LAUNCH_PAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity> </activity>
<!-- 配置APP ID --> <!-- 配置APP ID -->
<meta-data <meta-data
android:name="BUGLY_APPID" android:name="BUGLY_APPID"
android:value="865cfe9555" /> android:value="b45883f58f" />
<!-- &lt;!&ndash; 配置APP版本号 &ndash;&gt;--> <!-- &lt;!&ndash; 配置APP版本号 &ndash;&gt;-->
<!-- <meta-data--> <!-- <meta-data-->
<!-- android:name="BUGLY_APP_VERSION"--> <!-- android:name="BUGLY_APP_VERSION"-->
@@ -196,13 +199,18 @@
android:taskAffinity="com.xscm.qxlive" android:taskAffinity="com.xscm.qxlive"
android:launchMode="singleTask"> android:launchMode="singleTask">
</activity> </activity>
<!-- 微信支付回调Activity必须放在包名.wxapi路径下 -->
<activity <activity
android:name=".RealNameActivity" android:name=".wxapi.WXPayEntryActivity"
android:exported="true"
android:launchMode="singleTop" />
<activity
android:name="com.example.modulevocal.activity.RealNameActivity"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".PasswordLoginActivity" android:name=".PasswordLoginActivity"
android:exported="true" android:launchMode="singleTask" android:exported="true"
/> />
</application> </application>
<!-- <queries>--> <!-- <queries>-->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

View File

@@ -1,103 +0,0 @@
package com.xscm.midi;
import com.alibaba.android.arouter.launcher.ARouter;
import com.hjq.toast.ToastUtils;
import com.xscm.moduleutil.base.CommonAppContext;
/**
* Created by cxf on 2017/8/3.
*/
public class AppContext extends CommonAppContext {
private boolean mBeautyInited;
@Override
public void onCreate() {
super.onCreate();
ToastUtils.init(this);
ARouter.init(this);
/* mqttClient = MyMQTTClient.getInstance(this);
mqttClient.initialize("tcp://81.70.45.221:1883");
new Thread(() -> {
boolean connected = mqttClient.connect();
runOnUiThread(() -> {
if (connected) {
} else {
com.blankj.utilcode.util.ToastUtils.showShort("MQTT连接失败");
}
});
}).start();*/
// ToastUtils.setInterceptor(new IToastInterceptor() {
// @Override
// public boolean intercept(CharSequence charSequence) {
// return !CommonAppContext.getInstance().isFront();
// }
// });
// L.setDeBug(BuildConfig.DEBUG);
}
public static void initSdk() {
// CommonAppContext context = CommonAppContext.getInstance();
// if (BuildConfig.DEBUG) {
// L.e("应用签名:" + context.getAppSignature());
// //L.e("facebook散列秘钥------>" + context.getFacebookHashKey());
// }
// //腾讯云直播鉴权url
// String liveLicenceUrl = "https://license.vod2.myqcloud.com/license/v2/1346816652_1/v_cube.license";
// //腾讯云直播鉴权key
// String liveKey = "c30f209835056ba00f738a014ca4448a";
// //腾讯云视频鉴权url
// String ugcLicenceUrl = "https://license.vod2.myqcloud.com/license/v2/1346816652_1/v_cube.license";
// //腾讯云视频鉴权key
// String ugcKey = "c30f209835056ba00f738a014ca4448a";
// TXLiveBase.getInstance().setDebug(BuildConfig.DEBUG);
// TXLiveBase.getInstance().setLicence(context, liveLicenceUrl, liveKey, ugcLicenceUrl, ugcKey);
// //初始化腾讯bugly
// CrashReport.initCrashReport(context);
// CrashReport.setAppVersion(context, CommonAppConfig.getInstance().getVersion());
// //初始化ShareSdk
// MobSDK.init(context);
// MobSDK.submitPolicyGrantResult(true);
// //初始化IM
// ImMessageUtil.getInstance().init();
// //初始化腾讯TPNS 移动推送
// TpnsUtil.register(BuildConfig.DEBUG);
// //初始化友盟统计
// UmengUtil.init(context, BuildConfig.DEBUG);
// //OpenInstall
// OpenInstall.init(context);
}
/**
* 初始化美狐
*/
public void initBeautySdk(String beautyAppId, String beautyKey) {
// if (!TextUtils.isEmpty(beautyAppId) && !TextUtils.isEmpty(beautyKey)) {
// if (!mBeautyInited) {
// mBeautyInited = true;
// if (CommonAppConfig.isYunBaoApp()) {
// beautyAppId = DecryptUtil.decrypt(beautyAppId);
// beautyKey = DecryptUtil.decrypt(beautyKey);
// }
// MHSDK.init(this, beautyAppId, beautyKey);
// CommonAppConfig.getInstance().setMhBeautyEnable(true);
// L.e("美狐初始化----AppId--->" + beautyAppId + "---AppKey--->" + beautyKey);
// }
// } else {
// CommonAppConfig.getInstance().setMhBeautyEnable(false);
// }
}
@Override
public void startInitSdk() {
initSdk();
}
}

View File

@@ -1,20 +0,0 @@
package com.xscm.midi;
import android.app.Activity;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.activity.IView;
public final class LaunchContacter {
public interface View extends IView<Activity> {
}
public interface ILoginPre extends IPresenter {
void oauthLogin(String login_token);
void address_ip(String address_ip);
}
}

View File

@@ -1,97 +0,0 @@
package com.xscm.midi;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.Nullable;
import com.xscm.modulelogin.activity.ImproveInfoActivity;
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.dialog.PolicyDialog;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.midi.databinding.ActivityLaunchPageBinding;
public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPageBinding> {
private Handler handler;
// public PhoneNumberAuthHelper phoneNumberAuthHelper;
// private TokenResultListener tokenResultListener;
private boolean canOnePass;
private boolean isCanOnePass = true;
private String city1="";
@Override
protected void initData() {
handler = new Handler();
// 定义一个Runnable
Runnable runnable = new Runnable() {
@Override
public void run() {
initLogin();
}
};
if (SpUtil.isAgreePolicy()) {
initLogin();
// //延迟1.5秒执行
// handler.postDelayed(runnable, 2500);
} else {
PolicyDialog policyDialog = new PolicyDialog(this);
policyDialog.setCancelable(false);
policyDialog.setCanceledOnTouchOutside(false);
policyDialog.setPolicyClickListener(new PolicyDialog.PolicyClickListener() {
@Override
public void policyAgree() {
SpUtil.completeAgreePolicy();
// CommonAppContext.getInstance().initialization();
initLogin();
}
@Override
public void policyExit() {
finish();
}
});
policyDialog.show();
}
}
@Override
protected void initView() {
}
private void initLogin() {
startActivity(new Intent(this, PasswordLoginActivity.class));
finish();
}
@Override
protected int getLayoutId() {
return R.layout.activity_launch_page;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!this.isTaskRoot()) {
Intent intent = getIntent();
if (intent != null) {
String action = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
finish();
return;
}
}
}
}
}

View File

@@ -1,99 +0,0 @@
package com.xscm.midi;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.modulelogin.activity.ImproveInfoActivity;
import com.xscm.modulelogin.activity.SwitchAccountsActivity;
import com.xscm.modulemain.activity.MainActivity;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.bean.UserBean;
import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.presenter.BasePresenter;
import org.greenrobot.eventbus.EventBus;
import java.util.List;
import io.reactivex.disposables.Disposable;
public class LaunchPresenter extends BasePresenter<LaunchContacter.View> implements LaunchContacter.ILoginPre {
public LaunchPresenter(LaunchContacter.View view, Context context) {
super(view, context);
}
@Override
public void oauthLogin(String login_token) {
api.oauthLogin(login_token, new BaseObserver<List<UserBean>>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(List<UserBean> userBeans) {
loginSuccess(userBeans);
}
});
}
@Override
public void address_ip(String address_ip) {
api.address_ip(address_ip, new BaseObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
// addDisposable(d);
}
@Override
public void onNext(String s) {
}
});
}
public void loginSuccess(List<UserBean> userBean) {
if (userBean==null) {
ToastUtils.showShort("登录失败请重试");
return;
}
if (userBean.size()==1) {
CommonAppContext.getInstance().setUser(userBean.get(0));
// PreferencesUtils.putString( CommonAppContext.getInstance(), "mobile", userBean.get());
if (isViewAttach()) {
// MvpRef.get().disLoadings();
}
if (userBean.get(0).getSex() == 0) {
try {
Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), ImproveInfoActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("userBean", userBean.get(0));
intent.putExtras(bundle);
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
} else {
com.blankj.utilcode.util.ActivityUtils.startActivity(MainActivity.class);
}
}else {
Intent intent=new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), SwitchAccountsActivity.class);
Bundle bundle=new Bundle();
bundle.putSerializable("userBean", userBean.get(0));
intent.putExtras(bundle);
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
}
EventBus.getDefault().post(userBean);
// EventBus.getDefault().post(new SplashFinishEvent());
// AppLog.setUserUniqueID(userBean.getUser_id()); // 设置您自己的账号体系ID, 并保证其唯一性
}
}

View File

@@ -1,625 +0,0 @@
package com.xscm.midi;
import static android.view.View.VISIBLE;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.alibaba.fastjson.JSON;
import com.alipay.sdk.app.AuthTask;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.hjq.toast.ToastUtils;
import com.mobile.auth.gatewayauth.AuthUIConfig;
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
import com.mobile.auth.gatewayauth.PreLoginResultListener;
import com.mobile.auth.gatewayauth.TokenResultListener;
import com.mobile.auth.gatewayauth.model.TokenRet;
import com.xscm.modulelogin.activity.ImproveInfoActivity;
import com.xscm.modulelogin.even.LoginFinishEvent;
import com.xscm.modulelogin.present.LoginContacter;
import com.xscm.modulelogin.present.LoginPresenter;
import com.xscm.modulemain.activity.MainActivity;
import com.xscm.moduleutil.activity.BaseMvpActivity;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.bean.ThemeBean;
import com.xscm.moduleutil.bean.UserBean;
import com.xscm.moduleutil.utils.BarUtils;
import com.xscm.moduleutil.utils.PreferencesUtils;
import com.xscm.moduleutil.utils.logger.Logger;
import com.xscm.midi.databinding.ActivityPasswordLoginBinding;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, ActivityPasswordLoginBinding> implements LoginContacter.View, View.OnClickListener {
private CountDownTimer mTimer;
public String mobile;
private int type;//1:验证码登录2密码登录
boolean isPasswordVisible = false;
public PhoneNumberAuthHelper phoneNumberAuthHelper;
private TokenResultListener tokenResultListener;
private boolean canOnePass;
@Override
protected void initData() {
}
@Override
protected int getLayoutId() {
return R.layout.activity_password_login;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
// 检查是否已经创建过该Activity
if (!isTaskRoot()) {
Intent intent = getIntent();
if (intent != null) {
String action = intent.getAction();
// 如果是从Launcher启动的并且Activity已经存在则finish当前实例
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
finish();
return;
}
}
}
super.onCreate(savedInstanceState);
// EventBus.getDefault().register(this);
// AppLogUtil.reportAppLog(AppLogEvent.A0101);
}
@Override
protected void onDestroy() {
EventBus.getDefault().unregister(this);
if (phoneNumberAuthHelper!=null) {
phoneNumberAuthHelper.hideLoginLoading();
//获取成功 dimiss就去登录、登录成功
phoneNumberAuthHelper.quitLoginPage();
}
super.onDestroy();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void finishEvent(LoginFinishEvent event) {
finish();
}
@Override
protected void initView() {
super.initView();
MvpPre.getThemeData();
initQuickLogin();
checkOnePass();
BarUtils.setStatusBarAlpha(this, 0);
mBinding.edPhone.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
setUpLoginBtn();
}
@Override
public void afterTextChanged(Editable s) {
}
});
mBinding.edPhone.setOnFocusChangeListener(new View.
OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (mBinding.edPhone == null) {
return;
}
if (hasFocus) {
mBinding.relPhone.setSelected(true);
} else {
// 此处为失去焦点时的处理内容
mBinding.relPhone.setSelected(false);
}
}
});
mBinding.edPhone.setText(PreferencesUtils.getString(CommonAppContext.getInstance(), "mobile"));
if (!TextUtils.isEmpty(mobile)) {
mBinding.edPhone.setText(mobile);
}
mBinding.tvCodeText.setOnClickListener(this::onClick);
mBinding.flLogin.setOnClickListener(this::onClick);
mBinding.tvYhxy.setOnClickListener(this::onClick);
mBinding.tvYsxy.setOnClickListener(this::onClick);
mBinding.ivZfb.setOnClickListener(this::onClick);
mBinding.ivWeixin.setOnClickListener(this::onClick);
mBinding.tvSendCode.setOnClickListener(this::onClick);
mBinding.ivEye.setOnClickListener(this::onClick);
if (mBinding.tvCodeText.getText().equals("切换密码登录")){
type=1;
}else {
type=2;
}
}
private void initQuickLogin() {
tokenResultListener = new TokenResultListener() {
@Override
public void onTokenSuccess(String s) {
Logger.e("onTokenSuccess", s);
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
TokenRet tokenRet = null;
try {
tokenRet = JSON.parseObject(s, TokenRet.class);
if (tokenRet != null && ("600000").equals(tokenRet.getCode())) {
LogUtils.e("@@@",tokenRet.getToken());
MvpPre.oauthLoginLogin(tokenRet.getToken());
// phoneNumberAuthHelper.hideLoginLoading();
// //获取成功 dimiss就去登录、登录成功
// phoneNumberAuthHelper.quitLoginPage();
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
@Override
public void onTokenFailed(String s) {
Logger.e("onTokenFailed", s);
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
phoneNumberAuthHelper.hideLoginLoading();
phoneNumberAuthHelper.quitLoginPage();
}
});
}
};
try {
phoneNumberAuthHelper = PhoneNumberAuthHelper.getInstance(getApplicationContext(), null);
phoneNumberAuthHelper.getReporter().setLoggerEnable(true);
// phoneNumberAuthHelper.setAuthSDKInfo("6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=");
phoneNumberAuthHelper.setAuthSDKInfo(((CommonAppContext) getApplication()).getCurrentEnvironment().getALI_AUTH_KEY());
phoneNumberAuthHelper.checkEnvAvailable(2);
} catch (Throwable ignored) {
Logger.e("initAuthSDK", ignored);
}
}
private void checkOnePass() {
if (!TextUtils.isEmpty(CommonAppContext.getInstance().getToken()) && !TextUtils.isEmpty(CommonAppContext.getInstance().getUser().getTencent_im())) {
isRoot();
return;
}
showLoadings();
if (phoneNumberAuthHelper != null) {
phoneNumberAuthHelper.accelerateLoginPage(3 * 1000, new PreLoginResultListener() {
@Override
public void onTokenSuccess(String s) {
Logger.e("onTokenSuccess", s);
canOnePass = true;
isRoot();
}
@Override
public void onTokenFailed(String s, String s1) {
Logger.e("onTokenFailed", "错误信息" + s, s1);
isRoot();
}
});
} else {
canOnePass = false;
isRoot();
}
}
private void isRoot() {
runOnUiThread(new Runnable() {
@Override
public void run() {
disLoadings();
if (!PasswordLoginActivity.this.isTaskRoot()) {
Intent intent = getIntent();
if (intent != null) {
String action = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
finish();
} else {
goNextActivity();
}
} else {
goNextActivity();
}
} else {
goNextActivity();
}
}
});
}
private void goNextActivity() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
if (isFinishing() || isDestroyed()) {
return;
}
}
if (TextUtils.isEmpty(CommonAppContext.getInstance().getToken()) || TextUtils.isEmpty(CommonAppContext.getInstance().getUser().getTencent_im())) {
Logger.e("SplashEnd", "ARouters.CODE_LOGIN");
if (canOnePass) {
phoneNumberAuthHelper.setAuthListener(tokenResultListener);
doOnePass();
} else {
}
} else {
Logger.e("SplashEnd", "ARouters.MAIN");
UserBean userBean = CommonAppContext.getInstance().getUser();
// 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("@@@",code,"描述:",desc);
// }
// @Override
// public void onSuccess() {
// LogUtils.e("@@@","成功");
//
// }
// });
if (userBean.getSex() == 0) {
Intent intent = new Intent(this, ImproveInfoActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("userBean", userBean);
intent.putExtras(bundle);
startActivity(intent);
} else {
EventBus.getDefault().post(userBean);
startActivity(new Intent(this, MainActivity.class));
}
finish();
}
}
private void doOnePass() {
AuthUIConfig authUIConfig = new AuthUIConfig.Builder()
//导航栏
.setNavColor(Color.TRANSPARENT)
.setNavReturnHidden(true)
.setNavHidden(true)
.setNavText("")
.setNavTextColor(Color.BLACK)
.setWebNavColor(Color.TRANSPARENT)
.setWebNavTextColor(Color.BLACK)
.setWebNavReturnImgPath("ic_topbar_back_dark")
//状态栏区
.setStatusBarColor(Color.TRANSPARENT)
.setLightColor(false)
.setWebViewStatusBarColor(Color.TRANSPARENT)
.setStatusBarUIFlag(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
//logo区
.setLogoImgPath("login_log")
.setLogoWidth(142)
.setLogoHeight(142)
.setLogoOffsetY(54)
.setLogoHidden(false)
.setLogoScaleType(ImageView.ScaleType.FIT_XY)
//Slogan
.setSloganText("本机号码")
.setSloganTextColor(Color.parseColor("#A8A8A8"))
.setSloganTextSize(12)
.setSloganOffsetY(236)
//掩码栏
.setNumberColor(Color.BLACK)
.setNumberSize(30)
.setNumFieldOffsetY(263)
.setNumberLayoutGravity(Gravity.CENTER_HORIZONTAL)
//登录按钮
.setLogBtnText("一键登录")
.setLogBtnWidth(300)
.setLogBtnHeight(42)
.setLogBtnOffsetY(325)
.setLogBtnTextSize(14)
.setLogBtnTextColor(getResources().getColor(R.color.white))
.setLogBtnBackgroundPath("theme_bg")
//切换到其他方式
.setSwitchAccText("其他登录方式")
.setSwitchAccTextColor(Color.parseColor("#333333"))
.setSwitchAccTextSize(12)
.setSwitchOffsetY(390)
//协议栏
.setAppPrivacyOne("《用户协议》", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6")
.setAppPrivacyTwo("《隐私协议》", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4")
.setAppPrivacyColor(Color.parseColor("#A8A8A8"), Color.parseColor("#FFBC00"))
.setPrivacyBefore("登录即代表同意")
.setPrivacyEnd("并授权获得号码")
.setPrivacyTextSize(11)
.setPrivacyAlertContentVerticalMargin(20)
.setPrivacyMargin(39)
.setPrivacyState(true)
.setCheckboxHidden(false)
.setCheckedImgPath("ic_agreement_selected")
.setUncheckedImgPath("ic_agreement_unselect")
.setPrivacyOffsetX(2)
.setVendorPrivacyPrefix("")
.setVendorPrivacySuffix("")
.setProtocolAction("com.xscm.qxlive.PROTOCOL_WEBVIEW")//跳转到自定义的页面展示隐私协议
.setPackageName("com.xscm.qxlive")
//全页面属性
.setAuthPageActIn("in_activity", "out_activity")
.setAuthPageActOut("in_activity", "out_activity")
.setPageBackgroundPath("log_bj")
.create();
phoneNumberAuthHelper.setAuthUIConfig(authUIConfig);
phoneNumberAuthHelper.getLoginToken(getApplicationContext(), 5000);
}
@Override
protected LoginPresenter bindPresenter() {
return new LoginPresenter(this, this);
}
@Override
public void showLoadings() {
showLoading();
}
@Override
public void disLoadings() {
disLoading();
}
private void setUpLoginBtn() {
String text = mBinding.edPhone.getText().toString();
if (text.length() == 11) {
mBinding.flLogin.setEnabled(true);
mBinding.ivLoginBg.setAlpha(1f);
} else {
mBinding.ivLoginBg.setAlpha(0.3f);
mBinding.flLogin.setEnabled(false);
}
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.tv_code_text) {
// Intent intent = new Intent(this, LoginActivity.class);
// intent.putExtra("mobile", mBinding.edPhone.getText().toString());
// startActivity(intent);
// finish();
if (mBinding.tvCodeText.getText().equals("切换密码登录")){
mBinding.rlPassCode.setVisibility(VISIBLE);
mBinding.rlCode.setVisibility(View.GONE);
mBinding.tvCodeText.setText("切换验证码登录");
mBinding.tvLoginText.setText("密码登录");
type=2;
}else {
mBinding.rlPassCode.setVisibility(View.GONE);
mBinding.rlCode.setVisibility(VISIBLE);
mBinding.tvCodeText.setText("切换密码登录");
mBinding.tvLoginText.setText("验证码登录");
type=1;
}
}
else if (id == R.id.fl_login) {
if (!mBinding.cbPrivacy.isChecked()) {
ToastUtils.show("请先勾选服务条款");
return;
}
String phone = mBinding.edPhone.getText().toString().trim();
if (TextUtils.isEmpty(phone)) {
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
return;
}
if (type==1) {
String code = mBinding.edPassword.getText().toString().trim();
if (TextUtils.isEmpty(code)) {
com.blankj.utilcode.util.ToastUtils.showShort("请输入验证码");
return;
}
MvpPre.login(phone, "", code, 1);
}else if (type==2) {
String password = mBinding.edPasswordCode.getText().toString().trim();
if (TextUtils.isEmpty(password)) {
com.blankj.utilcode.util.ToastUtils.showShort("请输入密码");
return;
}
MvpPre.login(phone, password, "", 2);
}
} else if (id == R.id.tv_yhxy) {
MvpPre.ysxl();
} else if (id == R.id.tv_ysxy) {
MvpPre.yhxy();
} else if (id == R.id.iv_zfb) {
if (!mBinding.cbPrivacy.isChecked()) {
ToastUtils.show("请先勾选服务条款");
return;
}
MvpPre.authorization("zfb");
// MvpPre.authorization(SHARE_MEDIA.QQ);
} else if (id == R.id.iv_weixin) {
if (!mBinding.cbPrivacy.isChecked()) {
ToastUtils.show("请先勾选服务条款");
return;
}
// MvpPre.authorization("wx");
wcLogin();
} else if (id == R.id.tv_send_code) {
String phone = mBinding.edPhone.getText().toString().trim();
if (TextUtils.isEmpty(phone)) {
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
return;
}
sendCodeSuccess(phone);
MvpPre.sendCode(phone, 1);
}else if (id == R.id.iv_eye) {
if (!isPasswordVisible) {
mBinding.edPassword.setInputType(android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
mBinding.ivEye.setImageResource(com.xscm.moduleutil.R.mipmap.eye_visible); // 设置按钮文本为隐藏密码
} else {
mBinding.edPassword.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD);
mBinding.edPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
mBinding.ivEye.setImageResource(com.xscm.moduleutil.R.mipmap.eye_close); // 设置按钮文本为显示密码
}
mBinding.edPassword.setSelection(mBinding.edPassword.getText().length()); // 将光标移动到文字末尾
isPasswordVisible = !isPasswordVisible; // 切换状态
}
}
private void wcLogin() {
//发起登陆请求前先注册微信api
IWXAPI api = WXAPIFactory.createWXAPI(this,CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(),true);
api.registerApp(CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId());
if (!api.isWXAppInstalled()){
//todo 提醒未安装微信
com.blankj.utilcode.util.ToastUtils.showShort("请安装微信客户端");
return;
}
//开始发起登陆请求
final SendAuth.Req req = new SendAuth.Req();
req.scope = "snsapi_userinfo";
req.state = "wechat_sdk_demo_test";
api.sendReq(req);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void loginEvent(BaseResp event) {
if (event.errCode ==BaseResp.ErrCode.ERR_OK){
SendAuth.Resp authResp = (SendAuth.Resp)event;
LogUtils.e("@@@",authResp.code);
MvpPre.oauthLogin(authResp.code,1);
}
}
private void releaseTimer() {
if (mTimer != null) {
mTimer.cancel();
mTimer = null;
}
}
public void sendCodeSuccess(String phoneNumber) {
com.blankj.utilcode.util.ToastUtils.showShort("短信验证码发送成功请注意查收");
mBinding.tvSendCode.setEnabled(false);
mBinding.tvSendCode.setAlpha(0.5f);
releaseTimer();
if (mTimer != null) {
mTimer.cancel();
}
mTimer = new CountDownTimer(60000L, 1000L) {
@Override
public void onTick(long millisUntilFinished) {
if (mBinding.tvSendCode != null) {
mBinding.tvSendCode.setText(String.format("重新发送(%s", millisUntilFinished / 1000));
}
}
@Override
public void onFinish() {
mBinding.tvSendCode.setAlpha(1f);
mBinding.tvSendCode.setEnabled(true);
mBinding.tvSendCode.setText("重新发送");
}
};
mTimer.start();
}
@Override
public void sendCodeSuccess1(String s) {
LogUtils.e(s);
}
@Override
public void loginSuccess(UserBean userBean) {
}
@Override
public void authorizationSuccess(String s) {
zfbLogin(s);
}
@Override
public void ysxlSuccess(String s) {
}
@Override
public void getThemeData(ThemeBean themeBean) {
}
private void zfbLogin(String s) {
LogUtils.e("@@@",s);
CommonAppContext.getInstance();
if (!CommonAppContext.isAlipayInstalled(this)){
com.blankj.utilcode.util.ToastUtils.showShort("请安装支付宝客户端");
return;
}
String authInfo = s;
// String authInfo = "apiname=com.alipay.account.auth&app_id=2021005152631691&app_name=yusheng&auth_type=AUTHACCOUNT&biz_type=openservice&method=alipay.open.auth.sdk.code.get&pid=2088170624624316&product_id=APP_FAST_LOGIN&scope=kuaijie&sign_type=RSA2&target_id=20141225xxxx&sign=fMcp4GtiM6rxSIeFnJCVePJKV43eXrUP86CQgiLhDHH2u%2FdN75eEvmywc2ulkm7qKRetkU9fbVZtJIqFdMJcJ9Yp%2BJI%2FF%2FpESafFR6rB2fRjiQQLGXvxmDGVMjPSxHxVtIqpZy5FDoKUSjQ2%2FILDKpu3%2F%2BtAtm2jRw1rUoMhgt0%3D";
Runnable authRunnable = new Runnable() {
@Override
public void run() {
// 构造AuthTask 对象
AuthTask authTask = new AuthTask(PasswordLoginActivity.this);
// 调用授权接口,获取授权结果
Map<String, String> result = authTask.authV2(authInfo, true);
LogUtils.e(result);
if (result.get("resultStatus").equals("9000")){
Pattern pattern = Pattern.compile("auth_code=([^&]*)");
Matcher matcher = pattern.matcher(result.get("result"));
if (matcher.find()) {
String authCode = matcher.group(1);
LogUtils.e("AuthCode", authCode);
MvpPre.oauthLogin(authCode,2);
}
}
}
};
Thread authThread = new Thread(authRunnable);
authThread.start();
}
}

View File

@@ -1,165 +0,0 @@
package com.xscm.midi;
import android.graphics.Color;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.View;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.blankj.utilcode.util.RegexUtils;
import com.example.modulevocal.conacts.RealNameConacts;
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.utils.ARouteConstants;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.midi.databinding.ActivityRealNameBinding;
import com.tencent.cloud.huiyansdkface.facelight.api.WbCloudFaceContant;
import com.tencent.cloud.huiyansdkface.facelight.api.WbCloudFaceVerifySdk;
import com.tencent.cloud.huiyansdkface.facelight.api.listeners.WbCloudFaceVerifyLoginListener;
import com.tencent.cloud.huiyansdkface.facelight.api.listeners.WbCloudFaceVerifyResultListener;
import com.tencent.cloud.huiyansdkface.facelight.api.result.WbFaceError;
import com.tencent.cloud.huiyansdkface.facelight.api.result.WbFaceVerifyResult;
import com.tencent.cloud.huiyansdkface.facelight.process.FaceVerifyStatus;
/**
*@author qx
*@data 2025/7/15
*@description: 实名认证
*/
@Route(path = ARouteConstants.REAL_NAME_ACTIVITY2)
public class RealNameActivity extends BaseMvpActivity<RealNamePresenter, ActivityRealNameBinding> implements RealNameConacts.View{
@Override
protected void initData() {
mBinding.topBar.setTitle("实名认证");
String fullText = "您知悉并同意应用提供者\n· 收集、使用您本人的身份信息和人脸图像\n· 向合法数据持有者核实您的身份信息\n· 本操作数据仅用于身份核实,安全可靠";
SpannableString spannable = new SpannableString(fullText);
int firstLineEnd = fullText.indexOf('\n');
if (firstLineEnd > 0) {
// 设置第一行字体大小和颜色
spannable.setSpan(
new AbsoluteSizeSpan(16, true), // 18sp基于 TextView 的 sp 值调整
0,
firstLineEnd,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
);
spannable.setSpan(
new ForegroundColorSpan(Color.BLACK),
0,
firstLineEnd,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
);
}
mBinding.tvAgreeTerms.setText(spannable);
mBinding.btnSubmit.setOnClickListener(this::onClick);
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.btnSubmit, ColorManager.getInstance().getPrimaryColorInt(), 53);
mBinding.btnSubmit.setTextColor(ColorManager.getInstance().getButtonColorInt());
}
@Override
protected int getLayoutId() {
return R.layout.activity_real_name;
}
@Override
protected RealNamePresenter bindPresenter() {
return new RealNamePresenter(this, this);
}
@Override
public void realNameSuccess(RealNameBean msg) {
Bundle data = new Bundle();
WbCloudFaceVerifySdk.InputData inputData = new WbCloudFaceVerifySdk.InputData(
msg.getFaceId(),
msg.getOrderNo(),
msg.getAppid(),
msg.getApiVersion(),
msg.getNonce(),
msg.getUserid(),
msg.getSign(),
FaceVerifyStatus.Mode.GRADE,
msg.getLicence());
data.putSerializable(WbCloudFaceContant.INPUT_DATA, inputData);
//设置是否打开语音提示,默认关闭,此处设置为关闭
data.putBoolean(WbCloudFaceContant. PLAY_VOICE, true);
//避免用户快速点击导致二次登录,二次拉起刷脸等操作引起问题
WbCloudFaceVerifySdk.getInstance().
initAdvSdk(RealNameActivity.this, data, new WbCloudFaceVerifyLoginListener() {
@Override
public void onLoginSuccess () {
//登录成功,拉起 sdk 页面,由 FaceVerifyResultListener 返回刷脸结果
WbCloudFaceVerifySdk.getInstance().startWbFaceVerifySdk(RealNameActivity.this, new WbCloudFaceVerifyResultListener() {
@Override
public void onFinish(WbFaceVerifyResult result) {
if (result != null) {
if (result.isSuccess()) {
Log.d("@@@", "刷脸成功!");
SpUtil.setRealName(true);
MvpPre.realNameResult(result.getOrderNo());
} else {
Log.d("@@@", "刷脸失败!");
}
}
//刷脸结束后,及时释放资源
WbCloudFaceVerifySdk.getInstance().release();
}
});
}
@Override
public void onLoginFailed (WbFaceError error){
Log.d("@@@", "刷脸失败!");
//刷脸结束后,及时释放资源
WbCloudFaceVerifySdk.getInstance().release();
}
});
}
@Override
public void sendCodeSuccess() {
finish();
}
private void onClick(View view) {
if (view.getId()== R.id.btnSubmit){
if (mBinding.edName.getText().toString().isEmpty()){
com.blankj.utilcode.util.ToastUtils.showShort("请输入姓名");
return;
}
if (mBinding.edPassword.getText().toString().isEmpty()){
com.blankj.utilcode.util.ToastUtils.showShort("请输入身份证号");
return;
}
if (RegexUtils.isIDCard18Exact(mBinding.edPassword.getText().toString())) {
if (mBinding.btnSubmit.getText().toString().equals("下一步")) {
mBinding.stepNum1.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.num_11));
mBinding.stepNum2.setBackground(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.num_2));
// mBinding.l1.setVisibility(View.GONE);
// mBinding.l2.setVisibility(View.VISIBLE);
// mBinding.btnSubmit.setText("立即认证");
MvpPre.realName(mBinding.edName.getText().toString(),mBinding.edPassword.getText().toString());
} else {
SpUtil.setRealName(true);
finish();
}
}else {
com.blankj.utilcode.util.ToastUtils.showShort("请输入正确的身份证号");
return;
}
}
}
}

View File

@@ -1,110 +0,0 @@
package com.xscm.midi.presenter;
import android.content.Context;
import com.xscm.moduleutil.activity.IPresenter;
import com.xscm.moduleutil.activity.IView;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
public abstract class BasePresenter<V extends IView> implements IPresenter {
protected CompositeDisposable mDisposables = new CompositeDisposable();
// private RemoteDataSource api;
protected Reference<V> MvpRef;
protected Context mContext;
@Deprecated
public BasePresenter(V view) {
attachView(view);
}
public BasePresenter(V view, Context context) {
attachView(view);
mContext = context;
}
private void attachView(V view) {
MvpRef = new WeakReference<V>(view);
}
protected V getView() {
if (MvpRef != null) {
return MvpRef.get();
}
return null;
}
// protected RemoteDataSource getApi() {
// if (api == null) {
// api = RemoteDataSource.getInstance();
// }
// return api;
// }
/**
* 主要用于判断IView的生命周期是否结束防止出现内存泄露状况
*
* @return
*/
public boolean isViewAttach() {
return MvpRef != null && MvpRef.get() != null;
}
@Override
public void detachView() {
cancelRequest();
if (MvpRef != null) {
MvpRef.clear();
MvpRef = null;
}
// if (api != null) {
// api = null;
// }
unBindView();
}
public void unBindView() {
if (MvpRef != null) {
MvpRef.clear();
}
mContext=null;
}
/**
* 加入订阅对象
*
* @param disposable
*/
public void addDisposable(Disposable disposable) {
mDisposables.add(disposable);
}
/**
* 移除订阅对象
*
* @param disposable
*/
public void removeDisposable(Disposable disposable) {
mDisposables.remove(disposable);
}
/**
* 取消所有请求
*/
public void cancelRequest() {
if (mDisposables != null) {
mDisposables.clear(); // clear时网络请求会随即cancel
mDisposables = null;
}
}
}

View File

@@ -1,233 +0,0 @@
package com.xscm.midi.wxapi;
import android.app.Activity;
import android.os.Bundle;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.base.CommonAppContext;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import org.greenrobot.eventbus.EventBus;
public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
// private static String TAG = "MicroMsg.WXEntryActivity";
//
// private IWXAPI api;
// private MyHandler handler;
//
// private static class MyHandler extends Handler {
// private final WeakReference<WXEntryActivity> wxEntryActivityWeakReference;
//
// public MyHandler(WXEntryActivity wxEntryActivity){
// wxEntryActivityWeakReference = new WeakReference<WXEntryActivity>(wxEntryActivity);
// }
//
// @Override
// public void handleMessage(Message msg) {
// int tag = msg.what;
// switch (tag) {
// case 0: {
// Bundle data = msg.getData();
// JSONObject json = null;
// try {
// json = new JSONObject(data.getString("result"));
// String openId, accessToken, refreshToken, scope;
// openId = json.getString("openid");
// accessToken = json.getString("access_token");
// refreshToken = json.getString("refresh_token");
// scope = json.getString("scope");
//// Intent intent = new Intent(wxEntryActivityWeakReference.get(), SendToWXActivity.class);
//// intent.putExtra("openId", openId);
//// intent.putExtra("accessToken", accessToken);
//// intent.putExtra("refreshToken", refreshToken);
//// intent.putExtra("scope", scope);
//// wxEntryActivityWeakReference.get().startActivity(intent);
// } catch (JSONException e) {
// Log.e(TAG, e.getMessage());
// }
// }
// }
// }
// }
//
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
//
// api = WXAPIFactory.createWXAPI(this, CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(), false);
// handler = new MyHandler(this);
//
// try {
// Intent intent = getIntent();
// api.handleIntent(intent, this);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
//
// setIntent(intent);
// api.handleIntent(intent, this);
// }
//
// @Override
// public void onReq(BaseReq req) {
// switch (req.getType()) {
// case ConstantsAPI.COMMAND_GETMESSAGE_FROM_WX:
//// goToGetMsg();
// break;
// case ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX:
//// goToShowMsg((ShowMessageFromWX.Req) req);
// break;
// default:
// break;
// }
// finish();
// }
//
// @Override
// public void onResp(BaseResp resp) {
// int result = 0;
//
// switch (resp.errCode) {
// case BaseResp.ErrCode.ERR_OK:
//// result = com.qxcm.moduleutil.R.string.errcode_success;
// break;
// case BaseResp.ErrCode.ERR_USER_CANCEL:
//// result = R.string.errcode_cancel;
// break;
// case BaseResp.ErrCode.ERR_AUTH_DENIED:
//// result = R.string.errcode_deny;
// break;
// case BaseResp.ErrCode.ERR_UNSUPPORT:
//// result = R.string.errcode_unsupported;
// break;
// default:
//// result = R.string.errcode_unknown;
// break;
// }
//
// Toast.makeText(this, getString(result) + ", type=" + resp.getType(), Toast.LENGTH_SHORT).show();
//
//
// if (resp.getType() == ConstantsAPI.COMMAND_SUBSCRIBE_MESSAGE) {
// SubscribeMessage.Resp subscribeMsgResp = (SubscribeMessage.Resp) resp;
// String text = String.format("openid=%s\ntemplate_id=%s\nscene=%d\naction=%s\nreserved=%s",
// subscribeMsgResp.openId, subscribeMsgResp.templateID, subscribeMsgResp.scene, subscribeMsgResp.action, subscribeMsgResp.reserved);
//
// Toast.makeText(this, text, Toast.LENGTH_LONG).show();
// }
//
// if (resp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {
// WXLaunchMiniProgram.Resp launchMiniProgramResp = (WXLaunchMiniProgram.Resp) resp;
// String text = String.format("openid=%s\nextMsg=%s\nerrStr=%s",
// launchMiniProgramResp.openId, launchMiniProgramResp.extMsg,launchMiniProgramResp.errStr);
//
// Toast.makeText(this, text, Toast.LENGTH_LONG).show();
// }
//
// if (resp.getType() == ConstantsAPI.COMMAND_OPEN_BUSINESS_VIEW) {
// WXOpenBusinessView.Resp launchMiniProgramResp = (WXOpenBusinessView.Resp) resp;
// String text = String.format("openid=%s\nextMsg=%s\nerrStr=%s\nbusinessType=%s",
// launchMiniProgramResp.openId, launchMiniProgramResp.extMsg,launchMiniProgramResp.errStr,launchMiniProgramResp.businessType);
//
// Toast.makeText(this, text, Toast.LENGTH_LONG).show();
// }
//
// if (resp.getType() == ConstantsAPI.COMMAND_OPEN_BUSINESS_WEBVIEW) {
// WXOpenBusinessWebview.Resp response = (WXOpenBusinessWebview.Resp) resp;
// String text = String.format("businessType=%d\nresultInfo=%s\nret=%d",response.businessType,response.resultInfo,response.errCode);
//
// Toast.makeText(this, text, Toast.LENGTH_LONG).show();
// }
//
// if (resp.getType() == ConstantsAPI.COMMAND_SENDAUTH) {
// SendAuth.Resp authResp = (SendAuth.Resp)resp;
// final String code = authResp.code;
//// NetworkUtil.sendWxAPI(handler, String.format("https://api.weixin.qq.com/sns/oauth2/access_token?" +
//// "appid=%s&secret=%s&code=%s&grant_type=authorization_code", "wxd930ea5d5a258f4f",
//// "1d6d1d57a3dd063b36d917bc0b44d964", code), NetworkUtil.GET_TOKEN);
// }
// finish();
// }
//
//// private void goToGetMsg() {
//// Intent intent = new Intent(this, GetFromWXActivity.class);
//// intent.putExtras(getIntent());
//// startActivity(intent);
//// finish();
//// }
////
//// private void goToShowMsg(ShowMessageFromWX.Req showReq) {
//// WXMediaMessage wxMsg = showReq.message;
//// WXAppExtendObject obj = (WXAppExtendObject) wxMsg.mediaObject;
////
//// StringBuffer msg = new StringBuffer();
//// msg.append("description: ");
//// msg.append(wxMsg.description);
//// msg.append("\n");
//// msg.append("extInfo: ");
//// msg.append(obj.extInfo);
//// msg.append("\n");
//// msg.append("filePath: ");
//// msg.append(obj.filePath);
////
//// Intent intent = new Intent(this, ShowFromWXActivity.class);
//// intent.putExtra(Constants.ShowMsgActivity.STitle, wxMsg.title);
//// intent.putExtra(Constants.ShowMsgActivity.SMessage, msg.toString());
//// intent.putExtra(Constants.ShowMsgActivity.BAThumbData, wxMsg.thumbData);
//// startActivity(intent);
//// finish();
//// }
private final String TAG = this.getClass().getSimpleName();
public static final String APP_ID = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId();
public static final String APP_SECRET = "请自己填写";
private IWXAPI mApi;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mApi = WXAPIFactory.createWXAPI(this, APP_ID, true);
mApi.handleIntent(this.getIntent(), this);
}
//微信发送的请求将回调到onReq方法
@Override
public void onReq(BaseReq baseReq) {
}
//发送到微信请求的响应结果
@Override
public void onResp(BaseResp resp) {
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
//发送成功
ToastUtils.showShort("发送成功",resp.transaction);
EventBus.getDefault().post(resp);
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
//发送取消
ToastUtils.showShort("发送取消",resp);
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
ToastUtils.showShort("发送被拒绝",resp);
//发送被拒绝
break;
default:
//发送返回
break;
}
finish();
}
}

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="20dp"/>
<solid android:color="#80000000"/>
</shape>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#80000000"/>
</shape>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12sp"/>
<stroke android:color="@color/white" android:width="1dp"/>
<solid android:color="#80000000"/>
</shape>

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: 705 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

View File

@@ -1,102 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data></data>
<FrameLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000" />
<FrameLayout
android:id="@+id/btn_skip_img"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="right"
android:layout_marginTop="37dp"
android:layout_marginRight="15dp"
android:background="@drawable/bg_launcher_skip"
android:visibility="invisible">
<com.xscm.moduleutil.custon.CircleProgress
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cp_bg_color="@color/white"
app:cp_cur_progress="0"
app:cp_fg_color="#ff7200"
app:cp_stroke_width="2dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/recommend_skip"
android:textColor="@color/white"
android:textSize="11sp" />
</FrameLayout>
<TextView
android:id="@+id/btn_skip_video"
android:layout_width="44dp"
android:layout_height="26dp"
android:layout_gravity="right"
android:layout_marginTop="37dp"
android:layout_marginRight="15dp"
android:background="@drawable/bg_launcher_skip_2"
android:gravity="center"
android:text="@string/recommend_skip"
android:textColor="@color/white"
android:textSize="11sp"
android:visibility="invisible" />
<LinearLayout
android:id="@+id/ad_tip"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="50dp"
android:background="@drawable/bg_launcher_ad_tip"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:visibility="invisible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/a_067"
android:textColor="@color/white"
android:textSize="13sp" />
<ImageView
android:layout_width="13dp"
android:layout_height="13dp"
android:src="@mipmap/icon_arrow_right_3" />
</LinearLayout>
<ImageView
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:src="@mipmap/screen"
android:scaleType="centerCrop"
android:visibility="visible" />
</FrameLayout>
</layout>

View File

@@ -1,384 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/log_bj" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|top|center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_67"
android:gravity="left|center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/login_title" />
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="@dimen/dp_30"-->
<!-- android:text="@string/login_web_title"-->
<!-- android:textColor="@color/color_FF333333"-->
<!-- android:textSize="20sp"-->
<!-- android:textStyle="bold" />-->
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16">
<TextView
android:id="@+id/tv_login_text"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_27"
android:layout_centerVertical="true"
android:text="@string/login_title"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rel_phone"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_44"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_17"
android:layout_marginRight="@dimen/dp_16"
android:background="@drawable/bg_r16_ffeff2f8">
<ImageView
android:id="@+id/iv_user"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:src="@mipmap/icon_login_user_new" />
<EditText
android:id="@+id/ed_phone"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_28"
android:layout_marginLeft="13dp"
android:layout_marginRight="25dp"
android:layout_toRightOf="@+id/iv_user"
android:background="@android:color/transparent"
android:hint="@string/login_hint_phion"
android:inputType="phone"
android:layout_centerInParent="true"
android:maxLength="11"
android:singleLine="true"
android:textColor="@color/black"
android:textColorHint="@color/color_FFCCCCCC"
android:textSize="@dimen/sp_17" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_code"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_44"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:layout_marginRight="20dp"
android:background="@drawable/bg_r16_ffeff2f8">
<ImageView
android:id="@+id/iv_code"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:src="@mipmap/icon_login_code" />
<EditText
android:id="@+id/ed_password"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_28"
android:layout_marginLeft="13dp"
android:layout_marginRight="25dp"
android:layout_toRightOf="@+id/iv_code"
android:layout_centerInParent="true"
android:background="@android:color/transparent"
android:hint="@string/login_hint_code"
android:inputType="number"
android:maxLength="20"
android:singleLine="true"
android:textColor="@color/black"
android:textColorHint="@color/color_FFCCCCCC"
android:textSize="@dimen/sp_16" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:gravity="center"
>
<TextView
android:id="@+id/tv_send_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_13"
android:gravity="right"
android:text="@string/login_send_code"
android:textColor="#5F3EAB"
android:textSize="@dimen/sp_16"
tools:visibility="visible" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_pass_code"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_44"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:layout_marginRight="20dp"
android:visibility="gone"
android:background="@drawable/bg_r16_ffeff2f8">
<ImageView
android:id="@+id/iv_pass_code"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:src="@mipmap/icon_login_lick" />
<EditText
android:id="@+id/ed_password_code"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_28"
android:layout_marginLeft="13dp"
android:layout_marginRight="25dp"
android:layout_toRightOf="@+id/iv_pass_code"
android:layout_centerInParent="true"
android:background="@android:color/transparent"
android:hint="@string/login_hint_pass"
android:inputType="textPassword"
android:maxLength="20"
android:singleLine="true"
android:textColor="@color/black"
android:textColorHint="@color/color_FFCCCCCC"
android:textSize="@dimen/sp_16" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:gravity="center"
android:orientation="horizontal">
>
<ImageView
android:id="@+id/iv_eye"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/eye_close"
android:visibility="gone"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10">
<TextView
android:id="@+id/tv_code_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginRight="16dp"
android:drawableLeft="@mipmap/common_switch_login_icon"
android:drawablePadding="@dimen/dp_3"
android:gravity="center"
android:text="@string/login_btn_switch"
android:textColor="#666666"
android:textSize="12sp"
android:textStyle="bold" />
</RelativeLayout>
<FrameLayout
android:id="@+id/fl_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_38"
android:layout_marginTop="@dimen/dp_23"
android:layout_marginBottom="@dimen/dp_150"
android:layout_marginRight="@dimen/dp_38"
>
<ImageView
android:id="@+id/iv_login_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_42"
android:src="@drawable/theme_bg"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:enabled="false"
android:gravity="center"
android:text="@string/login_btn_login"
android:textColor="@color/color_white"
android:textSize="14sp" />
</FrameLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingBottom="@dimen/dp_7"
>
<TextView
android:id="@+id/tv_login_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="@dimen/dp_7"
android:gravity="center"
android:text="@string/login_btn_qt"
android:textColor="@color/color_666666"
android:textSize="@dimen/sp_12"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/ll_other_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_login_error"
android:gravity="center_horizontal"
android:layout_marginBottom="@dimen/dp_55"
android:orientation="horizontal"
android:visibility="visible"
tools:visibility="visible">
<ImageView
android:id="@+id/iv_weixin"
android:layout_width="@dimen/dp_44"
android:layout_height="44dp"
android:src="@mipmap/sign_icon_wechat" />
<ImageView
android:id="@+id/iv_zfb"
android:layout_width="@dimen/dp_44"
android:layout_height="@dimen/dp_44"
android:layout_marginLeft="@dimen/dp_33"
android:src="@mipmap/sign_icon_zfb"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_agreement"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_other_login"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/dp_25"
android:gravity="center"
android:orientation="horizontal">
<CheckBox
android:id="@+id/cb_privacy"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_marginEnd="@dimen/dp_5"
android:background="@drawable/selector_login_agreement"
android:button="@null" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我已阅读并同意"
android:textColor="@color/color_FFA8A8A8"
android:textSize="@dimen/sp_11"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_ysxy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《用户协议》"
android:textColor="#6C49E4"
android:textSize="@dimen/sp_11"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="和"
android:textColor="@color/color_FFA8A8A8"
android:textSize="@dimen/sp_11"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_yhxy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《隐私协议》"
android:textColor="#6C49E4"
android:textSize="@dimen/sp_11"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
</FrameLayout>
</layout>

View File

@@ -1,246 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.RealNameActivity">
<data>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.xscm.moduleutil.widget.CustomTopBar
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/steps"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_68"
android:layout_margin="@dimen/dp_16"
android:background="@drawable/bg_r9_fffff"
android:orientation="horizontal">
<!-- 第一步:验证手机号 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<!-- 步骤编号 -->
<TextView
android:id="@+id/step_num_1"
android:layout_width="@dimen/dp_23"
android:layout_height="@dimen/dp_23"
android:layout_marginTop="@dimen/dp_8"
android:background="@mipmap/num_1"
android:gravity="center" />
<!-- 步骤描述 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/dp_8"
android:text="@string/fill_identity_info"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_14" />
</LinearLayout>
<!-- 分割线 -->
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="@dimen/dp_19"
android:layout_weight="1"
android:background="@mipmap/line9" />
<!-- 第二步:设置新密码 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<!-- 步骤编号 -->
<TextView
android:id="@+id/step_num_2"
android:layout_width="@dimen/dp_23"
android:layout_height="@dimen/dp_23"
android:layout_marginTop="@dimen/dp_8"
android:background="@mipmap/num_22"
android:gravity="center" />
<!-- 步骤描述 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/dp_8"
android:text="@string/face_recognition"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_14" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/l_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
android:text="@string/real_name_authentication_tips"
android:textColor="@color/color_FF999999"
android:textSize="@dimen/sp_12" />
<RelativeLayout
android:id="@+id/rl_name"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_44"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_16"
android:background="@drawable/bg_r16_ffeff2f8"
android:gravity="center">
<TextView
android:id="@+id/tv_send_name"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_14"
android:gravity="left|center"
android:text="@string/real_name"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_16"
tools:visibility="visible" />
<EditText
android:id="@+id/ed_name"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_28"
android:layout_centerInParent="true"
android:layout_marginLeft="13dp"
android:layout_marginRight="25dp"
android:layout_toRightOf="@+id/tv_send_name"
android:background="@android:color/transparent"
android:hint="@string/please_enter_real_name"
android:singleLine="true"
android:textColor="@color/black"
android:textColorHint="@color/color_FF9b9b9b"
android:textSize="@dimen/sp_16" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_code"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_44"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_16"
android:background="@drawable/bg_r16_ffeff2f8"
android:gravity="center">
<TextView
android:id="@+id/tv_send_code"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_14"
android:gravity="left|center"
android:text="@string/id_number"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_16"
tools:visibility="visible" />
<EditText
android:id="@+id/ed_password"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_28"
android:layout_centerInParent="true"
android:layout_marginLeft="13dp"
android:layout_marginRight="25dp"
android:layout_toRightOf="@+id/tv_send_code"
android:background="@android:color/transparent"
android:hint="@string/please_enter_id_number"
android:singleLine="true"
android:textColor="@color/black"
android:textColorHint="@color/color_FF9b9b9b"
android:textSize="@dimen/sp_16" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/l_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:gravity="center"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_16"
android:textStyle="bold"
android:layout_marginEnd="@dimen/dp_16"
android:text="为了保证本人操作,请进行人脸验证"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/real_img"
android:layout_gravity="center"/>
<TextView
android:id="@+id/tv_agree_terms"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_54"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_54"
android:lineSpacingExtra="@dimen/dp_5"
android:text="您知悉并同意应用提供者 \n· 收集、使用您本人的身份信息和人脸图像 \n· 向合法数据持有者核实您的身份信息 \n· 本操作数据仅用于身份核实,安全可靠"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_12" />
</LinearLayout>
<!-- 提交按钮 -->
<Button
android:id="@+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_42"
android:layout_marginStart="@dimen/dp_38"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_38"
android:gravity="center"
android:text="下一步"
android:textColor="@color/color_FF333333"
android:textSize="16sp" />
</LinearLayout>
</layout>

View File

@@ -1,5 +0,0 @@
<?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"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -1,5 +0,0 @@
<?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"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -1,5 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="recommend_skip">Skip</string>
<string name="a_067">Click to jump to third-party applications</string>
</resources>

View File

@@ -1,16 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.QxLive" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="global">#ff5878</color>
<color name="background">@color/gray2</color>
<color name="transparent">#00000000</color>
<color name="textColor">#282828</color>
<color name="gray1">#969696</color>
<color name="gray2">#f5f5f5</color>
<color name="gray3">#c8c8c8</color>
<color name="gray4">#B4B4B4</color>
<color name="gray5">#dcdcdc</color>
<color name="yellow">#fffa37</color>
<color name="yellow2">#f0cd08</color>
<color name="yellow3">#FFF34D</color>
<color name="yellow4">#ffdd00</color>
<color name="textColor2">#646464</color>
<color name="red">#ff0000</color>
<color name="pk_red">#FF205E</color>
<color name="pk_blue">#169AFF</color>
<color name="black1">#e6323232</color>
<color name="blue1">#1FC8F8</color>
<color name="blue2">#4998F7</color>
<color name="blue3">#32A0FF</color>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@@ -1,5 +0,0 @@
<resources>
<string name="recommend_skip">跳过</string>
<string name="a_067">点击跳转第三方应用</string>
</resources>

View File

@@ -1,94 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorBackground">@color/background</item>
<item name="android:textColor">@color/color_1F1C1F</item>
<item name="android:textColorHint">@color/color_FF999999</item>
<item name="android:windowBackground">@color/color_F9FAFA</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="LauncherAppTheme" parent="AppTheme">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
</style>
<style name="AppthemeActivity" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowEnableSplitTouch">false</item>
<item name="android:windowAllowReturnTransitionOverlap">false</item>
<item name="android:windowEnterTransition">@null</item>
<item name="android:windowExitTransition">@null</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="dialog" parent="AppTheme">
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:backgroundDimAmount">0.5</item>
<!--显示区域以外是否使用黑色半透明背景-->
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="dialog2" parent="AppTheme">
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/transparent</item>
<!--显示区域以外是否使用黑色半透明背景-->
<item name="android:backgroundDimEnabled">false</item>
</style>
<style name="bottomToTopAnim" parent="android:Animation">
<item name="android:windowEnterAnimation">@anim/bottomview_anim_enter</item>
<item name="android:windowExitAnimation">@anim/bottomview_anim_exit</item>
</style>
<style name="bottomToTopAnim2" parent="android:Animation">
<item name="android:windowEnterAnimation">@anim/bottomview_anim_enter_2</item>
<item name="android:windowExitAnimation">@anim/bottomview_anim_exit_2</item>
</style>
<style name="leftToRightAnim" parent="android:Animation">
<item name="android:windowEnterAnimation">@anim/left_anim_enter</item>
<item name="android:windowExitAnimation">@anim/left_anim_exit</item>
</style>
<style name="animCenter" parent="android:Animation">
<item name="android:windowEnterAnimation">@anim/anim_center_enter</item>
<item name="android:windowExitAnimation">@anim/anim_center_exit</item>
</style>
<style name="groupLast" parent="AppTheme">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:layout_marginLeft">15dp</item>
<item name="android:layout_marginRight">15dp</item>
<item name="android:background">@color/gray2</item>
</style>
<style name="line2" parent="AppTheme">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">@color/gray2</item>
</style>
<style name="edit_profile_group" parent="AppTheme">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">60dp</item>
<item name="android:paddingLeft">15dp</item>
<item name="android:paddingRight">15dp</item>
</style>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

@@ -3,8 +3,6 @@
// build.gradle (Project-level) // build.gradle (Project-level)
buildscript { buildscript {
ext.kotlin_version = '1.9.24' // 根据你使用的 Kotlin 版本调整
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
@@ -15,10 +13,11 @@ buildscript {
dependencies { dependencies {
classpath libs.gradle // 或你使用的 Android Gradle 插件版本 classpath libs.gradle // 或你使用的 Android Gradle 插件版本
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// ✅ 添加 ARouter 插件依赖 // ✅ 添加 ARouter 插件依赖
classpath 'com.alibaba:arouter-register:1.0.2' classpath 'com.alibaba:arouter-register:1.0.2'
// classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin
} }
} }
plugins { plugins {
@@ -26,6 +25,14 @@ plugins {
alias(libs.plugins.android.library) apply false alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.android) apply false
} }
subprojects {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "11"
}
}
}
task clean(type: Delete) { task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View File

@@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx3072m -XX:MaxPermsize=512m -Xx:+HeapDumponOutofMemoryError -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit # This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
@@ -22,30 +22,35 @@ android.enableJetifier=true
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
arouter.register.auto=true arouter.register.auto=true
isBuildModule=false isBuildModule=false
#org.gradle.parallel=false #org.gradle.parallel=false
#org.gradle.deamon=false #org.gradle.deamon=false
android.injected.testOnly=false android.injected.testOnly=false
APP_VERSION_NAME=1.0.5 APP_VERSION_NAME=1.0.0.0
APP_VERSION_CODE=101 APP_VERSION_CODE=1
org.gradle.jvm.toolchain.useLegacyAdapters=false org.gradle.jvm.toolchain.useLegacyAdapters=false
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15 #org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
org.gradle.parallel=true org.gradle.parallel=true
org.gradel.daemon=true org.gradle.daemon=true
org.gradel.configureondemand=true org.gradle.configureondemand=true
aaptOptions.cruncherEnabled false aaptOptions.cruncherEnabled false
aaptOptions.useNewCruncher false aaptOptions.useNewCruncher false
#android.enableR8=true #android.enableR8=true
#isModule #isModule
modulevoice=false modulevoice=false
# <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> # ʽʱ
beta=false beta=false
org.gradle.caching=false org.gradle.caching=false
# ??APT???? # ??APT????
kapt.incremental.apt=false kapt.incremental.apt=true
# 或者禁用特定模块的增量编译
#org.gradle.configureondemand=false
# 统一 Kotlin JVM 目标版本
kotlin.jvm.target.validation.mode=warning

View File

@@ -20,6 +20,8 @@ githubPhotoview = "2.3.0"
githubRealtimeblurviewVersion = "1.2.1" githubRealtimeblurviewVersion = "1.2.1"
githubShadowlayout = "3.3.1" githubShadowlayout = "3.3.1"
gradle = "8.8.0" gradle = "8.8.0"
#gradle = "8.5.0-alpha04"
greendaoGradlePlugin = "3.3.0"
junit = "4.13.2" junit = "4.13.2"
junitVersion = "1.1.5" junitVersion = "1.1.5"
espressoCore = "3.5.1" espressoCore = "3.5.1"
@@ -45,6 +47,7 @@ logger = "2.2.0"
loggingInterceptorVersion = "3.10.0" loggingInterceptorVersion = "3.10.0"
multidex = "2.0.1" multidex = "2.0.1"
ossAndroidSdkVersion = "2.9.21" ossAndroidSdkVersion = "2.9.21"
permissionx = "1.7.1"
persistentcookiejar = "v1.0.1" persistentcookiejar = "v1.0.1"
picture_libraryVersion = "v2.6.0" picture_libraryVersion = "v2.6.0"
reactivexRxjava = "2.2.21" reactivexRxjava = "2.2.21"
@@ -72,6 +75,9 @@ webpdecoder = "1.6.4.9.0"
wechatSdkAndroid = "6.8.30" wechatSdkAndroid = "6.8.30"
xbanner = "1.7.0" xbanner = "1.7.0"
appcompatVersion = "1.3.1" appcompatVersion = "1.3.1"
legacySupportV4 = "1.0.0"
fragmentKtx = "1.5.6"
cosAndroidLite = "5.9.46"
[libraries] [libraries]
alipay-alipaysdk-android = { module = "com.alipay.sdk:alipaysdk-android", version.ref = "alipayAlipaysdkAndroid" } alipay-alipaysdk-android = { module = "com.alipay.sdk:alipaysdk-android", version.ref = "alipayAlipaysdkAndroid" }
@@ -96,6 +102,7 @@ github-photoview = { module = "com.github.chrisbanes:PhotoView", version.ref = "
github-shadowlayout = { module = "com.github.lihangleo2:ShadowLayout", version.ref = "githubShadowlayout" } github-shadowlayout = { module = "com.github.lihangleo2:ShadowLayout", version.ref = "githubShadowlayout" }
#glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "githubGlide" } #glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "githubGlide" }
gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle" } 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" } junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
@@ -122,6 +129,7 @@ logger = { module = "com.orhanobut:logger", version.ref = "logger" }
multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" } multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" }
#numberprogressbar-library = { module = "com.daimajia.numberprogressbar:library", version.ref = "libraryVersion" } #numberprogressbar-library = { module = "com.daimajia.numberprogressbar:library", version.ref = "libraryVersion" }
okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptorVersion" } okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptorVersion" }
permissionx = { module = "com.guolindev.permissionx:permissionx", version.ref = "permissionx" }
persistentcookiejar = { module = "com.github.franmontiel:PersistentCookieJar", version.ref = "persistentcookiejar" } persistentcookiejar = { module = "com.github.franmontiel:PersistentCookieJar", version.ref = "persistentcookiejar" }
#pictureselector-picture_library = { module = "com.github.LuckSiege.PictureSelector:picture_library", version.ref = "picture_libraryVersion" } #pictureselector-picture_library = { module = "com.github.LuckSiege.PictureSelector:picture_library", version.ref = "picture_libraryVersion" }
reactivex-rxjava = { module = "io.reactivex.rxjava2:rxjava", version.ref = "reactivexRxjava" } reactivex-rxjava = { module = "io.reactivex.rxjava2:rxjava", version.ref = "reactivexRxjava" }
@@ -152,6 +160,8 @@ wechat-sdk-android = { module = "com.tencent.mm.opensdk:wechat-sdk-android", ver
xbanner = { module = "com.github.xiaohaibin:XBanner", version.ref = "xbanner" } xbanner = { module = "com.github.xiaohaibin:XBanner", version.ref = "xbanner" }
zcw-togglebutton-library = { module = "com.zcw:togglebutton-library", version.ref = "togglebuttonLibraryVersion" } zcw-togglebutton-library = { module = "com.zcw:togglebutton-library", version.ref = "togglebuttonLibraryVersion" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompatVersion" } androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompatVersion" }
androidx-legacy-support-v4 = { group = "androidx.legacy", name = "legacy-support-v4", version.ref = "legacySupportV4" }
androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragmentKtx" }
[plugins] [plugins]
@@ -160,4 +170,7 @@ android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinVersion" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinVersion" }
#kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlinVersion" } #kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlinVersion" }
#alibaba-arouter = { id = "com.alibaba.arouter", version.ref = "arouter" } #alibaba-arouter = { id = "com.alibaba.arouter", version.ref = "arouter" }
greendao-plugin = { id = "org.greenrobot.greendao", version.ref = "greendaoGradlePlugin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlinVersion" }
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlinVersion" }

View File

@@ -1,8 +1,7 @@
#Wed May 07 09:31:48 CST 2025 #Mon Sep 22 21:05:11 CST 2025
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/distsl.
#distributionUrl=file:///D:/Greadle/gradle-8.10.2-all.zip
distributionUrl=file:///D:/Gradle/gradle-8.10.2-bin.zip distributionUrl=file:///D:/Gradle/gradle-8.10.2-bin.zip

View File

@@ -12,7 +12,6 @@ apply plugin: 'kotlin-kapt'
android { android {
compileSdkVersion 35 compileSdkVersion 35
buildToolsVersion build_versions.build_tools
defaultConfig { defaultConfig {
minSdkVersion 24 minSdkVersion 24
targetSdkVersion 28 targetSdkVersion 28

View File

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

View File

@@ -3,40 +3,63 @@ package com.xscm.modulelogin.present;
import android.content.Context; import android.content.Context;
import com.hjq.toast.ToastUtils;
import com.xscm.moduleutil.bean.UserBean; import com.xscm.moduleutil.bean.UserBean;
import com.xscm.moduleutil.http.BaseObserver; import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.presenter.BasePresenter; import com.xscm.moduleutil.presenter.BasePresenter;
import com.xscm.moduleutil.utils.cos.CosUploadManager;
import com.xscm.moduleutil.utils.oss.OSSOperUtils; import com.xscm.moduleutil.utils.oss.OSSOperUtils;
import java.io.File; import java.io.File;
import java.lang.ref.WeakReference;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View> implements ImproveInfoContacts.IImproveInfoPre { public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View> implements ImproveInfoContacts.IImproveInfoPre {
ImproveInfoContacts.View mView;
public ImproveInfoPresenter(ImproveInfoContacts.View view, Context context) { public ImproveInfoPresenter(ImproveInfoContacts.View view, Context context) {
super(view, context); super(view, context);
mView = view;
} }
@Override @Override
public void uploadFile(File file, int type) { public void uploadFile(File file, int type) {
MvpRef.get().showLoadings("上传中..."); MvpRef.get().showLoadings("上传中...");
String url = OSSOperUtils.getPath(file, type); String url = OSSOperUtils.getPath(file, type);
OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() { CosUploadManager.getInstance().upParameters(url,file.getPath(), new CosUploadManager.UploadCallback() {
@Override @Override
public void onSuccess() { public void onSuccess(String url) {
if (isViewAttach()) { if (MvpRef==null){
MvpRef.get().disLoadings(); MvpRef=new WeakReference<>(mView);
MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
} }
MvpRef.get().disLoadings();
MvpRef.get().upLoadSuccess(url, type);
} }
@Override @Override
public void onFail() { public void onFailure(Exception e) {
if (isViewAttach()) { ToastUtils.show("上传失败");
MvpRef.get().disLoadings(); MvpRef.get().disLoadings();
} }
}
}); });
// OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
// @Override
// public void onSuccess() {
// if (isViewAttach()) {
// MvpRef.get().disLoadings();
// MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
// }
// }
//
// @Override
// public void onFail() {
// if (isViewAttach()) {
// MvpRef.get().disLoadings();
// }
// }
// });
} }
@Override @Override

View File

@@ -10,6 +10,7 @@ import com.blankj.utilcode.util.ToastUtils;
import com.xscm.modulelogin.activity.ImproveInfoActivity; import com.xscm.modulelogin.activity.ImproveInfoActivity;
import com.xscm.modulelogin.activity.SwitchAccountsActivity; import com.xscm.modulelogin.activity.SwitchAccountsActivity;
import com.xscm.modulemain.activity.MainActivity; import com.xscm.modulemain.activity.MainActivity;
import com.xscm.moduleutil.activity.WebViewActivity;
import com.xscm.moduleutil.base.CommonAppContext; import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.bean.ThemeBean; import com.xscm.moduleutil.bean.ThemeBean;
import com.xscm.moduleutil.bean.UserBean; import com.xscm.moduleutil.bean.UserBean;
@@ -184,7 +185,7 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
public void loginSuccess(List<UserBean> userBean) { public void loginSuccess(List<UserBean> userBean) {
if (userBean == null) { if (userBean == null) {
ToastUtils.showShort("登录失败请重试"); // ToastUtils.showShort("登录失败请重试");
return; return;
} }
if (userBean.size() == 1) { if (userBean.size() == 1) {
@@ -264,10 +265,20 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
} }
public void ysxl() { public void ysxl() {
ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4").withString("title", "隐私协议").navigation(); Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), WebViewActivity.class);
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4");
intent.putExtra("title", "隐私协议");
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
// ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
} }
public void yhxy() { public void yhxy() {
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6").withString("title", "用户协议").navigation(); Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), WebViewActivity.class);
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6");
intent.putExtra("title", "用户协议");
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6").withString("title", "用户协议").navigation();
} }
} }

View File

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

View File

@@ -2,7 +2,7 @@ plugins {
alias(libs.plugins.android.library) alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.android)
} }
//apply plugin: 'kotlin-kapt' // 关键Kotlin 注解处理器
android { android {
namespace 'com.xscm.moduleutil' namespace 'com.xscm.moduleutil'
compileSdk 35 compileSdk 35
@@ -35,14 +35,14 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_17 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_11
} }
dataBinding { dataBinding {
enabled = true enabled = true
} }
kotlinOptions { kotlinOptions {
jvmTarget = '17' jvmTarget = '11'
} }
packagingOptions { packagingOptions {
@@ -50,6 +50,13 @@ android {
} }
} }
// Kotlin 注解处理器参数(针对 Kotlin 代码)
//kapt {
// arguments {
// arg("AROUTER_MODULE_NAME", project.getName())
// }
//}
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
@@ -139,8 +146,9 @@ dependencies {
api(libs.alipay.alipaysdk.android) api(libs.alipay.alipaysdk.android)
api(libs.arouter.api.v150) api(libs.arouter.api.v150)
annotationProcessor libs.arouter.annotation
annotationProcessor libs.arouter.compiler annotationProcessor libs.arouter.compiler
// implementation 'com.alibaba:arouter-api:1.5.2'
// kapt 'com.alibaba:arouter-compiler:1.5.2'/**/
api(libs.easypermissions) api(libs.easypermissions)
api(libs.xbanner) api(libs.xbanner)
@@ -156,6 +164,9 @@ dependencies {
api(libs.zcw.togglebutton.library) api(libs.zcw.togglebutton.library)
//图片模糊 //图片模糊
api(libs.com.github.mmin18.realtimeblurview) api(libs.com.github.mmin18.realtimeblurview)
api 'com.baoyz.actionsheet:library:1.1.7'
//播放器 //播放器
//腾讯直播sdk //腾讯直播sdk
api('com.tencent.liteav:LiteAVSDK_Professional:10.9.0.13102') api('com.tencent.liteav:LiteAVSDK_Professional:10.9.0.13102')
@@ -173,7 +184,7 @@ dependencies {
// api( 'io.agora.rtc:agora-special-full:4.1.1.29') // api( 'io.agora.rtc:agora-special-full:4.1.1.29')
api('com.github.AgoraIO-Community:LyricsView:1.1.3') api('com.github.AgoraIO-Community:LyricsView:1.1.3')
//声网集成屏幕共享 //声网集成屏幕共享
def agora_sdk_version = "4.5.2" def agora_sdk_version = "4.6.0"
api "io.agora.rtc:full-sdk:${agora_sdk_version}" api "io.agora.rtc:full-sdk:${agora_sdk_version}"
// api("io.agora.rtc:lite-sdk:${agora_sdk_version}") // api("io.agora.rtc:lite-sdk:${agora_sdk_version}")
// api ("io.agora.rtc:voice-sdk:${agora_sdk_version}") // api ("io.agora.rtc:voice-sdk:${agora_sdk_version}")
@@ -204,10 +215,21 @@ dependencies {
api 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5' api 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
api 'io.github.mayzs:paho.mqtt.android:1.2.1' api 'io.github.mayzs:paho.mqtt.android:1.2.1'
// api project(':LocalAar')
// ShapeViewhttps://github.com/getActivity/ShapeView
// api 'com.github.getActivity:ShapeView:10.0'
// 腾讯cos云储存
api 'com.qcloud.cos:cos-android:5.9.+'
// 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 //2. 云normal SDK
//aar的名称例如WbCloudNormal-v5.1.10-123456789.aar填入 'WbCloudNormal-v5.1.10-123456789.aar' //aar的名称例如WbCloudNormal-v5.1.10-123456789.aar填入 'WbCloudNormal-v5.1.10-123456789.aar'
} }
apply plugin: 'com.alibaba.arouter' // //apply plugin: 'com.alibaba.arouter' //

View File

@@ -6,16 +6,9 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <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_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<application android:allowBackup="true"> <application android:allowBackup="true">
<service
android:name=".service.MyRoomService"
android:enabled="true"
android:exported="true"/>
<activity
android:name=".activity.QxActivity"
android:exported="false" />
<service <service
android:name=".http.FloatingWindowService" android:name=".http.FloatingWindowService"
@@ -25,10 +18,10 @@
<activity <activity
android:name=".activity.WebViewActivity" android:name=".activity.WebViewActivity"
android:exported="false"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="com.xscm.qxlive.PROTOCOL_WEBVIEW" /> <action android:name="com.qxcm.qxlive.PROTOCOL_WEBVIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
@@ -36,14 +29,17 @@
android:name=".activity.news.OfficialNoticeActivity" android:name=".activity.news.OfficialNoticeActivity"
android:exported="false" /> 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:enabled="true" -->
<!-- android:exported="true" --> <!-- android:exported="true" -->
<!-- tools:ignore="Instantiatable" /> --> <!-- tools:ignore="Instantiatable" /> -->
<!-- <service android:name=".service.EMqttService" />--> <!-- <service android:name=".service.EMqttService" />-->
<service <!-- <service-->
android:name=".service.MyMqttService" <!-- android:name=".service.MyMqttService"-->
android:foregroundServiceType="dataSync" /> <!-- android:enabled="true"-->
<!-- android:exported="false"-->
<!-- android:foregroundServiceType="dataSync" />-->
</application> </application>
</manifest> </manifest>

View File

@@ -1,34 +1,72 @@
package com.xscm.moduleutil.activity; 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.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; 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.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding; import androidx.databinding.ViewDataBinding;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ActivityUtils; import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.BarUtils; 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.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.CommonAppContext; import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.bean.XLHBean;
import com.xscm.moduleutil.event.HourlyBean;
import com.xscm.moduleutil.event.MqttBean;
import com.xscm.moduleutil.event.RedBean;
import com.xscm.moduleutil.utils.ARouteConstants; import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.BackgroundManager; import com.xscm.moduleutil.utils.BackgroundManager;
import com.xscm.moduleutil.utils.ColorManager; import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.DisplayUtil; 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.SpUtil;
import com.xscm.moduleutil.utils.SystemUtils;
import com.xscm.moduleutil.widget.QXGiftDriftView;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@@ -36,6 +74,7 @@ import org.greenrobot.eventbus.ThreadMode;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -44,7 +83,8 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
@Override @Override
protected void attachBaseContext(Context newBase) { protected void attachBaseContext(Context newBase) {
super.attachBaseContext(LanguageUtil.attachBaseContext(newBase)); // 设置字体缩放比例为1.0f,即不跟随系统字体大小变化
super.attachBaseContext(DisplayUtil.attachBaseContext(newBase, 1.0f));
} }
protected VDB mBinding; protected VDB mBinding;
@@ -73,6 +113,8 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
ActivityUtils.finishAllActivities(); ActivityUtils.finishAllActivities();
} }
QXGiftDriftView qxGiftDriftView;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@@ -97,6 +139,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
loadNetworkBackground(); loadNetworkBackground();
// 注册颜色变化监听器 // 注册颜色变化监听器
ColorManager.getInstance().addColorChangeListener(this); ColorManager.getInstance().addColorChangeListener(this);
// 注册登出广播接收器 // 注册登出广播接收器
IntentFilter filter = new IntentFilter("com.xscm.moduleutil.ACTION_USER_LOGOUT"); IntentFilter filter = new IntentFilter("com.xscm.moduleutil.ACTION_USER_LOGOUT");
registerReceiver(mLogoutReceiver, filter); registerReceiver(mLogoutReceiver, filter);
@@ -115,18 +158,45 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
} }
// // 设置全屏模式,隐藏状态栏和导航栏 // 启动定时器
// View decorView = getWindow().getDecorView(); // startTimer();
// 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() { public static void finishAll() {
for (BaseMvpActivity activity : activityList) { for (BaseMvpActivity activity : activityList) {
if (!activity.isFinishing()) { if (!activity.isFinishing()) {
@@ -146,6 +216,37 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
// 默认实现,子类可以覆盖 // 默认实现,子类可以覆盖
} }
//在类中添加以下成员变量
private Handler timerHandler = new Handler();
private Runnable timerRunnable = new Runnable() {
@Override
public void run() {
// 调用你要执行的方法
// executePeriodicTask();
// 每10秒执行一次
timerHandler.postDelayed(this, 10000);
}
};
// 启动定时器的方法
private void startTimer() {
timerHandler.postDelayed(timerRunnable, 10000);
}
// 你需要定期执行的方法
private void executePeriodicTask() {
// 在这里实现你的业务逻辑
LogUtils.d("定时任务执行中...");
List<HourlyBean> hourlyBeans = new ArrayList<>();
HourlyBean hourlyBean = new HourlyBean();
hourlyBean.setText("nihao");
hourlyBean.setRank_number("1");
hourlyBean.setRoom_name("夏末");
hourlyBean.setRoom_id("1");
hourlyBeans.add(hourlyBean);
onMessageReceived(hourlyBeans);
}
protected void loadNetworkBackground() { protected void loadNetworkBackground() {
// 只有当已经有背景URL时才加载 // 只有当已经有背景URL时才加载
@@ -225,6 +326,36 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
@Override @Override
protected void onDestroy() { 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); BackgroundManager.getInstance().removeListener(this);
// 移除颜色变化监听器 // 移除颜色变化监听器
@@ -235,6 +366,12 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
if (EventBus.getDefault().isRegistered(this)) { if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this); EventBus.getDefault().unregister(this);
} }
try {
unregisterReceiver(mLogoutReceiver);
} catch (Exception e) {
// 忽略异常
}
try { try {
unregisterReceiver(mLogoutReceiver); unregisterReceiver(mLogoutReceiver);
} catch (Exception e) { } catch (Exception e) {
@@ -306,16 +443,742 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
return false; 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(); private final List<MqttBean.ListBean> mqttMessageQueue = new ArrayList<>(); // MQTT消息队列
// FloatingX.install(fxAppHelper).show(); private final List<XLHBean> xlhMessageQueue = new ArrayList<>(); // XLH消息队列
private final List<RedBean> redMessageQueue = new ArrayList<>(); // 红包队列
private boolean isMqttPlaying = false; // MQTT播放状态标志
private boolean isXlhPlaying = false; // XLH播放状态标志
private boolean isRedPlaying = false; // XLH播放状态标志
private final Object mqttQueueLock = new Object(); // MQTT队列同步锁
private final Object xlhQueueLock = new Object(); // XLH队列同步锁
private final Object RedQueueLock = new Object(); // XLH队列同步锁
private View currentMqttView = null; // 当前正在播放的MQTT视图
private View currentXlhView = null; // 当前正在播放的XLH视图
private View currentRedView = null; // 当前正在播放的XLH视图
private final List<HourlyBean> hourlyMessageQueue = new ArrayList<>(); // 小时榜消息队列
private final Map<Integer, View> currentHourlyViews = new HashMap<>(); // 当前显示的小时榜视图
private final Object hourlyQueueLock = new Object(); // 小时榜队列同步锁
private boolean isHourlyProcessing = false; // 小时榜处理状态标志
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageReceived(List<HourlyBean> hourlyBean) {
LogUtils.e("收到小时榜", hourlyBean);
if (hourlyBean == null) return;
if (SpUtil.getFloatingScreen() == 1) {
synchronized (hourlyQueueLock) {
hourlyMessageQueue.addAll(hourlyBean);
if (!isHourlyProcessing) {
isHourlyProcessing = true;
processHourlyMessages();
}
}
} else {
hourlyMessageQueue.clear();
clearAllHourlyViews();
}
}
private void processHourlyMessages() {
List<HourlyBean> messagesToProcess;
synchronized (hourlyQueueLock) {
if (hourlyMessageQueue.isEmpty()) {
isHourlyProcessing = false;
return;
}
// 每次只处理1条数据
messagesToProcess = new ArrayList<>();
messagesToProcess.add(hourlyMessageQueue.remove(0));
}
// 只展示一条数据
HourlyBean bean = messagesToProcess.get(0);
showHourlyFloatingMessage(bean, 0);
}
private void showHourlyFloatingMessage(HourlyBean hourlyBean, int positionIndex) {
try {
ViewGroup decorView = (ViewGroup) getWindow().getDecorView();
// 创建新的视图
View hourlyView = LayoutInflater.from(this).inflate(R.layout.item_hourly_floating, null);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
// 设置固定的垂直位置
int baseMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 70);
layoutParams.topMargin = baseMargin;
layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
hourlyView.setLayoutParams(layoutParams);
decorView.addView(hourlyView);
// 保存视图引用
currentHourlyViews.put(positionIndex, hourlyView);
// 更新视图数据
updateHourlyFloatingViewData(hourlyView, hourlyBean);
// 根据类型获取展示时间
long displayDuration = getDisplayDurationByType(Integer.parseInt(hourlyBean.getRank_number()));
// 启动动画
resetAndStartHourlyAnimation(hourlyView, displayDuration, () -> {
// 动画结束后清理视图
if (hourlyView.getParent() != null) {
decorView.removeView(hourlyView);
}
currentHourlyViews.remove(positionIndex);
// 检查是否还有更多消息需要处理
synchronized (hourlyQueueLock) {
if (hourlyMessageQueue.isEmpty()) {
isHourlyProcessing = false;
} else {
// 当前视图消失后处理下一条消息
processHourlyMessages();
}
}
});
} catch (Exception e) {
LogUtils.e("显示小时榜飘屏失败", e);
}
}
private long getDisplayDurationByType(int type) {
// 根据不同类型设置不同的展示时间(毫秒)
switch (type) {
case 1: // 第一名
return 5000; // 5秒
case 2: // 第二名
return 4000; // 4秒
case 3: // 第三名
return 3000; // 3秒
default:
return 3000; // 默认3秒
}
}
private void updateHourlyFloatingViewData(View view, HourlyBean hourlyBean) {
TextView tvName = view.findViewById(R.id.tv_name);
ImageView ivAvatar = view.findViewById(R.id.im_h_t);
if (hourlyBean != null) {
// 根据排名设置不同的显示
switch (hourlyBean.getRank_number()) {
case "1":
// tvName.setText("新科状元! ["+hourlyBean.getRoom_name()+"] 独占鳌头!");
setColoredText(tvName, "新科状元! [", hourlyBean.getRoom_name(), "] 独占鳌头!", R.color.color_FFFA63);
ivAvatar.setImageResource(R.mipmap.hourl_top1);
break;
case "2":
// tvName.setText("金榜榜眼! ["+hourlyBean.getRoom_name()+"] 才气逼人!");
setColoredText(tvName, "金榜榜眼! [", hourlyBean.getRoom_name(), "] 才气逼人!", R.color.color_FFFA63);
ivAvatar.setImageResource(R.mipmap.hourl_top2);
break;
case "3":
setColoredText(tvName, "风采探花! [", hourlyBean.getRoom_name(), "] 实力绽放!", R.color.color_1FFFE5);
// tvName.setText("风采探花! ["+hourlyBean.getRoom_name()+"] 实力绽放!");
ivAvatar.setImageResource(R.mipmap.hourl_top3);
break;
default:
tvName.setVisibility(View.GONE);
ivAvatar.setVisibility(View.GONE);
break;
}
}
}
// 设置带颜色的文本
// 设置带颜色的文本
private void setColoredText(TextView textView, String prefix, String roomName, String suffix, int colorRes) {
String fullText = prefix + roomName + suffix;
SpannableStringBuilder builder = new SpannableStringBuilder(fullText);
// 先为整个文本设置白色
builder.setSpan(
new ForegroundColorSpan(ContextCompat.getColor(this, R.color.white)),
0,
fullText.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
// 查找房间名在文本中的位置
int start = fullText.indexOf("[");
int end = fullText.indexOf("]") + 1;
if (start >= 0 && end > start) {
// 为房间名部分设置指定颜色
builder.setSpan(
new ForegroundColorSpan(ContextCompat.getColor(this, colorRes)),
start,
end,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
}
textView.setText(builder);
}
private void resetAndStartHourlyAnimation(View view, long displayDuration, Runnable onAnimationEnd) {
try {
int screenWidth = getScreenWidth();
// 设置初始位置:在屏幕右侧外部
view.setTranslationX(screenWidth);
// 进入动画
ObjectAnimator enterAnimator = ObjectAnimator.ofFloat(view, "translationX", screenWidth, 0f);
enterAnimator.setDuration(500);
enterAnimator.setInterpolator(new DecelerateInterpolator());
enterAnimator.start();
// 停留后退出动画
view.postDelayed(() -> {
try {
ObjectAnimator exitAnimator = ObjectAnimator.ofFloat(view, "translationX", 0f, -screenWidth);
exitAnimator.setDuration(500);
exitAnimator.setInterpolator(new AccelerateInterpolator());
exitAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onAnimationEnd.run();
}
@Override
public void onAnimationCancel(Animator animation) {
onAnimationEnd.run();
}
});
exitAnimator.start();
} catch (Exception e) {
LogUtils.e("小时榜退出动画执行失败", e);
onAnimationEnd.run();
}
}, displayDuration); // 根据类型设置的展示时间
} catch (Exception e) {
LogUtils.e("小时榜动画启动失败", e);
onAnimationEnd.run();
}
}
private void clearAllHourlyViews() {
ViewGroup decorView = (ViewGroup) getWindow().getDecorView();
for (View view : currentHourlyViews.values()) {
if (view.getParent() != null) {
decorView.removeView(view);
}
}
currentHourlyViews.clear();
}
/// 礼物特效 - 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 (event.getText()==null || event.getText().isEmpty()) return;
if (SpUtil.getFloatingScreen() == 1) {
synchronized (xlhQueueLock) {
xlhMessageQueue.add(event);
if (!isXlhPlaying) {
isXlhPlaying = true;
processNextXlhMessage();
}
}
} else {
xlhMessageQueue.clear();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(RedBean event){
LogUtils.e("收到红包", event);
if (event==null) return;
if (SpUtil.getFloatingScreen()==1){
synchronized (RedQueueLock) {
redMessageQueue.add(event);
if (!isRedPlaying) {
isRedPlaying = true;
processNextRedMessage();
}
}
} else {
redMessageQueue.clear();
}
}
private void processNextRedMessage() {
RedBean redBean;
synchronized (RedQueueLock) {
if (redMessageQueue.isEmpty()) {
isRedPlaying = false;
return;
}
redBean = redMessageQueue.remove(0);
}
showPiaoPingMessageRed(redBean);
}
private void showPiaoPingMessageRed(RedBean redBean){
try {
// 清理之前的视图(如果存在)
if (currentRedView != null && currentRedView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentRedView.getParent();
parent.removeView(currentRedView);
}
if (decorView2 == null) {
decorView2 = (ViewGroup) getWindow().getDecorView();
}
currentRedView = LayoutInflater.from(this).inflate(R.layout.item_piaoping_red, null);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 140);
layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
currentRedView.setLayoutParams(layoutParams);
decorView2.addView(currentRedView);
updateRedFloatingViewData(currentRedView, redBean);
// 播放红包音效
playRedPacketSound();
resetAndStartXlhAnimation(currentRedView, () -> {
// 清理当前视图
if (currentRedView != null && currentRedView.getParent() != null) {
ViewGroup parent = (ViewGroup) currentRedView.getParent();
parent.removeView(currentRedView);
}
currentRedView = null;
// 处理队列中的下一条消息
synchronized (RedQueueLock) {
isRedPlaying = false;
processNextRedMessage();
}
});
} catch (Exception e) {
LogUtils.e("显示红包飘屏失败", e);
// 出现异常时继续处理队列
synchronized (RedQueueLock) {
isRedPlaying = false;
processNextRedMessage();
}
}
}
// 在类中添加成员变量
private MediaPlayer redPacketMediaPlayer = null;
private boolean isRedPacketMediaPrepared = false;
// 添加播放红包音效的方法
private void playRedPacketSound() {
try {
if (!isRedPacketMediaPrepared) {
// 第一次初始化MediaPlayer
if (redPacketMediaPlayer == null) {
redPacketMediaPlayer = MediaPlayer.create(this, R.raw.red_packet_come); // 假设音效文件名为red_packet_sound.mp3
redPacketMediaPlayer.setOnPreparedListener(mp -> {
isRedPacketMediaPrepared = true;
mp.start();
});
redPacketMediaPlayer.setOnCompletionListener(mp -> {
// 播放完成后重置,以便下次重新播放
try {
mp.seekTo(0);
} catch (Exception e) {
LogUtils.e("MediaPlayer重置失败", e);
}
});
}
if (redPacketMediaPlayer != null) {
redPacketMediaPlayer.prepareAsync(); // 异步准备
}
} else {
// 已经准备好了,直接重新播放
if (redPacketMediaPlayer != null && !redPacketMediaPlayer.isPlaying()) {
redPacketMediaPlayer.seekTo(0);
redPacketMediaPlayer.start();
}
}
} catch (Exception e) {
LogUtils.e("播放红包音效失败", e);
isRedPacketMediaPrepared=false;
}
}
private void updateRedFloatingViewData(View view, RedBean redBean){
TextView textView = view.findViewById(R.id.tv_name);
if (redBean != null) {
String fullText = redBean.getText();
if (redBean.getNickname() != null && redBean.getRoom_name() != null) {
SpannableStringBuilder builder = new SpannableStringBuilder(fullText);
// 为用户名设置蓝色
int userNameStart = fullText.indexOf(redBean.getNickname());
if (userNameStart >= 0) {
builder.setSpan(
new ForegroundColorSpan(ContextCompat.getColor(this, R.color.colorPrimary)),
userNameStart,
userNameStart + redBean.getNickname().length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
}
// 为房间名设置蓝色
int roomNameStart = fullText.indexOf(redBean.getRoom_name());
if (roomNameStart >= 0) {
builder.setSpan(
new ForegroundColorSpan(ContextCompat.getColor(this, R.color.colorPrimary)),
roomNameStart,
roomNameStart + redBean.getRoom_name().length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
}
textView.setText(builder);
} else {
textView.setText(fullText);
}
} else {
textView.setText("");
}
view.setOnClickListener(v -> {
// 点击时执行跳转操作
handleRedItemClick(redBean);
});
}
// 处理下一个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;//巡乐会的
ViewGroup decorView2;//红包的
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.setInterpolator(new DecelerateInterpolator(2.0f));
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(3000);
exitAnim.setInterpolator(new DecelerateInterpolator(2f));
exitAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// 移除视图并处理下一个
onAnimationEnd.run();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
view.startAnimation(exitAnim);
}, 5000); // 停留1秒
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
view.startAnimation(enterAnim);
} 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();
}
}, 5000);
} 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();
}
private void handleRedItemClick(RedBean redBean) {
// 这里可以根据实际需求实现跳转逻辑
// 例如:跳转到礼物详情页面、用户主页等
// 使用缓存数据进入房间
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), redBean.getRoom_id(), "");
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", xlhBean.getRoom_id()).navigation();
}
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(ChatInfo event) { public void onEvent(ChatInfo event) {
String id = event.getId().replace("g", ""); 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(); Intent intent = new Intent(this, WebViewActivity.class);
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/union/setGroup?id=" + SpUtil.getToken() + "&guildId=" + id);
startActivity(intent);
// 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.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager; 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.annotation.NonNull;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
@@ -11,9 +14,22 @@ import androidx.core.content.ContextCompat;
import androidx.databinding.ViewDataBinding; import androidx.databinding.ViewDataBinding;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
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.CommonAppContext;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.bean.UserBean; import com.xscm.moduleutil.bean.UserBean;
import com.xscm.moduleutil.bean.UserInfo; 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.LanguageUtil;
import com.xscm.moduleutil.utils.location.LocationProvider; import com.xscm.moduleutil.utils.location.LocationProvider;
import com.xscm.moduleutil.utils.location.SystemLocationProvider; import com.xscm.moduleutil.utils.location.SystemLocationProvider;
@@ -28,13 +44,13 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewDataBinding> extends BaseAppCompatActivity<VDB> implements public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewDataBinding> extends BaseAppCompatActivity<VDB> implements
IView<Activity> , LocationProvider.LocationCallback IView<Activity> {
{
protected P MvpPre; protected P MvpPre;
protected abstract P bindPresenter(); protected abstract P bindPresenter();
private String city1;
@Override @Override
protected void initView() { protected void initView() {
@@ -77,98 +93,126 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void logOutEvent(UserBean userBean) { public void logOutEvent(UserBean userBean) {
// 在用户 UI 点击登录的时候调用 // 在用户 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 @Override
public void onError(final int code, final String desc) { 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 @Override
public void onSuccess() { public void onSuccess() {
LogUtils.e("@@@", "成功"); 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 @Override
public void onError(int code, String desc) { public void onError(int code, String desc) {
LogUtils.e("@@@", "描述"+desc); // 错误处理
} }
}); });
initLocation(); //initLocation();
} }
}); });
// V2TIMManager.getInstance().addIMSDKListener(imSdkListener);
} }
private SystemLocationProvider locationProvider;
private void initLocation() {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// 请求定位权限 private final V2TIMSDKListener imSdkListener = new V2TIMSDKListener() {
ActivityCompat.requestPermissions( @Override
(Activity) this, public void onConnecting() {
new String[]{ }
android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION @Override
public void onConnectSuccess() {//重连成功
if (CommonAppContext.getInstance().playId!=null){
LogUtils.e("@@@", "重连成功");
LogUtils.e("@@@", ""+CommonAppContext.getInstance().playId);
RetrofitClient.getInstance().roomUserReconnect(CommonAppContext.getInstance().playId);
}
}
@Override
public void onConnectFailed(int code, String error) {
LogUtils.e("@@@", "断开连接");
CommonAppContext.getInstance().onConnectFailed=true;
}
@Override
public void onKickedOffline() {
// queren1();
if (CommonAppContext.getInstance().playId!=null){
ToastUtils.showShort("您的账号已被挤下线");
try {
CommonAppContext.getInstance().clearLoginInfo();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
}
@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);
}
}, },
1001 // 自定义常量,比如 1001 v -> {
); // 点击“取消”按钮时什么都不做
}
locationProvider = new SystemLocationProvider();
// 请求一次性的位置信息 }, false, 0).show();
locationProvider.getLastKnownLocation(this, this);
} }
@Override @Override
public void onLocationReceived(double latitude, double longitude, String city) { public Resources getResources() {
LogUtils.e("当前位置:" + city); Resources resources = super.getResources();
city1=city; if (resources != null) {
EventBus.getDefault().post(city1); Configuration configuration = resources.getConfiguration();
if (configuration != null) {
// 设置字体缩放比例不随系统变化
configuration.fontScale = 1.0f; // 1.0f表示默认大小
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
}
}
return resources;
} }
@Override
public void onFailed(String errorMessage) {
LogUtils.e("定位失败");
}
@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();
}
locationProvider.getLastKnownLocation(this, this);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void userInfoEvent(UserInfo event) {
V2TIMUserFullInfo userFullInfo = new V2TIMUserFullInfo();
userFullInfo.setNickname(event.getNickname());
userFullInfo.setFaceUrl(event.getAvatar());
userFullInfo.setAllowType(event.getSex());
V2TIMManager.getInstance().setSelfInfo(userFullInfo, new V2TIMCallback() {
@Override
public void onSuccess() {
LogUtils.e("@@@", "成功");
}
@Override
public void onError(int code, String desc) {
LogUtils.e("@@@", "描述"+desc);
}
});
}
/** /**
* 显示全局飘屏消息(支持任意位置飘过) * 显示全局飘屏消息(支持任意位置飘过)
* *

View File

@@ -10,7 +10,10 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.webkit.GeolocationPermissions; import android.webkit.GeolocationPermissions;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
@@ -21,11 +24,16 @@ import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.Toast; 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.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.CommonAppContext; import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.databinding.ActivityWebViewBinding; import com.xscm.moduleutil.databinding.ActivityWebViewBinding;
import com.xscm.moduleutil.utils.ARouteConstants; import com.xscm.moduleutil.utils.ARouteConstants;
import com.tencent.imsdk.v2.V2TIMConversation; import com.tencent.imsdk.v2.V2TIMConversation;
@@ -46,6 +54,8 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
public String title; public String title;
public String url; public String url;
@Autowired
public String type;//type=1:青少年模式
private ValueCallback<Uri> mUploadMessage; private ValueCallback<Uri> mUploadMessage;
private ValueCallback<Uri[]> mUploadCallbackAboveL; private ValueCallback<Uri[]> mUploadCallbackAboveL;
private final int REQUEST_FILE_PICKER = 1; private final int REQUEST_FILE_PICKER = 1;
@@ -53,6 +63,8 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
@Override @Override
protected void initData() { protected void initData() {
WebSettings webSettings = mBinding.webView.getSettings(); WebSettings webSettings = mBinding.webView.getSettings();
// 禁用水平滚动 // 禁用水平滚动
@@ -61,9 +73,9 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptEnabled(true);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存 webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
//增加JSBridge //增加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("协议")) { if (title.contains("协议")) {
webSettings.setDisplayZoomControls(false); // 隐藏默认缩放控件 webSettings.setDisplayZoomControls(false); // 隐藏默认缩放控件
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL); // 使用正常布局算法 webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL); // 使用正常布局算法
@@ -75,10 +87,10 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
// 设置初始缩放 // 设置初始缩放
mBinding.webView.setInitialScale(100); mBinding.webView.setInitialScale(100);
mBinding.webView.getSettings().setUseWideViewPort(false); mBinding.webView.getSettings().setUseWideViewPort(false);
}else { } else {
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
} }
}else { } else {
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
} }
@@ -94,7 +106,6 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
mBinding.webView.setScrollContainer(true); mBinding.webView.setScrollContainer(true);
mBinding.webView.setWebViewClient(new WebViewClient()); mBinding.webView.setWebViewClient(new WebViewClient());
mBinding.webView.setBackgroundColor(Color.TRANSPARENT); mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); 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() { private void showFileChooser() {
// 这里可以扩展为显示对话框让用户选择“拍照”或“从相册选择” // 这里可以扩展为显示对话框让用户选择“拍照”或“从相册选择”
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 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 @Override
protected void initView() { protected void initView() {
getWindow().getDecorView().setBackgroundResource(com.xscm.moduleutil.R.color.white); getWindow().getDecorView().setBackgroundResource(com.xscm.moduleutil.R.color.white);
title = getIntent().getStringExtra("title"); title = getIntent().getStringExtra("title");
url = getIntent().getStringExtra("url"); 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("反馈")) { if (title.equals("举报") || title.equals("等级") || title.equals("公会") || title.equals("邀请") || title.equals("反馈")) {
mBinding.topBar.setVisibility(GONE); mBinding.topBar.setVisibility(GONE);
// mBinding.webView.setPadding(0,20,0,0); // mBinding.webView.setPadding(0,20,0,0);
@@ -227,20 +329,18 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
mBinding.topBar.setVisibility(VISIBLE); mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle(title); mBinding.topBar.setTitle(title);
} }
}else { } else {
if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6")){ if (url.equals(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6")) {
mBinding.topBar.setVisibility(VISIBLE); mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle("用户协议"); 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.setVisibility(VISIBLE);
mBinding.topBar.setTitle("隐私协议"); mBinding.topBar.setTitle("隐私协议");
}else { } else {
mBinding.topBar.setVisibility(GONE); mBinding.topBar.setVisibility(GONE);
} }
} }
} }
@Override @Override
@@ -250,9 +350,11 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
public class WebAppInterface { public class WebAppInterface {
Context mContext; Context mContext;
String type;
WebAppInterface(Context c) { WebAppInterface(Context c, String type1) {
mContext = c; mContext = c;
type = type1;
} }
// 被 H5 调用的方法 // 被 H5 调用的方法
@@ -263,9 +365,16 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
@JavascriptInterface @JavascriptInterface
public void closeWeb() { public void closeWeb() {
LogUtils.e("value: "); if (type != null) {
if (type.equals("1")) {
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 1).navigation();
} else {
finish(); finish();
} }
} else {
finish();
}
}
@JavascriptInterface @JavascriptInterface
public void customerService() { public void customerService() {
@@ -281,8 +390,11 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
@JavascriptInterface @JavascriptInterface
public void jumpRoomPage(String room_id) { 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 @JavascriptInterface
public void jumpWebPage(String objects) { public void jumpWebPage(String objects) {
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).navigation(); // ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).navigation();
@@ -290,22 +402,25 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
} }
@JavascriptInterface @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 intent = new Intent(mContext, TUIGroupChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id); 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); intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
mContext.startActivity(intent); mContext.startActivity(intent);
} }
@JavascriptInterface @JavascriptInterface
public void chatWithUser(String user_id,String nickname) { public void chatWithUser(String user_id, String nickname) {
Intent intent = new Intent(mContext, TUIC2CChatActivity.class); Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id); intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
intent.putExtra(TUIConstants.TUIChat.CHAT_NAME, nickname);
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C); intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
mContext.startActivity(intent); mContext.startActivity(intent);
} }
@JavascriptInterface @JavascriptInterface
public void exchange(){ public void exchange() {
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation(); ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
} }
@@ -321,7 +436,7 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
} }
@JavascriptInterface @JavascriptInterface
public void Recharge(){ public void Recharge() {
ARouter.getInstance().build(ARouteConstants.RECHARGE_ACTIVITY).navigation(); ARouter.getInstance().build(ARouteConstants.RECHARGE_ACTIVITY).navigation();
} }
} }
@@ -333,6 +448,7 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
// intent.putExtra("menuName", msg); // intent.putExtra("menuName", msg);
// startActivity(intent); // startActivity(intent);
LogUtils.e("closeWeb"); LogUtils.e("closeWeb");
} }
} }

View File

@@ -22,13 +22,13 @@ public class NewsPresenter extends BasePresenter<NewsContacts.View> implements N
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
addDisposable(d); addDisposable(d);
MvpRef.get().finishRefresh();
} }
@Override @Override
public void onNext(List<NewsMessageList> newsMessageLists) { public void onNext(List<NewsMessageList> newsMessageLists) {
MvpRef.get().showNews(newsMessageLists); MvpRef.get().showNews(newsMessageLists);
MvpRef.get().finishRefresh();
} }
}); });
} }

View File

@@ -3,6 +3,7 @@ package com.xscm.moduleutil.activity.news;
import static android.view.View.GONE; import static android.view.View.GONE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
import android.content.Intent;
import android.text.Html; import android.text.Html;
import android.view.View; import android.view.View;
@@ -14,6 +15,8 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.activity.BaseMvpActivity; import com.xscm.moduleutil.activity.BaseMvpActivity;
import com.xscm.moduleutil.activity.WebViewActivity;
import com.xscm.moduleutil.base.RoomManager;
import com.xscm.moduleutil.bean.NewsMessageList; import com.xscm.moduleutil.bean.NewsMessageList;
import com.xscm.moduleutil.databinding.ActivityOfficialNoticeBinding; import com.xscm.moduleutil.databinding.ActivityOfficialNoticeBinding;
import com.xscm.moduleutil.utils.ARouteConstants; import com.xscm.moduleutil.utils.ARouteConstants;
@@ -75,9 +78,13 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (item.getRoom_id()>0){ 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()){ }else if (item.getRoom_id() == 0 && item.getUrl() != null && !item.getUrl().isEmpty()){
ARouter.getInstance().build(ARouteConstants.H5).withString("url", item.getUrl()).navigation(); Intent intent = new Intent(OfficialNoticeActivity.this, WebViewActivity.class);
intent.putExtra("url", item.getUrl());
startActivity(intent);
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", item.getUrl()).navigation();
} }
} }
}); });

View File

@@ -9,19 +9,23 @@ import androidx.annotation.NonNull;
import android.text.Html; import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod; import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import com.blankj.utilcode.util.AppUtils; import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ScreenUtils; import com.blankj.utilcode.util.ScreenUtils;
import com.blankj.utilcode.util.ToastUtils; import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.CommonAppContext;
import com.xscm.moduleutil.bean.AppUpdateModel; import com.xscm.moduleutil.bean.AppUpdateModel;
import com.xscm.moduleutil.databinding.DialogAppUpdateBinding; import com.xscm.moduleutil.databinding.DialogAppUpdateBinding;
import com.xscm.moduleutil.utils.DownloadListener; import com.xscm.moduleutil.utils.DownloadListener;
import com.xscm.moduleutil.utils.DownloadUtil; import com.xscm.moduleutil.utils.DownloadUtil;
import com.xscm.moduleutil.utils.TextViewUtils;
import com.xscm.moduleutil.utils.logger.Logger; import com.xscm.moduleutil.utils.logger.Logger;
import com.xscm.moduleutil.widget.dialog.BaseDialog; import com.xscm.moduleutil.widget.dialog.BaseDialog;
@@ -77,7 +81,11 @@ public class AppUpdateDialog extends BaseDialog<DialogAppUpdateBinding> implemen
public void setAppUpdateModel(AppUpdateModel appUpdateModel) { public void setAppUpdateModel(AppUpdateModel appUpdateModel) {
this.appUpdateModel = appUpdateModel; this.appUpdateModel = appUpdateModel;
mBinding.tvContent.setText(TextUtils.isEmpty(appUpdateModel.getContent()) ? "修复旧版本已知bug" : Html.fromHtml(appUpdateModel.getContent())); TextViewUtils.setHtmlText(mBinding.tvContent,appUpdateModel.getContent(),false);
//mBinding.tvContent.setText(TextUtils.isEmpty(appUpdateModel.getContent()) ? "修复旧版本已知bug" : Html.fromHtml(appUpdateModel.getContent()));
LogUtils.d("AppUpdateDialog", "setAppUpdateModel " + appUpdateModel.getContent().toString());
// mBinding.tvContent.setHtmlText(appUpdateModel.getContent());
} }

View File

@@ -1,11 +1,16 @@
package com.xscm.moduleutil.adapter; package com.xscm.moduleutil.adapter;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter; import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.bean.RechargeBean; import com.xscm.moduleutil.bean.RechargeBean;
import com.xscm.moduleutil.utils.SystemUtils;
import java.util.List; import java.util.List;
@@ -36,7 +41,10 @@ public class BalanceRechargeAdapter extends BaseMultiItemQuickAdapter<RechargeBe
@Override @Override
protected void convert(BaseViewHolder helper, RechargeBean item) { protected void convert(BaseViewHolder helper, RechargeBean item) {
int type = helper.getItemViewType(); 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) { if (type == ITEM_TYPE_NORMAL) {
// 正常 item 显示逻辑 // 正常 item 显示逻辑
helper.setText(R.id.tv_gold_num, item.getCoins()); helper.setText(R.id.tv_gold_num, item.getCoins());

View File

@@ -26,15 +26,15 @@ public class GiftAdapter extends BaseQuickAdapter<HeavenGiftBean, BaseViewHolder
protected void convert(BaseViewHolder helper, HeavenGiftBean item) { protected void convert(BaseViewHolder helper, HeavenGiftBean item) {
ImageUtils.loadHeadCC(item.getPicture(), helper.getView(R.id.iv_head)); ImageUtils.loadHeadCC(item.getPicture(), helper.getView(R.id.iv_head));
helper.getView(R.id.im_jb).setVisibility(View.VISIBLE); helper.getView(R.id.im_jb).setVisibility(View.VISIBLE);
if (item.getType() == COIN_TYPE) { // if (item.getType() == COIN_TYPE) {
helper.setText(R.id.tv_gift_time, String.format("%s", item.getGold())); // helper.setText(R.id.tv_gift_time, String.format("%s", item.getGold()));
} else if (item.getType() == GIFT_TYPE) { // } else if (item.getType() == GIFT_TYPE) {
helper.getView(R.id.im_jb).setVisibility(View.GONE); // helper.getView(R.id.im_jb).setVisibility(View.GONE);
helper.setText(R.id.tv_gift_time, String.format("*%s", item.getQuantity())); // helper.setText(R.id.tv_gift_time, String.format("*%s", item.getQuantity()));
} else { // } else {
helper.getView(R.id.im_jb).setVisibility(View.GONE); // helper.getView(R.id.im_jb).setVisibility(View.GONE);
helper.setText(R.id.tv_gift_time, String.format("%s天", item.getDays())); // helper.setText(R.id.tv_gift_time, String.format("%s天", item.getDays()));
} // }
helper.setText(R.id.tv_head_name, item.getTitle()); helper.setText(R.id.tv_head_name, item.getTitle());
ViewGroup.LayoutParams layoutParams = helper.itemView.getLayoutParams(); ViewGroup.LayoutParams layoutParams = helper.itemView.getLayoutParams();
layoutParams.width = ((ScreenUtils.getScreenWidth() - ConvertUtils.dp2px(140)) / 4); layoutParams.width = ((ScreenUtils.getScreenWidth() - ConvertUtils.dp2px(140)) / 4);

View File

@@ -121,7 +121,7 @@ public class GiftPackAdapter extends BaseAdapter {
viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift); viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift);
viewHolder.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on); 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.cl_iv_down_on = (ConstraintLayout) convertView.findViewById(R.id.cl_iv_down_on);
viewHolder.integral = (TextView) convertView.findViewById(R.id.integral);
convertView.setTag(viewHolder); convertView.setTag(viewHolder);
} else { } else {
viewHolder = (GiftPackAdapter.ViewHolder) convertView.getTag(); viewHolder = (GiftPackAdapter.ViewHolder) convertView.getTag();
@@ -129,10 +129,11 @@ public class GiftPackAdapter extends BaseAdapter {
viewHolder.item_layout.setOnClickListener(v -> { viewHolder.item_layout.setOnClickListener(v -> {
// RoonGiftModel clickedModel = (RoonGiftModel) v.getTag(); // 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()); viewHolder.tv_gift_name.setText(giftModel.getGift_name());
//设置礼物价格 //设置礼物价格
@@ -162,7 +163,7 @@ public class GiftPackAdapter extends BaseAdapter {
static class ViewHolder { static class ViewHolder {
public ConstraintLayout item_layout; 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 ImageView iv_gift_pic;
public TextView tv_gift_change_love_values; public TextView tv_gift_change_love_values;
public ImageView ivDownOn; public ImageView ivDownOn;

View File

@@ -42,12 +42,13 @@ public class GiftRoomAdapter extends BaseAdapter {
private final int pageSize = 100; private final int pageSize = 100;
public GiftRoomAdapter(Context context, List<RoonGiftModel> mDatas, int curIndex, String type) { public GiftRoomAdapter(Context context, List<RoonGiftModel> mDatas, int curIndex, String type) {
inflater = LayoutInflater.from(context);
this.mDatas = mDatas; this.mDatas = mDatas;
this.curIndex = curIndex; this.curIndex = curIndex;
this.mContext = context; this.mContext = context;
this.type = type; this.type = type;
this.gestureDetector = new MyGestureDetector(mContext); this.gestureDetector = new MyGestureDetector(mContext);
inflater = LayoutInflater.from(mContext);
} }
/** /**
@@ -100,6 +101,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 static class MyGestureDetector extends GestureDetector {
// private GiftRoomAdapter mAdapter; // private GiftRoomAdapter mAdapter;
// private RoonGiftModel mGiftModel; // private RoonGiftModel mGiftModel;
@@ -146,18 +157,6 @@ public class GiftRoomAdapter extends BaseAdapter {
viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift); viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift);
viewHolder.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on); 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.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); convertView.setTag(viewHolder);
} else { } else {
@@ -211,7 +210,20 @@ public class GiftRoomAdapter extends BaseAdapter {
// if (giftModel.isManghe()) { // if (giftModel.isManghe()) {
// viewHolder.tv_gift_change_love_values.setVisibility(View.GONE); // viewHolder.tv_gift_change_love_values.setVisibility(View.GONE);
// } // }
if (giftModel.getGift_bag() == 10) {
viewHolder.item_layout.setBackgroundResource(R.mipmap.gift_tkzj);
viewHolder.tv_gift_name.setText("");
viewHolder.tv_gift_name.setBackgroundResource(R.mipmap.gift_name_tkzj);
} else if (giftModel.getGift_bag() == 11) {
viewHolder.tv_gift_name.setText("");
viewHolder.item_layout.setBackgroundResource(R.mipmap.gift_syzc);
viewHolder.tv_gift_name.setBackgroundResource(R.mipmap.gift_name_syzc);
} else if (giftModel.getGift_bag() == 12) {
viewHolder.tv_gift_name.setText("");
viewHolder.item_layout.setBackgroundResource(R.mipmap.gift_sjzd);
viewHolder.tv_gift_name.setBackgroundResource(R.mipmap.gift_name_skzd);
}
return convertView; return convertView;
} }

View File

@@ -158,7 +158,10 @@ public class GiftTwoAdapter extends BaseAdapter {
viewHolder.ivDownOn.setVisibility(View.GONE); viewHolder.ivDownOn.setVisibility(View.GONE);
viewHolder.cl_iv_down_on.setBackgroundResource(0); 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.base.BaseMvpFragment;
import com.xscm.moduleutil.bean.GiftLabelBean; import com.xscm.moduleutil.bean.GiftLabelBean;
import com.xscm.moduleutil.bean.GiftPackBean; 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.RewardUserBean;
import com.xscm.moduleutil.bean.RoonGiftModel; import com.xscm.moduleutil.bean.RoonGiftModel;
import com.xscm.moduleutil.bean.WalletBean; import com.xscm.moduleutil.bean.WalletBean;
@@ -34,21 +36,23 @@ import java.util.List;
public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter, RoomVpGiftBinding> implements RewardGiftContacts.View { public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter, RoomVpGiftBinding> implements RewardGiftContacts.View {
private String id; private String id;
private GiftTwoAdapter mAdapter;
private GiftRoomAdapter roomAdapter; private GiftRoomAdapter roomAdapter;
private GiftPackAdapter packAdapter; private GiftPackAdapter packAdapter;
private String tag; private String tag;
private int pageSize = 100;//一页显示的礼物个数 private int pageSize = 100;//一页显示的礼物个数
private int pageCount;//页数 private int pageCount;//页数
private int type;//1:房间点击进入的2打赏进入的 private int type;//1:房间点击进入的2打赏进入的
private List<RoonGiftModel> giftList=new ArrayList<>(); private List<RoonGiftModel> giftList = new ArrayList<>();
private List<GiftPackBean> giftPackList=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(); Bundle args = new Bundle();
args.putString("id", id); args.putString("id", id);
args.putInt("type", type); args.putInt("type", type);
args.putString("roomId", roomId);
GiftTwoDetailsFragment fragment = new GiftTwoDetailsFragment(); GiftTwoDetailsFragment fragment = new GiftTwoDetailsFragment();
fragment.setArguments(args); fragment.setArguments(args);
return fragment; return fragment;
@@ -59,8 +63,10 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
super.initArgs(arguments); super.initArgs(arguments);
id = arguments.getString("id"); id = arguments.getString("id");
type = arguments.getInt("type"); type = arguments.getInt("type");
roomId = arguments.getString("roomId");
} }
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
@@ -72,20 +78,50 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
return new RewardGiftPresenter(this, getActivity()); return new RewardGiftPresenter(this, getActivity());
} }
@Override public void loadDataIfNeeded(String id, int type, String roomId) {
protected void initData() { if (MvpPre==null){
if (id.equals("0")){ MvpPre = new RewardGiftPresenter(this, getActivity());
}
if (id.equals("0")) {
MvpPre.giftPack(); MvpPre.giftPack();
}else { } else {
if (type==0) { if (type == 0) {
MvpPre.getGiftList("0", type); MvpPre.getGiftList("0", type, roomId);
}else { } else {
MvpPre.getGiftList(id, type); 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 @Override
protected void initView() { protected void initView() {
@@ -118,29 +154,20 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
} }
return null; return null;
} }
@Override @Override
public void setGiftList(List<RoonGiftModel> data,int type) { public void setGiftList(List<RoonGiftModel> data, int type) {
if (type == 1){ giftList = new ArrayList<>();
giftList=new ArrayList<>();
giftList.addAll(data); giftList.addAll(data);
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize); pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
roomAdapter = new GiftRoomAdapter(getActivity(), data, j, "0"); // 只需要创建一次Adapter并设置循环设置没有意义
mBinding.rvGift.setAdapter(roomAdapter); if (pageCount > 0) {
} roomAdapter = new GiftRoomAdapter(getActivity(), data, 0, "0");
}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); mBinding.rvGift.setAdapter(roomAdapter);
} }
} }
// EventBus.getDefault().post(new RoomGiftEvent(data));
}
@Override @Override
public void giveGift() { public void giveGift() {
@@ -164,7 +191,17 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Override @Override
public void giftPack(List<GiftPackBean> giftPackBean) { public void giftPack(List<GiftPackBean> giftPackBean) {
giftPackList=new ArrayList<>(); 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); giftPackList.addAll(giftPackBean);
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize); pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) { for (int j = 0; j < pageCount; j++) {
@@ -173,6 +210,25 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, j, "0"); packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, j, "0");
mBinding.rvGift.setAdapter(packAdapter); 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 @Override
@@ -187,7 +243,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onGiftClicRoomkEvent(RoomGiftClickEvent event) { public void onGiftClicRoomkEvent(RoomGiftClickEvent event) {
if (giftList == null){ if (giftList == null) {
giftList = new ArrayList<>(); giftList = new ArrayList<>();
giftList.add(event.gift); giftList.add(event.gift);
} }
@@ -197,7 +253,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
RoonGiftModel giftModel = giftList.get(i); RoonGiftModel giftModel = giftList.get(i);
if (giftModel.getGift_id().equals(id)) { if (giftModel.getGift_id().equals(id)) {
if (!giftModel.isChecked()) { 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); giftModel.setChecked(true);
} }
} else { } else {
@@ -215,7 +271,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
if (giftModel.getGift_id().equals(id)) { if (giftModel.getGift_id().equals(id)) {
selGift = giftModel; selGift = giftModel;
if (!giftModel.isChecked()) { 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); giftModel.setChecked(true);
} }
} else { } else {
@@ -237,7 +293,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
giftPackList = new ArrayList<>(); giftPackList = new ArrayList<>();
giftPackList.add(event.gift); giftPackList.add(event.gift);
} }
if (event.type == 1){ if (event.type == 1) {
String id = event.gift.getGift_id(); String id = event.gift.getGift_id();
for (int i = 0; i < giftPackList.size(); i++) { for (int i = 0; i < giftPackList.size(); i++) {
GiftPackBean giftModel = giftPackList.get(i); GiftPackBean giftModel = giftPackList.get(i);
@@ -249,7 +305,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
roonGiftModel.setNum(Integer.parseInt(giftModel.getNum())); roonGiftModel.setNum(Integer.parseInt(giftModel.getNum()));
if (giftModel.getGift_id().equals(id)) { if (giftModel.getGift_id().equals(id)) {
if (!giftModel.isChecked()) { if (!giftModel.isChecked()) {
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,roonGiftModel)); EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
giftModel.setChecked(true); giftModel.setChecked(true);
} }
} else { } else {
@@ -259,7 +315,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
if (event.adapter != null && event.adapter.get() != null) { if (event.adapter != null && event.adapter.get() != null) {
event.adapter.get().notifyDataSetChanged(); event.adapter.get().notifyDataSetChanged();
} }
}else { } else {
String id = event.gift.getGift_id(); String id = event.gift.getGift_id();
GiftPackBean selGift = null; GiftPackBean selGift = null;
for (int i = 0; i < giftPackList.size(); i++) { for (int i = 0; i < giftPackList.size(); i++) {
@@ -273,12 +329,12 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
if (giftModel.getGift_id().equals(id)) { if (giftModel.getGift_id().equals(id)) {
selGift = giftModel; selGift = giftModel;
if (!giftModel.isChecked()) { if (!giftModel.isChecked()) {
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,roonGiftModel)); EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
giftModel.setChecked(true); giftModel.setChecked(true);
} }
} else { } else {
giftModel.setChecked(false); 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) { if (event.adapter != null && event.adapter.get() != null) {
@@ -293,7 +349,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onGiftClicRoomkTEvent(RoomGiftClickToEvent event) { public void onGiftClicRoomkTEvent(RoomGiftClickToEvent event) {
if (giftList == null){ if (giftList == null) {
giftList = new ArrayList<>(); giftList = new ArrayList<>();
giftList.add(event.gift); giftList.add(event.gift);
} }
@@ -304,10 +360,10 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
if (giftModel.getGift_id().equals(id)) { if (giftModel.getGift_id().equals(id)) {
if (giftModel.isChecked()) { if (giftModel.isChecked()) {
giftModel.setChecked(false); giftModel.setChecked(false);
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null)); EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, null));
}else { } else {
giftModel.setChecked(true); giftModel.setChecked(true);
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,event.gift)); EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, event.gift));
} }
} else { } else {
giftModel.setChecked(false); giftModel.setChecked(false);
@@ -325,10 +381,10 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
selGift = giftModel; selGift = giftModel;
if (giftModel.isChecked()) { if (giftModel.isChecked()) {
giftModel.setChecked(false); giftModel.setChecked(false);
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null)); EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, null));
}else { } else {
giftModel.setChecked(true); 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 { } else {
giftModel.setChecked(false); giftModel.setChecked(false);

View File

@@ -18,9 +18,11 @@ public class UserPhotoWallAdapter extends BaseQuickAdapter<String, BaseViewHolde
protected void convert(BaseViewHolder helper, String item) { protected void convert(BaseViewHolder helper, String item) {
helper.setGone(R.id.iv_close, false); helper.setGone(R.id.iv_close, false);
if (item.equals(ADD_PHOTO)) { 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); helper.setImageResource(R.id.riv_user_head, com.xscm.moduleutil.R.mipmap.add_img);
} else { } else {
helper.setVisible(R.id.iv_close, true);
ImageUtils.loadCenterCrop(item, helper.getView(R.id.riv_user_head)); ImageUtils.loadCenterCrop(item, helper.getView(R.id.riv_user_head));
} }

View File

@@ -3,17 +3,25 @@ package com.xscm.moduleutil.base;
import android.app.Activity; import android.app.Activity;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.Application; import android.app.Application;
import android.content.ComponentCallbacks2;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.Signature; import android.content.pm.Signature;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings;
import android.util.Base64; import android.util.Base64;
import android.util.DisplayMetrics;
import android.webkit.WebView; import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.multidex.MultiDex; import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication; import androidx.multidex.MultiDexApplication;
@@ -22,22 +30,31 @@ import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.FileUtils; import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ProcessUtils; import com.blankj.utilcode.util.ProcessUtils;
import com.blankj.utilcode.util.ServiceUtils;
import com.lahm.library.EasyProtectorLib; import com.lahm.library.EasyProtectorLib;
import com.lahm.library.EmulatorCheckCallback; 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.UserBean;
import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.event.AppLifecycleEvent; import com.xscm.moduleutil.event.AppLifecycleEvent;
import com.xscm.moduleutil.event.UnreadCountEvent;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.interfaces.AppLifecycleUtil; import com.xscm.moduleutil.interfaces.AppLifecycleUtil;
import com.xscm.moduleutil.listener.MessageListenerSingleton; import com.xscm.moduleutil.listener.MessageListenerSingleton;
import com.xscm.moduleutil.rtc.AgoraManager; 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.SpUtil;
import com.xscm.moduleutil.utils.UtilConfig; import com.xscm.moduleutil.utils.UtilConfig;
import com.xscm.moduleutil.utils.config.EnvironmentEnum; import com.xscm.moduleutil.utils.config.EnvironmentEnum;
import com.xscm.moduleutil.utils.config.EnvironmentPrefs; import com.xscm.moduleutil.utils.config.EnvironmentPrefs;
import com.xscm.moduleutil.utils.cos.CosUploadManager;
import com.xscm.moduleutil.widget.CommonAppConfig; import com.xscm.moduleutil.widget.CommonAppConfig;
import com.xscm.moduleutil.widget.PiaoPingManager;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator; import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator; import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
@@ -50,21 +67,24 @@ import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.qcloud.tuicore.TUILogin; import com.tencent.qcloud.tuicore.TUILogin;
import com.tencent.qcloud.tuicore.interfaces.TUICallback; import com.tencent.qcloud.tuicore.interfaces.TUICallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.concurrent.Executors; import java.util.HashMap;
import java.util.concurrent.ScheduledExecutorService; import java.util.List;
import java.util.Map;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
/** /**
* Created by cxf on 2017/8/3. * 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 CommonAppContext sInstance;
private static Handler sMainThreadHandler; private static Handler sMainThreadHandler;
@@ -79,11 +99,54 @@ public class CommonAppContext extends MultiDexApplication {
public boolean isPlaying; public boolean isPlaying;
public String playId; public String playId;
public String lable_id;
public boolean isMicPlace;
public boolean isShowAg;
public boolean isRoomJoininj=false;
public String playCover; public String playCover;
public boolean showSelf;//盲盒是否能送自己 public boolean showSelf;//盲盒是否能送自己
public String playName; public String playName;
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); private MqttConnect mqttConnect=null;
private ScheduledExecutorService scheduledExecutorServiceRoom = null;
// 添加后台状态标记
private boolean wasInBackground = false;
public boolean isMai=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;
public boolean onConnectFailed=false;//是否重连
public Map<String, Integer> onlineMap=new HashMap<>();
public void setOnlineMap(Map<String, Integer> onlineMap) {
this.onlineMap = onlineMap;
}
public Map<String, Integer> getOnlineMap() {
return onlineMap;
}
@Setter
@Getter
public UnreadCountEvent unreadCountEvent;
@Override @Override
public void onCreate() { public void onCreate() {
@@ -91,37 +154,352 @@ public class CommonAppContext extends MultiDexApplication {
sInstance = this; sInstance = this;
sMainThreadHandler = new Handler(); sMainThreadHandler = new Handler();
EnvironmentPrefs prefs = new EnvironmentPrefs(this); EnvironmentPrefs prefs = new EnvironmentPrefs(this);
// 添加内存优化配置
optimizeMemorySettings();
currentEnvironment = prefs.getSelectedEnvironment(); currentEnvironment = prefs.getSelectedEnvironment();
initialization(); 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(){ public void initialization(){
UtilConfig.init(this); UtilConfig.init(this);
registerActivityLifecycleCallbacks(); // registerActivityLifecycleCallbacks();
initWebView(); initWebView();
if (ProcessUtils.isMainProcess()) { if (ProcessUtils.isMainProcess()) {
initARouter(); initARouter();
if (SpUtil.isAgreePolicy()) { if (SpUtil.isAgreePolicy()) {
checkInEmulator(); checkInEmulator();
UtilConfig.checkInEmulator(); UtilConfig.checkInEmulator();
AgoraManager.getInstance(this).init(currentEnvironment.getSwSdkAppId()); AgoraManager.getInstance(this);
AgoraManager.init(currentEnvironment.getSwSdkAppId());
MessageListenerSingleton.getInstance(); MessageListenerSingleton.getInstance();
CrashReport.initCrashReport(this, "865cfe9555", true);/*bugly初始化*/ CrashReport.initCrashReport(this, "b45883f58f", 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://1.13.181.248","android-"+ MqttClient.generateClientId());
mqttConnect=MqttConnect.getInstance(this,"tcp://1.13.101.98","android-"+ MqttClient.generateClientId());
mqttConnect.mqttClient();
// 每次启动应用时重置状态 // 每次启动应用时重置状态
SpUtil.getInstance().setBooleanValue("youth_model_shown", false); SpUtil.getInstance().setBooleanValue("youth_model_shown", false);
startInitSdk();
// 初始化通常在Application或Activity的onCreate中
CosUploadManager.getInstance().init(this);
// 启动IM连接服务
// IMServiceManager.getInstance().startIMService(this);
}
}
// 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() { private void initARouter() {
// 在ARouter初始化之前添加这行
if (true) { if (true) {
ARouter.openDebug(); ARouter.openDebug();
ARouter.openLog(); ARouter.openLog();
@@ -151,6 +529,14 @@ public class CommonAppContext extends MultiDexApplication {
return null; return null;
} }
public void upMqtt(){
if (mqttConnect==null){
// mqttConnect=MqttConnect.getInstance(this,"tcp://1.13.181.248","android-"+ MqttClient.generateClientId());
mqttConnect=MqttConnect.getInstance(this,"tcp://1.13.101.98","android-"+ MqttClient.generateClientId());
mqttConnect.mqttClient();
}
}
@Override @Override
protected void attachBaseContext(Context base) { protected void attachBaseContext(Context base) {
MultiDex.install(this); MultiDex.install(this);
@@ -218,9 +604,9 @@ public class CommonAppContext extends MultiDexApplication {
// 确保在主线程中订阅 // 确保在主线程中订阅
if (activity != null && !activity.isFinishing()) { if (activity != null && !activity.isFinishing()) {
activity.runOnUiThread(() -> { activity.runOnUiThread(() -> {
if (piaoPingManager != null) { // if (piaoPingManager != null) {
piaoPingManager.subscribe(); // piaoPingManager.subscribe();
} // }
}); });
} }
} }
@@ -248,9 +634,9 @@ public class CommonAppContext extends MultiDexApplication {
AppLifecycleUtil.onAppBackGround(); AppLifecycleUtil.onAppBackGround();
if (activity != null && !activity.isFinishing()) { if (activity != null && !activity.isFinishing()) {
activity.runOnUiThread(() -> { activity.runOnUiThread(() -> {
if (piaoPingManager != null) { // if (piaoPingManager != null) {
piaoPingManager.unsubscribe(); // piaoPingManager.unsubscribe();
} // }
}); });
} }
} }
@@ -354,6 +740,11 @@ public class CommonAppContext extends MultiDexApplication {
return mUserBean; return mUserBean;
} }
public UserInfo getUserInfo() {
UserInfo userInfo = SpUtil.getUserInfo();
return userInfo;
}
public void setUserBean(UserBean bean) { public void setUserBean(UserBean bean) {
mUserBean = bean; mUserBean = bean;
} }
@@ -370,9 +761,7 @@ public class CommonAppContext extends MultiDexApplication {
SpUtil.saveUserId(-1); SpUtil.saveUserId(-1);
SpUtil.saveUserBean(new UserBean()); SpUtil.saveUserBean(new UserBean());
SpUtil.putToken(""); SpUtil.putToken("");
Intent intent = new Intent("com.example.action.LAUNCH_PAGE");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
// piaoPingManager.unsubscribe(); // piaoPingManager.unsubscribe();
FileUtils.deleteAllInDir(getCacheDir()); FileUtils.deleteAllInDir(getCacheDir());
FileUtils.deleteAllInDir(getExternalCacheDir()); FileUtils.deleteAllInDir(getExternalCacheDir());
@@ -383,7 +772,9 @@ public class CommonAppContext extends MultiDexApplication {
// 发送广播通知所有Activity刷新状态 // 发送广播通知所有Activity刷新状态
Intent refreshIntent = new Intent("com.xscm.moduleutil.ACTION_USER_LOGOUT"); Intent refreshIntent = new Intent("com.xscm.moduleutil.ACTION_USER_LOGOUT");
sendBroadcast(refreshIntent); sendBroadcast(refreshIntent);
Intent intent = new Intent("com.qxcm.qxlive.LAUNCH_PAGE");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
} }
public static boolean isAlipayInstalled(Context context) { public static boolean isAlipayInstalled(Context context) {
@@ -420,4 +811,129 @@ public class CommonAppContext extends MultiDexApplication {
} }
}); });
} }
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
}
@Override
public void onActivityStarted(@NonNull Activity activity) {
AppLifecycleUtil.onAppFrontGround();
// if (playId!=null && !playId.equals("")){
// RetrofitClient.getInstance().userRoomBack(playId, "1");
// }
}
@Override
public void onActivityResumed(@NonNull Activity activity) {
if (activityCount == 0) {
// 应用从后台回到前台
if (appStateListener != null) {
appStateListener.onAppForeground();
}
// handleAppForeground(activity);
// AppStateManager.setRoomActivityMinimized(false);
AppLifecycleUtil.onAppFrontGround();
}
if (playId!=null && !playId.equals("")){
RetrofitClient.getInstance().userRoomBack(playId, "2");
}
activityCount++;
}
@Override
public void onActivityPaused(@NonNull Activity activity) {
activityCount--;
if (activityCount == 0) {
// 应用切换到后台
if (appStateListener != null) {
appStateListener.onAppBackground();
}
if (playId!=null && !playId.equals("")){
RetrofitClient.getInstance().userRoomBack(playId, "1");
}
AppLifecycleUtil.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();
// }
}
@Override
public void onTerminate() {
super.onTerminate();
LogUtils.e("@@@", "onTerminate");
}
} }

View File

@@ -10,6 +10,7 @@ import lombok.Data;
public class AppPay { public class AppPay {
private String ali; private String ali;
private WxBean wx; private WxBean wx;
private BeanPayData tl;
@Data @Data
public static class WxBean { public static class WxBean {
@@ -20,4 +21,20 @@ public class AppPay {
private String timestamp; private String timestamp;
private String sign; private String sign;
} }
@Data
public static class BeanPayData {
private String appid;
private String body;
private String cusid;
private String notify_url;
private String paytype;
private String randomstr;
private String remark;
private String reqsn;
private String sign;
private String signtype;
private String trxamt;
private String version;
}
} }

View File

@@ -15,11 +15,13 @@ public class FirstChargeGiftBean {
private List<GiftBag> gift_bag; private List<GiftBag> gift_bag;
@Data @Data
public static class GiftBag { public static class GiftBag {
private String gift_bag_id;
private String name; private String name;
private String title1; private String title1;
private String title2; private String title2;
private String money; private String money;
private List<RoonGiftModel> gift_list; private List<RoonGiftModel> gift_list;
private int status;
// @Data // @Data
// public static class GiftList { // public static class GiftList {

View File

@@ -1,15 +1,66 @@
package com.xscm.moduleutil.bean; package com.xscm.moduleutil.bean;
import lombok.Data; import java.io.Serializable;
import java.util.Objects;
import lombok.Data;
/**
*@author qx
*@data 2025/8/27
*@description: 推送过来的礼物信息,复用在盲盒活动获取礼物信息中
*/
@Data @Data
public class GiftBean { public class GiftBean {
private String gift_id; private String gift_id;
private String periods;
private String gift_name; private String gift_name;
private String gift_price; private String gift_price;
private int file_type; private int file_type;
private String play_image; private String play_image;
private String base_image; private String base_image;
private String gift_type; private String gift_type;
private int number;
private String createtime;
private String nickname;
private int count;
private String user_id;
private int num;
private boolean is_paly =false;
private long timestamp;
//谁送的
private String userAvatar;
// 发送者名称
private String senderName;
// 发送者头像URL
private String senderAvatarUrl;
// 判断两个礼物是否相同(同一人送同一礼物)
public boolean isSameGiftFromSameSender(GiftBean other) {
if (other == null) return false;
return Objects.equals(gift_id, other.gift_id) &&
Objects.equals(senderName, other.senderName);
}
// 生成礼物唯一键
public String getGiftKey() {
return (senderName != null ? senderName : "unknown") + "_" +
(gift_id != null ? gift_id : "unknown");
}
@Override
public GiftBean clone() {
GiftBean clone = new GiftBean();
clone.gift_id = this.gift_id;
clone.gift_name = this.gift_name;
clone.base_image = this.base_image;
clone.senderName = this.senderName;
clone.userAvatar = this.userAvatar;
clone.senderAvatarUrl = this.senderAvatarUrl;
clone.number = this.number;
clone.timestamp = this.timestamp;
return clone;
}
} }

View File

@@ -2,12 +2,23 @@ package com.xscm.moduleutil.bean;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class HeavenGiftBean { public class HeavenGiftBean {
private String title; private String title;
private String picture; private String picture;
private int type;
private String quantity; private String quantity;
private String gold; private String gold;
private String days; private String days;
private int gift_bag_id;
private String name; //活动名称
private String bag_name;//礼包名称
private String effective_time;//倒计时时间 秒
private String rule;//规则地址
private String counter;
private String money;
private String diamond;
private List<RoonGiftModel> gift_list;
} }

View File

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

View File

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

View File

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

View File

@@ -1,9 +1,7 @@
package com.xscm.moduleutil.bean; package com.xscm.moduleutil.bean;
import com.xscm.moduleutil.bean.room.FriendInfo; import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.room.RoomAuction; import com.xscm.moduleutil.bean.room.*;
import com.xscm.moduleutil.bean.room.RoomBean;
import com.xscm.moduleutil.bean.room.RoomPitBean;
import java.util.List; import java.util.List;
@@ -15,6 +13,9 @@ public class RoomMessageEvent {
private String RoomId; // 房间 ID private String RoomId; // 房间 ID
private T Text; // 携带的数据对象 private T Text; // 携带的数据对象
public RoomMessageEvent() {
}
public RoomMessageEvent(int msgType, String roomId, T text) { public RoomMessageEvent(int msgType, String roomId, T text) {
MsgType = msgType; MsgType = msgType;
RoomId = roomId; RoomId = roomId;
@@ -30,7 +31,9 @@ public class RoomMessageEvent {
private String jia_jia; private String jia_jia;
private UserInfo FromUserInfo; private UserInfo FromUserInfo;
private UserInfo ToUserInfo; private UserInfo ToUserInfo;
private List<UserInfo> ToUserInfos;
private GiftBean GiftInfo; private GiftBean GiftInfo;
private List<GiftBean> GiftInfos;
private int room_up_pit_type; private int room_up_pit_type;
private MusicSongBean songInfo; private MusicSongBean songInfo;
private MusicSongBean nextInfo; private MusicSongBean nextInfo;
@@ -47,7 +50,7 @@ public class RoomMessageEvent {
private String AcceptRoomId;//接收者所在的房间id private String AcceptRoomId;//接收者所在的房间id
private String PkId; private String PkId;
private String room_id;//当type==1的时候。这个roomId是对方的房间id private String room_id;//当type==1的时候。这个roomId是对方的房间id
private String user_id; private String user_id="";
private String pk_end_times;//pk结束时间 private String pk_end_times;//pk结束时间
private List<RoomPitBean> userCharmList; private List<RoomPitBean> userCharmList;
@@ -67,10 +70,32 @@ public class RoomMessageEvent {
private int count;//排麦模式下的人数 private int count;//排麦模式下的人数
private int step ; //1:等待邂逅 2心动连线 3牵手良缘 private int step ; //1:等待邂逅 2心动连线 3牵手良缘
private int friend_id; //场次id private int friend_id; //场次id
private List<FriendInfo.HeartList> heart_list;//交友心动值发生变化 // private List<FriendInfo.HeartList> list;//交友心动值发生变化
private List<UserInfo> list;//交友房麦位发生变化 //推送的事麦上用户信息这里使用了userinfo接收的 private List<UserInfo> list;//交友房麦位发生变化 //推送的事麦上用户信息这里使用了userinfo接收的
private FriendUserBean friend_user;//这是推送过来需要卡关系的数据
private String relation_name;
private String user1_id;
private String user2_id;
private String user1_avatar;
private String user1_nickname;
private String user2_nickname;
private String user2_avatar;
private long time_day;
private int online_number;//在线人数 private int online_number;//在线人数
private BlindBoxBean.XlhData xlh_data;
private String from_pit_number;
private String to_pit_number;
private String gift_num;
private RedPacketInfo redpacketInfo;
private String redpacket_id;
private EmotionDeatils emoji;
} }
@Data @Data

View File

@@ -1,26 +0,0 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
@Data
public class RoomMessageEvent1 {
private int MsgType; // 消息类型,如 QXRoomMessageTypeJoin
private String RoomId; // 房间 ID
private RoomMessageEvent.T Text; // 携带的数据对象
public RoomMessageEvent1(int msgType, String roomId, RoomMessageEvent.T text) {
MsgType = msgType;
RoomId = roomId;
Text = text;
}
@Data
public static class T {
private String text;
private String GiftNum;
private UserInfo FromUserInfo;
private UserInfo ToUserInfo;
private GiftBean GiftInfo;
}
}

View File

@@ -1,41 +1,84 @@
package com.xscm.moduleutil.bean; package com.xscm.moduleutil.bean;
import com.blankj.utilcode.util.GsonUtils;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMMessage;
import com.tencent.imsdk.v2.V2TIMSendCallback;
import com.xscm.moduleutil.bean.room.Children;
import com.xscm.moduleutil.bean.room.EmotionDeatils;
import com.xscm.moduleutil.event.RoomTaskEvent;
import com.xscm.moduleutil.utils.SpUtil;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.nio.charset.StandardCharsets;
import java.util.Random;
public class RoomMessageManager { public class RoomMessageManager {
public String roomId;
private static RoomMessageManager instance ;
private static final RoomMessageManager instance = new RoomMessageManager(); public String getRoomId() {
return roomId;
}
private RoomMessageManager() {} public void setRoomId(String roomId) {
this.roomId = roomId;
}
public static RoomMessageManager getInstance() { public static RoomMessageManager getInstance() {
if (instance == null){
instance = new RoomMessageManager();
}
return instance; return instance;
} }
/**
* 接收原始消息,转换后发送到 EventBus
*/ public void sendChatEmoji(EmotionDeatils emotionDeatils){
public void onNewMessage(String roomId, int msgType, RoomMessageEvent.T data) { EmotionDeatils event = new EmotionDeatils();
RoomMessageEvent event = new RoomMessageEvent(msgType, roomId, data); if (emotionDeatils != null&& emotionDeatils.getChildren()!=null && !emotionDeatils.getChildren().isEmpty() && emotionDeatils.getChildren().size()>0){
EventBus.getDefault().post(event); int position = new Random().nextInt(emotionDeatils.getChildren().size());
Children children = emotionDeatils.getChildren().get(position);
event.setImage(children.getImage());
event.setAnimate_image(emotionDeatils.getAnimate_image());
}else {
event= emotionDeatils;
}
RoomMessageEvent roomMessageEvent=new RoomMessageEvent();
roomMessageEvent.setRoomId(roomId);
roomMessageEvent.setMsgType(2);//这是表情类型1单发文本消息 2单发表情消息
UserInfo userInfo= SpUtil.getUserInfo();
RoomMessageEvent.T t=new RoomMessageEvent.T();
t.setFromUserInfo(userInfo);
t.setEmoji(event);
roomMessageEvent.setText(t);
String json = GsonUtils.toJson(roomMessageEvent);
// 转换为 byte[]
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
// 创建自定义消息
V2TIMMessage v2TIMMessage = V2TIMManager.getMessageManager().createCustomMessage(binaryData);
// 发送消息
V2TIMManager.getMessageManager().sendMessage(v2TIMMessage, null, "room" + roomId, V2TIMMessage.V2TIM_PRIORITY_NORMAL, false, null, new V2TIMSendCallback<V2TIMMessage>() {
@Override
public void onProgress(int progress) {
// 自定义消息不会回调进度
} }
/** @Override
* 注册监听器(如 Fragment 或 Activity public void onSuccess(V2TIMMessage message) {
*/ // 发送群聊自定义消息成功
public void register(Object subscriber) { // EventBus.getDefault().post(new RoomTaskEvent());
if (!EventBus.getDefault().isRegistered(subscriber)) {
EventBus.getDefault().register(subscriber);
}
} }
/** @Override
* 反注册监听器 public void onError(int code, String desc) {
*/ // 发送群聊自定义消息失败
public void unregister(Object subscriber) {
if (EventBus.getDefault().isRegistered(subscriber)) {
EventBus.getDefault().unregister(subscriber);
} }
});
} }
} }

View File

@@ -19,4 +19,14 @@ public class RoomSearchResp {
private String hot_value; private String hot_value;
private String room_id;
private String room_name;
private String room_cover;
private String room_number;
private int label_id;
private String today_hot_value;
} }

View File

@@ -31,7 +31,8 @@ public class RoonGiftModel {
private boolean isSelected; private boolean isSelected;
private boolean can_send_self;//是否能送自己 private boolean can_send_self;//是否能送自己
private int num;//礼物数量 private int num;//礼物数量
private int activities_id;//4盲盒 5天空之境
private int gift_bag;//10天空之境 11岁月之城 12时空之巅
public boolean isCan_send_self() { public boolean isCan_send_self() {
if ( isManghe()) { if ( isManghe()) {
return true; return true;

View File

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

View File

@@ -1,5 +1,8 @@
package com.xscm.moduleutil.bean; package com.xscm.moduleutil.bean;
import com.google.gson.annotations.SerializedName;
import com.xscm.moduleutil.bean.room.FriendInfo;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@@ -14,7 +17,7 @@ public class UserInfo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String FEMALE = "2"; public static final String FEMALE = "2";
public static final String MALE = "1"; public static final String MALE = "1";
// @SerializedName(value = "id", alternate = "user_id") private int id;
private int user_id; //用户id private int user_id; //用户id
private String user_code;//用户id码 private String user_code;//用户id码
private String avatar;//头像 private String avatar;//头像
@@ -39,6 +42,7 @@ public class UserInfo implements Serializable {
private int age;//年龄 private int age;//年龄
private String is_room; private String is_room;
private String dress;//头像框 private String dress;//头像框
private String chat_bubble;//聊天气泡
private String charm;//魅力值 private String charm;//魅力值
private String room_id; private String room_id;
private String guild;//公会名称 private String guild;//公会名称
@@ -53,9 +57,16 @@ public class UserInfo implements Serializable {
private String red_status; private String red_status;
private String gift_num; private String gift_num;
private int is_can_chat;//是否可以私聊1可以0不可以
private int can_chat_money;//需要充值的金额
private RelationshipBean qinmi; private RelationshipBean qinmi;
private RelationshipBean zhenai; private RelationshipBean zhenai;
private int heartId; // "heartId": 4,
private int heartNum; //
private String red_num;
private String ta;

View File

@@ -1,8 +1,11 @@
package com.xscm.moduleutil.bean; package com.xscm.moduleutil.bean;
import lombok.Data;
@Data
public class UserResultResp { public class UserResultResp {
private String room_id;
private String user_id; private String user_id;
private String user_code; private String user_code;
private String nickname; private String nickname;
@@ -14,83 +17,4 @@ public class UserResultResp {
private String good_number; private String good_number;
private String id_color; private String id_color;
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getUser_code() {
return user_code;
}
public void setUser_code(String user_code) {
this.user_code = user_code;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getHead_picture() {
return head_picture;
}
public void setHead_picture(String head_picture) {
this.head_picture = head_picture;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getFollow() {
return follow;
}
public void setFollow(String follow) {
this.follow = follow;
}
public String getFans_count() {
return fans_count;
}
public void setFans_count(String fans_count) {
this.fans_count = fans_count;
}
public String getOnline_text() {
return online_text;
}
public void setOnline_text(String online_text) {
this.online_text = online_text;
}
public String getGood_number() {
return good_number;
}
public void setGood_number(String good_number) {
this.good_number = good_number;
}
public String getId_color() {
return id_color;
}
public void setId_color(String id_color) {
this.id_color = id_color;
}
} }

View File

@@ -11,7 +11,11 @@ import lombok.Data;
public class WithdrawalBean { public class WithdrawalBean {
private String name; private String name;
private String money; private String money;
private String status; private int status;
private String status_str; private String status_str;
private String createtime; private String createtime;
private String withdraw_fee;
private String surplus_money;
private String received_tax_amount;
} }

View File

@@ -94,6 +94,22 @@ public class EMMessageInfo implements MultiItemEntity {
public static final int QXRoomMessageTypeSeatDidChanged = 1053; public static final int QXRoomMessageTypeSeatDidChanged = 1053;
/// 心动值发生变化 /// 心动值发生变化
public static final int QXRoomMessageTypeHeartDidChanged = 1054; public static final int QXRoomMessageTypeHeartDidChanged = 1054;
/// 小黑屋有人退出房间
public static final int QXRoomMessageTypeHeartDid = 1055;
///盲盒抽奖进度条
public static final int QXRoomMessageTypeMangH = 1056;
///巡乐会
public static final int QXRoomMessageTypeXlh = 1057;
///在离线
public static final int QXRoomMessageTypezailx = 1058;
///清除个人魅力值
public static final int QXRoomMessageTypeQingGRMl = 1059;
//有红包列表
public static final int QXRoomMessageTypeQXRoomMessageRed = 1060;
public static final int QXRoomMessageTypeQXRoomMessageRedRemove = 1061;
///房间内换麦
public static final int QXRoomMessageTypehm = 1039;
private RoomMessageEvent emMessage; private RoomMessageEvent emMessage;
private int custom = 0; private int custom = 0;
@@ -145,13 +161,15 @@ public class EMMessageInfo implements MultiItemEntity {
case QXRoomMessageTypeRoomDress: case QXRoomMessageTypeRoomDress:
case QXRoomMessageTypeRoomOnline: case QXRoomMessageTypeRoomOnline:
case QXRoomMessageTypeRoomOPK: case QXRoomMessageTypeRoomOPK:
case QXRoomMessageTypeRoomOMh:
case QXRoomMessageTypeRoomFriendPartDidChanged: case QXRoomMessageTypeRoomFriendPartDidChanged:
case QXRoomMessageTypeSeatDidChanged: case QXRoomMessageTypeSeatDidChanged:
case QXRoomMessageTypehm:
return 1; return 1;
case QXRoomMessageTypeRoomOMh:
case QXRoomMessageTypeGift: case QXRoomMessageTypeGift:
return 3; return 3;
case 1: case 1:
case 2:
return 2; return 2;
case QXRoomMessageTypeRoomTypeChanged://房间类型发生变化 case QXRoomMessageTypeRoomTypeChanged://房间类型发生变化
return 4; return 4;

View File

@@ -1,5 +1,6 @@
package com.xscm.moduleutil.bean.room; package com.xscm.moduleutil.bean.room;
import java.io.Serializable;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
@@ -10,14 +11,14 @@ import lombok.Data;
* @description: 交友房的实体类 * @description: 交友房的实体类
*/ */
@Data @Data
public class FriendInfo { public class FriendInfo implements Serializable {
private int friend_id; private int friend_id;
private long end_time; private long end_time;
private int step; private int step;
private List<HeartList> heart_list; private List<HeartList> heart_list;
@Data @Data
public static class HeartList { public static class HeartList implements Serializable {
private int heartId; // "heartId": 4, private int heartId; // "heartId": 4,
private int heartNum; // "heartNum": 10510 private int heartNum; // "heartNum": 10510
} }

View File

@@ -40,7 +40,7 @@ public class RoomAuction implements Serializable {
} }
@Data @Data
public class AuctionListBean implements Serializable { public static class AuctionListBean implements Serializable {
private String user_id; private String user_id;
private String user_code; private String user_code;
private String nickname; private String nickname;

View File

@@ -29,6 +29,8 @@ public class RoomInfoResp implements Serializable {
private PkRoomInfo pk_info; private PkRoomInfo pk_info;
private List<RoomPitBean> song_pit_list; private List<RoomPitBean> song_pit_list;
private FriendInfo friend_info; private FriendInfo friend_info;
private GiftXlh gift_cycle;
private int hour_ranking_open;//1:开启 0关闭
//弹出麦位操作弹出 //弹出麦位操作弹出
@@ -114,4 +116,18 @@ public class RoomInfoResp implements Serializable {
public boolean isFreedomMode() { public boolean isFreedomMode() {
return "1".equals(room_info.getWheat()); return "1".equals(room_info.getWheat());
} }
@Data
public class GiftXlh implements Serializable{
private XlhInfo xlh_info ;
}
@Data
public class XlhInfo implements Serializable{
private String activities_name;
private String icon;
private String xlh_status;
private String end_time;
}
} }

View File

@@ -34,7 +34,7 @@ public class RoomPitBean implements Serializable {
private int is_lock;//0未锁麦 1锁麦 private int is_lock;//0未锁麦 1锁麦
private int is_mute;//0未禁麦 1禁麦 private int is_mute;//0未禁麦 1禁麦
private int count_down;//麦位倒计时 private int count_down;//麦位倒计时
private String user_id;//麦位上用户id private String user_id="";//麦位上用户id
private String nickname;//麦位上用户昵称 private String nickname;//麦位上用户昵称
private String avatar;//用户头像 private String avatar;//用户头像
private String sex;//性别 private String sex;//性别

View File

@@ -18,6 +18,7 @@ public class RoomSettingBean implements MultiItemEntity {
public static final int QXRoomSettingTypeRoomTypeGirl = 13; public static final int QXRoomSettingTypeRoomTypeGirl = 13;
///交友 房 ///交友 房
public static final int QXRoomSettingTypeRoomTypeJiaoy = 27; public static final int QXRoomSettingTypeRoomTypeJiaoy = 27;
public static final int QXRoomSettingTypeRoomTypeHUYU = 28;
/// 常用工具 /// 常用工具
/// 房间补贴 /// 房间补贴
@@ -48,6 +49,8 @@ public class RoomSettingBean implements MultiItemEntity {
public static final int QXRoomSettingTypeRoomCloseEffects = 25; public static final int QXRoomSettingTypeRoomCloseEffects = 25;
/// 意见反馈 /// 意见反馈
public static final int QXRoomSettingTypeRoomReport = 26; public static final int QXRoomSettingTypeRoomReport = 26;
public static final int QXRoomSettingTypeRoomFloatingScreen = 29;//关闭飘屏
public static final int QXRoomSettingTypeRoomFloatingRed = 30;//红包
public static final int ITEM_TYPE_DEFAULT = 0; public static final int ITEM_TYPE_DEFAULT = 0;
public static final int ITEM_TYPE_WITH_ICON = 1; public static final int ITEM_TYPE_WITH_ICON = 1;

View File

@@ -82,6 +82,11 @@ public class ConfirmDialog extends Dialog {
// 设置点击监听器 // 设置点击监听器
btnPositive.setOnClickListener(v -> { btnPositive.setOnClickListener(v -> {
isCountdownCancelled = true; // 标记倒计时被取消
if (countDownTimer != null) {
countDownTimer.cancel(); // 取消倒计时
countDownTimer = null;
}
if (positiveButtonClickListener != null) { if (positiveButtonClickListener != null) {
positiveButtonClickListener.onClick(v); positiveButtonClickListener.onClick(v);
} }
@@ -126,7 +131,7 @@ public class ConfirmDialog extends Dialog {
// rootView.startAnimation(shake); // rootView.startAnimation(shake);
// } // }
} }
private boolean isCountdownCancelled = false; // 添加标志位
private void startCountdown(Button btnNegative) { private void startCountdown(Button btnNegative) {
countDownTimer = new CountDownTimer(countdownSeconds * 1000L, 1000) { countDownTimer = new CountDownTimer(countdownSeconds * 1000L, 1000) {
@Override @Override
@@ -137,12 +142,15 @@ public class ConfirmDialog extends Dialog {
@Override @Override
public void onFinish() { public void onFinish() {
// 检查是否被主动取消
if (!isCountdownCancelled) {
btnNegative.setText(negativeButtonText); btnNegative.setText(negativeButtonText);
if (negativeButtonClickListener != null) { if (negativeButtonClickListener != null) {
negativeButtonClickListener.onClick(btnNegative); // 自动触发取消 negativeButtonClickListener.onClick(btnNegative); // 自动触发取消
} }
dismiss(); dismiss();
} }
}
}.start(); }.start();
} }
@Override @Override

View File

@@ -14,14 +14,12 @@ import androidx.annotation.NonNull;
import com.blankj.utilcode.util.ScreenUtils; import com.blankj.utilcode.util.ScreenUtils;
import com.blankj.utilcode.util.ToastUtils; import com.blankj.utilcode.util.ToastUtils;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.adapter.GiftAdapter;
import com.xscm.moduleutil.adapter.HeavenGiftAdapter; import com.xscm.moduleutil.adapter.HeavenGiftAdapter;
import com.xscm.moduleutil.bean.BaseListData; import com.xscm.moduleutil.bean.BaseListData;
import com.xscm.moduleutil.bean.FirstChargeGiftBean; import com.xscm.moduleutil.bean.FirstChargeGiftBean;
import com.xscm.moduleutil.bean.RoonGiftModel; import com.xscm.moduleutil.bean.RoonGiftModel;
import com.xscm.moduleutil.color.ThemeableDrawableUtils; import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.databinding.DialogFirstChargeBinding; import com.xscm.moduleutil.databinding.DialogFirstChargeBinding;
import com.xscm.moduleutil.databinding.DialogHeavenGiftBinding;
import com.xscm.moduleutil.http.BaseObserver; import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.http.RetrofitClient; import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.utils.ColorManager; import com.xscm.moduleutil.utils.ColorManager;
@@ -42,7 +40,6 @@ import io.reactivex.disposables.Disposable;
*/ */
public class FirstChargeDialog extends BaseDialog<DialogFirstChargeBinding> { public class FirstChargeDialog extends BaseDialog<DialogFirstChargeBinding> {
GiftAdapter giftAdapter;
HeavenGiftAdapter heavenGiftAdapter; HeavenGiftAdapter heavenGiftAdapter;
FirstChargeGiftBean firstChargeGiftBean; FirstChargeGiftBean firstChargeGiftBean;
private int type; private int type;
@@ -66,7 +63,6 @@ public class FirstChargeDialog extends BaseDialog<DialogFirstChargeBinding> {
mBinding.tvTitle2.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG); mBinding.tvTitle2.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
heavenGiftAdapter = new HeavenGiftAdapter(); heavenGiftAdapter = new HeavenGiftAdapter();
mBinding.bannerViewPager mBinding.bannerViewPager
.setPageMargin(15)
.setAutoPlay(false) .setAutoPlay(false)
.setRevealWidth(0, 0) .setRevealWidth(0, 0)
.setIndicatorVisibility(View.VISIBLE) .setIndicatorVisibility(View.VISIBLE)
@@ -160,18 +156,6 @@ public class FirstChargeDialog extends BaseDialog<DialogFirstChargeBinding> {
} }
}); });
// List<HeavenGiftBean> list = new ArrayList<>();
// for (int i = 0; i < 7; i++) {
// HeavenGiftBean bean = new HeavenGiftBean();
// bean.setTitle("礼物" + i);
// bean.setPicture("");
// bean.setType(1);
// bean.setQuantity("x" + i);
// bean.setGold(i + "");
// bean.setDays(i + "天");
// list.add(bean);
// }
// mBinding.bannerViewPager.create(baseListData(list, 4));
} }
private List<BaseListData<RoonGiftModel>> baseListData(List<RoonGiftModel> list, int chunkSize) { private List<BaseListData<RoonGiftModel>> baseListData(List<RoonGiftModel> list, int chunkSize) {
@@ -203,14 +187,15 @@ public class FirstChargeDialog extends BaseDialog<DialogFirstChargeBinding> {
if (firstChargeGiftBean.getGift_bag().size() > 0) { if (firstChargeGiftBean.getGift_bag().size() > 0) {
type=1; type=1;
List<RoonGiftModel> list = new ArrayList<>(); List<RoonGiftModel> list = new ArrayList<>();
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle1()); // mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle1());
mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle2()); // mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle2());
mBinding.btn0.setText(firstChargeGiftBean.getGift_bag().get(0).getName()); // mBinding.btn0.setText(firstChargeGiftBean.getGift_bag().get(0).getName());
list.addAll(firstChargeGiftBean.getGift_bag().get(0).getGift_list()); list.addAll(firstChargeGiftBean.getGift_bag().get(0).getGift_list());
mBinding.tvTitle22.setText("充值"+firstChargeGiftBean.getGift_bag().get(0).getName()+"即可获得"+firstChargeGiftBean.getGift_bag().get(0).getTitle2()+"的道具或装扮");
mBinding.bannerViewPager.create(baseListData(list, 4)); mBinding.bannerViewPager.create(baseListData(list, 4));
mBinding.btn1.setText(firstChargeGiftBean.getGift_bag().get(1).getName()); // mBinding.btn1.setText(firstChargeGiftBean.getGift_bag().get(1).getName());
mBinding.btn2.setText(firstChargeGiftBean.getGift_bag().get(2).getName()); // mBinding.btn2.setText(firstChargeGiftBean.getGift_bag().get(2).getName());
} else if (firstChargeGiftBean.getGift_bag().size() == 2) { } else if (firstChargeGiftBean.getGift_bag().size() == 2) {
// mBinding.rg.check(R.id.btn_0); // mBinding.rg.check(R.id.btn_0);
// mBinding.btn1.setVisibility(View.VISIBLE); // mBinding.btn1.setVisibility(View.VISIBLE);

View File

@@ -3,6 +3,7 @@ package com.xscm.moduleutil.dialog;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.CountDownTimer;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
@@ -11,15 +12,21 @@ import androidx.annotation.NonNull;
import com.blankj.utilcode.util.ScreenUtils; import com.blankj.utilcode.util.ScreenUtils;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.adapter.GiftAdapter;
import com.xscm.moduleutil.adapter.HeavenGiftAdapter; import com.xscm.moduleutil.adapter.HeavenGiftAdapter;
import com.xscm.moduleutil.bean.BaseListData; import com.xscm.moduleutil.bean.BaseListData;
import com.xscm.moduleutil.bean.FirstChargeGiftBean;
import com.xscm.moduleutil.bean.HeavenGiftBean; import com.xscm.moduleutil.bean.HeavenGiftBean;
import com.xscm.moduleutil.bean.RoonGiftModel;
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.databinding.DialogHeavenGiftBinding; import com.xscm.moduleutil.databinding.DialogHeavenGiftBinding;
import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.widget.dialog.BaseDialog; import com.xscm.moduleutil.widget.dialog.BaseDialog;
import com.zhpan.bannerview.indicator.DrawableIndicator; import com.zhpan.bannerview.indicator.DrawableIndicator;
import com.zhpan.indicator.base.IIndicator; import com.zhpan.indicator.base.IIndicator;
import com.zhpan.indicator.enums.IndicatorSlideMode; import com.zhpan.indicator.enums.IndicatorSlideMode;
import io.reactivex.disposables.Disposable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -30,17 +37,27 @@ import java.util.List;
*/ */
public class HeavenGiftDialog extends BaseDialog<DialogHeavenGiftBinding> { public class HeavenGiftDialog extends BaseDialog<DialogHeavenGiftBinding> {
GiftAdapter giftAdapter;
HeavenGiftAdapter heavenGiftAdapter; HeavenGiftAdapter heavenGiftAdapter;
private CountDownTimer countDownTimer;
public HeavenGiftDialog(@NonNull Context context) { public HeavenGiftDialog(@NonNull Context context) {
super(context,R.style.BaseDialogStyleH); super(context,R.style.BaseDialogStyleH);
} }
HeavenGiftBean heavenGiftBea;
@Override @Override
public int getLayoutId() { public int getLayoutId() {
return R.layout.dialog_heaven_gift; return R.layout.dialog_heaven_gift;
} }
private OnFirstChargeListener listener;
public interface OnFirstChargeListener {
void onFirstChargeConfirmed(HeavenGiftBean giftBean, int type);
void onFirstChargeCancelled();
}
// 设置监听器的方法
public void setOnFirstChargeListener(OnFirstChargeListener listener) {
this.listener = listener;
}
@Override @Override
public void initView() { public void initView() {
setCancelable(false); setCancelable(false);
@@ -64,29 +81,98 @@ public class HeavenGiftDialog extends BaseDialog<DialogHeavenGiftBinding> {
.setIndicatorSlideMode(IndicatorSlideMode.NORMAL) .setIndicatorSlideMode(IndicatorSlideMode.NORMAL)
.setAdapter(heavenGiftAdapter) .setAdapter(heavenGiftAdapter)
.create(); .create();
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvInvite, ColorManager.getInstance().getPrimaryColorInt(), 53);
mBinding.tvInvite.setTextColor(ColorManager.getInstance().getButtonColorInt());
mBinding.tvInvite.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onFirstChargeConfirmed(heavenGiftBea,2);
}
}
});
} }
@Override @Override
public void initData() { public void initData() {
List<HeavenGiftBean> list=new ArrayList<>();
for (int i = 0; i < 7; i++){ RetrofitClient.getInstance().getDayDropGift(new BaseObserver<HeavenGiftBean>() {
HeavenGiftBean bean=new HeavenGiftBean(); @Override
bean.setTitle("礼物"+i); public void onSubscribe(Disposable d) {
bean.setPicture("");
bean.setType(1);
bean.setQuantity("x"+i);
bean.setGold(i+"");
bean.setDays(i+"");
list.add(bean);
}
// giftAdapter.setNewData(list);
mBinding.bannerViewPager.create(baseListData(list,4));
} }
private List<BaseListData<HeavenGiftBean>> baseListData(List<HeavenGiftBean> list, int chunkSize){ @Override
List<BaseListData<HeavenGiftBean>> baseListData = new ArrayList<>(); public void onNext(HeavenGiftBean heavenGiftBean) {
if (heavenGiftBean != null){
heavenGiftBea=heavenGiftBean;
mBinding.tvTitle.setText(heavenGiftBean.getCounter());
// 示例:假设从 HeavenGiftBean 中获取倒计时时间(单位:秒)
// long countdownTime =Integer.parseInt(heavenGiftBean.getEffective_time()) * 1000L; // 转换为毫秒
// startCountdown(countdownTime);
mBinding.tvSj.setText("截止时间:"+heavenGiftBean.getEffective_time());
mBinding.bannerViewPager.create(baseListData(heavenGiftBean.getGift_list(),4));
}
}
});
// List<HeavenGiftBean> list=new ArrayList<>();
// for (int i = 0; i < 7; i++){
// HeavenGiftBean bean=new HeavenGiftBean();
// bean.setTitle("礼物"+i);
// bean.setPicture("");
// bean.setQuantity("x"+i);
// bean.setGold(i+"");
// bean.setDays(i+"天");
// list.add(bean);
// }
//// giftAdapter.setNewData(list);
// mBinding.bannerViewPager.create(baseListData(list,4));
}
private void startCountdown(long millisInFuture) {
if (countDownTimer != null) {
countDownTimer.cancel();
}
countDownTimer = new CountDownTimer(millisInFuture, 1000) {
@Override
public void onTick(long millisUntilFinished) {
updateCountdownDisplay(millisUntilFinished);
}
@Override
public void onFinish() {
// 倒计时结束时的处理
mBinding.tvSj.setText("00:00:00");
}
}.start();
}
private void updateCountdownDisplay(long millisUntilFinished) {
long totalSeconds = millisUntilFinished / 1000;
long hours = totalSeconds / 3600;
long minutes = (totalSeconds % 3600) / 60;
long seconds = totalSeconds % 60;
String timeFormatted = String.format("%02d:%02d:%02d", hours, minutes, seconds);
mBinding.tvSj.setText(timeFormatted);
}
@Override
public void dismiss() {
super.dismiss();
if (countDownTimer != null) {
countDownTimer.cancel();
countDownTimer = null;
}
}
private List<BaseListData<RoonGiftModel>> baseListData(List<RoonGiftModel> list, int chunkSize) {
List<BaseListData<RoonGiftModel>> baseListData = new ArrayList<>();
for (int i = 0; i < list.size(); i += chunkSize) { for (int i = 0; i < list.size(); i += chunkSize) {
BaseListData<HeavenGiftBean> baseListData1 = new BaseListData<>(); BaseListData<RoonGiftModel> baseListData1 = new BaseListData<>();
baseListData1.setData(list.subList(i, Math.min(i + chunkSize, list.size()))); baseListData1.setData(list.subList(i, Math.min(i + chunkSize, list.size())));
baseListData.add(baseListData1); baseListData.add(baseListData1);
} }

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