10 Commits

Author SHA1 Message Date
38337c63a5 修改每日任务,修改切换后更新背景音乐 2025-08-04 21:31:01 +08:00
5a6600a7e3 封版羽声,作为最后的基础版 2025-08-04 17:15:03 +08:00
86b32f65d4 添加礼物飘屏功能 2025-07-19 14:24:04 +08:00
7f0df85123 修改可以使用 2025-07-17 22:46:35 +08:00
4a7e96473a 初版定稿 2025-07-12 19:08:21 +08:00
2d510ffe2a pk房完成,剩余禁止对方麦未完成
拍卖房完成
点歌房完成,音乐播放需要测试
2025-07-04 16:38:21 +08:00
4c7e996706 开始画房间页面功能 2025-06-09 17:43:01 +08:00
aa865a69b3 个性装扮展示完成 2025-06-09 09:14:47 +08:00
53ade75f84 个性装扮展示完成 2025-06-09 09:14:32 +08:00
c9f5c59ba8 语圈基本完成
2、个人主页完成
2025-06-07 09:00:24 +08:00
1219 changed files with 826542 additions and 220269 deletions

6
.idea/appInsightsSettings.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AppInsightsSettings">
<option name="selectedTabId" value="Android Vitals" />
</component>
</project>

117
.idea/codeStyles/Project.xml generated Normal file
View File

@@ -0,0 +1,117 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>

View File

@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-05-26T06:41:03.502984700Z">
<DropdownSelection timestamp="2025-07-28T13:34:22.682062600Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=88Y4C19912006888" />
<DeviceId pluginId="PhysicalDevice" identifier="serial=6705124a" />
</handle>
</Target>
</DropdownSelection>

6
.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

4
.idea/gradle.xml generated
View File

@@ -4,9 +4,8 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="ms-17" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
@@ -16,6 +15,7 @@
<option value="$PROJECT_DIR$/modulecircle" />
<option value="$PROJECT_DIR$/modulemain" />
<option value="$PROJECT_DIR$/modulenews" />
<option value="$PROJECT_DIR$/moduleroom" />
<option value="$PROJECT_DIR$/moduletablayout" />
<option value="$PROJECT_DIR$/modulevocal" />
<option value="$PROJECT_DIR$/modulevoice" />

2
.idea/misc.xml generated
View File

@@ -46,7 +46,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@@ -5,23 +5,37 @@ plugins {
android {
namespace 'com.qxcm.qxlive'
compileSdk 34
compileSdk 35
defaultConfig {
applicationId "com.qxcm.qxlive"
minSdk 24
targetSdk 35
targetSdk 33
versionCode Integer.parseInt(project.findProperty("APP_VERSION_CODE"))
versionName project.findProperty("APP_VERSION_NAME")
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
//设置支持的so库框架
abiFilters 'armeabi-v7a', 'arm64-v8a'
//设置支持的so库
abiFilters 'arm64-v8a'
// abiFilters 'armeabi-v7a', 'arm64-v8a'
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [
AROUTER_MODULE_NAME: project.getName()
]
}
}
// signingConfig signingConfigs.release
// proguardFiles 'proguard-rules.pro'
}
signingConfigs {
debug {
@@ -41,7 +55,7 @@ android {
}
buildTypes {
release {
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
@@ -84,8 +98,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
dataBinding true
@@ -97,33 +111,53 @@ android {
exclude 'META-INF/gradle/incremental.annotation.processors'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
// exclude 'lib/arm64-v8a/libagora-ffmpeg.so'
// exclude 'lib/arm64-v8a/libagora-fdkaac.so'
}
kotlinOptions {
jvmTarget = '17'
}
dexOptions {
dexInProcess true
preDexLibraries true
javaMaxHeapSize "6g"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
// implementation fileTree(dir: '../LocalAar/aar_libs', include: ['*.jar', '*.aar'] dir: 'libs')
implementation libs.appcompat
implementation libs.material
implementation libs.activity
implementation libs.constraintlayout
implementation project(':modulemain')
testImplementation libs.junit
androidTestImplementation libs.ext.junit
androidTestImplementation libs.espresso.core
api project(":moduleUtil")
api project(":moduleLogin")
implementation files('libs/auth_number_product-2.14.7-log-online-standard-cuum-release.aar')
implementation files('libs/logger-2.2.2-release.aar')
implementation files('libs/main-2.2.3-release.aar')
implementation files('libs/WbCloudFaceLiveSdk-face-v6.6.2-8e4718fc.aar')
implementation files('libs/WbCloudNormal-v5.1.10-4e3e198.aar')
implementation (libs.arouter.api.v150)
//annotationProcessor
annotationProcessor libs.arouter.compiler
implementation project(':modulevocal') // 必须
annotationProcessor project(':modulevocal') // 关键!
api project(":moduleUtil")
api project(":moduleLogin")
implementation project(':modulemain')
//aar的名称例如WbCloudFaceLiveSdk-v6.0.0-1234567.aar填入'WbCloudFaceLiveSdk-v6.0.0-1234567'
// implementation(name: 'WbCloudFaceLiveSdk-face-v6.6.2-8e4718fc', ext: 'aar')
////2. 云normal SDK

BIN
app/certificate.cer Normal file

Binary file not shown.

15
app/lint-baseline.xml Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.8.0" type="baseline" client="gradle" dependencies="false" name="AGP (8.8.0)" variant="fatal" version="8.8.0">
<issue
id="ExpiredTargetSdkVersion"
message="Google Play requires that apps target API level 33 or higher."
errorLine1=" targetSdk 28"
errorLine2=" ~~~~~~~~~~~~">
<location
file="build.gradle"
line="13"
column="9"/>
</issue>
</issues>

Binary file not shown.

BIN
app/my-release-key.jks.old Normal file

Binary file not shown.

View File

@@ -875,4 +875,26 @@ public static java.lang.String TABLENAME;
}
-dontwarn com.tencent.cloud.huiyansdkface.okhttp3.OkHttpClient$Builder
####################### normal混淆规则-END#############################
####################### normal混淆规则-END#############################
# 保留 BaseModel 和其子类的字段名
-keep class com.qxcm.moduleutil.http.BaseModel { *; }
-keep class com.qxcm.moduleutil.bean.** { *; }
# 保留所有作为 API 响应体的类
-keep class com.qxcm.moduleutil.bean.**.*Response { *; }
# 保留 Gson 使用的字段
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# 避免 Retrofit 接口被混淆
-keep interface com.qxcm.moduleutil.http.ApiServer { *; }
# 保留 retrofit 相关类
-keep class retrofit2.** { *; }
-keep class okhttp3.** { *; }
-keep class com.qxcm.moduleutil.utils.location.** { *; }
-keep class io.agora.**{*;}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -11,9 +11,9 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "羽声_1.0_1.apk"
"versionCode": 6,
"versionName": "1.0.5",
"outputFile": "羽声_1.0.5_6.apk"
}
],
"elementType": "File",
@@ -22,14 +22,14 @@
"minApi": 28,
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/羽声_1.0_1.dm"
"baselineProfiles/1/羽声_1.0.5_6.dm"
]
},
{
"minApi": 31,
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/羽声_1.0_1.dm"
"baselineProfiles/0/羽声_1.0.5_6.dm"
]
}
],

View File

@@ -0,0 +1,37 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.qxcm.qxlive",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 10,
"versionName": "1.0.1.8",
"outputFile": "羽声_1.0.1.8_10.apk"
}
],
"elementType": "File",
"baselineProfiles": [
{
"minApi": 28,
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/羽声_1.0.1.8_10.dm"
]
},
{
"minApi": 31,
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/羽声_1.0.1.8_10.dm"
]
}
],
"minSdkVersionForDexing": 24
}

Binary file not shown.

View File

@@ -65,12 +65,9 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
/>
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
@@ -88,11 +85,36 @@
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<queries>
<package android:name="com.tencent.mm" />
</queries>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
tools:ignore="ProtectedPermissions"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
android:required="false"
android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<!-- 声明前台服务权限 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<application
android:name="AppContext"
android:allowBackup="true"
@@ -108,9 +130,11 @@
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config"
android:usesCleartextTraffic="true"
tools:targetApi="31"
tools:targetApi="tiramisu"
tools:ignore="SelectedPhotoAccess"
tools:replace="android:theme,android:allowBackup"
android:enableOnBackInvokedCallback="true"
>
<activity
android:name=".LaunchPageActivity"
@@ -156,6 +180,22 @@
android:taskAffinity="com.qxcm.qxlive"
android:launchMode="singleTask">
</activity>
<activity
android:name=".RealNameActivity"
android:exported="false" />
</application>
<!-- <queries>-->
<!-- &lt;!&ndash; 支付宝 scheme &ndash;&gt;-->
<!-- <intent>-->
<!-- <action android:name="android.intent.action.VIEW" />-->
<!-- <data android:scheme="alipays" />-->
<!-- </intent>-->
<!-- &lt;!&ndash; 微信 scheme &ndash;&gt;-->
<!-- <intent>-->
<!-- <action android:name="android.intent.action.VIEW" />-->
<!-- <data android:scheme="weixin" />-->
<!-- </intent>-->
<!-- </queries>-->
</manifest>

Binary file not shown.

View File

@@ -1,9 +1,10 @@
package com.qxcm.qxlive;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ServiceUtils;
import com.hjq.toast.ToastUtils;
import com.qxcm.moduleutil.utils.config.EnvironmentEnum;
import com.qxcm.moduleutil.utils.config.EnvironmentPrefs;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.service.MyMqttService;
/**
@@ -18,6 +19,21 @@ public class AppContext extends CommonAppContext {
public void onCreate() {
super.onCreate();
ToastUtils.init(this);
ARouter.init(this);
ServiceUtils.startService(MyMqttService.class);/**/
/* 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) {
@@ -27,7 +43,8 @@ public class AppContext extends CommonAppContext {
// L.setDeBug(BuildConfig.DEBUG);
}
public static void initSdk() {
CommonAppContext context = CommonAppContext.getInstance();
// CommonAppContext context = CommonAppContext.getInstance();
// if (BuildConfig.DEBUG) {
// L.e("应用签名:" + context.getAppSignature());
// //L.e("facebook散列秘钥------>" + context.getFacebookHashKey());
@@ -56,6 +73,9 @@ public class AppContext extends CommonAppContext {
// UmengUtil.init(context, BuildConfig.DEBUG);
// //OpenInstall
// OpenInstall.init(context);
}
/**

View File

@@ -14,5 +14,7 @@ public final class LaunchContacter {
public interface ILoginPre extends IPresenter {
void oauthLogin(String login_token);
void address_ip(String address_ip);
}
}

View File

@@ -1,7 +1,10 @@
package com.qxcm.qxlive;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
@@ -10,10 +13,16 @@ import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.alibaba.fastjson.JSON;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.mobile.auth.gatewayauth.AuthUIConfig;
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
import com.mobile.auth.gatewayauth.PreLoginResultListener;
@@ -29,6 +38,8 @@ import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.bean.UserBean;
import com.qxcm.moduleutil.dialog.PolicyDialog;
import com.qxcm.moduleutil.utils.SpUtil;
import com.qxcm.moduleutil.utils.location.LocationProvider;
import com.qxcm.moduleutil.utils.location.LocationServiceFactory;
import com.qxcm.moduleutil.utils.logger.Logger;
import com.qxcm.qxlive.databinding.ActivityLaunchPageBinding;
import com.tencent.qcloud.tuicore.TUILogin;
@@ -42,7 +53,7 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
private TokenResultListener tokenResultListener;
private boolean canOnePass;
private boolean isCanOnePass = true;
private String city1="";
@Override
protected void initData() {
handler = new Handler();
@@ -59,7 +70,7 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
// BaseApplication.getInstance().checkInEmulator();
// BaseApplication.getInstance().initHeartBeat();
// //延迟1.5秒执行
handler.postDelayed(runnable, 100);
handler.postDelayed(runnable, 2500);
// initLogin();
} else {
PolicyDialog policyDialog = new PolicyDialog(this);
@@ -86,16 +97,20 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
});
policyDialog.show();
}
}
private void initLogin() {
// EventBus.getDefault().register(this);
initQuickLogin();
checkOnePass();
//
}
private void checkOnePass() {
if (!TextUtils.isEmpty(AppContext.getInstance().getToken())) {
if (!TextUtils.isEmpty(AppContext.getInstance().getToken()) && !TextUtils.isEmpty(AppContext.getInstance().getUser().getTencent_im())) {
isRoot();
return;
}
@@ -151,7 +166,7 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
return;
}
}
if (TextUtils.isEmpty(AppContext.getInstance().getToken())) {
if (TextUtils.isEmpty(AppContext.getInstance().getToken()) || TextUtils.isEmpty(AppContext.getInstance().getUser().getTencent_im())) {
Logger.e("SplashEnd", "ARouters.CODE_LOGIN");
if (canOnePass) {
phoneNumberAuthHelper.setAuthListener(tokenResultListener);
@@ -161,7 +176,20 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
}
} 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();
@@ -169,16 +197,7 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
intent.putExtras(bundle);
startActivity(intent);
} else {
TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), String.valueOf(userBean.getUser_code()), 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("@@@","成功");
}
});
EventBus.getDefault().post(userBean);
startActivity(new Intent(this, MainActivity.class));
}
finish();
@@ -232,12 +251,13 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
.setSwitchAccTextSize(12)
.setSwitchOffsetY(390)
//协议栏
.setAppPrivacyOne("《用户协议》", "")
.setAppPrivacyTwo("《隐私协议》", "")
.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)
@@ -322,5 +342,25 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
return new LaunchPresenter(this, this);
}
// @Override
// public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
// super.onRequestPermissionsResult(requestCode, permissions, grantResults);
//
// if (requestCode == 1001) {
// LocationProvider provider = LocationServiceFactory.createBestProvider(this);
// provider.getLastKnownLocation(this, new LocationProvider.LocationCallback() {
// @Override
// public void onLocationReceived(double latitude, double longitude, String city) {
// ToastUtils.showShort("当前位置:" + city);
// city1=city;
// }
//
// @Override
// public void onFailed(String errorMessage) {
// ToastUtils.showShort("定位失败");
// }
// });
// }
// }
}

View File

@@ -14,6 +14,8 @@ import com.qxcm.moduleutil.bean.UserBean;
import com.qxcm.moduleutil.http.BaseObserver;
import com.qxcm.moduleutil.presenter.BasePresenter;
import org.greenrobot.eventbus.EventBus;
import java.util.List;
import io.reactivex.disposables.Disposable;
@@ -40,6 +42,21 @@ public class LaunchPresenter extends BasePresenter<LaunchContacter.View> impleme
});
}
@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("登录失败请重试");
@@ -76,7 +93,7 @@ public class LaunchPresenter extends BasePresenter<LaunchContacter.View> impleme
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
}
// EventBus.getDefault().post(new LoginFinishEvent());
EventBus.getDefault().post(userBean);
// EventBus.getDefault().post(new SplashFinishEvent());
// AppLog.setUserUniqueID(userBean.getUser_id()); // 设置您自己的账号体系ID, 并保证其唯一性
}

View File

@@ -1,4 +1,4 @@
package com.example.modulevocal.activity;
package com.qxcm.qxlive;
import android.graphics.Color;
import android.os.Bundle;
@@ -9,20 +9,15 @@ import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.View;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.blankj.utilcode.util.RegexUtils;
import com.example.modulevocal.R;
import com.example.modulevocal.conacts.RealNameConacts;
import com.example.modulevocal.databinding.ActivityRealNameBinding;
import com.example.modulevocal.presenter.RealNamePresenter;
import com.qxcm.moduleutil.activity.BaseMvpActivity;
import com.qxcm.moduleutil.bean.RealNameBean;
import com.qxcm.moduleutil.utils.ARouteConstants;
import com.qxcm.moduleutil.utils.SpUtil;
import com.qxcm.qxlive.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;
@@ -31,7 +26,13 @@ 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;
public class RealName1Activity extends BaseMvpActivity<RealNamePresenter, ActivityRealNameBinding> implements RealNameConacts.View{
/**
*@author qx
*@data 2025/7/15
*@description: 实名认证
*/
@Route(path = ARouteConstants.REAL_NAME_ACTIVITY2)
public class RealNameActivity extends BaseMvpActivity<RealNamePresenter, ActivityRealNameBinding> implements RealNameConacts.View{
@Override
@@ -91,11 +92,11 @@ public class RealName1Activity extends BaseMvpActivity<RealNamePresenter, Activi
//避免用户快速点击导致二次登录二次拉起刷脸等操作引起问题
WbCloudFaceVerifySdk.getInstance().
initAdvSdk(RealName1Activity.this, data, new WbCloudFaceVerifyLoginListener() {
initAdvSdk(RealNameActivity.this, data, new WbCloudFaceVerifyLoginListener() {
@Override
public void onLoginSuccess () {
//登录成功拉起 sdk 页面, FaceVerifyResultListener 返回刷脸结果
WbCloudFaceVerifySdk.getInstance().startWbFaceVerifySdk(RealName1Activity.this, new WbCloudFaceVerifyResultListener() {
WbCloudFaceVerifySdk.getInstance().startWbFaceVerifySdk(RealNameActivity.this, new WbCloudFaceVerifyResultListener() {
@Override
public void onFinish(WbFaceVerifyResult result) {
if (result != null) {

View File

@@ -8,7 +8,8 @@
<FrameLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/transparent">
<FrameLayout
@@ -93,8 +94,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:scaleType="centerCrop"
android:src="@mipmap/screen"
android:scaleType="centerCrop"
android:visibility="visible" />
</FrameLayout>

View File

@@ -5,6 +5,12 @@
<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">
@@ -13,6 +19,17 @@
<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>

View File

@@ -1,6 +1,31 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// build.gradle (Project-level)
buildscript {
ext.kotlin_version = '1.9.24' // 根据你使用的 Kotlin 版本调整
repositories {
google()
mavenCentral()
jcenter() // 已废弃,仅限旧项目使用
gradlePluginPortal()
maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
}
dependencies {
classpath libs.gradle // 或你使用的 Android Gradle 插件版本
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// ✅ 添加 ARouter 插件依赖
classpath 'com.alibaba:arouter-register:1.0.2'
}
}
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx3072m -XX:MaxPermsize=512m -Xx:+HeapDumponOutofMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
@@ -25,12 +25,27 @@ arouter.register.auto=true
isBuildModule=false
org.gradle.parallel=false
org.gradle.deamon=false
#org.gradle.parallel=false
#org.gradle.deamon=false
android.injected.testOnly=false
APP_VERSION_NAME=1.0.0
APP_VERSION_CODE=1
APP_VERSION_NAME=1.0.1.8
APP_VERSION_CODE=10
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.gradel.daemon=true
org.gradel.configureondemand=true
aaptOptions.cruncherEnabled false
aaptOptions.useNewCruncher false
#android.enableR8=true
#isModule
modulevoice=false
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
beta=false
org.gradle.caching=false
# ??APT????
kapt.incremental.apt=false

View File

@@ -1,17 +1,25 @@
[versions]
agp = "8.8.0"
agp = "8.4.0"
alipayAlipaysdkAndroid = "15.8.33"
arouterApiVersion = "1.5.2"
comJacktuotuoCustomviewVerificationcodeview2 = "1.0.5"
comLiulishuoOkdownloadOkdownload4 = "1.0.7"
comLiulishuoOkdownloadSqlite3 = "1.0.7"
comLiulishuoOkdownloadOkhttp3 = "1.0.7"
comLiulishuoOkdownloadFiledownloader3 = "1.0.7"
custompopwindow = "2.1.1"
databindingRuntimeVersion = "7.0.2"
easypermissions = "3.0.0"
easyProtectorRelease = "1.1.2"
egameAnimplayer = "2.0.8"
flexboxVersion = "1.0.0"
githubBannerviewpagerVersion = "3.5.12"
githubGlide = "4.12.0"
githubNiceSpinnerVersion = "1.4.4"
githubPhotoview = "2.3.0"
githubRealtimeblurviewVersion = "1.2.1"
githubShadowlayout = "3.3.1"
gradle = "8.5.0-alpha04"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
@@ -22,6 +30,7 @@ marqueeview = "1.1.0"
material = "1.10.0"
activity = "1.8.0"
constraintlayout = "2.1.4"
arouter = "1.0.2"
arouterAnnotation = "1.0.6"
arouterCompiler = "1.5.2"
@@ -47,6 +56,7 @@ scwangSmartrefreshheader = "1.1.0-alpha-20"
singledateandtimepicker = "2.2.7"
svgaplayerAndroid = "2.5.13"
toastVersion = "8.2"
togglebuttonLibraryVersion = "1.0.0"
utilcode = "1.30.6"
databindingRuntime = "8.8.0"
datastoreCoreAndroid = "1.1.5"
@@ -58,24 +68,34 @@ kotlinVersion = "1.9.24"
coreKtx = "1.10.1"
lifecycleLivedataKtx = "2.6.1"
lifecycleViewmodelKtx = "2.6.1"
webpdecoder = "1.6.4.9.0"
wechatSdkAndroid = "6.8.30"
xbanner = "1.7.0"
appcompatVersion = "1.3.1"
[libraries]
alipay-alipaysdk-android = { module = "com.alipay.sdk:alipaysdk-android", version.ref = "alipayAlipaysdkAndroid" }
android-flexbox = { module = "com.google.android:flexbox", version.ref = "flexboxVersion" }
arouter-api-v150 = { module = "com.alibaba:arouter-api", version.ref = "arouterApiVersion" }
com-github-arcadefire-nice-spinner = { module = "com.github.arcadefire:nice-spinner", version.ref = "githubNiceSpinnerVersion" }
com-github-bumptech-glide-glide = { module = "com.github.bumptech.glide:glide", version.ref = "githubGlide" }
com-github-mmin18-realtimeblurview = { module = "com.github.mmin18:realtimeblurview", version.ref = "githubRealtimeblurviewVersion" }
com-github-zhpanvip-bannerviewpager = { module = "com.github.zhpanvip:bannerviewpager", version.ref = "githubBannerviewpagerVersion" }
com-jacktuotuo-customview-verificationcodeview3 = { module = "com.jacktuotuo.customview:verificationcodeview", version.ref = "comJacktuotuoCustomviewVerificationcodeview2" }
custompopwindow = { module = "com.github.pinguo-zhouwei:CustomPopwindow", version.ref = "custompopwindow" }
#com-liulishuo-okdownload-filedownloader4 = { module = "com.liulishuo.okdownload:filedownloader", version.ref = "comLiulishuoOkdownloadFiledownloader3" }
#com-liulishuo-okdownload-okhttp4 = { module = "com.liulishuo.okdownload:okhttp", version.ref = "comLiulishuoOkdownloadOkhttp3" }
#com-liulishuo-okdownload-sqlite4 = { module = "com.liulishuo.okdownload:sqlite", version.ref = "comLiulishuoOkdownloadSqlite3" }
#com-liulishuo-okdownload-okdownload6 = { module = "com.liulishuo.okdownload:okdownload", version.ref = "comLiulishuoOkdownloadOkdownload4" }
#custompopwindow = { module = "com.github.pinguo-zhouwei:CustomPopwindow", version.ref = "custompopwindow" }
databinding-runtime-v702 = { module = "androidx.databinding:databinding-runtime", version.ref = "databindingRuntimeVersion" }
dpa-oss-android-sdk = { module = "com.aliyun.dpa:oss-android-sdk", version.ref = "ossAndroidSdkVersion" }
easy-protector-release = { module = "com.lahm.library:easy-protector-release", version.ref = "easyProtectorRelease" }
easypermissions = { module = "pub.devrel:easypermissions", version.ref = "easypermissions" }
#egame-animplayer = { module = "com.egame.vap:animplayer", version.ref = "egameAnimplayer" }
github-photoview = { module = "com.github.chrisbanes:PhotoView", version.ref = "githubPhotoview" }
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" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
@@ -85,7 +105,7 @@ marqueeview = { module = "com.sunfusheng:marqueeview", version.ref = "marqueevie
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
arouter-api = { module = "com.alibaba:arouter-api", version.ref = "arouterApi" }
#arouter-api = { module = "com.alibaba:arouter-api", version.ref = "arouterApi" }
arouter-compiler = { module = "com.alibaba:arouter-compiler", version.ref = "arouterCompiler" }
arouter-annotation = { module = "com.alibaba:arouter-annotation", version.ref = "arouterAnnotation" }
com-scwang-smartrefresh-smartrefreshheader = { module = "com.scwang.smartrefresh:SmartRefreshHeader", version.ref = "scwangSmartrefreshheader" }
@@ -96,44 +116,48 @@ github-baserecyclerviewadapterhelper = { module = "com.github.CymChad:BaseRecycl
hjq-toast = { module = "com.hjq:toast", version.ref = "toastVersion" }
jakewharton-retrofit2-kotlin-coroutines-adapter = { module = "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter", version.ref = "retrofit2KotlinCoroutinesAdapterVersion" }
greenrobot-eventbus = { module = "org.greenrobot:eventbus", version.ref = "eventbusVersion" }
greenrobot-eventbus-annotation-processor = { module = "org.greenrobot:eventbus-annotation-processor", version.ref = "eventbusAnnotationProcessorVersion" }
#greenrobot-eventbus-annotation-processor = { module = "org.greenrobot:eventbus-annotation-processor", version.ref = "eventbusAnnotationProcessorVersion" }
google-gson = { module = "com.google.code.gson:gson", version.ref = "gsonVersion" }
logger = { module = "com.orhanobut:logger", version.ref = "logger" }
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" }
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" }
roundedimageview = { module = "com.makeramen:roundedimageview", version.ref = "roundedimageview" }
rxandroid = { module = "io.reactivex.rxjava2:rxandroid", version.ref = "rxandroid" }
singledateandtimepicker = { module = "com.github.florent37:singledateandtimepicker", version.ref = "singledateandtimepicker" }
#singledateandtimepicker = { module = "com.github.florent37:singledateandtimepicker", version.ref = "singledateandtimepicker" }
squareup-converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "comSquareupRetrofit2Retrofit3" }
retrofit2-adapter-rxjava2 = { module = "com.squareup.retrofit2:adapter-rxjava2", version.ref = "comSquareupRetrofit2Retrofit3" }
svgaplayer-android = { module = "com.github.yyued:SVGAPlayer-Android", version.ref = "svgaplayerAndroid" }
utilcode = { module = "com.blankj:utilcode", version.ref = "utilcode" }
databinding-runtime = { group = "androidx.databinding", name = "databinding-runtime", version.ref = "databindingRuntime" }
datastore-core-android = { group = "androidx.datastore", name = "datastore-core-android", version.ref = "datastoreCoreAndroid" }
lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
ui = { group = "androidx.compose.ui", name = "ui" }
ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
material3 = { group = "androidx.compose.material3", name = "material3" }
#databinding-runtime = { group = "androidx.databinding", name = "databinding-runtime", version.ref = "databindingRuntime" }
#datastore-core-android = { group = "androidx.datastore", name = "datastore-core-android", version.ref = "datastoreCoreAndroid" }
#lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
#activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
#compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
#ui = { group = "androidx.compose.ui", name = "ui" }
#ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
#ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
#ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
#ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
#ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
#material3 = { group = "androidx.compose.material3", name = "material3" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycleLivedataKtx" }
lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" }
#webpdecoder = { module = "com.zlc.glide:webpdecoder", version.ref = "webpdecoder" }
wechat-sdk-android = { module = "com.tencent.mm.opensdk:wechat-sdk-android", version.ref = "wechatSdkAndroid" }
xbanner = { module = "com.github.xiaohaibin:XBanner", version.ref = "xbanner" }
zcw-togglebutton-library = { module = "com.zcw:togglebutton-library", version.ref = "togglebuttonLibraryVersion" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompatVersion" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinVersion" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlinVersion" }
#kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlinVersion" }
#alibaba-arouter = { id = "com.alibaba.arouter", version.ref = "arouter" }

View File

@@ -1,6 +1,8 @@
#Wed May 07 09:31:48 CST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.10.2-bin.zip
#distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=file:///D:/Greadle/gradle-8.10.2-all.zip
distributionUrl=file:///D:/Greadle/gradle-8.7-bin.zip

View File

@@ -15,7 +15,7 @@ android {
buildToolsVersion build_versions.build_tools
defaultConfig {
minSdkVersion 24
targetSdkVersion 35
targetSdkVersion 28
versionCode 1
versionName 1.0
consumerProguardFiles 'consumer-rules.pro'

View File

@@ -48,4 +48,6 @@ dependencies {
androidTestImplementation libs.espresso.core
implementation project(":moduleUtil")
}
}
apply plugin: 'com.alibaba.arouter' //

View File

@@ -1,6 +1,8 @@
package com.qxcm.modulelogin.activity;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.view.View;
import androidx.activity.EdgeToEdge;
@@ -9,6 +11,8 @@ import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.qxcm.modulelogin.R;
import com.qxcm.modulelogin.databinding.ActivityForgetPasswordBinding;
import com.qxcm.modulelogin.databinding.ActivityLoginBinding;
@@ -16,14 +20,19 @@ import com.qxcm.modulelogin.present.LoginContacter;
import com.qxcm.modulelogin.present.LoginPresenter;
import com.qxcm.moduleutil.activity.BaseMvpActivity;
import com.qxcm.moduleutil.bean.UserBean;
/**
*@author qx
*@data 2025/6/3
*@description: 忘记密码重新修改密码
*/
public class ForgetPasswordActivity extends BaseMvpActivity<LoginPresenter, ActivityForgetPasswordBinding> implements LoginContacter.View, View.OnClickListener {
private CountDownTimer mTimer;
@Override
protected void initData() {
mBinding.tvSendCode.setOnClickListener(this::onClick);
mBinding.btnSubmit.setOnClickListener(this::onClick);
}
@Override
@@ -33,13 +42,78 @@ public class ForgetPasswordActivity extends BaseMvpActivity<LoginPresenter, Acti
@Override
public void onClick(View v) {
if (v.getId() == 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, 3);
}
else if (v.getId() == R.id.btnSubmit){
String phone = mBinding.edPhone.getText().toString().trim();
String code = mBinding.edPassword.getText().toString().trim();
String password = mBinding.editTextNewPassword.getText().toString().trim();
String confirmPassword = mBinding.editTextConfirmPassword.getText().toString().trim();
if (TextUtils.isEmpty(phone)){
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
return;
}
if (TextUtils.isEmpty(code)){
com.blankj.utilcode.util.ToastUtils.showShort("请输入验证码");
return;
}
if (TextUtils.isEmpty(password)){
com.blankj.utilcode.util.ToastUtils.showShort("请输入密码");
return;
}
if (TextUtils.isEmpty(confirmPassword)){
com.blankj.utilcode.util.ToastUtils.showShort("两次密码不一致");
return;
}
if (!password.equals(confirmPassword)){
com.blankj.utilcode.util.ToastUtils.showShort("两次密码不一致");
return;
}
MvpPre.forgotPassword(password,phone,code);
}
}
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 phoneNumber) {
LogUtils.e(phoneNumber);
}
@Override
@@ -52,8 +126,14 @@ public class ForgetPasswordActivity extends BaseMvpActivity<LoginPresenter, Acti
}
@Override
public void ysxlSuccess(String s) {
ToastUtils.showShort(s);
finish();
}
@Override
protected LoginPresenter bindPresenter() {
return null;
return new LoginPresenter(this, this);
}
}

View File

@@ -7,8 +7,9 @@ import android.view.View;
import androidx.annotation.Nullable;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.basic.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.config.PictureMimeType;
import com.luck.picture.lib.entity.LocalMedia;
@@ -19,6 +20,7 @@ import com.qxcm.modulelogin.present.ImproveInfoContacts;
import com.qxcm.modulelogin.present.ImproveInfoPresenter;
import com.qxcm.modulemain.activity.MainActivity;
import com.qxcm.moduleutil.activity.BaseMvpActivity;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.bean.UserBean;
import com.qxcm.moduleutil.bean.UserPictrue;
import com.qxcm.moduleutil.utils.DateSelectDialog;
@@ -28,6 +30,13 @@ import com.qxcm.moduleutil.utils.ImageUtils;
import com.qxcm.moduleutil.utils.MyPictureParameterStyle;
import com.qxcm.moduleutil.utils.SpUtil;
import com.qxcm.moduleutil.widget.Constants;
import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
import com.tencent.imsdk.v2.V2TIMValueCallback;
import com.tencent.qcloud.tuicore.TUIConfig;
import com.tencent.qcloud.tuicore.TUILogin;
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
import org.greenrobot.eventbus.EventBus;
@@ -53,6 +62,9 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
HashMap<String, String> map = new HashMap<>();
private String avatar;
private String birthdy;
private String init_code;
@Override
protected void initData() {
@@ -64,7 +76,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
Bundle extras = getIntent().getExtras();
userBean= extras != null ? (UserBean) extras.getSerializable("userBean") : null;
assert userBean != null;
if (userBean.getNickname().isEmpty()){
if (userBean.getNickname()!=null&&!"".equals(userBean.getNickname())){
MvpPre.updateNickname();
}else {
mBinding.edNickName.setText(userBean.getNickname());
@@ -124,10 +136,20 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
return;
}
if (!inviteCode.isEmpty() || inviteCode != null) {
map.put("user_no", inviteCode);
// map.put("user_no", inviteCode);
init_code = inviteCode;
}
map.put("sex", sex);
MvpPre.upDateUserInfo(map);
String user_id="";
if (userBean!=null){
user_id = userBean.getUser_id() + "";
}
assert userBean != null;
userBean.setSex(Integer.parseInt(sex));
userBean.setNickname(nickname);
userBean.setAvatar(avatar);
SpUtil.saveUserBean(userBean);
MvpPre.upDateUserInfo(nickname, birthdy, sex, avatar, init_code, user_id);
// MvpPre.fill(inviteCode, nickname, sex);
// try {
@@ -148,7 +170,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
mBinding.rlNv.setSelected(false);
sex = "1";
} else if (id == R.id.rv_user_head) {
startChoosePhoto(PictureMimeType.ofImage(), PictureConfig.CHOOSE_REQUEST);
startChoosePhoto(1, PictureConfig.CHOOSE_REQUEST);
} else if (id == R.id.tv_user_name) {
MvpPre.updateNickname();
} else if (id == R.id.iv_girl) {
@@ -188,13 +210,13 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
PictureSelector.create(this)
.openGallery(mimeType)
.isGif(false)
.imageEngine(GlideEngine.createGlideEngine())
.maxSelectNum(1)
.setImageEngine(GlideEngine.createGlideEngine())
.setMaxSelectNum(1)
.isPreviewImage(true)
.isCamera(true)
.setOutputCameraPath(Constants.FILE_PATH)
.isCompress(true)
.setPictureStyle(MyPictureParameterStyle.Companion.selectPicture())
.isDisplayCamera(true)
.setOutputCameraDir(Constants.FILE_PATH)
.isOriginalSkipCompress(true)
.forResult(requestCode); //结果回调onActivityResult code
}
@@ -205,7 +227,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
if (resultCode == RESULT_OK && data != null) {
switch (requestCode) {
case PictureConfig.CHOOSE_REQUEST:
List<LocalMedia> localMedia = PictureSelector.obtainMultipleResult(data);
List<LocalMedia> localMedia = PictureSelector.obtainSelectorList(data);
if (localMedia != null && localMedia.size() != 0) {
LocalMedia imgMedia = localMedia.get(0);
String url;
@@ -218,7 +240,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
}
break;
case PictureConfig.REQUEST_CAMERA:
List<LocalMedia> localMedia1 = PictureSelector.obtainMultipleResult(data);
List<LocalMedia> localMedia1 = PictureSelector.obtainSelectorList(data);
if (localMedia1 != null && localMedia1.size() != 0) {
LocalMedia imgMedia = localMedia1.get(0);
MvpPre.uploadFile(new File(imgMedia.getRealPath()), 3);
@@ -233,6 +255,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
// MvpPre.updateAvatar(url);
ImageUtils.loadHeadCC(url, mBinding.rvUserHead);
map.put("avatar", url);
avatar=url;
isFirst = true;
}
@@ -240,6 +263,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
public void updateAvatarSuccess(String headPicture) {
ImageLoader.loadHead(this, mBinding.rvUserHead, headPicture);
map.put("avatar", headPicture);
avatar=headPicture;
isFirst = true;
}
@@ -247,19 +271,33 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
public void updateNicknameSuccess(String nickname) {
mBinding.edNickName.setText(nickname);
map.put("nickname", nickname);
this.nickname=nickname;
}
@Override
public void updateSexTrue(String sex) {
ImageLoader.loadHead(this, mBinding.rvUserHead,sex);
map.put("avatar", sex);
public void updateSexTrue(String sex1) {
ImageLoader.loadHead(this, mBinding.rvUserHead,sex1);
map.put("avatar", sex1);
// sex=sex1;
avatar=sex1;
}
@Override
public void updateSuccess(UserBean userBean) {
SpUtil.saveUserInfo(userBean);
EventBus.getDefault().post(userBean);
// SpUtil.saveUserBean(userBean);
EventBus.getDefault().post(SpUtil.getUserBean());
// TUILogin.login(ImproveInfoActivity.this, CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), String.valueOf(userBean.getUser_code()), 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("@@@","成功");
// }
// });
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
@@ -272,6 +310,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
mBinding.tvMonth.setText(month);
mBinding.tvYear.setText(year);
map.put("birthday", year + "-" + month + "-" + day);
birthdy=year + "-" + month + "-" + day;
}
}

View File

@@ -69,7 +69,7 @@ public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLogin
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
// EventBus.getDefault().register(this);
}
@Override
@@ -201,6 +201,11 @@ public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLogin
zfbLogin(s);
}
@Override
public void ysxlSuccess(String s) {
}
boolean isPasswordVisible = false;
@Override

View File

@@ -1,11 +1,14 @@
package com.qxcm.modulelogin.activity;
import static android.view.View.VISIBLE;
import android.content.Intent;
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.View;
import androidx.annotation.Nullable;
@@ -41,6 +44,8 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
private CountDownTimer mTimer;
public String mobile;
private int type;//1:验证码登录2密码登录
boolean isPasswordVisible = false;
@Override
protected void initData() {
@@ -53,7 +58,7 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
// EventBus.getDefault().register(this);
// AppLogUtil.reportAppLog(AppLogEvent.A0101);
}
@@ -115,6 +120,13 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
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;
}
}
@@ -150,10 +162,26 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
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();
// 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()) {
@@ -165,16 +193,26 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
return;
}
String code=mBinding.edPassword.getText().toString().trim();
if (TextUtils.isEmpty(code)){
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);
}
MvpPre.login(phone, "", code, 1);
} else if (id == R.id.tv_yhxy) {
MvpPre.yhxy();
} else if (id == R.id.tv_ysxy) {
MvpPre.ysxl();
} else if (id == R.id.tv_ysxy) {
MvpPre.yhxy();
} else if (id == R.id.iv_zfb) {
if (!mBinding.cbPrivacy.isChecked()) {
ToastUtils.show("请先勾选服务条款");
@@ -197,6 +235,18 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
}
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.qxcm.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.qxcm.moduleutil.R.mipmap.eye_close); // 设置按钮文本为显示密码
}
mBinding.edPassword.setSelection(mBinding.edPassword.getText().length()); // 将光标移动到文字末尾
isPasswordVisible = !isPasswordVisible; // 切换状态
}
}
private void wcLogin() {
@@ -271,6 +321,11 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
zfbLogin(s);
}
@Override
public void ysxlSuccess(String s) {
}
private void zfbLogin(String s) {
LogUtils.e("@@@",s);
CommonAppContext.getInstance();

View File

@@ -85,4 +85,9 @@ public class SwitchAccountsActivity extends BaseMvpActivity<LoginPresenter, Acti
public void authorizationSuccess(String s) {
}
@Override
public void ysxlSuccess(String s) {
}
}

View File

@@ -38,6 +38,6 @@ public final class ImproveInfoContacts {
void getSexTrue(String sex);
void upDateUserInfo(Map<String, String> map);
void upDateUserInfo(String nickname,String birthday,String sex,String avatar,String init_code,String user_id);
}
}

View File

@@ -18,21 +18,6 @@ public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View
public ImproveInfoPresenter(ImproveInfoContacts.View view, Context context) {
super(view, context);
}
@Override
public void upDateUserInfo(Map<String, String> map) {
api.userUpdate(map, new BaseObserver<UserBean>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(UserBean userBean) {
MvpRef.get().updateSuccess(userBean);
}
});
}
@Override
public void uploadFile(File file, int type) {
@@ -118,5 +103,21 @@ public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View
});
}
@Override
public void upDateUserInfo(String nickname, String birthday, String sex, String avatar, String init_code, String user_id) {
api.userUpdate(nickname, birthday, sex, avatar, init_code, user_id, new BaseObserver<UserBean>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(UserBean userBean) {
MvpRef.get().updateSuccess(userBean);
}
});
}
}

View File

@@ -12,6 +12,8 @@ public final class LoginContacter {
void loginSuccess(UserBean userBean);
void authorizationSuccess(String s);
void ysxlSuccess(String s);
}
public interface ILoginPre extends IPresenter {
@@ -25,6 +27,7 @@ public final class LoginContacter {
void switchAccounts(String loginId);//切换账号
void forgotPassword(String new_password,String mobile, String sms_code );
}

View File

@@ -8,6 +8,7 @@ import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.android.arouter.launcher.ARouter;
import com.alipay.sdk.app.AuthTask;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.LogUtils;
@@ -21,7 +22,9 @@ import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.bean.UserBean;
import com.qxcm.moduleutil.http.BaseObserver;
import com.qxcm.moduleutil.presenter.BasePresenter;
import com.qxcm.moduleutil.utils.ARouteConstants;
import com.qxcm.moduleutil.utils.PreferencesUtils;
import com.qxcm.moduleutil.utils.SpUtil;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.mm.opensdk.openapi.IWXAPI;
@@ -39,16 +42,16 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
@Override
public void sendCode(String phoneNumber, int type) {
api.sendCode(phoneNumber,"default", new BaseObserver<Object>() {
api.sendCode(phoneNumber, "default", new BaseObserver<Object>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
addDisposable(d);
}
@Override
public void onNext(Object o) {
MvpRef.get().sendCodeSuccess1(o+"");
MvpRef.get().sendCodeSuccess1(o + "");
}
@@ -57,14 +60,15 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
/**
* 登录
* @param mobile 手机号
*
* @param mobile 手机号
* @param password 密码
* @param code 验证码
* @param type 1:手机号登录 2:密码登录
* @param code 验证码
* @param type 1:手机号登录 2:密码登录
*/
@Override
public void login(String mobile, String password, String code, int type) {
if (type==1){
if (type == 1) {
api.login(mobile, code, new BaseObserver<List<UserBean>>() {
@Override
public void onSubscribe(Disposable d) {
@@ -77,8 +81,8 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
}
});
}else if (type==2){
api.userLogin(mobile,password, new BaseObserver<List<UserBean>>(){
} else if (type == 2) {
api.userLogin(mobile, password, new BaseObserver<List<UserBean>>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
@@ -96,13 +100,14 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
/**
* 支付宝登录
*
* @param auth_code
* @param type type=1:微信登录type=2:支付宝登录
* @param type type=1:微信登录type=2:支付宝登录
*/
@Override
public void oauthLogin(String auth_code, int type) {
api.authCode(auth_code,type, new BaseObserver<List<UserBean>>() {
public void oauthLogin(String auth_code, int type) {
api.authCode(auth_code, type, new BaseObserver<List<UserBean>>() {
@Override
public void onSubscribe(Disposable d) {
@@ -134,18 +139,39 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
});
}
@Override
public void forgotPassword(String new_password, String mobile, String sms_code) {
api.forgotPassword(new_password, mobile, sms_code, new BaseObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
}
@Override
public void onNext(String s) {
MvpRef.get().ysxlSuccess(s);
}
});
}
@Override
public void detachView() {
}
public void loginSuccess(List<UserBean> userBean) {
if (userBean==null) {
if (userBean == null) {
ToastUtils.showShort("登录失败请重试");
return;
}
if (userBean.size()==1) {
if (userBean.size() == 1) {
CommonAppContext.getInstance().setUser(userBean.get(0));
if (userBean.get(0).getAuth() == 1) {
SpUtil.setRealName(true);
} else {
SpUtil.setRealName(false);
}
// PreferencesUtils.putString( CommonAppContext.getInstance(), "mobile", userBean.get());
@@ -167,9 +193,9 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
EventBus.getDefault().post(userBean.get(0));
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();
} 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);
@@ -179,6 +205,7 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
// EventBus.getDefault().post(new SplashFinishEvent());
// AppLog.setUserUniqueID(userBean.getUser_id()); // 设置您自己的账号体系ID, 并保证其唯一性
}
public void authorization(String type) {
if (type.equals("wx")) {
@@ -191,7 +218,7 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
// req.scope = "snsapi_userinfo"; // 只能填 snsapi_userinfo
// req.state = "wechat_sdk_demo_test";
// api.sendReq(req);
}else if (type.equals("zfb")){
} else if (type.equals("zfb")) {
// Map<String, String> result = authTask.authV2(authInfo, true);
api.authorization(new BaseObserver<String>() {
@Override
@@ -207,14 +234,13 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
}
}
public void ysxl() {
// ARouter.getInstance().build(ARouters.H5).withString("url", Constant.URL.URL_USER_YSXY).withString("title", "隐私协议").navigation();
ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
}
public void yhxy() {
// ARouter.getInstance().build(ARouters.H5).withString("url", Constant.URL.URL_USER_YHXY).withString("title", "用户协议").navigation();
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6").withString("title", "用户协议").navigation();
}
}

View File

@@ -319,16 +319,16 @@
android:layout_gravity="center"
android:enabled="false"
android:gravity="center"
android:text="开启初梦之旅"
android:text="开启羽声之旅"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="gone"/>
<TextView
android:layout_width="84dp"
android:layout_width="wrap_content"
android:layout_height="21dp"
android:text="进入初梦语音"
android:text="进入羽声语音"
android:textColor="#ff333333"
android:textSize="14sp"
/>

View File

@@ -165,6 +165,60 @@
</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"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@@ -1,6 +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="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -1,6 +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="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -15,6 +15,19 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [
AROUTER_MODULE_NAME: project.getName()
]
}
}
ndk {
// 移除 abiFilters 或仅保留你需要的架构
abiFilters "armeabi-v7a", "arm64-v8a", "x86_64"
}
}
buildTypes {
@@ -34,14 +47,22 @@ android {
jvmTarget = '17'
}
packagingOptions {
// exclude 'lib/arm64-v8a/libagora-fdkaac.so'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
// implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation libs.appcompat
implementation libs.material
implementation libs.core.ktx
implementation project(':moduletablayout')
implementation libs.activity
implementation libs.constraintlayout
implementation libs.androidx.appcompat
implementation libs.androidx.appcompat
testImplementation libs.junit
androidTestImplementation libs.ext.junit
androidTestImplementation libs.espresso.core
@@ -81,7 +102,8 @@ dependencies {
api(libs.databinding.runtime.v702)
api(libs.pictureselector.picture.library)
// api(libs.pictureselector.picture.library)
api('io.github.lucksiege:pictureselector:v3.11.2')
api(libs.com.github.bumptech.glide.glide)
// api(libs.glide.compiler)
@@ -102,7 +124,9 @@ dependencies {
//判断是否是模拟器
api(libs.easy.protector.release)
//第三方Popup
api(libs.custompopwindow)
// api(libs.custompopwindow)
// api 'com.github.pinguo-zhouwei:CustomPopwindow:2.1.1'
api 'com.example.zhouwei.library:library:1.0.0'
// cookie
api(libs.persistentcookiejar)
@@ -113,6 +137,10 @@ dependencies {
//支付宝
api(libs.alipay.alipaysdk.android)
api(libs.arouter.api.v150)
annotationProcessor libs.arouter.annotation
annotationProcessor libs.arouter.compiler
api(libs.easypermissions)
api(libs.xbanner)
@@ -123,14 +151,68 @@ dependencies {
//定位
api('com.google.android.gms:play-services-location:21.0.1')
//SwitchButton
api(libs.zcw.togglebutton.library)
//图片模糊
api(libs.com.github.mmin18.realtimeblurview)
//播放器
//腾讯直播sdk
api('com.tencent.liteav:LiteAVSDK_Professional:10.9.0.13102')
api('com.google.android.exoplayer:exoplayer-core:2.19.1')
api('com.google.android.exoplayer:exoplayer-ui:2.19.1')
api("com.egame.vap:animplayer:2.0.8")
api("com.liulishuo.okdownload:okdownload:1.0.7")
api('com.zlc.glide:webpdecoder:1.6.4.9.0')
api('com.jungly:gridPasswordView:0.3')
api('com.cpiz.bubbleview:bubbleview:1.0.2')
// 集成音频 SDK声网
// api('io.agora.rtc:voice-sdk:4.5.2')
// api( 'io.agora.rtc:agora-special-full:4.1.1.29')
api('com.github.AgoraIO-Community:LyricsView:1.1.3')
//声网集成屏幕共享
def agora_sdk_version = "4.5.2"
api "io.agora.rtc:full-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:full-screen-sharing:${agora_sdk_version}"
//腾讯im
// api project(':tuiconversation')
// api project(':tuichat')
api project(':tuichat')
annotationProcessor 'com.google.auto.service:auto-service:1.1.1'
api files('libs/WbCloudFaceLiveSdk-face-v6.6.2-8e4718fc.aar')
api files('libs/WbCloudNormal-v5.1.10-4e3e198.aar')
// api files('libs/WbCloudFaceLiveSdk-face-v6.6.2-8e4718fc.aar')
// api files('libs/WbCloudNormal-v5.1.10-4e3e198.aar')
// api project(':LocalAar')
// 房间引擎
api "io.trtc.uikit:rtc_room_engine:latest.release"
// rtc room engine 依赖 trtc sdk 和 im sdk
api "com.tencent.liteav:LiteAVSDK_Professional:latest.release"
api "com.tencent.imsdk:imsdk-plus:latest.release"
//悬浮框
api "io.github.petterpx:floatingx:2.3.5"
// system浮窗&&compose时需要导入 https://github.com/Petterpx/FloatingX/
// 记得AppHelper里调用 enableComposeSupport()
api 'io.github.petterpx:floatingx-compose:2.3.5'
api 'com.github.princekin-f:EasyFloat:2.0.4'
//MQTT
// api 'org.eclipse.paho:org.eclipse.paho.mqttv5.client:1.2.5'
// api 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.1'
// api 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
// api 'com.github.hannesa2:paho.mqtt.android:3.3.5'
// 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 project(':LocalAar')
//2. 云normal SDK
//aar的名称例如WbCloudNormal-v5.1.10-123456789.aar填入 'WbCloudNormal-v5.1.10-123456789.aar'
}
}
apply plugin: 'com.alibaba.arouter' //

View File

@@ -1,12 +1,40 @@
<?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">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application android:allowBackup="true">
<activity
android:name="com.qxcm.moduleutil.activity.news.OfficialNoticeActivity"
android:name=".activity.QxActivity"
android:exported="false" />
<service
android:name=".http.FloatingWindowService"
android:enabled="true"
android:exported="true"
android:foregroundServiceType="specialUse" />
<activity
android:name=".activity.WebViewActivity"
android:exported="false" />
<activity
android:name=".activity.news.OfficialNoticeActivity"
android:exported="false" />
<service android:name="org.eclipse.paho.android.service.MqttService" /> <!-- <receiver android:name="org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver" -->
<!-- android:enabled="true" -->
<!-- android:exported="true" -->
<!-- tools:ignore="Instantiatable" /> -->
<service
android:name=".service.EMqttService"
/>
<service
android:name=".service.MyMqttService"
android:foregroundServiceType="dataSync" />
</application>
</manifest>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,20 @@
package com.qxcm.moduleutil;
import lombok.Data;
@Data
public class RoomAutionTimeBean {
private int days; // 天数,例如 1, 3, 5, 10, 15, 20
private boolean isSelected;
public RoomAutionTimeBean(int days) {
this.days = days;
}
/**
* 获取对应小时数1天 = 24小时
*/
public int getHours() {
return days * 24;
}
}

View File

@@ -17,10 +17,17 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.BarUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.utils.DisplayUtil;
import com.qxcm.moduleutil.utils.LanguageUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.lang.reflect.Method;
public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends AppCompatActivity {
@Override
protected void attachBaseContext(Context newBase) {
@@ -35,25 +42,44 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
super.onCreate(savedInstanceState);
getWindow().getDecorView().setBackgroundResource(R.mipmap.activity_bj);
setContentView(getLayoutId());
// 隐藏标题栏
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}
mBinding = DataBindingUtil.setContentView(this, getLayoutId());
mBinding.setLifecycleOwner(this);
ARouter.getInstance().inject(this);
BarUtils.setStatusBarLightMode(this, isLightMode());
BarUtils.transparentStatusBar(this);
initView();
initData();
initCompleted();
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);
// 动态判断是否包含 @Subscribe 注解的方法
boolean hasSubscribeMethods = false;
for (Method method : getClass().getDeclaredMethods()) {
if (method.isAnnotationPresent(Subscribe.class)) {
hasSubscribeMethods = true;
break;
}
} else {
// 对于低于 Android 6.0 的设备,无需请求悬浮窗权限
// 可在此处添加针对旧版本的处理逻辑(如果需要)
}
if (hasSubscribeMethods) {
EventBus.getDefault().register(this);
}
// // 设置全屏模式,隐藏状态栏和导航栏
// View decorView = getWindow().getDecorView();
// decorView.setSystemUiVisibility(
// View.SYSTEM_UI_FLAG_LAYOUT_STABLE
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
// | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
// | View.SYSTEM_UI_FLAG_FULLSCREEN
// | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
@Override
@@ -66,7 +92,18 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
}
return resources;
}
static float fontScale = 1f;
// @Override
// public Resources getResources() {
// Resources resources = super.getResources();
// return DisplayUtil.getResources(this,resources,fontScale);
// }
public void setFontScale(float fontScale) {
this.fontScale = fontScale;
DisplayUtil.recreate(this);
}
public boolean isLightMode() {
return true;
}
@@ -84,6 +121,9 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
if (mBinding != null) {
mBinding.unbind();
}
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
super.onDestroy();
}

View File

@@ -1,11 +1,13 @@
package com.qxcm.moduleutil.activity;
import android.Manifest;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.PixelFormat;
import android.os.Build;
import android.view.Gravity;
@@ -15,24 +17,46 @@ import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.databinding.ViewDataBinding;
import com.blankj.utilcode.util.FragmentUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.bean.UserBean;
import com.qxcm.moduleutil.bean.UserInfo;
import com.qxcm.moduleutil.event.MqttBean;
import com.qxcm.moduleutil.event.UnreadCountEvent;
import com.qxcm.moduleutil.utils.ImageUtils;
import com.qxcm.moduleutil.utils.LanguageUtil;
import com.qxcm.moduleutil.utils.location.LocationProvider;
import com.qxcm.moduleutil.utils.location.LocationServiceFactory;
import com.qxcm.moduleutil.utils.location.SystemLocationProvider;
import com.qxcm.moduleutil.widget.PiaoPingManager;
import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
import com.tencent.imsdk.v2.V2TIMValueCallback;
import com.tencent.liteav.base.Log;
import com.tencent.qcloud.tuicore.TUILogin;
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewDataBinding> extends BaseAppCompatActivity<VDB> implements IView<Activity> {
public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewDataBinding> extends BaseAppCompatActivity<VDB> implements
IView<Activity> , LocationProvider.LocationCallback
{
protected P MvpPre;
protected abstract P bindPresenter();
private String city1;
@Override
protected void initView() {
@@ -75,102 +99,208 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
@Subscribe(threadMode = ThreadMode.MAIN)
public void logOutEvent(UserBean userBean) {
// 在用户 UI 点击登录的时候调用
TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), String.valueOf(userBean.getUser_code()), userBean.getTencent_im(), new TUICallback() {
TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), "u"+userBean.getUser_id(), userBean.getTencent_im(), new TUICallback() {
@Override
public void onError(final int code, final String desc) {
LogUtils.e("@@@",code,"描述:",desc);
LogUtils.e("@@@1",code,"描述:",desc);
}
@Override
public void onSuccess() {
LogUtils.e("@@@","成功");
}
});
}
/**
* 显示全局飘屏消息(支持任意位置飘过)
*
* @param message 漂浮内容
* @param duration 动画时间(毫秒)
*/
public void showPiaoPingMessage(String message, long duration) {
WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
if (windowManager == null) return;
int screenWidth = getResources().getDisplayMetrics().widthPixels;
int screenHeight = getResources().getDisplayMetrics().heightPixels;
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
PixelFormat.TRANSLUCENT);
// 设置 Gravity 为左上角
layoutParams.gravity = Gravity.TOP | Gravity.START;
// Y 轴随机位置
layoutParams.y = (int) ((Math.random() * (screenHeight - 200)));
// 初始 X 设为负值,确保 View 在屏幕左侧外
layoutParams.x = -200;
View piaoPingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
TextView textView = piaoPingView.findViewById(R.id.tv_content);
textView.setText(message);
windowManager.addView(piaoPingView, layoutParams);
piaoPingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
piaoPingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
int viewWidth = piaoPingView.getWidth();
// 设置锚点为左上角,避免偏移干扰
piaoPingView.setPivotX(0);
piaoPingView.setPivotY(0);
// 更新 x 坐标为 -screenWidth确保 View 完全在屏幕左侧外
layoutParams.x = -screenWidth;
windowManager.updateViewLayout(piaoPingView, layoutParams);
// 启动动画:从左外滑入 -> 右外滑出
ObjectAnimator animator = ObjectAnimator.ofFloat(
piaoPingView,
"translationX",
0f, // 初始偏移为 0此时 View 在左侧外)
screenWidth + viewWidth // 向右移动整个屏幕宽度 + View 宽度
);
animator.setDuration(duration);
animator.addUpdateListener(animation -> {
float value = (float) animation.getAnimatedValue();
LogUtils.d("PiaoPing", "translationX = " + value);
});
animator.addListener(new AnimatorListenerAdapter() {
V2TIMUserFullInfo userFullInfo = new V2TIMUserFullInfo();
userFullInfo.setNickname(userBean.getNickname());
userFullInfo.setFaceUrl(userBean.getAvatar());
userFullInfo.setAllowType(userBean.getSex());
V2TIMManager.getInstance().setSelfInfo(userFullInfo, new V2TIMCallback() {
@Override
public void onAnimationEnd(Animator animation) {
windowManager.removeView(piaoPingView);
public void onSuccess() {
LogUtils.e("@@@", "成功");
// V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
// @Override
// public void onSuccess(Long aLong) {
// if (aLong == 0) {
// EventBus.getDefault().post(new UnreadCountEvent(aLong));
// } else {
// mBinding.tvMessage.setVisibility(View.VISIBLE);
// }
// mBinding.tvMessage.setText(String.valueOf(aLong));
// }
// @Override
// public void onError(int code, String desc) {
//
// }
// });
}
@Override
public void onError(int code, String desc) {
LogUtils.e("@@@", "描述"+desc);
}
});
initLocation();
// 强制 GPU 渲染
piaoPingView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
animator.start();
// V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
// @Override
// public void onSuccess(Long aLong) {
// Log.i("imsdk", "success");
//// EventBus.getDefault().post(new UnreadCountEvent(aLong));
// }
//
// @Override
// public void onError(int code, String desc) {
// Log.i("imsdk", "failure, code:" + code + ", desc:" + desc);
// }
// });
}
});
}
private SystemLocationProvider locationProvider;
private void initLocation() {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// 请求定位权限
ActivityCompat.requestPermissions(
(Activity) this,
new String[]{
android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
},
1001 // 自定义常量,比如 1001
);
}
locationProvider = new SystemLocationProvider();
// 请求一次性的位置信息
locationProvider.getLastKnownLocation(this, this);
}
@Override
public void onLocationReceived(double latitude, double longitude, String city) {
LogUtils.e("当前位置:" + city);
city1=city;
EventBus.getDefault().post(city1);
}
@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);
}
});
}
/**
* 显示全局飘屏消息(支持任意位置飘过)
*
*/
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void showPiaoPingMessage(MqttBean mqttBean) {
// WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
// if (windowManager == null) return;
//
// int screenWidth = getResources().getDisplayMetrics().widthPixels;
// int screenHeight = getResources().getDisplayMetrics().heightPixels;
//
// WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
// WindowManager.LayoutParams.MATCH_PARENT,
// WindowManager.LayoutParams.WRAP_CONTENT,
// Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
// WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
// WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
// WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
// WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
// WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
// PixelFormat.TRANSLUCENT);
//
// // 设置 Gravity 为左上角
// layoutParams.gravity = Gravity.TOP | Gravity.START;
//
// // Y 轴随机位置
//// layoutParams.y = (int) ((Math.random() * (screenHeight - 200)));
//
// // 初始 X 设为负值,确保 View 在屏幕左侧外
// layoutParams.x = -screenWidth;
//
// View piaoPingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
// TextView textView = piaoPingView.findViewById(R.id.tv_name);
// TextView textView2 = piaoPingView.findViewById(R.id.tv_to_name);
// textView2.setText("送给"+mqttBean.getList().getToUserName());
// textView.setText(mqttBean.getList().getFromUserName());
// ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), piaoPingView.findViewById(R.id.iv_piaoping));
// TextView tv_time = piaoPingView.findViewById(R.id.tv_num);
// tv_time.setText(mqttBean.getList().getNumber());
// windowManager.addView(piaoPingView, layoutParams);
//
// piaoPingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
// @Override
// public void onGlobalLayout() {
// piaoPingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
//
// // 设置锚点为左上角,避免偏移干扰
// piaoPingView.setPivotX(0);
// piaoPingView.setPivotY(0);
//
// // 启动动画:从左外滑入 -> 右外滑出
// ObjectAnimator animator = ObjectAnimator.ofFloat(
// piaoPingView,
// "translationX",
// 0f, // 初始偏移为 0此时 View 在左侧外)
// screenWidth // 向右移动整个屏幕宽度
// );
// animator.setDuration(2000); // 整个动画的时长为2秒
//
// // 强制 GPU 渲染
// piaoPingView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
//
// // 延迟显示2秒后开始滑出屏幕的动画
// piaoPingView.postDelayed(new Runnable() {
// @Override
// public void run() {
// animator.start();
// }
// }, 3000);
//
// animator.addListener(new AnimatorListenerAdapter() {
// @Override
// public void onAnimationEnd(Animator animation) {
// windowManager.removeView(piaoPingView);
// }
// });
// }
// });
// }
}

View File

@@ -0,0 +1,288 @@
package com.qxcm.moduleutil.activity;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.webkit.GeolocationPermissions;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.LogUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.databinding.ActivityWebViewBinding;
import com.qxcm.moduleutil.utils.ARouteConstants;
import com.tencent.imsdk.v2.V2TIMConversation;
import com.tencent.mm.opensdk.modelbiz.WXOpenCustomerServiceChat;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.tencent.qcloud.tuicore.TUIConstants;
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIGroupChatActivity;
import java.util.Map;
import java.util.Objects;
/**
* @author qx
* @data 2025/6/3
* @description: webview公共方法
*/
@Route(path = ARouteConstants.H5)
public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBinding> {
public String title;
public String url;
private ValueCallback<Uri> mUploadMessage;
private ValueCallback<Uri[]> mUploadCallbackAboveL;
private final int REQUEST_FILE_PICKER = 1;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void initData() {
WebSettings webSettings = mBinding.webView.getSettings();
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setJavaScriptEnabled(true);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
//增加JSBridge
mBinding.webView.addJavascriptInterface(new WebAppInterface(this), "Android");
// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
webSettings.setBuiltInZoomControls(false);
webSettings.setSupportZoom(false);
webSettings.setDomStorageEnabled(true);
webSettings.setBlockNetworkImage(false);//解决图片不显示
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
mBinding.webView.requestFocus();
mBinding.webView.loadUrl(url);
// mBinding.webView.evaluateJavascript("javascript:window.Android.closeWeb()", new ValueCallback<String>() {
//
// @Override
// public void onReceiveValue(String value) {
// LogUtils.e("value: " + value);
// }
// });
mBinding.webView.setWebChromeClient(new WebChromeClient() {
//配置权限同样在WebChromeClient中实现
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false);
super.onGeolocationPermissionsShowPrompt(origin, callback);
}
@Override
public void onProgressChanged(WebView view, int newProgress) {
}
// For Android < 3.0
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
mUploadMessage = uploadMsg;
// showFileChooser();
}
// For Android > 4.1.1
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
mUploadMessage = uploadMsg;
// showFileChooser();
}
// For Android > 5.0支持多张上传
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> uploadMsg, WebChromeClient.FileChooserParams
fileChooserParams) {
mUploadCallbackAboveL = uploadMsg;
showFileChooser();
return true;
}
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
// tvTitle.setText(title);
}
});
}
private void showFileChooser() {
// 这里可以扩展为显示对话框让用户选择“拍照”或“从相册选择”
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "选择图片"), REQUEST_FILE_PICKER);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_FILE_PICKER) {
if (mUploadMessage != null) {
Uri result = data == null || resultCode != RESULT_OK ? null : data.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
} else if (mUploadCallbackAboveL != null) {
Uri[] results = null;
if (resultCode == Activity.RESULT_OK && data != null) {
String dataString = data.getDataString();
ClipData clipData = data.getClipData();
if (clipData != null) {
results = new Uri[clipData.getItemCount()];
for (int i = 0; i < clipData.getItemCount(); i++) {
ClipData.Item item = clipData.getItemAt(i);
results[i] = item.getUri();
}
}
if (dataString != null)
results = new Uri[]{Uri.parse(dataString)};
}
mUploadCallbackAboveL.onReceiveValue(results);
mUploadCallbackAboveL = null;
}
}
}
@Override
protected void initView() {
getWindow().getDecorView().setBackgroundResource(com.qxcm.moduleutil.R.color.white);
title = getIntent().getStringExtra("title");
url = getIntent().getStringExtra("url");
if (title!=null) {
if (title.equals("举报") || title.equals("等级") || title.equals("公会") || title.equals("邀请") || title.equals("反馈")) {
mBinding.topBar.setVisibility(GONE);
// mBinding.webView.setPadding(0,20,0,0);
} else {
mBinding.topBar.setVisibility(VISIBLE);
mBinding.topBar.setTitle(title);
}
}else {
mBinding.topBar.setVisibility(GONE);
}
}
@Override
protected int getLayoutId() {
return R.layout.activity_web_view;
}
public class WebAppInterface {
Context mContext;
WebAppInterface(Context c) {
mContext = c;
}
// 被 H5 调用的方法
@JavascriptInterface
public void showToast(String toast) {
Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
}
@JavascriptInterface
public void closeWeb() {
LogUtils.e("value: ");
finish();
}
@JavascriptInterface
public void customerService() {
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(); // 填移动应用(App)的 AppId
IWXAPI api = WXAPIFactory.createWXAPI(mContext, appId);
// 判断当前版本是否支持拉起客服会话
WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
req.corpId = "ww1de4300858c0b461"; // 企业ID
req.url = "https://work.weixin.qq.com/kfid/kfcb3d23a59c188a0e7"; // 客服URL
api.sendReq(req);
}
@JavascriptInterface
public void jumpRoomPage(String room_id) {
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
}
@JavascriptInterface
public void jumpWebPage(String objects) {
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).navigation();
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", objects).navigation();
}
@JavascriptInterface
public void enterGroupChat(String group_id,String cover,String guild_name) {
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id);
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
mContext.startActivity(intent);
}
@JavascriptInterface
public void chatWithUser(String user_id,String nickname) {
Intent intent = new Intent(mContext, TUIC2CChatActivity.class);
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
mContext.startActivity(intent);
}
@JavascriptInterface
public void exchange(){
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
}
@JavascriptInterface
public void Withdrawal() {
ARouter.getInstance().build(ARouteConstants.WITHDRAWAL_ACTIVITY).navigation();
}
@JavascriptInterface
public void enterAuthent() {//实名认证
ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
}
}
@JavascriptInterface
public void closeWeb() {
//做原生操作
// Intent intent = new Intent(mContext, ListActivity.class);
// intent.putExtra("menuName", msg);
// startActivity(intent);
LogUtils.e("closeWeb");
}
}

View File

@@ -0,0 +1,403 @@
package com.qxcm.moduleutil.activity;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.JavascriptInterface;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.qxcm.moduleutil.utils.logger.Logger;
import org.json.JSONObject;
import io.reactivex.disposables.Disposable;
/**
* 项目名称 qipao-android
* 包名com.yutang.xqipao.ui.h5
* 创建人 王欧
* 创建时间 2020/6/16 1:26 PM
* 描述 describe
*/
public class WebViewBridgeConfig {
public static final String NAME = "bridge";
public static final String TYPE_QQ_SERVICE = "qqService";
public static final String TYPE_FEEDBACK = "feedback";
public static final String TYPE_USER_ZONE = "userZone";
public static final String TYPE_RECHARGE = "recharge";
public static final String TYPE_BACK = "onBackPressed";
public static final String TYPE_GAME_RANK = "gameRank";//游戏排行榜
public static final String TYPE_GAME_SOUND = "gameSound";//游戏声音
public static final String TYPE_GAME_END = "gameEnd";//游戏结束
public static final String TYPE_GAME_PAUSE = "gamePause";//游戏暂停
public static final String TYPE_GAME_BEGIN = "gameBegin";//游戏开始
public static final String TYPE_GAME_NEXT = "gameNext";//游戏下一关
private static int gameCount = 0;//游戏次数
private String NextGame = "";//上次游戏名称
private String title = "";//标题
public static final String GAME_EL = "俄罗斯方块";//俄罗斯方块
public static final String GAME_XM = "消灭星星";//消灭星星
public static final String GAME_SB = "神步伐";//神步伐
public static final String GAME_XT = "线条冲刺";//线条冲刺
public static final String GAME_FK = "疯狂赛车";//疯狂赛车
public WebViewBridgeConfig(String title) {
this.title = title;
}
@JavascriptInterface
public void postMessage(String json) {
Logger.e(json);
try {
JSONObject jsonObject = new JSONObject(json);
String type = jsonObject.getString("type");
JSONObject object = jsonObject.getJSONObject("data");
switch (type) {
case TYPE_QQ_SERVICE:
serviceUser();
break;
case TYPE_FEEDBACK:
// ActivityUtils.startActivity(FeedBackActivity.class);
break;
case TYPE_USER_ZONE:
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", object.getString("userId")).navigation();
break;
case TYPE_RECHARGE:
// ARouter.getInstance().build(ARouters.ME_BALANCE).navigation();
break;
case TYPE_BACK:
try {
ActivityUtils.getTopActivity().onBackPressed();
} catch (Exception e) {
e.printStackTrace();
}
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
//跳转QQ客服
private void serviceUser() {
// RemoteDataSource.getInstance().serviceUser(new BaseObserver<String>() {
// @Override
// public void onSubscribe(Disposable d) {
//
// }
//
// @Override
// public void onNext(String uin) {
// try {
// String qqUrl = "mqqwpa://im/chat?chat_type=wpa&uin=" + uin + "&version=1";
// ActivityUtils.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(qqUrl)));
// } catch (Exception e) {
// ToastUtils.showShort("请先安装QQ");
// }
// }
//
// @Override
// public void onComplete() {
//
// }
// });
}
/**
* H5小游戏语音互动调用
*
* @param json
*/
@JavascriptInterface
public void common(String json) {
// ThreadUtils.runOnUiThread(new Runnable() {
// @Override
// public void run() {
// Logger.e(json);
// try {
// JSONObject jsonObject = new JSONObject(json);
// String type = jsonObject.getString("type");
// JSONObject object = jsonObject.getJSONObject("params");
// switch (type) {
// case JOIN_LIVE_ROOM:
// quitLiveRoom();
// RtcManager.getInstance().setGame(true);
// RtcManager.getInstance().leaveChannel();
// //游戏时关闭房间
// ActivityUtils.finishActivity(RoomActivity.class);
// BaseApplication.getInstance().isPlaying = false;
// BaseApplication.getInstance().isShow = false;
// UserBean userBean = BaseApplication.getInstance().getUser();
// RtcManager.getInstance().loginRoomGame(object.getString("roomId"), userBean.getUser_id(), userBean.getNickname(), "");
// break;
// case LEAVE_LIVE_ROOM:
// RtcManager.getInstance().leaveChannel(object.getString("roomId"));
// RtcManager.getInstance().setAudioUrl(null);
// break;
// case ROOM_START_PUBLISH_STREAM:
// RtcManager.getInstance().applyWheat(String.format("%s_%s", object.getString("roomId"), object.getString("userId")));
// break;
// case ROOM_STOP_PUBLISH_STREAM:
// RtcManager.getInstance().downWheat();
// break;
// case ROOM_MUTE_LOCAL:
// RtcManager.getInstance().muteLocalAudioStream(object.getBoolean("mute"));
// break;
// case ROOM_MUTE_MICROPHONE:
// RtcManager.getInstance().muteSpeaker(object.getBoolean("mute"));
// break;
// case ROOM_SHOW_MESSAGE_DIALOG:
// DialogUtils.showDialogFragment(ARouter.getInstance().build(ARouteConstants.ROOM_MSG_DIALOG).navigation());
// break;
// case ON_CLOSE_BTN_CLICK:
// RtcManager.getInstance().leaveChannel();
// ActivityUtils.finishActivity(H5Activity.class);
// break;
// case TYPE_QQ_SERVICE:
// serviceUser();
// break;
// case TYPE_FEEDBACK:
// ActivityUtils.startActivity(FeedBackActivity.class);
// break;
// case TYPE_USER_ZONE:
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", object.getString("userId")).navigation();
// break;
// case TYPE_RECHARGE:
// ARouter.getInstance().build(ARouters.ME_BALANCE).navigation();
// break;
// case TYPE_BACK:
// try {
// ActivityUtils.getTopActivity().onBackPressed();
// } catch (Exception e) {
// e.printStackTrace();
// }
// break;
// //游戏排行榜
// case TYPE_GAME_RANK:
// switch (title) {
// case GAME_EL:
// AppLogUtil.reportAppLog(AppLogEvent.A050303);
// break;
// case GAME_SB:
// AppLogUtil.reportAppLog(AppLogEvent.A050403);
// break;
// case GAME_XM:
// AppLogUtil.reportAppLog(AppLogEvent.A050503);
// break;
// case GAME_XT:
// AppLogUtil.reportAppLog(AppLogEvent.A050603);
// break;
// case GAME_FK:
// AppLogUtil.reportAppLog(AppLogEvent.A050703);
// break;
// }
// break;
// //游戏开始
// case TYPE_GAME_BEGIN:
// switch (title) {
// case GAME_EL:
// if (!TextUtils.isEmpty(NextGame) && GAME_EL.equals(NextGame)) {
// gameCount++;
// }
// break;
// case GAME_SB:
// if (!TextUtils.isEmpty(NextGame) && GAME_SB.equals(NextGame)) {
// gameCount++;
// }
// break;
// case GAME_XM:
// if (!TextUtils.isEmpty(NextGame) && GAME_XM.equals(NextGame)) {
// gameCount++;
// }
// break;
// case GAME_XT:
// if (!TextUtils.isEmpty(NextGame) && GAME_XT.equals(NextGame)) {
// gameCount++;
// }
// break;
// case GAME_FK:
// if (!TextUtils.isEmpty(NextGame) && GAME_FK.equals(NextGame)) {
// gameCount++;
// }
// break;
// }
// if (gameCount == 0) {
// gameCount = 1;
// }
// break;
// //游戏结束
// case TYPE_GAME_END:
// switch (title) {
// case GAME_EL:
// AppLogUtil.reportAppLog(AppLogEvent.A050301, "game_count", String.valueOf(gameCount));
// break;
// case GAME_SB:
// AppLogUtil.reportAppLog(AppLogEvent.A050401, "game_count", String.valueOf(gameCount));
// break;
// case GAME_XM:
// AppLogUtil.reportAppLog(AppLogEvent.A050501, "game_count", String.valueOf(gameCount));
// break;
// case GAME_XT:
// AppLogUtil.reportAppLog(AppLogEvent.A050601, "game_count", String.valueOf(gameCount));
// break;
// case GAME_FK:
// AppLogUtil.reportAppLog(AppLogEvent.A050701, "game_count", String.valueOf(gameCount));
// break;
// }
// break;
// //游戏下一关
// case TYPE_GAME_NEXT:
// switch (title) {
// case GAME_XM:
// AppLogUtil.reportAppLog(AppLogEvent.A050504);
// break;
// case GAME_XT:
// AppLogUtil.reportAppLog(AppLogEvent.A050604);
// break;
// }
// break;
// //游戏暂停
// case TYPE_GAME_PAUSE:
// break;
// //游戏声音
// case TYPE_GAME_SOUND:
// switch (title) {
// case GAME_EL:
// if (!object.getBoolean("sound")) {
// AppLogUtil.reportAppLog(AppLogEvent.A050302);
// }
// break;
// case GAME_SB:
// if (!object.getBoolean("sound")) {
// AppLogUtil.reportAppLog(AppLogEvent.A050402);
// }
// break;
// case GAME_XM:
// if (!object.getBoolean("sound")) {
// AppLogUtil.reportAppLog(AppLogEvent.A050502);
// }
// break;
// case GAME_XT:
// if (!object.getBoolean("sound")) {
// AppLogUtil.reportAppLog(AppLogEvent.A050602);
// }
// break;
// case GAME_FK:
// if (!object.getBoolean("sound")) {
// AppLogUtil.reportAppLog(AppLogEvent.A050702);
// }
// break;
// }
// break;
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// });
}
private void quitLiveRoom() {
// if (!TextUtils.isEmpty(BaseApplication.getInstance().playId)) {
// NewApi.getInstance().quit(BaseApplication.getInstance().playId, new com.qpyy.libcommon.api.BaseObserver<String>(false, false) {
// @Override
// public void onSubscribe(Disposable d) {
//
// }
//
// @Override
// public void onNext(String s) {
//
// }
//
// @Override
// public void onComplete() {
//
// }
// });
// }
}
// 调用示例:
// window.bridge.common('{"type":"joinStreamLiveRoom","params":{"roomId":"12445435","userId":"12323 ","mute":false}}');
// 调用顺序:
// 1、加入直播间 joinStreamLiveRoom
// 2、开始推流 startPublishingStreamLiveRoom
// 3、打开麦克风 muteMicrophoneLiveRoom
/*
加入直播间 joinStreamLiveRoom
params :
{
"roomId":"房间id",
}
*/
public static final String JOIN_LIVE_ROOM = "joinStreamLiveRoom";
/*
离开流房间 推拉流 leaveStreamLiveRoom
params :
{
"roomId":"房间id",
}
*/
public static final String LEAVE_LIVE_ROOM = "leaveStreamLiveRoom";
/*
开始推流 startPublishingStreamLiveRoom
params :
{
"roomId":"房间id",
"userId":"用户ID"
}
*/
public static final String ROOM_START_PUBLISH_STREAM = "startPublishingStreamLiveRoom";
/*
停止推流 stopPublishingStreamLiveRoom
params :
{
"roomId":"房间id",
"userId":"用户ID"
}
*/
public static final String ROOM_STOP_PUBLISH_STREAM = "stopPublishingStreamLiveRoom";
/*
是否屏蔽远端所有声音 muteSpeakerLiveRoom
params :
{
mute:true // true为关闭false为打开
}
*/
public static final String ROOM_MUTE_LOCAL = "muteSpeakerLiveRoom";
/*
是否静音(关闭)麦克风 muteMicrophoneLiveRoom
params :
{
mute:true // true为关闭false为打开
}
*/
public static final String ROOM_MUTE_MICROPHONE = "muteMicrophoneLiveRoom";
/*
点击消息按钮 onMessageBtnClick
params :
{
}
*/
public static final String ROOM_SHOW_MESSAGE_DIALOG = "onMessageBtnClick";
//关闭按钮
public static final String ON_CLOSE_BTN_CLICK = "onCloseBtnClick";
}

View File

@@ -5,18 +5,18 @@ import android.app.Activity;
import com.qxcm.moduleutil.activity.IPresenter;
import com.qxcm.moduleutil.activity.IView;
import com.qxcm.moduleutil.bean.NewsDataBean;
import com.qxcm.moduleutil.bean.NewsMessageList;
import java.util.List;
public class NewsContacts {
public interface View extends IView<Activity> {
void getOfficialNoticeList(List<NewsDataBean> newsDataBeans);
void showNews(List<NewsMessageList> newsList);
void finishRefresh();
}
public interface IHomePre extends IPresenter {
void getOfficialNotice(String page,String page_limit,String type);
void getMessagetitle(String type,String page,String pageLimit);
}
}

View File

@@ -3,58 +3,35 @@ package com.qxcm.moduleutil.activity.news;
import android.content.Context;
import com.qxcm.moduleutil.bean.NewsDataBean;
import com.qxcm.moduleutil.bean.NewsMessageList;
import com.qxcm.moduleutil.http.BaseObserver;
import com.qxcm.moduleutil.presenter.BasePresenter;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.disposables.Disposable;
public class NewsPresenter extends BasePresenter<NewsContacts.View> implements NewsContacts.IHomePre {
public NewsPresenter(NewsContacts.View view, Context context) {
super(view, context);
}
@Override
public void getOfficialNotice(String page, String page_limit, String type) {
// api.getOfficialNotice(page, page_limit, type, new BaseObserver<List<NewsDataBean>>() {
// @Override
// public void onSubscribe(Disposable d) {
// addDisposable(d);
// }
//
// @Override
// public void onNext(List<NewsDataBean> newsDataBeans) {
// MvpRef.get().getOfficialNoticeList(newsDataBeans);
// }
// });
List<NewsDataBean> newsDataBeans= new ArrayList<>();
if (type.equals("1")){
for (int i = 0; i < 5; i++) {
NewsDataBean newsDataBean = new NewsDataBean();
newsDataBean.setId(i+"");
newsDataBean.setTitle("系统消息"+i);
newsDataBean.setContent("系统消息"+i);
newsDataBean.setType("1");
newsDataBean.setSource_id("1");
newsDataBean.setIs_read("1");
newsDataBean.setCreatetime("2019-09-09");
newsDataBean.setImage("");
newsDataBeans.add(newsDataBean);
@Override
public void getMessagetitle(String type, String page, String pageLimit) {
api.getMessagetitle(type, page, pageLimit, new BaseObserver<List<NewsMessageList>>() {
@Override
public void onSubscribe(Disposable d) {
addDisposable(d);
MvpRef.get().finishRefresh();
}
}else {
for (int i = 0; i < 5; i++) {
NewsDataBean newsDataBean = new NewsDataBean();
newsDataBean.setId(i+"");
newsDataBean.setTitle("官方公告"+i);
newsDataBean.setContent("官方公告"+i);
newsDataBean.setType("2");
newsDataBean.setSource_id("1");
newsDataBean.setIs_read("1");
newsDataBean.setCreatetime("2019-09-09");
newsDataBean.setImage("");
newsDataBeans.add(newsDataBean);
@Override
public void onNext(List<NewsMessageList> newsMessageLists) {
MvpRef.get().showNews(newsMessageLists);
}
}
MvpRef.get().getOfficialNoticeList(newsDataBeans);
});
}
}

View File

@@ -9,13 +9,17 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.activity.BaseMvpActivity;
import com.qxcm.moduleutil.bean.NewsDataBean;
import com.qxcm.moduleutil.bean.NewsMessageList;
import com.qxcm.moduleutil.databinding.ActivityOfficialNoticeBinding;
import com.qxcm.moduleutil.utils.ARouteConstants;
import com.qxcm.moduleutil.utils.ImageUtils;
import com.qxcm.moduleutil.utils.TimeUtils;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
@@ -24,15 +28,15 @@ import java.util.List;
public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, ActivityOfficialNoticeBinding> implements NewsContacts.View {
private int page = 1;
private BaseQuickAdapter<NewsDataBean, BaseViewHolder> mAdapter;
private BaseQuickAdapter<NewsMessageList, BaseViewHolder> mAdapter;
private String type;
@Override
protected void initData() {
type=getIntent().getStringExtra("type");
if (type.equals("1")){
type = getIntent().getStringExtra("type");
if (type.equals("1")) {
mBinding.topBar.setTitle("系统消息");
}else {
} else {
mBinding.topBar.setTitle("官方公告");
}
// mBinding.smartRefreshLayout.autoRefresh();
@@ -42,40 +46,63 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
@Override
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
page++;
MvpPre.getOfficialNotice(page+"", "10",type);
MvpPre.getMessagetitle(type, page + "", "10");
}
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
page = 1;
MvpPre.getOfficialNotice(page+"", "10",type);
MvpPre.getMessagetitle(type, page + "", "10");
}
});
mBinding.recycleView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new BaseQuickAdapter<NewsDataBean, BaseViewHolder>(R.layout.news_rv_item_system_news) {
mAdapter = new BaseQuickAdapter<NewsMessageList, BaseViewHolder>(R.layout.news_rv_item_system_news) {
@Override
protected void convert(BaseViewHolder helper, NewsDataBean item) {
helper.setText(R.id.tv_sys_time, item.getCreatetime() );
helper.setText(R.id.tv_sys_con, Html.fromHtml(item.getTitle()));
if (item.getType().equals("1")){
protected void convert(BaseViewHolder helper, NewsMessageList item) {
String time = TimeUtils.getDateToStringNoZ(Long.parseLong(item.getCreatetime()) * 1000L);
helper.setText(R.id.tv_sys_time, time);
if (item.getImage()==null || item.getImage().isEmpty()){
helper.getView(R.id.tv_sys_con).setVisibility(VISIBLE);
helper.setText(R.id.tv_sys_con, item.getContent());
helper.getView(R.id.ll_system_official).setVisibility(GONE);
}else if (item.getType().equals("2")){
}else {
helper.getView(R.id.tv_sys_con).setVisibility(GONE);
helper.getView(R.id.ll_system_official).setVisibility(VISIBLE);
}else {
helper.getView(R.id.ll_system_official).setVisibility(GONE);
ImageUtils.loadHeadCC(item.getImage(), helper.getView(R.id.image));
helper.setText(R.id.tv_cont, Html.fromHtml(item.getContent()));
}
ImageUtils.loadHeadCC(item.getImage(), helper.getView(R.id.image));
helper.getView(R.id.image).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
helper.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (item.getRoom_id()>0){
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("room_id", item.getRoom_id() + "").navigation();
}else if (item.getRoom_id() == 0 && item.getUrl() != null && !item.getUrl().isEmpty()){
ARouter.getInstance().build(ARouteConstants.H5).withString("url", item.getUrl()).navigation();
}
}
});
// if (item.getType().equals("1")) {
// helper.getView(R.id.ll_system_official).setVisibility(GONE);
// } else if (item.getType().equals("2")) {
// helper.getView(R.id.tv_sys_con).setVisibility(GONE);
// helper.getView(R.id.ll_system_official).setVisibility(VISIBLE);
// } else {
// helper.getView(R.id.ll_system_official).setVisibility(GONE);
// }
// helper.getView(R.id.image).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
// }
// });
}
};
mBinding.recycleView.setAdapter(mAdapter);
MvpPre.getOfficialNotice("1","10",type);
MvpPre.getMessagetitle(type, "1", "10");
}
@Override
@@ -88,8 +115,15 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
return new NewsPresenter(this, this);
}
@Override
public void getOfficialNoticeList(List<NewsDataBean> newsDataBeans) {
mAdapter.setNewData(newsDataBeans);
public void showNews(List<NewsMessageList> newsList) {
mAdapter.setNewData(newsList);
}
@Override
public void finishRefresh() {
mBinding.smartRefreshLayout.finishRefresh();
mBinding.smartRefreshLayout.finishLoadMore();
}
}

View File

@@ -0,0 +1,133 @@
package com.qxcm.moduleutil.adapter;
import static com.qxcm.moduleutil.utils.UtilConfig.getContext;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import androidx.annotation.NonNull;
import android.text.Html;
import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.ScreenUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.AppUpdateModel;
import com.qxcm.moduleutil.databinding.DialogAppUpdateBinding;
import com.qxcm.moduleutil.utils.DownloadListener;
import com.qxcm.moduleutil.utils.DownloadUtil;
import com.qxcm.moduleutil.utils.logger.Logger;
import com.qxcm.moduleutil.widget.dialog.BaseDialog;
public class AppUpdateDialog extends BaseDialog<DialogAppUpdateBinding> implements DownloadListener, View.OnClickListener {
private AppUpdateModel appUpdateModel;
private ProgressDialog mProgressDialog;
public AppUpdateDialog(@NonNull Context context) {
super(context);
}
@Override
public int getLayoutId() {
return R.layout.dialog_app_update;
}
@Override
public void initView() {
Window window = getWindow();
window.setBackgroundDrawableResource(android.R.color.transparent);
window.setLayout((int) (ScreenUtils.getScreenWidth() * 305 / 375), WindowManager.LayoutParams.WRAP_CONTENT);
mBinding.tvContent.setMovementMethod(new ScrollingMovementMethod());
mBinding.btUpdate.setOnClickListener(this::onClick);
}
@Override
public void initData() {
}
@Override
public void onClick(View view) {
if (appUpdateModel != null) {
mProgressDialog = new ProgressDialog(getContext()) {
@Override
public void onBackPressed() {
}
};
mProgressDialog.setMax(100);//设置最大值
mProgressDialog.setTitle("安装包下载");//设置标题
mProgressDialog.setIcon(R.mipmap.ic_launcher);//设置标题小图标
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);//设置样式为横向显示进度的样式
mProgressDialog.incrementProgressBy(0);//设置初始值为0其实可以不用设置默认就是0
mProgressDialog.setIndeterminate(false);//是否精确显示对话框flase为是反之为否
mProgressDialog.setCanceledOnTouchOutside(false);
mProgressDialog.setMessage("下载中请稍等!!!");
mProgressDialog.show();
DownloadUtil downloadUtil = new DownloadUtil(getContext());
downloadUtil.downloadFile(appUpdateModel.getUrl(), this);
}
}
public void setAppUpdateModel(AppUpdateModel appUpdateModel) {
this.appUpdateModel = appUpdateModel;
mBinding.tvContent.setText(TextUtils.isEmpty(appUpdateModel.getContent()) ? "修复旧版本已知bug" : Html.fromHtml(appUpdateModel.getContent()));
}
@Override
public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
return true;
}
if (keyCode == KeyEvent.KEYCODE_SEARCH) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public void onStart() {
}
@Override
public void onProgress(int currentLength) {
if (mProgressDialog != null) {
mProgressDialog.setProgress(currentLength);
}
}
@Override
public void onFinish(String localPath) {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
try {
AppUtils.installApp(localPath);
} catch (Exception e) {
Logger.e("installAppError", e);
onFailure();
}
dismiss();
}
@Override
public void onFailure() {
ToastUtils.showShort("下载失败前往浏览器手动更新");
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri url = Uri.parse(appUpdateModel.getUrl());
intent.setData(url);
getContext().startActivity(intent);
}
}

View File

@@ -1,12 +1,10 @@
package com.example.modulevocal.adapter;
import android.view.View;
package com.qxcm.moduleutil.adapter;
import androidx.annotation.NonNull;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.modulevocal.R;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.RechargeBean;
import java.util.List;
@@ -41,7 +39,7 @@ public class BalanceRechargeAdapter extends BaseMultiItemQuickAdapter<RechargeBe
if (type == ITEM_TYPE_NORMAL) {
// 正常 item 显示逻辑
helper.setText(R.id.tv_gold_num, item.getGoldNum());
helper.setText(R.id.tv_gold_num, item.getCoins());
helper.setText(R.id.tv_money, String.format("¥%s", item.getMoney()));
if (selectedPosition == helper.getAdapterPosition()) {
helper.setBackgroundRes(R.id.cl_item, com.qxcm.moduleutil.R.drawable.bg_10_white_sele);

View File

@@ -1,18 +1,37 @@
package com.qxcm.moduleutil.adapter;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
import android.content.Intent;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.TimeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.CircleListBean;
import com.qxcm.moduleutil.generated.callback.OnClickListener;
import com.qxcm.moduleutil.bean.HeatedBean;
import com.qxcm.moduleutil.utils.ImageUtils;
import com.qxcm.moduleutil.utils.MeHeadView;
import com.qxcm.moduleutil.utils.NumberFormatUtils;
import com.qxcm.moduleutil.utils.SpUtil;
import com.qxcm.moduleutil.widget.MyGridView;
import com.qxcm.moduleutil.widget.img.FullScreenUtil;
@@ -20,18 +39,31 @@ import java.util.Arrays;
import java.util.List;
public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewHolder> {
public CirleListAdapter() {
public static final int PAGE_HOME = 0; // 首页
public static final int PAGE_SEARCH = 2; // 点击头像进入的
private int mPageType;
public CirleListAdapter(int pageType) {
super(R.layout.item_cirle_list);
this.mPageType = pageType;
}
public interface OnItemClickListener {
void onDianzanClick(CircleListBean item);
void onHeadImageClick(CircleListBean item);
void onZsClick(CircleListBean item);
void onDiandianClick(CircleListBean item);
void onPinglunClick(CircleListBean item);
void onRelaClick(CircleListBean item);
void onGensui(CircleListBean item);
}
private OnItemClickListener mListener;
public void setOnItemClickListener(OnItemClickListener listener) {
@@ -43,24 +75,28 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
helper.addOnClickListener(com.qxcm.moduleutil.R.id.dianzan)
.addOnClickListener(R.id.dy_lookmore_tv)
.addOnClickListener(R.id.dy_head_image)
.addOnClickListener(R.id.dy_oneimage_iv)
.addOnClickListener(R.id.diandian)
.addOnClickListener(R.id.pinglun)
.addOnClickListener(R.id.rela)
.addOnClickListener(R.id.gensui)
.addOnClickListener(com.qxcm.moduleutil.R.id.zs);
//先让单图,多图,音频的布局显示
helper.getView(R.id.dy_oneimage_iv).setVisibility(View.VISIBLE);
helper.getView(R.id.dy_image_recyc).setVisibility(View.VISIBLE);
helper.getView(R.id.dy_image_recyc).setVisibility(VISIBLE);
helper.getView(R.id.iv_jubao).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// ARouter.getInstance().build(AroutUtil.COMMUNITY_JUBAO).withString("uid", item.getUid() + "").navigation();
// Intent intent = new Intent(mContext, UserHomepageActivity.class);
// intent.putExtra("userId", SpUtil.getUserId()+"");
// startActivity(intent);
}
});
// 设置点击回调
helper.getView(com.qxcm.moduleutil.R.id.dianzan).setOnClickListener(v -> {
if (mListener != null) mListener.onDianzanClick(item);
if (mListener != null){
mListener.onDianzanClick(item);
}
});
helper.getView(com.qxcm.moduleutil.R.id.dy_head_image).setOnClickListener(v -> {
@@ -75,24 +111,37 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
if (mListener != null) mListener.onDiandianClick(item);
});
helper.getView(R.id.pinglun).setOnClickListener(v->{
helper.getView(R.id.pinglun).setOnClickListener(v -> {
if (mListener != null) mListener.onPinglunClick(item);
});
helper.getView(R.id.rela).setOnClickListener(v -> {
if (mListener != null) mListener.onRelaClick(item);
});
helper.getView(R.id.gensui).setOnClickListener(v -> {
if (mListener != null) mListener.onGensui(item);
});
// 为整个 item 设置点击事件
helper.itemView.setOnClickListener(v -> {
if (mListener != null) {
mListener.onPinglunClick(item); // 复用 onHeadImageClick 作为跳转逻辑
}
});
//昵称
helper.setText(R.id.dy_name_text, item.getNickname());
//头像
ImageUtils.loadHeadCC(item.getAvatar(), (ImageView) helper.getView(R.id.dy_head_image));
// ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.dy_head_image));
MeHeadView headView = helper.getView(R.id.dy_head_image);
headView.setData(item.getAvatar(), "", item.getSex() + "");
//动态内容以富文本展示
String content = item.getContent();
if (content == null || content.length() == 0) {
helper.getView(R.id.dy_lookmore_tv).setVisibility(View.GONE);
helper.getView(R.id.dy_content_tv).setVisibility(View.GONE);
helper.getView(R.id.dy_lookmore_tv).setVisibility(GONE);
helper.getView(R.id.dy_content_tv).setVisibility(GONE);
} else {
helper.getView(R.id.dy_lookmore_tv).setVisibility(View.VISIBLE);
helper.getView(R.id.dy_content_tv).setVisibility(View.VISIBLE);
helper.getView(R.id.dy_lookmore_tv).setVisibility(VISIBLE);
helper.getView(R.id.dy_content_tv).setVisibility(VISIBLE);
}
helper.getView(R.id.dy_lookmore_tv).getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
@@ -101,67 +150,110 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
TextView view = helper.getView(R.id.dy_content_tv);
int lineCount = view.getLineCount();
if (lineCount >= 7) {
helper.getView(R.id.dy_lookmore_tv).setVisibility(View.VISIBLE);
helper.getView(R.id.dy_lookmore_tv).setVisibility(VISIBLE);
helper.getView(R.id.dy_content_tv).getViewTreeObserver().removeOnPreDrawListener(this);//销毁
} else {
helper.getView(R.id.dy_lookmore_tv).setVisibility(View.GONE);
helper.getView(R.id.dy_lookmore_tv).setVisibility(GONE);
helper.getView(R.id.dy_content_tv).getViewTreeObserver().removeOnPreDrawListener(this);//销毁
}
return true;
}
});
helper.setText(R.id.dy_content_tv, content);
if (TextUtils.isEmpty(content)) {
TextView view = helper.getView(R.id.dy_content_tv);
view.setVisibility(View.GONE);
view.setVisibility(GONE);
} else {
TextView view = helper.getView(R.id.dy_content_tv);
view.setVisibility(View.VISIBLE);
view.setVisibility(VISIBLE);
}
// 创建 SpannableString 来拼接 title 并设置点击事件
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
spannableStringBuilder.append(content).append(" "); // 添加原始内容
if (item.getTitle() != null) {
helper.setVisible(R.id.dy_more_tv, true);
helper.setText(R.id.dy_more_tv, item.getTitle().replace("#", ""));
}else {
helper.setVisible(R.id.dy_more_tv, false);
}
//点赞
helper.setText(R.id.dy_fabulous, item.getLike_num());
if (item.getIs_like() == 1) {
TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
helper.setImageResource(R.id.dianzan_image, R.mipmap.dongtai_hudong_yidianzan);
} else {
TextView dy_fabulous = helper.getView(R.id.dy_fabulous);
helper.setImageResource(R.id.dianzan_image, com.qxcm.moduleutil.R.mipmap.dongtai_hudong_dianzan);
for (int i = 0; i < item.getTitle().size(); i++) {
HeatedBean heatedBean = item.getTitle().get(i);
String title = heatedBean != null ? heatedBean.getTitle() : "";
// 添加 title 到 SpannableString
spannableStringBuilder.append(title);
// 创建点击事件和颜色
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View widget) {
// 处理点击事件,比如跳转
// Intent intent = new Intent(mContext, TargetActivity.class);
// intent.putExtra("url", item.getUrl()); // 传递 URL 或其他参数
// mContext.startActivity(intent);
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(ContextCompat.getColor(mContext, R.color.color_0DFFB9)); // 设置文字颜色
ds.setUnderlineText(false); // 去掉下划线
}
};
// 设置点击效果
spannableStringBuilder.setSpan(clickableSpan, spannableStringBuilder.length() - title.length(), spannableStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
TextView textView = helper.getView(R.id.dy_content_tv);
textView.setMovementMethod(LinkMovementMethod.getInstance()); // 允许点击
textView.setHighlightColor(0); // 去掉点击时的背景色
textView.setText(spannableStringBuilder);
}
if (item.getIs_room()!=null && item.getIs_room().equals("0")){
helper.setVisible(R.id.gensui,false);
if (item.getIs_like() == 1) {
helper.setImageResource(R.id.dianzan_image, R.mipmap.dongtai_hudong_yidianzan);
// helper.setText(R.id.dy_fabulous, String.valueOf(Integer.parseInt(item.getLike_num()) + 1));
} else {
helper.setImageResource(R.id.dianzan_image, com.qxcm.moduleutil.R.mipmap.dongtai_hudong_dianzan);
// helper.setText(R.id.dy_fabulous, item.getLike_num());
}
helper.setText(R.id.dy_fabulous, item.getLike_num());
if (mPageType==PAGE_SEARCH){
helper.setVisible(R.id.gensui, false);
}else {
helper.setVisible(R.id.gensui,true);
if (item.getUser_id()==SpUtil.getUserId()){
helper.setVisible(R.id.gensui, false);
}else {
helper.setVisible(R.id.gensui, true);
}
}
if (item.getRoom_id() != null && !item.getRoom_id().equals("0")) {
helper.setText(R.id.gensui, "跟随");
} else if (item.getRoom_id() == null || item.getRoom_id().equals("0")){
helper.setText(R.id.gensui, "私信");
}
//分享数
helper.setText(R.id.dy_zs, item.getRewards_num()!=null ? item.getRewards_num() : "0");
// helper.setText(R.id.dy_zs, item.getRewards_num() != null ? item.getRewards_num() : "0");
double rewardNum = item.getRewards_num() != null ? Double.parseDouble(item.getRewards_num()) : 0;
helper.setText(R.id.dy_zs, NumberFormatUtils.formatRewardNumber(rewardNum));
//评论数
helper.setText(R.id.dy_comment, item.getComment_num() + "");
//时间
if (!item.getCreatetime().isEmpty()) {
try {
helper.setText(R.id.dy_time_text, "发布于:"+TimeUtils.millis2String(Long.parseLong(item.getCreatetime()) * 1000));
helper.setText(R.id.dy_time_text, TimeUtils.millis2String(Long.parseLong(item.getCreatetime()) * 1000));
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
if (item.getImages()!=null) {
//显示图片
if (item.getImages() != null && !item.getImages().isEmpty()) {
String[] arrIv = item.getImages().split(",");
// String[] arrIv = Arrays.asList(item.getImages().split(",")).toArray(new String[item.getImages().size()]);
int length = arrIv.length;
OneImageYuanJiaoAdapter oneImageYuanJiaoAdapter = new OneImageYuanJiaoAdapter(mContext);
MyGridView recyclerView = helper.getView(R.id.dy_image_recyc);
recyclerView.setNumColumns(3);
@@ -171,14 +263,55 @@ public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewH
for (int j = 0; j < arrIv.length; j++) {
oneImageYuanJiaoAdapter.getList_adapter().add(arrIv[j]);
}
helper.getView(R.id.dy_oneimage_iv).setVisibility(View.GONE);
oneImageYuanJiaoAdapter.notifyDataSetChanged();
recyclerView.setOnItemClickListener((parent, view, position, id) -> {
FullScreenUtil.showFullScreenDialog(mContext, position, oneImageYuanJiaoAdapter.getList_adapter());
});
}else {
helper.getView(R.id.dy_image_recyc).setVisibility(View.GONE);
}
if (item.getLike_list() == null){
helper.getView(R.id.rela).setVisibility(GONE);
helper.getView(R.id.view).setVisibility(VISIBLE);
}else {
helper.getView(R.id.rela).setVisibility(VISIBLE);
helper.getView(R.id.view).setVisibility(GONE);
RecyclerView recyclerView= helper.getView(R.id.recycle_view);
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
LikeUserAdapter<CircleListBean.LikeList> likeUserAdapter = new LikeUserAdapter<>();
recyclerView.setAdapter(likeUserAdapter);
likeUserAdapter.setNewData(item.getLike_list());
helper.setText(R.id.pinglun_tv, item.getLike_num()+"人点赞");
}
}
public static final String PAYLOAD_LIKE = "like";
public void updateLikeStatusOnly(int position, int isLike) {
notifyItemChanged(position, PAYLOAD_LIKE);
}
@Override
public void onBindViewHolder(@NonNull BaseViewHolder holder, int position, @NonNull List<Object> payloads) {
if (payloads.isEmpty()) {
onBindViewHolder(holder, position); // 全量绑定
} else {
for (Object payload : payloads) {
if (payload.equals(PAYLOAD_LIKE)) {
CircleListBean item = getData().get(position);
if (item.getIs_like() == 1) {
holder.setImageResource(R.id.dianzan_image, R.mipmap.dongtai_hudong_yidianzan);
holder.setText(R.id.dy_fabulous, String.valueOf(Integer.parseInt(item.getLike_num()) + 1));
} else {
holder.setImageResource(R.id.dianzan_image, com.qxcm.moduleutil.R.mipmap.dongtai_hudong_dianzan);
holder.setText(R.id.dy_fabulous, item.getLike_num());
}
}
}
}
}
}

View File

@@ -1,34 +1,63 @@
package com.qxcm.moduleutil.adapter;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.blankj.utilcode.util.TimeUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.CommentBean;
import com.qxcm.moduleutil.dialog.ReplyDialogFragment;
import com.qxcm.moduleutil.utils.MeHeadView;
import com.qxcm.moduleutil.utils.SpUtil;
import java.util.ArrayList;
import java.util.List;
public class CommentAdapter extends RecyclerView.Adapter<CommentAdapter.CommentViewHolder> {
public interface OnCommentInteractionListener {
void onInputBoxShow(int id,String s,int position,String replyTo);
void onDetaleClick(int id,int position);
// 新增长按回调
void onCommentLongClick(CommentBean.CommentDetailsBean comment, CommentBean.CommentDetailsBean.Replies reply, int position);
}
private OnCommentInteractionListener listener; // 新增监听器引用
public void setOnCommentInteractionListener(OnCommentInteractionListener listener) {
this.listener = listener;
}
private List<CommentBean.CommentDetailsBean> commentList;
private static FragmentManager fragmentManager = null;
public CommentAdapter(List<CommentBean.CommentDetailsBean> commentList) {
this.commentList = commentList;
}
public void updateData(List<CommentBean.CommentDetailsBean> newReplyList) {
commentList.clear();
commentList.addAll(newReplyList);
notifyDataSetChanged();
DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new CommentDiffCallback(this.commentList, newReplyList));
this.commentList.clear();
this.commentList.addAll(newReplyList);
diffResult.dispatchUpdatesTo(this);
}
@NonNull
@Override
@@ -40,7 +69,7 @@ public class CommentAdapter extends RecyclerView.Adapter<CommentAdapter.CommentV
@Override
public void onBindViewHolder(@NonNull CommentViewHolder holder, int position) {
CommentBean.CommentDetailsBean comment = commentList.get(position);
holder.bind(comment);
holder.bind(comment, listener, position);
}
@@ -54,24 +83,33 @@ public class CommentAdapter extends RecyclerView.Adapter<CommentAdapter.CommentV
private TextView tvNickname;
private TextView tvContent;
private RecyclerView rvReplies;
private TextView btnReply;
private TextView btnReply,btnDetale;
private TextView tvTime;
private TextView btnShowAllReplies;
private TextView tv_send;
private EditText et_input;
public CommentViewHolder(@NonNull View itemView) {
super(itemView);
ivAvatar = itemView.findViewById(R.id.iv_avatar);
tvNickname = itemView.findViewById(R.id.tv_nickname);
tvContent = itemView.findViewById(R.id.tv_content);
// rvReplies = itemView.findViewById(R.id.rv_replies);
rvReplies = itemView.findViewById(R.id.rv_replies);
btnReply = itemView.findViewById(R.id.btn_reply);
btnDetale=itemView.findViewById(R.id.btn_detale);
tvTime = itemView.findViewById(R.id.tv_time);
btnShowAllReplies = itemView.findViewById(R.id.btn_show_all_replies);
tv_send= itemView.findViewById(R.id.tv_send);
et_input= itemView.findViewById(R.id.et_input);
// 设置子评论的适配器
// LinearLayoutManager layoutManager = new LinearLayoutManager(itemView.getContext());
// rvReplies.setLayoutManager(layoutManager);
// ReplyAdapter replyAdapter = new ReplyAdapter(new ArrayList<>());
// rvReplies.setAdapter(replyAdapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(itemView.getContext());
rvReplies.setLayoutManager(layoutManager);
ReplyAdapter replyAdapter = new ReplyAdapter(new ArrayList<>());
rvReplies.setAdapter(replyAdapter);
}
public void bind(CommentBean.CommentDetailsBean comment) {
public void bind(CommentBean.CommentDetailsBean comment, OnCommentInteractionListener listener, int position) {
// 绑定主评论数据
tvNickname.setText(comment.getNickname());
tvContent.setText(comment.getContent());
@@ -79,21 +117,108 @@ public class CommentAdapter extends RecyclerView.Adapter<CommentAdapter.CommentV
// 加载用户头像(使用 Glide 或其他图片加载库)
// Glide.with(itemView).load(comment.getAvatar()).into(ivAvatar);
// 绑定子评论数据
// ReplyAdapter replyAdapter = (ReplyAdapter) rvReplies.getAdapter();
// if (replyAdapter != null) {
// replyAdapter.updateData(comment.getReplies());
// }
if (comment.getUser_id()==SpUtil.getUserId()){
btnDetale.setVisibility(View.VISIBLE);
}else {
btnDetale.setVisibility(View.GONE);
}
tvTime.setText(TimeUtils.millis2String(Long.parseLong(comment.getCreatetime()+"") * 1000));
// 绑定子评论数据
ReplyAdapter replyAdapter = (ReplyAdapter) rvReplies.getAdapter();
if (replyAdapter != null) {
if (comment.getReplies() != null&& comment.getReplies().size() > 0) {
rvReplies.setVisibility(VISIBLE);
replyAdapter.updateData(comment.getReplies());
// 控制“全部评论...”按钮的显示
btnShowAllReplies.setVisibility(comment.getReplies().size() > 2 ? VISIBLE : GONE);
btnShowAllReplies.setOnClickListener(v -> {
replyAdapter.setExpanded(true); // 展开所有评论
btnShowAllReplies.setVisibility(GONE); // 隐藏按钮
});
replyAdapter.setOnReplyClickListener((reply, position1) -> {
if (listener != null) {
// 构造回复内容(如 @用户名)
String replyContent = "@" + reply.getNickname() + " ";
listener.onInputBoxShow(reply.getPid(), replyContent, getAdapterPosition(),reply.getReply_to()+"");
}
});
replyAdapter.setOnReplyLongClickListener((reply, replyPosition) -> {
if (listener != null) {
// 转发到Activity
listener.onCommentLongClick(comment,reply, replyPosition);
}
});
}else {
rvReplies.setVisibility(GONE);
}
}
// 点击回复按钮
btnReply.setOnClickListener(v -> {
// 弹出输入框让用户输入回复内容
showReplyDialog(comment.getId());
if (listener != null) {
// 传递需要的参数
listener.onInputBoxShow(comment.getId(), "", position,"");
}
});
btnDetale.setOnClickListener(v -> {
if (listener != null) {
listener.onDetaleClick(comment.getId(), position); // 点击删除按钮
}
});
// if (comment.getUser_id()!= SpUtil.getUserId()){
// btnReply.setVisibility(GONE);
// }else {
// btnReply.setVisibility(VISIBLE);
// }
// 添加长按监听
itemView.setOnLongClickListener(v -> {
if (listener != null) {
listener.onCommentLongClick(comment, null,position);
}
return true; // 消费事件
});
}
private void showReplyDialog(int commentId) {
// 调用弹窗逻辑,传递 commentId 和 FragmentManager
}
static class CommentDiffCallback extends DiffUtil.Callback {
private final List<CommentBean.CommentDetailsBean> oldList;
private final List<CommentBean.CommentDetailsBean> newList;
public CommentDiffCallback(List<CommentBean.CommentDetailsBean> oldList, List<CommentBean.CommentDetailsBean> newList) {
this.oldList = oldList;
this.newList = newList;
}
@Override
public int getOldListSize() {
return oldList.size();
}
@Override
public int getNewListSize() {
return newList.size();
}
@Override
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
return oldList.get(oldItemPosition).getId() == newList.get(newItemPosition).getId();
}
@Override
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
return oldList.get(oldItemPosition).equals(newList.get(newItemPosition));
}
}
}

View File

@@ -0,0 +1,108 @@
package com.qxcm.moduleutil.adapter;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.ArrayList;
import java.util.List;
/**
*@author qx
*@data 2025/6/9
*@description:可动态添加和删除的viewPage适配器
*/
public class CommonPageAdapter extends FragmentPagerAdapter {
private List<Fragment> mFragmentList = new ArrayList<>();
private List<Integer> mItemIdList = new ArrayList<>();
private int id = 0;
private FragmentManager mFm;
public CommonPageAdapter(FragmentManager fm, @NonNull List<Fragment> fragmentList) {
super(fm);
this.mFm = fm;
for (Fragment fragment : fragmentList) {
this.mFragmentList.add(fragment);
mItemIdList.add(id++);
}
}
public CommonPageAdapter(FragmentManager fm) {
super(fm);
}
public List<Fragment> getFragmentList() {
return mFragmentList;
}
public void addPage(int index, Fragment fragment) {
mFragmentList.add(index, fragment);
mItemIdList.add(index, id++);
notifyDataSetChanged();
}
public void addPage(Fragment fragment) {
mFragmentList.add(fragment);
mItemIdList.add(id++);
notifyDataSetChanged();
}
public void delPage(int index) {
mFragmentList.remove(index);
mItemIdList.remove(index);
notifyDataSetChanged();
}
public void updatePage(List<Fragment> fragmentList) {
mFragmentList.clear();
mItemIdList.clear();
for (int i = 0; i < fragmentList.size(); i++) {
mFragmentList.add(fragmentList.get(i));
mItemIdList.add(id++);//注意这里是id++不是i++。
}
notifyDataSetChanged();
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
/**
* 返回值有三种,
* POSITION_UNCHANGED 默认值,位置没有改变
* POSITION_NONE item已经不存在
* position item新的位置
* 当position发生改变时这个方法应该返回改变后的位置以便页面刷新。
*/
@Override
public int getItemPosition(Object object) {
if (object instanceof Fragment) {
if (mFragmentList.contains(object)) {
return mFragmentList.indexOf(object);
} else {
return POSITION_NONE;
}
}
return super.getItemPosition(object);
}
public void updateFragments(List<Fragment> newFragments) {
this.mFragmentList.clear();
this.mFragmentList.addAll(newFragments);
notifyDataSetChanged();
}
@Override
public long getItemId(int position) {
return mItemIdList.get(position);
}
}

View File

@@ -0,0 +1,173 @@
package com.qxcm.moduleutil.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.view.GestureDetector;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.GiftPackBean;
import com.qxcm.moduleutil.bean.RoonGiftModel;
import com.qxcm.moduleutil.event.RoomGiftClickToEvent;
import com.qxcm.moduleutil.event.RoomGiftPackToEvent;
import com.qxcm.moduleutil.utils.ImageUtils;
import org.greenrobot.eventbus.EventBus;
import java.lang.ref.WeakReference;
import java.util.List;
/**
* @Author lxj$
* @Time 2025年7月29日23:36:25$ $
* @Description 背包礼物适配器$
*/
public class GiftPackAdapter extends BaseAdapter {
private final List<GiftPackBean> mDatas;
private final LayoutInflater inflater;
private final Context mContext;
private final MyGestureDetector gestureDetector;
private final String type;
/**
* 页数下标,从0开始(当前是第几页)
*/
private final int curIndex;
/**
* 每一页显示的个数
*/
private final int pageSize = 100;
public GiftPackAdapter(Context context, List<GiftPackBean> mDatas, int curIndex, String type) {
inflater = LayoutInflater.from(context);
this.mDatas = mDatas;
this.curIndex = curIndex;
this.mContext = context;
this.type = type;
this.gestureDetector = new MyGestureDetector(mContext);
}
/**
* 先判断数据集的大小是否足够显示满本页mDatas.size() > (curIndex+1)*pageSize,
* 如果够则直接返回每一页显示的最大条目个数pageSize,
* 如果不够,则有几项返回几,(mDatas.size() - curIndex * pageSize);(也就是最后一页的时候就显示剩余item)
*/
@Override
public int getCount() {
return mDatas.size() > (curIndex + 1) * pageSize ? pageSize : (mDatas.size() - curIndex * pageSize);
}
@Override
public GiftPackBean getItem(int position) {
return mDatas.get(position + curIndex * pageSize);
}
@Override
public long getItemId(int position) {
return position + (long) curIndex * pageSize;
}
private static class MyGestureDetector extends GestureDetector {
private static WeakReference<GiftPackAdapter> sAdapter = new WeakReference<>(null);
private static GiftPackBean sGiftModel;
private GiftPackAdapter mAdapter;
private GiftPackBean mGiftModel;
public void setGiftModel(GiftPackAdapter adapter, GiftPackBean gift) {
sAdapter = new WeakReference<>(adapter);
sGiftModel = gift;
}
private static final SimpleOnGestureListener sSimpleOnGestureListener = new SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
EventBus.getDefault().post(new RoomGiftPackToEvent(sAdapter.get(), sGiftModel, 1));
return true;
}
@Override
public boolean onDoubleTap(MotionEvent e) {
EventBus.getDefault().post(new RoomGiftPackToEvent(sAdapter.get(), sGiftModel, 2));
return true;
}
};
public MyGestureDetector(Context context) {
super(context, sSimpleOnGestureListener);
setOnDoubleTapListener(sSimpleOnGestureListener);
}
}
@Override
@SuppressLint({"SetTextI18n", "ClickableViewAccessibility"})
public View getView(int position, View convertView, ViewGroup parent) {
GiftPackAdapter.ViewHolder viewHolder;
GiftPackBean giftModel = getItem(position);
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_gift_room, parent, false);
viewHolder = new GiftPackAdapter.ViewHolder();
viewHolder.tv_gift_name = (TextView) convertView.findViewById(R.id.tv_gift_name);
viewHolder.tv_gift_price = (TextView) convertView.findViewById(R.id.tv_gift_price);
viewHolder.iv_gift_pic = (ImageView) convertView.findViewById(R.id.iv_gift_pic);
viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift);
viewHolder.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on);
viewHolder.cl_iv_down_on = (ConstraintLayout) convertView.findViewById(R.id.cl_iv_down_on);
convertView.setTag(viewHolder);
} else {
viewHolder = (GiftPackAdapter.ViewHolder) convertView.getTag();
}
viewHolder.item_layout.setOnClickListener(v -> {
// RoonGiftModel clickedModel = (RoonGiftModel) v.getTag();
EventBus.getDefault().post(new RoomGiftPackToEvent(this, giftModel, 1));
});
//设置礼物名字
viewHolder.tv_gift_name.setText(giftModel.getGift_name());
//设置礼物价格
String surplusTxt = giftModel.getGift_price();
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(surplusTxt);
//ForegroundColorSpan 为文字前景色BackgroundColorSpan为文字背景色
ForegroundColorSpan redSpan = new ForegroundColorSpan(mContext.getResources().getColor(R.color.color_FFA9A9A9));
stringBuilder.setSpan(redSpan, surplusTxt.length(), surplusTxt.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);//修改最后两个字体的颜色
viewHolder.tv_gift_price.setText(stringBuilder);
// viewHolder.item_layout.setTag(R.id.id_gift_tag, giftModel);
//加载礼物图片
ImageUtils.loadImageView(giftModel.getBase_image(), viewHolder.iv_gift_pic);
//设置选中后的样式
if (giftModel.isChecked()) {//被选中
viewHolder.cl_iv_down_on.setBackgroundResource(R.mipmap.room_gift_bjx);
viewHolder.ivDownOn.setVisibility(View.GONE);
} else {
viewHolder.ivDownOn.setVisibility(View.GONE);
viewHolder.cl_iv_down_on.setBackgroundResource(0);
}
return convertView;
}
static class ViewHolder {
public ConstraintLayout item_layout;
public TextView tv_gift_name, tv_gift_price, tv_gift_num;
public ImageView iv_gift_pic;
public TextView tv_gift_change_love_values;
public ImageView ivDownOn;
public ConstraintLayout cl_iv_down_on;
}
}

View File

@@ -0,0 +1,228 @@
package com.qxcm.moduleutil.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.GestureDetector;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.RoonGiftModel;
import com.qxcm.moduleutil.event.RoomGiftClickToEvent;
import com.qxcm.moduleutil.utils.ImageUtils;
import org.greenrobot.eventbus.EventBus;
import java.lang.ref.WeakReference;
import java.util.List;
public class GiftRoomAdapter extends BaseAdapter {
private final List<RoonGiftModel> mDatas;
private final LayoutInflater inflater;
private final Context mContext;
private final MyGestureDetector gestureDetector;
private final String type;
/**
* 页数下标,从0开始(当前是第几页)
*/
private final int curIndex;
/**
* 每一页显示的个数
*/
private final int pageSize = 100;
public GiftRoomAdapter(Context context, List<RoonGiftModel> mDatas, int curIndex, String type) {
inflater = LayoutInflater.from(context);
this.mDatas = mDatas;
this.curIndex = curIndex;
this.mContext = context;
this.type = type;
this.gestureDetector = new MyGestureDetector(mContext);
}
/**
* 先判断数据集的大小是否足够显示满本页mDatas.size() > (curIndex+1)*pageSize,
* 如果够则直接返回每一页显示的最大条目个数pageSize,
* 如果不够,则有几项返回几,(mDatas.size() - curIndex * pageSize);(也就是最后一页的时候就显示剩余item)
*/
@Override
public int getCount() {
return mDatas.size() > (curIndex + 1) * pageSize ? pageSize : (mDatas.size() - curIndex * pageSize);
}
@Override
public RoonGiftModel getItem(int position) {
return mDatas.get(position + curIndex * pageSize);
}
@Override
public long getItemId(int position) {
return position + (long) curIndex * pageSize;
}
private static class MyGestureDetector extends GestureDetector {
private static WeakReference<GiftRoomAdapter> sAdapter = new WeakReference<>(null);
private static RoonGiftModel sGiftModel;
private GiftRoomAdapter mAdapter;
private RoonGiftModel mGiftModel;
public void setGiftModel(GiftRoomAdapter adapter, RoonGiftModel gift) {
sAdapter = new WeakReference<>(adapter);
sGiftModel = gift;
}
private static final SimpleOnGestureListener sSimpleOnGestureListener = new SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
EventBus.getDefault().post(new RoomGiftClickToEvent(sAdapter.get(), sGiftModel, 1));
return true;
}
@Override
public boolean onDoubleTap(MotionEvent e) {
EventBus.getDefault().post(new RoomGiftClickToEvent(sAdapter.get(), sGiftModel, 2));
return true;
}
};
public MyGestureDetector(Context context) {
super(context, sSimpleOnGestureListener);
setOnDoubleTapListener(sSimpleOnGestureListener);
}
}
// private static class MyGestureDetector extends GestureDetector {
// private GiftRoomAdapter mAdapter;
// private RoonGiftModel mGiftModel;
//
// public MyGestureDetector(Context context) {
// super(context, new SimpleOnGestureListener() {
// @Override
// public boolean onSingleTapConfirmed(MotionEvent e) {
// if (mAdapter != null && mGiftModel != null) {
// EventBus.getDefault().post(new RoomGiftClickToEvent(mAdapter, mGiftModel, 1));
// }
// return true;
// }
//
// @Override
// public boolean onDoubleTap(MotionEvent e) {
// if (mAdapter != null && mGiftModel != null) {
// EventBus.getDefault().post(new RoomGiftClickToEvent(mAdapter, mGiftModel, 2));
// }
// return true;
// }
// });
// setOnDoubleTapListener(getListener());
// }
//
// public void setGiftModel(GiftRoomAdapter adapter, RoonGiftModel giftModel) {
// this.mAdapter = adapter;
// this.mGiftModel = giftModel;
// }
// }
@Override
@SuppressLint({"SetTextI18n", "ClickableViewAccessibility"})
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
RoonGiftModel giftModel = getItem(position);
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_gift_room, parent, false);
viewHolder = new ViewHolder();
viewHolder.tv_gift_name = (TextView) convertView.findViewById(R.id.tv_gift_name);
viewHolder.tv_gift_price = (TextView) convertView.findViewById(R.id.tv_gift_price);
viewHolder.iv_gift_pic = (ImageView) convertView.findViewById(R.id.iv_gift_pic);
viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift);
viewHolder.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on);
viewHolder.cl_iv_down_on = (ConstraintLayout) convertView.findViewById(R.id.cl_iv_down_on);
// viewHolder.tv_gift_num = convertView.findViewById(R.id.tv_gift_num);
// viewHolder.tv_gift_change_love_values = convertView.findViewById(R.id.tv_gift_change_love_values);
// viewHolder.item_layout.setOnTouchListener((v, event) -> {
// gestureDetector.setGiftModel(GiftRoomAdapter.this, giftModel);
// gestureDetector.onTouchEvent(event);
//
// return true;
// });
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.item_layout.setOnClickListener(v -> {
// RoonGiftModel clickedModel = (RoonGiftModel) v.getTag();
EventBus.getDefault().post(new RoomGiftClickToEvent(this, giftModel, 1));
});
/*
* 在给View绑定显示的数据时计算正确的position = position + curIndex * pageSize
*/
// viewHolder.tv_gift_num.setVisibility(type.equals("1") ? View.VISIBLE : View.INVISIBLE);
// viewHolder.tv_gift_change_love_values.setVisibility(View.GONE);
//设置礼物名字
viewHolder.tv_gift_name.setText(giftModel.getGift_name());
//设置礼物价格
String surplusTxt = giftModel.getGift_price();
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(surplusTxt);
//ForegroundColorSpan 为文字前景色BackgroundColorSpan为文字背景色
ForegroundColorSpan redSpan = new ForegroundColorSpan(mContext.getResources().getColor(R.color.color_FFA9A9A9));
stringBuilder.setSpan(redSpan, surplusTxt.length(), surplusTxt.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);//修改最后两个字体的颜色
viewHolder.tv_gift_price.setText(stringBuilder);
// viewHolder.item_layout.setTag(R.id.id_gift_tag, giftModel);
//加载礼物图片
ImageUtils.loadImageView(giftModel.getBase_image(), viewHolder.iv_gift_pic);
//设置选中后的样式
if (giftModel.isChecked()) {//被选中
viewHolder.cl_iv_down_on.setBackgroundResource(R.mipmap.room_gift_bjx);
viewHolder.ivDownOn.setVisibility(View.GONE);
} else {
viewHolder.ivDownOn.setVisibility(View.GONE);
viewHolder.cl_iv_down_on.setBackgroundResource(0);
}
//设置
// //设置礼物心动值
// if (giftModel.getCardiac().equals("0")) {
// viewHolder.tv_gift_change_love_values.setBackgroundResource(R.mipmap.room_gift_xin_dong_reduce);
// viewHolder.tv_gift_change_love_values.setText(String.format("%s", giftModel.getCardiac()));
// } else {
// viewHolder.tv_gift_change_love_values.setBackgroundResource(R.mipmap.room_gift_xin_dong_add);
// viewHolder.tv_gift_change_love_values.setText(String.format("+%s", giftModel.getCardiac()));
// }
// if (giftModel.isManghe()) {
// viewHolder.tv_gift_change_love_values.setVisibility(View.GONE);
// }
return convertView;
}
static class ViewHolder {
public ConstraintLayout item_layout;
public TextView tv_gift_name, tv_gift_price, tv_gift_num;
public ImageView iv_gift_pic;
public TextView tv_gift_change_love_values;
public ImageView ivDownOn;
public ConstraintLayout cl_iv_down_on;
}
}

View File

@@ -20,6 +20,8 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.RoonGiftModel;
import com.qxcm.moduleutil.event.RoomGiftClickEvent;
import com.qxcm.moduleutil.event.RoomGiftClickToEvent;
import com.qxcm.moduleutil.utils.ImageUtils;
import org.greenrobot.eventbus.EventBus;
@@ -83,15 +85,13 @@ public class GiftTwoAdapter extends BaseAdapter {
private static final SimpleOnGestureListener sSimpleOnGestureListener = new SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
Log.d("@@", "sGiftModel"+sGiftModel.toString());
// EventBus.getDefault().post(new RoomGiftClickEvent(sAdapter.get(), sGiftModel, 1));
EventBus.getDefault().post(new RoomGiftClickEvent(sAdapter.get(), sGiftModel, 1));
return true;
}
@Override
public boolean onDoubleTap(MotionEvent e) {
Log.d("@@", "sGiftModel"+sGiftModel.toString());
// EventBus.getDefault().post(new RoomGiftClickEvent(sAdapter.get(), sGiftModel, 2));
EventBus.getDefault().post(new RoomGiftClickEvent(sAdapter.get(), sGiftModel, 2));
return true;
}
};
@@ -115,11 +115,11 @@ public class GiftTwoAdapter extends BaseAdapter {
viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift);
viewHolder.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on);
viewHolder.cl_iv_down_on = (ConstraintLayout) convertView.findViewById(R.id.cl_iv_down_on);
// viewHolder.tv_gift_num = convertView.findViewById(R.id.tv_gift_num);
viewHolder.tv_gift_num = convertView.findViewById(R.id.tv_number);
// viewHolder.tv_gift_change_love_values = convertView.findViewById(R.id.tv_gift_change_love_values);
viewHolder.item_layout.setOnTouchListener((v, event) -> {
// gestureDetector.setGiftModel(GiftTwoAdapter.this, (RoonGiftModel) v.getTag(R.id.id_gift_tag));
// gestureDetector.onTouchEvent(event);
gestureDetector.setGiftModel(GiftTwoAdapter.this, (RoonGiftModel) v.getTag(R.id.id_gift_tag));
gestureDetector.onTouchEvent(event);
return true;
});
@@ -135,9 +135,9 @@ public class GiftTwoAdapter extends BaseAdapter {
RoonGiftModel giftModel = getItem(position);
//设置礼物名字
viewHolder.tv_gift_name.setText(giftModel.getName());
viewHolder.tv_gift_name.setText(giftModel.getGift_name());
//设置礼物价格
String surplusTxt = giftModel.getPrice();
String surplusTxt = giftModel.getGift_price();
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(surplusTxt);
//ForegroundColorSpan 为文字前景色BackgroundColorSpan为文字背景色
ForegroundColorSpan redSpan = new ForegroundColorSpan(mContext.getResources().getColor(R.color.color_FFA9A9A9));
@@ -146,16 +146,19 @@ public class GiftTwoAdapter extends BaseAdapter {
// viewHolder.item_layout.setTag(R.id.id_gift_tag, giftModel);
//加载礼物图片
ImageUtils.loadImageView(giftModel.getPicture(), viewHolder.iv_gift_pic);
ImageUtils.loadImageView(giftModel.getBase_image(), viewHolder.iv_gift_pic);
//设置选中后的样式
if (giftModel.isChecked()) {//被选中
viewHolder.cl_iv_down_on.setBackgroundResource(R.drawable.gift_x);
viewHolder.cl_iv_down_on.setBackgroundResource(R.mipmap.room_gift_bjx);
viewHolder.ivDownOn.setVisibility(View.GONE);
} else {
viewHolder.ivDownOn.setVisibility(View.GONE);
viewHolder.cl_iv_down_on.setBackgroundResource(0);
}
viewHolder.tv_gift_num.setText(String.format("x%s", giftModel.getNum()));
//设置
// //设置礼物心动值
// if (giftModel.getCardiac().equals("0")) {
@@ -165,9 +168,9 @@ public class GiftTwoAdapter extends BaseAdapter {
// viewHolder.tv_gift_change_love_values.setBackgroundResource(R.mipmap.room_gift_xin_dong_add);
// viewHolder.tv_gift_change_love_values.setText(String.format("+%s", giftModel.getCardiac()));
// }
if (giftModel.isManghe()) {
viewHolder.tv_gift_change_love_values.setVisibility(View.GONE);
}
// if (giftModel.isManghe()) {
// viewHolder.tv_gift_change_love_values.setVisibility(View.GONE);
// }
return convertView;
}

View File

@@ -1,36 +1,54 @@
package com.qxcm.moduleutil.adapter;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.blankj.utilcode.util.ToastUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.base.BaseMvpFragment;
import com.qxcm.moduleutil.bean.GiftLabelBean;
import com.qxcm.moduleutil.bean.GiftPackBean;
import com.qxcm.moduleutil.bean.RewardUserBean;
import com.qxcm.moduleutil.bean.RoonGiftModel;
import com.qxcm.moduleutil.bean.WalletBean;
import com.qxcm.moduleutil.bean.room.RoomAuction;
import com.qxcm.moduleutil.databinding.RoomVpGiftBinding;
import com.qxcm.moduleutil.event.GiftDoubleClickEvent;
import com.qxcm.moduleutil.event.GiftUserRefreshEvent;
import com.qxcm.moduleutil.event.RoomGiftClickEvent;
import com.qxcm.moduleutil.event.RoomGiftClickToEvent;
import com.qxcm.moduleutil.presenter.RewardGiftContacts;
import com.qxcm.moduleutil.presenter.RewardGiftPresenter;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter, RoomVpGiftBinding> implements RewardGiftContacts.View {
private String id;
private GiftTwoAdapter mAdapter;
private GiftRoomAdapter roomAdapter;
private GiftPackAdapter packAdapter;
private String tag;
private int pageSize = 100;//一页显示的礼物个数
private int pageCount;//页数
private int type;//1:房间点击进入的2打赏进入的
private List<RoonGiftModel> giftList=new ArrayList<>();
private List<GiftPackBean> giftPackList=new ArrayList<>();
public static GiftTwoDetailsFragment newInstance(String type) {
public static GiftTwoDetailsFragment newInstance(String id,int type) {
Bundle args = new Bundle();
args.putString("id", type);
args.putString("id", id);
args.putInt("type", type);
GiftTwoDetailsFragment fragment = new GiftTwoDetailsFragment();
fragment.setArguments(args);
return fragment;
@@ -40,12 +58,13 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
public void initArgs(Bundle arguments) {
super.initArgs(arguments);
id = arguments.getString("id");
type = arguments.getInt("type");
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// EventBus.getDefault().register(this);
EventBus.getDefault().register(this);
}
@Override
@@ -55,13 +74,21 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
@Override
protected void initData() {
MvpPre.getGiftList(id);
if (id.equals("0")){
MvpPre.giftPack();
}else {
if (type==0) {
MvpPre.getGiftList("0", type);
}else {
MvpPre.getGiftList(id, type);
}
}
}
@Override
protected void initView() {
}
@Override
@@ -70,18 +97,84 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
}
public RoonGiftModel getGiftList() {
if (giftList != null) {
for (RoonGiftModel item : giftList) {
if (item.isChecked()) {
return item;
}
}
}
return null;
}
public GiftPackBean mGiftList() {
if (giftPackList != null) {
for (GiftPackBean item : giftPackList) {
if (item.isChecked()) {
return item;
}
}
}
return null;
}
@Override
public void setGiftList(List<RoonGiftModel> 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);
public void setGiftList(List<RoonGiftModel> data,int type) {
if (type == 1){
giftList=new ArrayList<>();
giftList.addAll(data);
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
roomAdapter = new GiftRoomAdapter(getActivity(), data, j, "0");
mBinding.rvGift.setAdapter(roomAdapter);
}
}else {
giftList=new ArrayList<>();
giftList.addAll(data);
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
// mAdapter = new GiftTwoAdapter(getActivity(), data, j, "0");
// mBinding.rvGift.setAdapter(mAdapter);
roomAdapter = new GiftRoomAdapter(getActivity(), data, j, "0");
mBinding.rvGift.setAdapter(roomAdapter);
}
}
// EventBus.getDefault().post(new RoomGiftEvent(data));
}
@Override
public void giveGift() {
}
@Override
public void wallet(WalletBean walletBean) {
}
@Override
public void reward_zone() {
ToastUtils.showShort("打赏成功");
}
@Override
public void roomAuctionJoin(RoomAuction.AuctionListBean auctionListBean) {
}
@Override
public void giftPack(List<GiftPackBean> giftPackBean) {
giftPackList=new ArrayList<>();
giftPackList.addAll(giftPackBean);
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
for (int j = 0; j < pageCount; j++) {
// mAdapter = new GiftTwoAdapter(getActivity(), data, j, "0");
// mBinding.rvGift.setAdapter(mAdapter);
packAdapter = new GiftPackAdapter(getActivity(), giftPackBean, j, "0");
mBinding.rvGift.setAdapter(roomAdapter);
}
}
@Override
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {
@@ -92,5 +185,103 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onGiftClicRoomkEvent(RoomGiftClickEvent event) {
if (giftList == null){
giftList = new ArrayList<>();
giftList.add(event.gift);
}
if (event.type == 1) {
String id = event.gift.getGift_id();
for (int i = 0; i < giftList.size(); i++) {
RoonGiftModel giftModel = giftList.get(i);
if (giftModel.getGift_id().equals(id)) {
if (!giftModel.isChecked()) {
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type,event.gift));
giftModel.setChecked(true);
}
} else {
giftModel.setChecked(false);
}
}
if (event.adapter != null && event.adapter.get() != null) {
event.adapter.get().notifyDataSetChanged();
}
} else if (event.type == 2) {
String id = event.gift.getGift_id();
RoonGiftModel selGift = null;
for (int i = 0; i < giftList.size(); i++) {
RoonGiftModel giftModel = giftList.get(i);
if (giftModel.getGift_id().equals(id)) {
selGift = giftModel;
if (!giftModel.isChecked()) {
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type,event.gift));
giftModel.setChecked(true);
}
} else {
giftModel.setChecked(false);
}
}
if (event.adapter != null && event.adapter.get() != null) {
event.adapter.get().notifyDataSetChanged();
}
if (selGift != null) {
EventBus.getDefault().post(new GiftDoubleClickEvent());
}
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onGiftClicRoomkTEvent(RoomGiftClickToEvent event) {
if (giftList == null){
giftList = new ArrayList<>();
giftList.add(event.gift);
}
if (event.type == 1) {
String id = event.gift.getGift_id();
for (int i = 0; i < giftList.size(); i++) {
RoonGiftModel giftModel = giftList.get(i);
if (giftModel.getGift_id().equals(id)) {
if (giftModel.isChecked()) {
giftModel.setChecked(false);
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null));
}else {
giftModel.setChecked(true);
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,event.gift));
}
} else {
giftModel.setChecked(false);
}
}
if (event.adapter != null && event.adapter.get() != null) {
event.adapter.get().notifyDataSetChanged();
}
} else if (event.type == 2) {
String id = event.gift.getGift_id();
RoonGiftModel selGift = null;
for (int i = 0; i < giftList.size(); i++) {
RoonGiftModel giftModel = giftList.get(i);
if (giftModel.getGift_id().equals(id)) {
selGift = giftModel;
if (giftModel.isChecked()) {
giftModel.setChecked(false);
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null));
}else {
giftModel.setChecked(true);
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type,event.gift));
}
} else {
giftModel.setChecked(false);
}
}
if (event.adapter != null && event.adapter.get() != null) {
event.adapter.get().notifyDataSetChanged();
}
if (selGift != null) {
EventBus.getDefault().post(new GiftDoubleClickEvent());
}
}
}
}

View File

@@ -1,6 +1,7 @@
package com.qxcm.moduleutil.adapter;
import android.view.View;
import android.widget.GridView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -9,6 +10,7 @@ import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.BaseListData;
import com.qxcm.moduleutil.bean.HeatedBean;
import com.qxcm.moduleutil.bean.HeavenGiftBean;
import com.qxcm.moduleutil.bean.RoonGiftModel;
import com.zhpan.bannerview.BaseBannerAdapter;
import com.zhpan.bannerview.BaseViewHolder;
@@ -26,11 +28,11 @@ public class HeavenGiftAdapter extends BaseBannerAdapter<BaseListData> {
@Override
protected void bindData(BaseViewHolder<BaseListData> holder, BaseListData data, int position, int pageSize) {
GiftAdapter adapter = new GiftAdapter();
RecyclerView recyclerView = holder.itemView.findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new GridLayoutManager(holder.itemView.getContext(), 4));
GiftTwoAdapter adapter = new GiftTwoAdapter(holder.itemView.getContext(), data.getData(), 0,"4");
GridView recyclerView = holder.itemView.findViewById(R.id.rv_gift);
// recyclerView.setLayoutManager(new GridLayoutManager(holder.itemView.getContext(), 4));
recyclerView.setAdapter(adapter);
adapter.setNewData(data.getData());
// adapter.setNewData(data.getData());
}
@Override

View File

@@ -0,0 +1,28 @@
package com.qxcm.moduleutil.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.CircleListBean;
import com.qxcm.moduleutil.utils.ImageUtils;
/**
*@author qx
*@data 2025/6/10
*@description: 点赞适配
*/
public class LikeListAdapter extends BaseQuickAdapter<CircleListBean.LikeList, BaseViewHolder> {
public LikeListAdapter() {
super(R.layout.item_like_list);
}
@Override
protected void convert(BaseViewHolder helper, CircleListBean.LikeList item) {
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.like_avatar));
helper.setText(R.id.tv_nickname, item.getNickname());
String s=item.getSex().equals("1")?"":"";
String age=item.getAge()+"";
String constellation=item.getConstellation();
String co=s+"/"+age+"/"+constellation;
helper.setText(R.id.tv_content, co);
}
}

View File

@@ -0,0 +1,28 @@
package com.qxcm.moduleutil.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.CircleListBean;
import com.qxcm.moduleutil.bean.room.RoomOnlineBean;
import com.qxcm.moduleutil.utils.ImageUtils;
/**
*@author qx
*@data 2025/6/10
*@description: 显示用户小头像
*/
public class LikeUserAdapter<T> extends BaseQuickAdapter<T, BaseViewHolder> {
public LikeUserAdapter() {
super(R.layout.item_like_user);
}
@Override
protected void convert(BaseViewHolder helper,T item) {
if (item instanceof CircleListBean.LikeList) {
ImageUtils.loadHeadCC(((CircleListBean.LikeList) item).getAvatar(), helper.getView(R.id.user_icon));
} else {
// 可扩展:通过接口回调获取头像 URL
ImageUtils.loadHeadCC(((RoomOnlineBean) item).getAvatar(), helper.getView(R.id.user_icon));
}
}
}

View File

@@ -6,10 +6,11 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentStatePagerAdapter;
import java.util.List;
public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
public class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
private List<Fragment> fragmentList;
@@ -18,7 +19,6 @@ public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
super(fm);
this.fragmentList = list;
}
@Override
public Fragment getItem(int i) {
return fragmentList.get(i);

View File

@@ -0,0 +1,47 @@
package com.qxcm.moduleutil.adapter;
import android.view.View;
import android.widget.ImageView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.BindType;
import com.qxcm.moduleutil.utils.ImageUtils;
public class PayMethodAdapter extends BaseQuickAdapter<BindType.AllData, BaseViewHolder> {
private int selectedPosition = -1; // -1 表示未选中
public PayMethodAdapter(int layoutResId) {
super(layoutResId);
}
public void setSelectedPosition(int position) {
selectedPosition = position;
notifyDataSetChanged();
}
public int getSelectedPosition() {
return selectedPosition;
}
@Override
protected void convert(BaseViewHolder helper, BindType.AllData item) {
helper.setText(R.id.tv_name, item.getName());
ImageUtils.loadHeadCC(item.getIcon(), helper.getView(R.id.im_zfb));
// 设置选中状态样式
boolean isSelected = helper.getAdapterPosition() == selectedPosition;
View itemView = helper.itemView;
itemView.setSelected(isSelected);
ImageView imageView= helper.getView(R.id.iv_three_pay);
// 你可以在这里修改背景、边框、图标等来表示选中状态
if (isSelected) {
imageView.setImageLevel(1);
} else {
imageView.setImageLevel(0);
}
}
}

View File

@@ -1,5 +1,8 @@
package com.qxcm.moduleutil.adapter;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -8,14 +11,34 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.blankj.utilcode.util.TimeUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.CommentBean;
import java.util.List;
public class ReplyAdapter extends RecyclerView.Adapter<ReplyAdapter.ReplyViewHolder> {
public interface OnReplyClickListener {
void onReplyClick(CommentBean.CommentDetailsBean.Replies reply, int position);
}
// 添加回调接口
public interface OnReplyLongClickListener {
void onReplyLongClick(CommentBean.CommentDetailsBean.Replies reply, int position);
}
private OnReplyLongClickListener longClickListener;
public void setOnReplyLongClickListener(OnReplyLongClickListener listener) {
this.longClickListener = listener;
}
private OnReplyClickListener listener;
// 设置监听器的方法
public void setOnReplyClickListener(OnReplyClickListener listener) {
this.listener = listener;
}
private List<CommentBean.CommentDetailsBean.Replies> replyList;
private boolean isExpanded = false; // 是否展开显示所有评论
public ReplyAdapter(List<CommentBean.CommentDetailsBean.Replies> replyList) {
this.replyList = replyList;
@@ -37,27 +60,68 @@ public class ReplyAdapter extends RecyclerView.Adapter<ReplyAdapter.ReplyViewHol
@Override
public void onBindViewHolder(@NonNull ReplyViewHolder holder, int position) {
CommentBean.CommentDetailsBean.Replies reply = replyList.get(position);
holder.bind(reply);
if (!isExpanded && position >= 2) {
return; // 不绑定数据
}
holder.bind(reply,position, listener,longClickListener);
}
public void setExpanded(boolean expanded) {
isExpanded = expanded;
notifyDataSetChanged(); // 刷新适配器
}
@Override
public int getItemCount() {
return replyList.size();
return isExpanded ? replyList.size() : Math.min(2, replyList.size());
}
static class ReplyViewHolder extends RecyclerView.ViewHolder {
class ReplyViewHolder extends RecyclerView.ViewHolder {
private TextView tvNickname;
private TextView tvContent;
private TextView btnReply;
private TextView tvTime;
private TextView btnShowAllReplies;
public ReplyViewHolder(@NonNull View itemView) {
super(itemView);
// tvNickname = itemView.findViewById(R.id.tv_reply_nickname);
// tvContent = itemView.findViewById(R.id.tv_reply_content);
tvNickname = itemView.findViewById(R.id.tv_name);
tvContent = itemView.findViewById(R.id.tv_reply);
btnReply = itemView.findViewById(R.id.btn_reply);
tvTime = itemView.findViewById(R.id.tv_time);
// btnShowAllReplies = itemView.findViewById(R.id.btn_show_all_replies);
}
public void bind(CommentBean.CommentDetailsBean.Replies reply) {
tvNickname.setText(reply.getNickname());
public void bind(CommentBean.CommentDetailsBean.Replies reply,int position, OnReplyClickListener listener,OnReplyLongClickListener longClickListener) {
tvNickname.setText(reply.getNickname()+":" +(reply.getReply_to_user()!=null?reply.getReply_to_user():""));
tvContent.setText(reply.getContent());
tvTime.setText(TimeUtils.millis2String(Long.parseLong(reply.getCreatetime()+"") * 1000));
btnReply.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onReplyClick(reply, position);
}
}
});
// 添加长按监听
itemView.setOnLongClickListener(v -> {
if (longClickListener != null) {
longClickListener.onReplyLongClick(reply, position);
return true; // 消费事件
}
return false;
});
// 控制“全部评论...”按钮的显示
// btnShowAllReplies.setVisibility(position > 2 ? VISIBLE : GONE);
//
// btnShowAllReplies.setOnClickListener(v -> {
//// replyAdapter.setExpanded(true); // 展开所有评论
// notifyDataSetChanged(); // 刷新适配器
// btnShowAllReplies.setVisibility(GONE); // 隐藏按钮
// });
}
}
}

View File

@@ -2,6 +2,7 @@ package com.qxcm.moduleutil.base;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -13,6 +14,11 @@ import androidx.fragment.app.Fragment;
import com.qxcm.moduleutil.activity.BaseAppCompatActivity;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.lang.reflect.Method;
public abstract class BaseFragment<VDB extends ViewDataBinding> extends Fragment {
protected VDB mBinding;
@@ -44,6 +50,9 @@ public abstract class BaseFragment<VDB extends ViewDataBinding> extends Fragment
if (mBinding != null) {
mBinding.unbind();
}
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
super.onDestroyView();
}
@@ -73,4 +82,5 @@ public abstract class BaseFragment<VDB extends ViewDataBinding> extends Fragment
((BaseAppCompatActivity) getActivity()).disLoading();
}
}
}

View File

@@ -86,6 +86,7 @@ public abstract class BaseMvpDialogFragment<P extends IPresenter, VDM extends Vi
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
if (isAnimation) {
window.setWindowAnimations(R.style.CommonShowDialogBottom);
}

View File

@@ -3,6 +3,7 @@ package com.qxcm.moduleutil.base;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -59,4 +60,5 @@ public abstract class BaseMvpFragment<P extends IPresenter, VDB extends ViewData
public void disLoadings() {
// disLoading();
}
}

View File

@@ -0,0 +1,27 @@
package com.qxcm.moduleutil.base;
import android.app.Activity;
import com.qxcm.moduleutil.activity.IPresenter;
import com.qxcm.moduleutil.activity.IView;
public final class BaseRoomContacts {
public interface View extends IView<Activity> {
}
public interface IBaseRoomPre extends IPresenter {
void downWheat(String roomId);
void applyWheat(String roomId, String pitNumber);
void applyWheatWait(String roomId, String pitNumber);
void getRoomInfo(String roomId, String password);
void putOnWheat(String roomId, String userId,String pitNum);
}
}

View File

@@ -0,0 +1,171 @@
package com.qxcm.moduleutil.base;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.ViewDataBinding;
import com.qxcm.moduleutil.bean.room.RoomInfoResp;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
public abstract class BaseRoomFragment<P extends BaseRoomPresenter, VDB extends ViewDataBinding> extends BaseMvpFragment<P, VDB> implements BaseRoomContacts.View {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
EventBus.getDefault().register(this);
}
@Override
public void onDestroyView() {
unRegisterWheatViews();
EventBus.getDefault().unregister(this);
super.onDestroyView();
}
@Override
protected void initView() {
registerWheatViews();
}
/**
* 房间信息
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void roomInfo(RoomInfoResp resp) {
roomInfoUpdate(resp);
// EventBus.getDefault().post(new RoomCardiacValueChangedEvent());
}
public abstract void roomInfoUpdate(RoomInfoResp resp);
public abstract void registerWheatViews();
public abstract void unRegisterWheatViews();
public abstract int[] collectCurrentCardiacValues();
public int[][] collectAmativenessCurrentCardiacValues() { return new int[2][0]; }
public abstract void hideAllWheatMaozi();
public void showWheatMaoziHuangguan(int wheat) {}
public void showWheatMaoziBianbian(int... wheats) {}
public void showAmativenessMaleWheatMaozi(int index, int level) {}
public void showAmativenessFemaleWheatMaozi(int index, int level) {}
protected void tzblChanged() {
}
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void onRoomTzblChangedEvent(RoomTzblChangedEvent event) {
// tzblChanged();
// }
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void onRoomCardiacValueChangedEvent(RoomCardiacValueChangedEvent event) {
//// hideAllWheatMaozi();
// checkWheatMaoziState(collectCurrentCardiacValues());
// int[][] cvs = collectAmativenessCurrentCardiacValues();
// checkAmativenessMaleWheatMaoziState(cvs[0]);
// checkAmativenessFemaleWheatMaoziState(cvs[1]);
// }
private void checkWheatMaoziState(int[] cvs) {
int max = -999999999;
int min = 999999999;
List<Integer> maxs = new ArrayList<>();
List<Integer> mins = new ArrayList<>();
// 找出最大值/最小值
for (int i = 0; i < cvs.length; i++) {
int v = cvs[i];
if (v < 0) continue; // 小于0的麦位表示麦位没人
if (v >= max) { max = v; }
if (v <= min) { min = v; }
}
// 如果最大值和最小值相同,全部不带帽子
if (min == max) return;
// 找出最大值的麦位/最小值的麦位
for (int i = 0; i < cvs.length; i++) {
int v = cvs[i];
if (v < 0) continue; // 小于0的麦位表示麦位没人
if (v == max) { maxs.add(i); }
if (v == min) { mins.add(i); }
}
// 排序最大值的麦位,选出最优先的一个,带皇冠
if (maxs.size() > 0) {
// showWheatMaoziHuangguan(maxs.get(0));
}
// 给所有最小值的麦位,带便便
if (mins.size() > 0) {
int[] ws = new int[mins.size()];
for (int i = 0; i < ws.length; i++) { ws[i] = mins.get(i); }
// showWheatMaoziBianbian(ws);
}
}
private void checkAmativenessMaleWheatMaoziState(int[] cvs) {
int max = -999999999;
List<Integer> maxs = new ArrayList<>();
// 找出最大值
for (int v : cvs) {
if (v < 0) continue; // 小于0的麦位表示麦位没人
if (v >= max) {
max = v;
}
}
// 找出最大值的麦位
for (int i = 0; i < cvs.length; i++) {
int v = cvs[i];
if (v < 0) continue; // 小于0的麦位表示麦位没人
if (v == max) { maxs.add(i); }
}
// 获得男生第一帽子等级
if (maxs.size() > 0) {
int level = getAmativenessWheatMaoziLevel(max);
if (level > 0) showAmativenessMaleWheatMaozi(maxs.get(0), level);
}
}
private void checkAmativenessFemaleWheatMaoziState(int[] cvs) {
int max = -999999999;
List<Integer> maxs = new ArrayList<>();
// 找出最大值
for (int v : cvs) {
if (v < 0) continue; // 小于0的麦位表示麦位没人
if (v >= max) {
max = v;
}
}
// 找出最大值的麦位
for (int i = 0; i < cvs.length; i++) {
int v = cvs[i];
if (v < 0) continue; // 小于0的麦位表示麦位没人
if (v == max) { maxs.add(i); }
}
// 获得女生第一帽子等级
if (maxs.size() > 0) {
int level = getAmativenessWheatMaoziLevel(max);
if (level > 0) showAmativenessFemaleWheatMaozi(maxs.get(0), level);
}
}
private int getAmativenessWheatMaoziLevel(int value) {
if (value >= 52000) {
return 3;
} else if (value >= 10000) {
return 2;
} else if (value >= 1000) {
return 1;
} else {
return 0;
}
}
}

View File

@@ -0,0 +1,158 @@
package com.qxcm.moduleutil.base;
import android.content.Context;
import com.blankj.utilcode.util.ObjectUtils;
import com.qxcm.moduleutil.activity.IView;
import com.qxcm.moduleutil.presenter.BasePresenter;
import org.greenrobot.eventbus.EventBus;
import io.reactivex.disposables.Disposable;
public class BaseRoomPresenter<V extends IView> extends BasePresenter<V> implements BaseRoomContacts.IBaseRoomPre {
public BaseRoomPresenter(V view, Context context) {
super(view, context);
}
@Override
public void downWheat(String roomId) {
// ApiClient.getInstance().downWheat(roomId, new BaseObserver<String>() {
// @Override
// public void onSubscribe(Disposable d) {
// addDisposable(d);
// }
//
// @Override
// public void onNext(String s) {
//// getRoomInfo(roomId);
// EventBus.getDefault().post(new UserDownWheatEvent());
// RtcManager.getInstance().downWheat();
// }
//
// @Override
// public void onComplete() {
//
// }
// });
}
@Override
public void applyWheat(String roomId, String pitNumber) {
// ApiClient.getInstance().applyWheat(roomId, pitNumber, new BaseObserver<String>() {
// @Override
// public void onSubscribe(Disposable d) {
// addDisposable(d);
// }
//
// @Override
// public void onNext(String s) {
//// getRoomInfo(roomId);
// }
//
// @Override
// public void onComplete() {
//
// }
// });
}
@Override
public void applyWheatWait(String roomId, String pitNumber) {
// ApiClient.getInstance().applyWheatWait(roomId, pitNumber, new BaseObserver<ApplyWheatWaitResp>() {
// @Override
// public void onSubscribe(Disposable d) {
// addDisposable(d);
// }
//
// @Override
// public void onNext(ApplyWheatWaitResp applyWheatWaitResp) {
// if (applyWheatWaitResp != null && !applyWheatWaitResp.getState().equals("1")) {
// EventBus.getDefault().post(new ApplyWaitEvent(true, pitNumber));
//// ToastUtils.show("申请成功");
// }
// }
//
// @Override
// public void onComplete() {
//
// }
// });
}
@Override
public void getRoomInfo(String roomId, String password) {
// NewApi.getInstance().roomInfo(roomId, password, new com.qpyy.libcommon.api.BaseObserver<RoomInfoResp>() {
//// NewApi.getInstance().roomGetIn(roomId, password, new com.qpyy.libcommon.api.BaseObserver<RoomInfoResp>() {
// @Override
// public void onSubscribe(Disposable d) {
// addDisposable(d);
// }
//
// @Override
// public void onNext(RoomInfoResp roomInfoResp) {
// if (roomInfoResp.getRejoin() == 1) {
// UserBean userBean = BaseApplication.getInstance().getUser();
// Config config = null;
// if (!ObjectUtils.isEmpty(roomInfoResp.getRoom_info().getSound_effect())) {
// config = roomInfoResp.getRoom_info().getSound_effect().getConfig();
// }
// RtcManager.getInstance().destroyAndLogin(RtcConstants.RtcType_CURR, roomInfoResp.getRoom_info().getSceneId(), config, roomId, userBean.getUser_id(), userBean.getNickname(), "", new RtcDestroyCallback() {
// @Override
// public void onDestroySuccess() {
// if (roomInfoResp.isOnWheat()) {//在麦位上就恢复麦克风状态
// RtcManager.getInstance().applyWheat(String.format("%s_%s", roomId, SpUtils.getUserId()));
// } else {//否则停止推流
// RtcManager.getInstance().downWheat();
// }
// RtcManager.getInstance().resumeAudio();
// }
// });
// } else {
// if (roomInfoResp.isOnWheat()) {//在麦位上就恢复麦克风状态
// RtcManager.getInstance().resumeMic();
// } else {//否则停止推流
// RtcManager.getInstance().downWheat();
// }
// }
// EventBus.getDefault().post(roomInfoResp);
// }
//
// @Override
// public void onComplete() {
//
// }
//
// @Override
// public void onError(Throwable e) {
// super.onError(e);
// if (e instanceof APIException) {
// EventBus.getDefault().post(new RoomOutEvent());
// }
// }
// });
}
@Override
public void putOnWheat(String roomId, String userId,String pitNum) {
MvpRef.get().showLoadings();
// ApiClient.getInstance().putOnWheat(roomId, userId,pitNum, new BaseObserver<PutOnWheatResp>() {
// @Override
// public void onSubscribe(Disposable d) {
// addDisposable(d);
// }
//
// @Override
// public void onNext(PutOnWheatResp s) {
//
// }
//
// @Override
// public void onComplete() {
// MvpRef.get().disLoadings();
// }
// });
}
}

View File

@@ -1,5 +1,8 @@
package com.qxcm.moduleutil.base;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Application;
@@ -9,34 +12,50 @@ import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.graphics.PixelFormat;
import android.media.MediaRouter;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.webkit.WebView;
import android.widget.TextView;
import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;
import com.alibaba.android.arouter.facade.model.RouteMeta;
import com.alibaba.android.arouter.facade.template.IRouteGroup;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.BuildConfig;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ProcessUtils;
import com.blankj.utilcode.util.ServiceUtils;
import com.lahm.library.EasyProtectorLib;
import com.lahm.library.EmulatorCheckCallback;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.bean.UserBean;
import com.qxcm.moduleutil.event.AppLifecycleEvent;
import com.qxcm.moduleutil.interfaces.AppLifecycleUtil;
import com.qxcm.moduleutil.listener.MessageListenerSingleton;
import com.qxcm.moduleutil.rtc.AgoraManager;
import com.qxcm.moduleutil.utils.FloatWindowHelper;
import com.qxcm.moduleutil.utils.SPConstants;
import com.qxcm.moduleutil.utils.ImageUtils;
import com.qxcm.moduleutil.utils.SpUtil;
import com.qxcm.moduleutil.utils.UtilConfig;
import com.qxcm.moduleutil.utils.config.EnvironmentEnum;
import com.qxcm.moduleutil.utils.config.EnvironmentPrefs;
import com.qxcm.moduleutil.widget.CommonAppConfig;
import com.qxcm.moduleutil.widget.Constants;
import com.qxcm.moduleutil.widget.CustomRefreshHeader;
import com.qxcm.moduleutil.widget.PiaoPingManager;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
@@ -44,16 +63,20 @@ import com.scwang.smartrefresh.layout.api.RefreshFooter;
import com.scwang.smartrefresh.layout.api.RefreshHeader;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
import com.tencent.qcloud.tuicore.TUILogin;
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.lang.reflect.Method;
import java.security.MessageDigest;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import io.reactivex.disposables.Disposable;
import lombok.Getter;
@@ -71,25 +94,55 @@ public class CommonAppContext extends MultiDexApplication {
@Getter
private EnvironmentEnum currentEnvironment;
public UserBean mUserBean;
public boolean isShow;
public boolean isPlaying;
public String playId;
public String playCover;
public boolean showSelf;//盲盒是否能送自己
public String playName;
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
private ScheduledExecutorService scheduledExecutorServiceRoom = null;
@Override
public void onCreate() {
super.onCreate();
sInstance = this;
sMainThreadHandler=new Handler();
sMainThreadHandler = new Handler();
UtilConfig.init(this);
registerActivityLifecycleCallbacks();
initWebView();
if (ProcessUtils.isMainProcess()) {
initARouter();
if (SpUtil.isAgreePolicy()) {
checkInEmulator();
UtilConfig.checkInEmulator();
}
}
// ServiceUtils.startService(EMqttService.class);
// MyMqttService.startService(getApplicationContext());
// ServiceUtils.startService(MyMqttService.class);
// RtcManager.instance(this);
EnvironmentPrefs prefs = new EnvironmentPrefs(this);
currentEnvironment = prefs.getSelectedEnvironment();
piaoPingManager = PiaoPingManager.getInstance(this);
piaoPingManager.subscribe();
AgoraManager.getInstance(this).init(currentEnvironment.getSwSdkAppId());
MessageListenerSingleton.getInstance();
// startInitSdk();
}
private PiaoPingManager piaoPingManager;
private void initARouter() {
if(true) {
ARouter.openDebug();
ARouter.openLog();
}
ARouter.init(this);
}
private void initWebView() {
//Android P 以及之后版本不支持同时从多个进程使用具有相同数据目录的WebView
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
@@ -99,6 +152,7 @@ public class CommonAppContext extends MultiDexApplication {
}
}
}
public String getProcessName(Context context) {
if (context == null) return null;
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
@@ -109,6 +163,7 @@ public class CommonAppContext extends MultiDexApplication {
}
return null;
}
@Override
protected void attachBaseContext(Context base) {
MultiDex.install(this);
@@ -155,6 +210,7 @@ public class CommonAppContext extends MultiDexApplication {
public String getToken() {
return SpUtil.getToken();
}
private void registerActivityLifecycleCallbacks() {
registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() {
@Override
@@ -264,26 +320,42 @@ public class CommonAppContext extends MultiDexApplication {
return mFront;
}
public void startInitSdk(){
public void startInitSdk() {
UserBean userBean = SpUtil.getUserBean();
if (userBean != null){
// 在用户 UI 点击登录的时候调用
TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), "u"+userBean.getUser_id(), userBean.getTencent_im(), new TUICallback() {
@Override
public void onError(final int code, final String desc) {
LogUtils.e("@@@1",code,"描述:",desc);
}
@Override
public void onSuccess() {
LogUtils.e("@@@","成功");
}
});
}
}
public void setUser(UserBean userBean) {
mUserBean = userBean;
SpUtil.saveUserId(userBean.getUser_id());
SpUtil.saveUserInfo(userBean);
SpUtil.saveUserBean(userBean);
SpUtil.putToken(userBean.getToken());
}
public UserBean getUser() {
if (mUserBean == null) {
mUserBean = SpUtil.getUserInfo();
mUserBean = SpUtil.getUserBean();
}
return mUserBean;
}
public void setUserBean(UserBean bean) {
mUserBean = bean;
}
public void clearLoginInfo() throws ClassNotFoundException {
// mUid = null;
// mToken = null;
@@ -292,14 +364,15 @@ public class CommonAppContext extends MultiDexApplication {
// );
mUserBean = null;
SpUtil.saveUserId(-1);
SpUtil.saveUserInfo(new UserBean());
SpUtil.saveUserBean(new UserBean());
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();
}
public static boolean isAlipayInstalled(Context context){
public static boolean isAlipayInstalled(Context context) {
try {
context.getPackageManager().getPackageInfo("com.eg.android.AlipayGphone", 0);
return true;//安装了支付宝
@@ -314,7 +387,11 @@ public class CommonAppContext extends MultiDexApplication {
SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
@Override
public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
return new CustomRefreshHeader(context);//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header默认是 贝塞尔雷达Header
ClassicsHeader header = new ClassicsHeader(context);
header.setDrawableSize(20);
header.setFinishDuration(0);
return header;//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header默认是 贝塞尔雷达Header
// return new CustomRefreshHeader(context);//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header默认是 贝塞尔雷达Header
}
});
//设置全局的Footer构建器
@@ -329,5 +406,4 @@ public class CommonAppContext extends MultiDexApplication {
}
});
}
}

View File

@@ -0,0 +1,11 @@
package com.qxcm.moduleutil.base;
import lombok.Data;
@Data
public class RoomRollModel {
private String room_id;
private String user_id;
private String pit_number;
private int number;
}

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