Compare commits
3 Commits
7a084b6b2b
...
2673835fc6
| Author | SHA1 | Date | |
|---|---|---|---|
| 2673835fc6 | |||
| a4caa9b078 | |||
| 2f06d60fec |
@@ -116,7 +116,7 @@ android {
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
jvmTarget = '11'
|
||||
}
|
||||
dexOptions {
|
||||
dexInProcess true
|
||||
@@ -144,13 +144,9 @@ dependencies {
|
||||
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') // 关键!
|
||||
|
||||
@@ -158,6 +154,10 @@ dependencies {
|
||||
api project(":moduleLogin")
|
||||
implementation project(':modulemain')
|
||||
|
||||
implementation(libs.arouter.api.v150)
|
||||
//annotationProcessor
|
||||
annotationProcessor libs.arouter.compiler
|
||||
|
||||
//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,
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
android:launchMode="singleTask">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".RealNameActivity"
|
||||
android:name="com.example.modulevocal.activity.RealNameActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.xscm.modulelogin.activity.ImproveInfoActivity;
|
||||
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.AppStateListener;
|
||||
import com.xscm.moduleutil.base.AppStateManager;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
@@ -69,8 +70,13 @@ public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPage
|
||||
if (!isTaskRoot()) {
|
||||
|
||||
if (SpUtil.getUnderagePassword() != null && !SpUtil.getUnderagePassword().isEmpty()) {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken())
|
||||
.withString("type", "1").navigation();//type==1:青少年模式
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken())
|
||||
// .withString("type", "1").navigation();//type==1:青少年模式
|
||||
|
||||
Intent intent = new Intent(this, WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken());
|
||||
intent.putExtra("title", "1");
|
||||
startActivity(intent);
|
||||
} else {
|
||||
// 如果没有设置青少年模式,应该导航到首页
|
||||
try {
|
||||
|
||||
11
build.gradle
11
build.gradle
@@ -3,8 +3,6 @@
|
||||
|
||||
// build.gradle (Project-level)
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.9.24' // 根据你使用的 Kotlin 版本调整
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
@@ -15,7 +13,6 @@ buildscript {
|
||||
|
||||
dependencies {
|
||||
classpath libs.gradle // 或你使用的 Android Gradle 插件版本
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// ✅ 添加 ARouter 插件依赖
|
||||
classpath 'com.alibaba:arouter-register:1.0.2'
|
||||
@@ -28,6 +25,14 @@ plugins {
|
||||
alias(libs.plugins.android.library) apply false
|
||||
alias(libs.plugins.kotlin.android) apply false
|
||||
}
|
||||
|
||||
subprojects {
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
}
|
||||
}
|
||||
}
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
@@ -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=-Xmx3072m -XX:MaxPermsize=512m -Xx:+HeapDumponOutofMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx3072m -XX:MaxMetaspaceSize=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
|
||||
@@ -22,28 +22,27 @@ android.enableJetifier=true
|
||||
android.nonTransitiveRClass=true
|
||||
|
||||
arouter.register.auto=true
|
||||
|
||||
isBuildModule=false
|
||||
|
||||
#org.gradle.parallel=false
|
||||
#org.gradle.deamon=false
|
||||
android.injected.testOnly=false
|
||||
|
||||
APP_VERSION_NAME=1.1.0
|
||||
APP_VERSION_CODE=163
|
||||
APP_VERSION_NAME=1.1.1
|
||||
APP_VERSION_CODE=164
|
||||
|
||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||
org.gradle.parallel=true
|
||||
org.gradel.daemon=true
|
||||
org.gradel.configureondemand=true
|
||||
org.gradle.daemon=true
|
||||
org.gradle.configureondemand=true
|
||||
aaptOptions.cruncherEnabled false
|
||||
aaptOptions.useNewCruncher false
|
||||
|
||||
#android.enableR8=true
|
||||
#isModule
|
||||
modulevoice=false
|
||||
# <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
# ʽʱ
|
||||
beta=false
|
||||
|
||||
org.gradle.caching=false
|
||||
@@ -51,4 +50,7 @@ org.gradle.caching=false
|
||||
kapt.incremental.apt=false
|
||||
|
||||
# 或者禁用特定模块的增量编译
|
||||
#org.gradle.configureondemand=false
|
||||
#org.gradle.configureondemand=false
|
||||
|
||||
# 统一 Kotlin JVM 目标版本
|
||||
kotlin.jvm.target.validation.mode=warning
|
||||
@@ -166,4 +166,6 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinVer
|
||||
#kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlinVersion" }
|
||||
#alibaba-arouter = { id = "com.alibaba.arouter", version.ref = "arouter" }
|
||||
greendao-plugin = { id = "org.greenrobot.greendao", version.ref = "greendaoGradlePlugin" }
|
||||
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlinVersion" }
|
||||
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlinVersion" }
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.modulelogin.activity.ImproveInfoActivity;
|
||||
import com.xscm.modulelogin.activity.SwitchAccountsActivity;
|
||||
import com.xscm.modulemain.activity.MainActivity;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.ThemeBean;
|
||||
import com.xscm.moduleutil.bean.UserBean;
|
||||
@@ -264,10 +265,20 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
|
||||
}
|
||||
|
||||
public void ysxl() {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
|
||||
Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4");
|
||||
intent.putExtra("title", "隐私协议");
|
||||
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
|
||||
}
|
||||
|
||||
public void yhxy() {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6").withString("title", "用户协议").navigation();
|
||||
Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6");
|
||||
intent.putExtra("title", "用户协议");
|
||||
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6").withString("title", "用户协议").navigation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
//apply plugin: 'kotlin-kapt' // 关键:Kotlin 注解处理器
|
||||
android {
|
||||
namespace 'com.xscm.moduleutil'
|
||||
compileSdk 35
|
||||
@@ -35,14 +35,14 @@ android {
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
dataBinding {
|
||||
enabled = true
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
jvmTarget = '11'
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
@@ -50,6 +50,13 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
// Kotlin 注解处理器参数(针对 Kotlin 代码)
|
||||
//kapt {
|
||||
// arguments {
|
||||
// arg("AROUTER_MODULE_NAME", project.getName())
|
||||
// }
|
||||
//}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||
|
||||
@@ -139,8 +146,9 @@ dependencies {
|
||||
api(libs.alipay.alipaysdk.android)
|
||||
|
||||
api(libs.arouter.api.v150)
|
||||
annotationProcessor libs.arouter.annotation
|
||||
annotationProcessor libs.arouter.compiler
|
||||
// implementation 'com.alibaba:arouter-api:1.5.2'
|
||||
// kapt 'com.alibaba:arouter-compiler:1.5.2'/**/
|
||||
|
||||
api(libs.easypermissions)
|
||||
api(libs.xbanner)
|
||||
@@ -221,4 +229,4 @@ dependencies {
|
||||
//aar的名称,例如:WbCloudNormal-v5.1.10-123456789.aar,填入 'WbCloudNormal-v5.1.10-123456789.aar'
|
||||
}
|
||||
|
||||
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||
//apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||
@@ -766,7 +766,10 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEvent(ChatInfo event) {
|
||||
String id = event.getId().replace("g", "");
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/union/setGroup?id=" + SpUtil.getToken() + "&guildId=" + id).navigation();
|
||||
Intent intent = new Intent(this, WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/union/setGroup?id=" + SpUtil.getToken() + "&guildId=" + id);
|
||||
startActivity( intent);
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/union/setGroup?id=" + SpUtil.getToken() + "&guildId=" + id).navigation();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.xscm.moduleutil.activity.news;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
|
||||
@@ -14,6 +15,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.RoomManager;
|
||||
import com.xscm.moduleutil.bean.NewsMessageList;
|
||||
import com.xscm.moduleutil.databinding.ActivityOfficialNoticeBinding;
|
||||
@@ -79,7 +81,10 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id()+"","");
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("roomId", item.getRoom_id() + "").navigation();
|
||||
}else if (item.getRoom_id() == 0 && item.getUrl() != null && !item.getUrl().isEmpty()){
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", item.getUrl()).navigation();
|
||||
Intent intent = new Intent(OfficialNoticeActivity.this, WebViewActivity.class);
|
||||
intent.putExtra("url", item.getUrl());
|
||||
startActivity(intent);
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", item.getUrl()).navigation();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.xscm.moduleutil.base;
|
||||
|
||||
import static android.app.PendingIntent.getActivity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.ActivityUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
@@ -124,6 +127,9 @@ public class RoomManager {
|
||||
if (!CommonAppContext.getInstance().playId.equals(roomId)) {
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||
exitRoom(CommonAppContext.getInstance().playId);
|
||||
CommonAppContext.getInstance().isShow = false;
|
||||
CommonAppContext.getInstance().isPlaying = false;
|
||||
EventBus.getDefault().post(new RoomOutEvent());
|
||||
} else if (CommonAppContext.getInstance().lable_id.equals("6")) {
|
||||
upInfo(context, roomId, password, true, null, true);
|
||||
return;
|
||||
@@ -334,7 +340,6 @@ public class RoomManager {
|
||||
ARouter.getInstance()
|
||||
.build(ARouteConstants.ROOM_DETAILS)
|
||||
.with(bundle)
|
||||
.withFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||
.navigation(context);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.xscm.moduleutil.dialog;
|
||||
|
||||
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.TextPaint;
|
||||
@@ -16,6 +19,7 @@ import androidx.databinding.DataBindingUtil;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.SpanUtils;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.databinding.DialogPolicBinding;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
@@ -42,7 +46,12 @@ public class PolicyDialog extends Dialog {
|
||||
ClickableSpan clickSpan = new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6" ).withString("title", "用户协议").navigation();
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6");
|
||||
intent.putExtra("title", "用户协议");
|
||||
startActivity(intent);
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6" ).withString("title", "用户协议").navigation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,7 +63,12 @@ public class PolicyDialog extends Dialog {
|
||||
ClickableSpan ysClickSpan = new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4");
|
||||
intent.putExtra("title", "隐私协议");
|
||||
startActivity(intent);
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xscm.moduleutil.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@@ -9,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.TeenagerInfo;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
@@ -55,7 +57,11 @@ public class YouthModelDialog extends BaseDialog<IndexDialogYouthModelBinding> {
|
||||
// } else {
|
||||
// ARouter.getInstance().build(ARouteConstants.SET_YOUTH_PWD_ACTIVITY).withInt("type", SetYouthPasswordActivity.SET_TYPE).navigation();
|
||||
// }
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken()).navigation();
|
||||
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken());
|
||||
getContext().startActivity(intent);
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken()).navigation();
|
||||
dismiss();
|
||||
});
|
||||
|
||||
|
||||
@@ -122,6 +122,9 @@ public class GiftLotteryPresenter extends BasePresenter<GiftLotteryContacts.View
|
||||
|
||||
@Override
|
||||
public void onNext(WalletBean walletBean) {
|
||||
if (MvpRef == null) {
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().wallet(walletBean);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.xscm.moduleutil.http;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* 通用的API响应处理回调类
|
||||
* 统一处理所有接口的响应和错误情况
|
||||
*/
|
||||
public abstract class ApiResponseCallback<T> implements Callback<BaseModel<T>> {
|
||||
private Context mContext;
|
||||
|
||||
// 构造方法,传入上下文用于显示提示
|
||||
public ApiResponseCallback(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<T>> call, Response<BaseModel<T>> response) {
|
||||
// 统一处理HTTP响应
|
||||
if (response.isSuccessful()) {
|
||||
// 处理200-299范围内的HTTP状态码
|
||||
BaseModel<T> body = response.body();
|
||||
|
||||
if (body != null) {
|
||||
// 根据code值进行不同处理
|
||||
switch (body.getCode()) {
|
||||
case 1: // 接口返回成功
|
||||
// 业务成功,回调给具体实现
|
||||
// 即使data为null也调用onSuccess,由具体实现决定如何处理null值
|
||||
onSuccess(body.getData());
|
||||
break;
|
||||
case 0: // 接口请求成功但数据错误
|
||||
// 显示错误信息
|
||||
// String errorMsg = body.getMsg() != null ? body.getMsg() : "操作失败,请重试";
|
||||
// showToast(errorMsg);
|
||||
onFailure(new Exception(body.getMsg()));
|
||||
break;
|
||||
case 301: // 登录失效
|
||||
// 显示错误信息并退出应用
|
||||
// String loginErrorMsg = body.getMsg() != null ? body.getMsg() : "登录已失效,请重新登录";
|
||||
showToast(body.getMsg());
|
||||
|
||||
try {
|
||||
// 发送退出登录事件
|
||||
// EventBus.getDefault().post(new com.xscm.moduleutil.event.LogOutEvent());
|
||||
|
||||
// 清除登录信息
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
|
||||
// 跳转到登录页面
|
||||
// android.content.Intent intent = new android.content.Intent(CommonAppContext.getInstance(), Class.forName("com.xscm.midi.LaunchPageActivity"));
|
||||
// intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK | android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
// CommonAppContext.getInstance().startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
onFailure(new Exception(body.getMsg()));
|
||||
break;
|
||||
default:
|
||||
// 其他错误情况
|
||||
String defaultErrorMsg = body.getMsg() != null ? body.getMsg() : "未知错误";
|
||||
showToast(defaultErrorMsg);
|
||||
onFailure(new Exception(defaultErrorMsg));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// 响应体为空的情况
|
||||
String errorMsg = "获取数据失败,请重试";
|
||||
showToast(errorMsg);
|
||||
onFailure(new Exception(errorMsg));
|
||||
}
|
||||
} else {
|
||||
// 处理HTTP错误状态码
|
||||
String errorInfo;
|
||||
try {
|
||||
if (response.errorBody() != null) {
|
||||
errorInfo = response.errorBody().string();
|
||||
// 可以在这里统一解析错误响应体
|
||||
} else {
|
||||
errorInfo = "请求失败,状态码:" + response.code();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
errorInfo = "请求失败,状态码:" + response.code();
|
||||
e.printStackTrace();
|
||||
}
|
||||
showToast("");
|
||||
onFailure(new Exception(errorInfo));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<T>> call, Throwable t) {
|
||||
// 统一处理网络异常
|
||||
String errorMsg;
|
||||
if (t instanceof IOException) {
|
||||
// errorMsg = "网络异常,请检查网络连接";
|
||||
} else {
|
||||
// errorMsg = "请求处理失败,请重试";
|
||||
}
|
||||
showToast("");
|
||||
// 回调给具体实现处理
|
||||
onFailure(t);
|
||||
}
|
||||
|
||||
// 显示提示信息
|
||||
private void showToast(String message) {
|
||||
if (mContext != null) {
|
||||
Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
// 业务成功时的回调,由具体接口实现
|
||||
public abstract void onSuccess(T data);
|
||||
|
||||
// 错误时的回调,可选实现
|
||||
public void onFailure(Throwable t) {
|
||||
// 可以留空,由子类选择性实现
|
||||
LogUtils.e("接口错误:",t);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.xscm.moduleutil.http;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Converter;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class BusinessAwareConverterFactory extends Converter.Factory {
|
||||
private final GsonConverterFactory originalFactory;
|
||||
private final Context context;
|
||||
|
||||
public BusinessAwareConverterFactory(Context context) {
|
||||
this.context = context;
|
||||
this.originalFactory = GsonConverterFactory.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Converter<ResponseBody, ?> responseBodyConverter(Type type,
|
||||
Annotation[] annotations,
|
||||
Retrofit retrofit) {
|
||||
final Converter<ResponseBody, ?> delegate =
|
||||
originalFactory.responseBodyConverter(type, annotations, retrofit);
|
||||
|
||||
return new Converter<ResponseBody, Object>() {
|
||||
@Override
|
||||
public Object convert(ResponseBody value) throws IOException {
|
||||
// 先读取响应字符串检查业务状态码
|
||||
String responseString = value.string();
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(responseString);
|
||||
int code = jsonObject.getInt("code");
|
||||
String msg = jsonObject.getString("msg");
|
||||
|
||||
if (code == 301) {
|
||||
handleForceLogout();
|
||||
ToastUtils.showShort(msg);
|
||||
}
|
||||
|
||||
// 重新构建 ResponseBody 供原始转换器使用
|
||||
ResponseBody newValue = ResponseBody.create(value.contentType(), responseString);
|
||||
return delegate.convert(newValue);
|
||||
|
||||
} catch (JSONException e) {
|
||||
throw new IOException("");
|
||||
}
|
||||
}
|
||||
|
||||
private void handleForceLogout() {
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -193,6 +193,7 @@ public class RetrofitClient {
|
||||
|
||||
private Retrofit provideRetrofit(OkHttpClient client) {
|
||||
return new Retrofit.Builder()
|
||||
.addConverterFactory(new BusinessAwareConverterFactory(CommonAppContext.getInstance()))
|
||||
.addConverterFactory(MyConverterFactory.create())/**/
|
||||
// .addConverterFactory(GsonConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
@@ -234,7 +235,29 @@ public class RetrofitClient {
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
/**
|
||||
* 检查网络连接状态
|
||||
* @return true表示网络可用,false表示网络不可用
|
||||
*/
|
||||
private boolean isNetworkAvailable() {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) CommonAppContext.getInstance()
|
||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (connectivityManager != null) {
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 网络不可用时的统一处理方法
|
||||
* @param observer BaseObserver对象
|
||||
* @param <T> 泛型类型
|
||||
*/
|
||||
private <T> void handleNetworkUnavailable(BaseObserver<T> observer) {
|
||||
ToastUtils.showShort("网络不可用,请检查网络设置");
|
||||
observer.onError(new Throwable("网络不可用,请检查网络设置"));
|
||||
}
|
||||
public <T> T createApiClient(Class<T> apiClientClass) {
|
||||
return mRetrofit.create(apiClientClass);
|
||||
}
|
||||
@@ -258,6 +281,7 @@ public class RetrofitClient {
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<String> body = response.body();
|
||||
|
||||
observer.onNext(body.getMsg());
|
||||
|
||||
}
|
||||
@@ -367,6 +391,7 @@ public class RetrofitClient {
|
||||
sApiServer.exchangeCoin(earnings_num).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
|
||||
onNextRetu(response, observer);
|
||||
}
|
||||
|
||||
@@ -400,7 +425,7 @@ public class RetrofitClient {
|
||||
public void onResponse(Call<BaseModel<FirstChargeBean>> call, Response<BaseModel<FirstChargeBean>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<FirstChargeBean> baseModel = response.body();
|
||||
if (baseModel != null) {
|
||||
if (baseModel.getCode()==1){
|
||||
observer.onNext(baseModel.getData());
|
||||
} else {
|
||||
ToastUtils.showShort("获取数据失败");
|
||||
@@ -1301,7 +1326,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<MyRoomBean>>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("获取房间列表失败", t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1345,7 +1371,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<TopRoom>>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("getTopRooms", t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1748,6 +1775,11 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
public void roomGetIn(String roomId, String password, BaseObserver<RoomInfoResp> observer) {
|
||||
if (!isNetworkAvailable()) {
|
||||
handleNetworkUnavailable(observer);
|
||||
CommonAppContext.getInstance().isRoomJoininj=false;
|
||||
return;
|
||||
}
|
||||
sApiServer.roomGetIn(roomId, password).enqueue(new Callback<BaseModel<RoomInfoResp>>() {
|
||||
|
||||
@Override
|
||||
@@ -1827,7 +1859,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<MyCpRoom>>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("myCpRoom", t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2026,8 +2059,7 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
// TODO: 2025/3/15 获取主持人列表
|
||||
public void getHostList(String roomId, String
|
||||
type, BaseObserver<List<HostBean>> observer) {
|
||||
public void getHostList(String roomId, String type, BaseObserver<List<HostBean>> observer) {
|
||||
sApiServer.getHostList(roomId, type).enqueue(new Callback<BaseModel<List<HostBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<HostBean>>> call, Response<BaseModel<List<HostBean>>> response) {
|
||||
@@ -2046,8 +2078,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getSearch(String keyWord, String
|
||||
type, BaseObserver<List<RoomSearchResp>> observer) {
|
||||
public void getSearch(String keyWord, String type, BaseObserver<List<RoomSearchResp>> observer) {
|
||||
sApiServer.getSearch(keyWord, type).enqueue(new Callback<BaseModel<List<RoomSearchResp>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<RoomSearchResp>>> call, Response<BaseModel<List<RoomSearchResp>>> response) {
|
||||
@@ -2086,8 +2117,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getCharmList(String roomId, String stime, String etime, String
|
||||
p, BaseObserver<RoomDetails> observer) {
|
||||
public void getCharmList(String roomId, String stime, String etime, String p, BaseObserver<RoomDetails> observer) {
|
||||
sApiServer.getCharmList(roomId, stime, etime, p).enqueue(new Callback<BaseModel<RoomDetails>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<RoomDetails>> call, Response<BaseModel<RoomDetails>> response) {
|
||||
@@ -2146,26 +2176,22 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void roomAuctionJoin(String auctionId, String userId, String giftId, String
|
||||
num, String type, BaseObserver<RoomAuction.AuctionListBean> observer) {
|
||||
sApiServer.roomAuctionJoin(auctionId, userId, giftId, num, type).enqueue(new Callback<BaseModel<RoomAuction.AuctionListBean>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<RoomAuction.AuctionListBean>> call, Response<BaseModel<RoomAuction.AuctionListBean>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<RoomAuction.AuctionListBean> baseModel = response.body();
|
||||
|
||||
if (baseModel.getCode() == 1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
} else {
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
public void roomAuctionJoin(String auctionId, String userId, String giftId, String num, String type, BaseObserver<RoomAuction.AuctionListBean> observer) {
|
||||
sApiServer.roomAuctionJoin(auctionId, userId, giftId, num, type).enqueue(new ApiResponseCallback<RoomAuction.AuctionListBean>(CommonAppContext.getInstance()) {
|
||||
@Override
|
||||
public void onSuccess(RoomAuction.AuctionListBean data) {
|
||||
// 确保即使data为null也能够正确传递给observer
|
||||
if (data == null){
|
||||
data = new RoomAuction.AuctionListBean();
|
||||
}
|
||||
observer.onNext(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<RoomAuction.AuctionListBean>> call, Throwable t) {
|
||||
t.printStackTrace();
|
||||
public void onFailure(Throwable t) {
|
||||
super.onFailure(t);
|
||||
RoomAuction.AuctionListBean yy=new RoomAuction.AuctionListBean();
|
||||
observer.onNext(yy);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2180,6 +2206,7 @@ public class RetrofitClient {
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("auction",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2197,7 +2224,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2211,7 +2238,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2225,7 +2252,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2241,7 +2268,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("editRoom",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2256,7 +2284,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setPresidedRatio",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2272,7 +2301,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("postHostAdd",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2287,7 +2317,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("reward_zone",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2301,7 +2332,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("upSong",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2315,7 +2347,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("clearApply",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2356,7 +2389,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("helpApply",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2371,7 +2405,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setRoomApply",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2386,13 +2421,13 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("giveGift",t);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String
|
||||
type, String pit_number, String heart_id, BaseObserver<String> observer) {
|
||||
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String type, String pit_number, String heart_id, BaseObserver<String> observer) {
|
||||
sApiServer.roomGift(room_id, gift_id, gift_num, to_uid, type, pit_number, heart_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -2401,7 +2436,9 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("解析失败:roomGift", t.toString());
|
||||
observer.onNext( "");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2579,8 +2616,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void setMutePit(String roomId, String user_id, String
|
||||
isMute, BaseObserver<String> observer) {
|
||||
public void setMutePit(String roomId, String user_id, String isMute, BaseObserver<String> observer) {
|
||||
sApiServer.setMutePit(roomId, user_id, isMute).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -2589,7 +2625,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setMutePit", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2604,7 +2641,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setLockPit", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2618,7 +2656,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("downPit", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2632,7 +2671,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("kickOutRoom", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2646,7 +2686,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("applySong", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2660,7 +2701,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("agreeSong", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2674,7 +2716,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("endSong", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2769,6 +2812,7 @@ public class RetrofitClient {
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("changeSong", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2783,7 +2827,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("hostUserPit", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2836,7 +2881,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("topRelationCard", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2850,7 +2896,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteRelationCard", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2906,7 +2953,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("setUserDecorate", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2938,7 +2986,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("publishZone", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2952,7 +3001,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("likeZone", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2966,7 +3016,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteComment", t.toString());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2982,7 +3033,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteZone", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2997,7 +3049,9 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("commentZone", t.toString());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3012,7 +3066,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("clearLoginInfo", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3027,13 +3082,13 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("cancel", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getPostData(String new_password, String mobile, String code, String
|
||||
userId, BaseObserver<String> observer) {
|
||||
public void getPostData(String new_password, String mobile, String code, String userId, BaseObserver<String> observer) {
|
||||
sApiServer.getPostData(new_password, mobile, code, userId).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -3066,7 +3121,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("forgotPassword", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3081,7 +3137,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("createAlbum", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3096,7 +3153,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("editAlbum", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3113,7 +3171,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("editUserInfo", t.toString());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -3126,7 +3185,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("editUserBg", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3141,7 +3201,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("userGuanz", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3155,7 +3216,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3170,7 +3232,7 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
@@ -3220,7 +3282,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("removeBlackList", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3235,7 +3298,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("upAddAlbum", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3249,7 +3313,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("moveAlbum", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3278,7 +3343,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteAlbum", t.toString());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -3290,7 +3356,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("deleteAlbum", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3306,7 +3373,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("likeAlbum", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3320,7 +3388,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("getRealNameResult", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3334,7 +3403,8 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("changeRoom", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3348,13 +3418,13 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
// ToastUtils.showShort(t.toString());
|
||||
LogUtils.e("changeRoomType", t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onNextRetu
|
||||
(Response<BaseModel<String>> response, BaseObserver<String> observer) {
|
||||
public void onNextRetu(Response<BaseModel<String>> response, BaseObserver<String> observer) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<String> string = response.body();
|
||||
if (string != null) {
|
||||
@@ -3380,8 +3450,7 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
/// 获取活动礼物列表
|
||||
public void getBoxGiftList(String giftBagId, String
|
||||
roomId, BaseObserver<BlindBoxBean> observer) {
|
||||
public void getBoxGiftList(String giftBagId, String roomId, BaseObserver<BlindBoxBean> observer) {
|
||||
sApiServer.getBoxGiftList(giftBagId, roomId).enqueue(new Callback<BaseModel<BlindBoxBean>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<BlindBoxBean>> call, Response<BaseModel<BlindBoxBean>> response) {
|
||||
@@ -3512,8 +3581,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void xlhMyRecord(String roomId, String page, String
|
||||
pageSize, BaseObserver<List<GiftBean>> observer) {
|
||||
public void xlhMyRecord(String roomId, String page, String pageSize, BaseObserver<List<GiftBean>> observer) {
|
||||
sApiServer.xlhMyRecord(roomId, page, pageSize).enqueue(new Callback<BaseModel<List<GiftBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<GiftBean>>> call, Response<BaseModel<List<GiftBean>>> response) {
|
||||
@@ -3532,8 +3600,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getAllRecord(String giftBagId, String page, String
|
||||
pageSize, BaseObserver<List<GiftBean>> observer) {
|
||||
public void getAllRecord(String giftBagId, String page, String pageSize, BaseObserver<List<GiftBean>> observer) {
|
||||
sApiServer.getAllRecord(giftBagId, page, pageSize).enqueue(new Callback<BaseModel<List<GiftBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<GiftBean>>> call, Response<BaseModel<List<GiftBean>>> response) {
|
||||
|
||||
@@ -21,9 +21,9 @@ public class ARouteConstants {
|
||||
public static final String CREATED_ROOM = "/modulevocal/CreatedRoomActivity"; //创建房间
|
||||
public static final String WITHDRAWAL_ACTIVITY = "/modulevocal/WithdrawalActivity"; //提现
|
||||
public static final String REAL_NAME_ACTIVITY ="/modulevocal/RealNameActivity"; //实名认证
|
||||
public static final String REAL_NAME_ACTIVITY2 ="/app/RealNameActivity"; //实名认证
|
||||
public static final String H5 ="/moduleutil/WebViewActivity"; //网页
|
||||
public static final String GIFT_WALL ="/moduleroom/UserGiftWallFragment"; //实名认证
|
||||
public static final String REAL_NAME_ACTIVITY2 ="/modulevocal/RealNameActivity"; //实名认证
|
||||
public static final String H5 ="/moduleUtil/WebViewActivity"; //网页
|
||||
// public static final String GIFT_WALL ="/moduleroom/UserGiftWallFragment"; //实名认证
|
||||
public static final String RECHARGE_ACTIVITY ="/modulevocal/RechargeActivity"; //实名认证
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xscm.moduleutil.widget.room
|
||||
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp
|
||||
import com.xscm.moduleutil.http.RetrofitClient
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
open class BaseViewModel : ViewModel(),LifecycleObserver {
|
||||
|
||||
val roomInfoData=MutableLiveData<RoomInfoResp>()
|
||||
private val passRoom by lazy { MutableLiveData<Exception>() }
|
||||
|
||||
private val error by lazy { MutableLiveData<Exception>() }
|
||||
|
||||
private val finally by lazy { MutableLiveData<Int>() }
|
||||
//加入房间
|
||||
fun jiaoRoom(roomId:String, password:String){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求失败,出现异常
|
||||
*/
|
||||
fun getError(): LiveData<Exception> {
|
||||
return error
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求完成,在此处做一些关闭操作
|
||||
*/
|
||||
fun getFinally(): LiveData<Int> {
|
||||
return finally
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.xscm.moduleutil.widget.room
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* 自定义异常信息显示
|
||||
*/
|
||||
data class PassRoomException(var msg: String,var code: Int) : IOException()
|
||||
@@ -244,7 +244,9 @@ public class CircleCategoryFragment extends BaseMvpFragment<CirclePresenter, Fra
|
||||
|
||||
@Override
|
||||
public void setLikeZone(int type) {
|
||||
// MvpPre.getCircleList(page + "", "10");
|
||||
if (type == 1) {
|
||||
MvpPre.getCircleList(page + "", "10");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,7 @@ android {
|
||||
enabled = true
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
jvmTarget = '11'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin-kapt'
|
||||
android {
|
||||
namespace 'com.example.moduleroom'
|
||||
compileSdk 35
|
||||
@@ -34,7 +35,12 @@ android {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
||||
// 与 dependencies 同级别
|
||||
kapt {
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
|
||||
implementation libs.appcompat
|
||||
@@ -48,9 +54,12 @@ dependencies {
|
||||
implementation project(':moduleUtil')
|
||||
implementation project(':moduletablayout')
|
||||
|
||||
implementation 'com.alibaba:arouter-api:1.5.2'
|
||||
// implementation 'com.alibaba:arouter-api:1.5.2'
|
||||
//annotationProcessor
|
||||
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
|
||||
// annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
|
||||
|
||||
implementation 'com.alibaba:arouter-api:1.5.2'
|
||||
kapt 'com.alibaba:arouter-compiler:1.5.2'
|
||||
|
||||
implementation 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'
|
||||
|
||||
|
||||
@@ -39,6 +39,17 @@
|
||||
android:name=".service.MediaProjectionService"
|
||||
android:foregroundServiceType="mediaProjection">
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".service.ForegroundService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:foregroundServiceType="microphone|camera|mediaPlayback" />
|
||||
<service
|
||||
android:name=".service.CancelNoticeService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@ package com.example.moduleroom.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
@@ -35,6 +36,7 @@ import com.example.moduletablayout.listener.OnTabSelectListener;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.adapter.GiftTwoDetailsFragment;
|
||||
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
@@ -499,7 +501,14 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
mBinding.ivWf.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", giftDetailResp.getRule_url()).withString("title", "盲盒规则").navigation();
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", giftDetailResp.getRule_url()).withString("title", "盲盒规则").navigation();
|
||||
|
||||
Intent intent = new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", giftDetailResp.getRule_url());
|
||||
intent.putExtra("title", "盲盒规则");
|
||||
startActivity(intent);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.example.moduleroom.dialog;
|
||||
import static com.xscm.moduleutil.bean.room.RoomSettingBean.QXRoomSettingTypeRoomOrderMic;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@@ -24,6 +25,7 @@ import com.example.moduleroom.contacts.RoomSettingContacts;
|
||||
import com.example.moduleroom.databinding.DialogRoomSettingFragmentBinding;
|
||||
import com.example.moduleroom.fragment.RoomBackgroundDialogFragment;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.event.EffectEvent;
|
||||
@@ -291,7 +293,11 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
}
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomReport) {
|
||||
if (roomId != null) {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + 2 + "&fromId=" + roomId).navigation();
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + 2 + "&fromId=" + roomId).navigation();
|
||||
Intent intent = new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + 2 + "&fromId=" + roomId);
|
||||
|
||||
startActivity(intent);
|
||||
}else {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("数据错误,请关闭重试");
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.example.moduleroom.fragment.RelationshipFragment;
|
||||
import com.example.moduleroom.presenter.RoomUserPresenter;
|
||||
import com.example.zhouwei.library.CustomPopWindow;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.RelationCardBean;
|
||||
@@ -202,7 +203,11 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
|
||||
|
||||
// UserGiftWallRoomFragment.newInstance(Integer.parseInt(user_id)).show(getChildFragmentManager(), "UserGiftWallRoomFragment");
|
||||
}else if (id == R.id.room_jb){
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id).withString("title", "举报").navigation();
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id).withString("title", "举报").navigation();
|
||||
Intent intent = new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id);
|
||||
intent.putExtra("title", "举报");
|
||||
startActivity(intent);
|
||||
}else if (id==R.id.iv_avatar){
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", userInfo.getUser_id()+"").navigation();
|
||||
dismiss();
|
||||
@@ -270,7 +275,12 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
|
||||
} else if (id == R.id.action_report) {
|
||||
// showContent = "点击 Item菜单6";
|
||||
//TODO 举报功能
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id).withString("title", "举报").navigation();
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id).withString("title", "举报").navigation();
|
||||
Intent intent=new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id);
|
||||
intent.putExtra("title", "举报");
|
||||
startActivity(intent);
|
||||
|
||||
dismiss();
|
||||
} else if (id == R.id.action_blacklist) {
|
||||
MvpPre.addBlackList(user_id);
|
||||
|
||||
@@ -9,8 +9,6 @@ import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import android.os.CountDownTimer;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -18,8 +16,6 @@ import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
@@ -36,9 +32,7 @@ import com.example.moduleroom.dialog.RoomGiftDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomOnlineDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomUserInfoFragment;
|
||||
import com.example.moduleroom.presenter.FriendshipRoomPresenter;
|
||||
import com.opensource.svgaplayer.SVGACallback;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.base.BaseRoomFragment;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.RoomRelationBean;
|
||||
@@ -51,15 +45,12 @@ import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.utils.ClickUtils;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.StringUtil;
|
||||
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
import com.xscm.moduleutil.widget.floatingView.IFloatingView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -1005,7 +996,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setrlMic(true);
|
||||
((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
|
||||
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled( false,SpUtil.getUserId()+"");
|
||||
// AgoraManager.getInstance(getActivity()).setLocalAudioEnabled( false,SpUtil.getUserId()+"");
|
||||
}
|
||||
}
|
||||
configPowerBtn();
|
||||
|
||||
@@ -37,7 +37,6 @@ import com.xscm.moduleutil.event.RoomJoinMountModel;
|
||||
import com.xscm.moduleutil.rtc.MusicPlayBean;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
import com.tencent.imsdk.v2.V2TIMCallback;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.imsdk.v2.V2TIMSendCallback;
|
||||
|
||||
@@ -13,20 +13,14 @@ import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewStub;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.TimeUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.activity.RoomActivity;
|
||||
import com.example.moduleroom.contacts.RoomAuctionContacts;
|
||||
@@ -41,7 +35,6 @@ import com.example.moduleroom.dialog.RoomUserInfoFragment;
|
||||
import com.example.moduleroom.presenter.RoomAuctionPresenterTow;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
@@ -54,22 +47,16 @@ import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.dialog.RoomAuctionWebViewDialog;
|
||||
import com.xscm.moduleutil.dialog.WebViewDialog;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ClickUtils;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.StringUtil;
|
||||
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
|
||||
import com.xscm.moduleutil.widget.RoomMakeWheatView;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,9 +25,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ObjectUtils;
|
||||
import com.blankj.utilcode.util.TimeUtils;
|
||||
@@ -51,7 +49,6 @@ import com.xscm.moduleutil.event.CabinEvent;
|
||||
import com.xscm.moduleutil.event.RoomBeckoningEvent;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
import com.xscm.moduleutil.widget.dialog.CommonDialog;
|
||||
@@ -60,7 +57,6 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.TouchDelegate;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
@@ -40,7 +36,6 @@ import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.rtc.AgoraIsOPen;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.rtc.MusicFileBean;
|
||||
import com.xscm.moduleutil.rtc.MusicPlayBean;
|
||||
|
||||
@@ -32,7 +32,6 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.blankj.utilcode.util.ObjectUtils;
|
||||
import com.example.moduleroom.R;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.example.moduleroom.service
|
||||
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import android.os.SystemClock
|
||||
import android.util.Log
|
||||
|
||||
|
||||
// 同时启动两个service,共享同一个NotificationID,并且将他们同时置为前台状态,
|
||||
// 此时会出现两个前台服务,但通知管理器里只有一个关联的通知。
|
||||
// 这时我们在其中一个服务中调用 stopForeground(true),
|
||||
// 这个服务前台状态会被取消,同时状态栏通知也被移除。另外一个服务并没有受到影响,还是前台服务状态,但是此时,状态栏通知已经没了!
|
||||
// 其oom_adj值还是没变的
|
||||
class CancelNoticeService : Service() {
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
if (null == intent) {
|
||||
//服务被系统kill掉之后重启进来的
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
ForegroundNotification.startForeground(this)
|
||||
Thread {
|
||||
SystemClock.sleep(1000)
|
||||
// stopForeground(true)
|
||||
Log.d("ForegroundService", "CancelNoticeService onStartCommand: CancelNoticeService" )
|
||||
ForegroundNotification.stopForeground(this)
|
||||
// stopSelf()
|
||||
}.start()
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Log.d("ForegroundService", "onDestroy: CancelNoticeService")
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.example.moduleroom.service
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.ActivityManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
|
||||
fun Context.startForegroundService() {
|
||||
Intent(this, ForegroundService::class.java).also { intent ->
|
||||
if (Build.VERSION.SDK_INT >= 34) {
|
||||
this.startForegroundService(intent)
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
this.startForegroundService(intent)
|
||||
} else {
|
||||
this.startService(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Context.hideBackground(hide: Boolean) {
|
||||
var appTasks: List<ActivityManager.AppTask>? = null
|
||||
val activityManager = getSystemService(
|
||||
Context.ACTIVITY_SERVICE
|
||||
) as? ActivityManager
|
||||
if (activityManager != null && activityManager.appTasks.also {
|
||||
appTasks = it
|
||||
} != null && appTasks?.isNotEmpty() == true) {
|
||||
appTasks?.get(0)?.setExcludeFromRecents(hide)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Activity.ignoreBattery() {
|
||||
val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
|
||||
intent.data = Uri.parse("package:$packageName")
|
||||
startActivityForResult(intent, 1)
|
||||
}
|
||||
|
||||
fun Activity.startAccessibilitySetting() {
|
||||
runCatching {
|
||||
val intent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun isServiceRunning(context: Context, serviceName: String="com.voice.module_live.keepalive.ForegroundService"): Boolean {
|
||||
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
||||
if (activityManager != null) {
|
||||
for (service in activityManager.getRunningServices(Int.MAX_VALUE)) {
|
||||
if (serviceName == service.service.className) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.example.moduleroom.service
|
||||
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.*
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.getSystemService
|
||||
import com.example.moduleroom.activity.RoomActivity
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object ForegroundNotification {
|
||||
private const val CHANNEL_FOREGROUND = "foreground-notification"
|
||||
const val NOTICE_ID = 233
|
||||
private var service: Service? = null
|
||||
|
||||
private fun createChannelIfNeeded(context: Context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
|
||||
|
||||
val foregroundChannel =
|
||||
NotificationChannel(CHANNEL_FOREGROUND, "前台服务", NotificationManager.IMPORTANCE_MIN)
|
||||
.apply {
|
||||
setShowBadge(false)
|
||||
enableLights(false)
|
||||
enableVibration(false)
|
||||
lockscreenVisibility = Notification.VISIBILITY_SECRET
|
||||
}
|
||||
context.getSystemService<NotificationManager>()
|
||||
?.createNotificationChannel(foregroundChannel)
|
||||
}
|
||||
|
||||
fun startForeground(service: Service) {
|
||||
ForegroundNotification.service = service
|
||||
createChannelIfNeeded(service)
|
||||
val pendingIntent = PendingIntent.getActivity(
|
||||
service,
|
||||
0,
|
||||
Intent(service, RoomActivity::class.java),
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
val notification = NotificationCompat.Builder(service, CHANNEL_FOREGROUND)
|
||||
.setSmallIcon(com.xscm.moduleutil.R.mipmap.ic_launcher_app)
|
||||
.setContentText("正在运行")
|
||||
.setContentIntent(pendingIntent)
|
||||
.setLocalOnly(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.setCategory(NotificationCompat.CATEGORY_SERVICE)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
|
||||
.setOngoing(true)
|
||||
.setShowWhen(false)
|
||||
.build()
|
||||
service.startForeground(NOTICE_ID, notification)
|
||||
}
|
||||
|
||||
fun stopForeground(service: Service) {
|
||||
val manager = service.getSystemService(Service.NOTIFICATION_SERVICE) as? NotificationManager
|
||||
manager?.cancel(NOTICE_ID)
|
||||
service.stopForeground(true)
|
||||
}
|
||||
|
||||
fun cancelNotice(service: Service) {
|
||||
val manager = service.getSystemService(Service.NOTIFICATION_SERVICE) as? NotificationManager
|
||||
manager?.cancel(NOTICE_ID)
|
||||
}
|
||||
|
||||
fun stopForeground() {
|
||||
val manager =
|
||||
service?.getSystemService(Service.NOTIFICATION_SERVICE) as? NotificationManager
|
||||
manager?.cancel(NOTICE_ID)
|
||||
service?.stopForeground(true)
|
||||
}
|
||||
|
||||
fun startForegroundIfNeed(service: Service) {
|
||||
val manager = service.getSystemService(Service.NOTIFICATION_SERVICE) as? NotificationManager
|
||||
var needStart = true
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
manager?.activeNotifications?.forEach {
|
||||
needStart = (it.id == NOTICE_ID).not()
|
||||
}
|
||||
}
|
||||
if (needStart) {
|
||||
startForeground(service)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.example.moduleroom.service
|
||||
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import java.util.*
|
||||
|
||||
//前台服务
|
||||
class ForegroundService : Service() {
|
||||
private var logInt = 0
|
||||
private var timer: Timer? = null
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
ForegroundNotification.startForeground(this)
|
||||
timer = Timer()
|
||||
timer?.schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
Log.d("ForegroundService", "Timer task ${logInt++}")
|
||||
}
|
||||
}, 0L, 300L)
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
if (null == intent) {
|
||||
//服务被系统kill掉之后重启进来的
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
ForegroundNotification.startForegroundIfNeed(this)
|
||||
if (ServiceHelper.cancelNotice) {
|
||||
Log.d("ForegroundService", "onStartCommand: CancelNoticeService")
|
||||
val intent = Intent(this, CancelNoticeService::class.java)
|
||||
startService(intent)
|
||||
}
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Log.d("ForegroundService", "onDestroy: $timer")
|
||||
|
||||
timer?.cancel()
|
||||
ForegroundNotification.stopForeground(this)
|
||||
// 重启自己
|
||||
startForegroundService()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.example.moduleroom.service;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
|
||||
public class RoomPlayService extends Service {
|
||||
|
||||
private NotificationManager notificationManager;
|
||||
|
||||
private String notificationId = "room_play_channelId";
|
||||
|
||||
private String notificationName = "room_play_channelName";
|
||||
|
||||
//通知的唯一标识号。
|
||||
private static final int NOTIFICATION_ID = 11210666;
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
//创建NotificationChannel
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannel channel = new NotificationChannel(notificationId, notificationName, NotificationManager.IMPORTANCE_HIGH);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
startForeground(1, getNotification());
|
||||
}
|
||||
|
||||
private Notification getNotification() {
|
||||
|
||||
// PendingIntent如果用户选择此通知,则启动我们的活动
|
||||
// PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0);
|
||||
|
||||
Notification.Builder builder = new Notification.Builder(this)
|
||||
.setTicker("正在运行")
|
||||
.setSmallIcon(R.mipmap.ic_launcher_app)
|
||||
|
||||
// .setContentIntent(pendingIntent)
|
||||
|
||||
.setContentTitle(getString(R.string.app_name))
|
||||
|
||||
.setContentText("运行中");
|
||||
|
||||
//设置Notification的ChannelID,否则不能正常显示
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
builder.setChannelId(notificationId);
|
||||
}
|
||||
Notification notification = builder.build();
|
||||
|
||||
//发送通知
|
||||
// notificationManager.notify(NOTIFICATION_ID,notification);
|
||||
return notification;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (notificationManager != null) {
|
||||
notificationManager.cancel(NOTIFICATION_ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.example.moduleroom.service
|
||||
|
||||
object ServiceHelper {
|
||||
|
||||
var cancelNotice = false
|
||||
}
|
||||
@@ -61,5 +61,9 @@ dependencies {
|
||||
//annotationProcessor
|
||||
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
|
||||
|
||||
implementation files('libs/WbCloudFaceLiveSdk-face-v6.6.2-8e4718fc.aar')
|
||||
implementation files('libs/WbCloudNormal-v5.1.10-4e3e198.aar')
|
||||
|
||||
|
||||
}
|
||||
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||
BIN
modulevocal/libs/WbCloudFaceLiveSdk-face-v6.6.2-8e4718fc.aar
Normal file
BIN
modulevocal/libs/WbCloudFaceLiveSdk-face-v6.6.2-8e4718fc.aar
Normal file
Binary file not shown.
BIN
modulevocal/libs/WbCloudNormal-v5.1.10-4e3e198.aar
Normal file
BIN
modulevocal/libs/WbCloudNormal-v5.1.10-4e3e198.aar
Normal file
Binary file not shown.
@@ -38,9 +38,6 @@
|
||||
android:name=".activity.CreateAlbumActivity"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".activity.RealName1Activity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".activity.RevenueActivity"
|
||||
android:exported="false"
|
||||
@@ -143,6 +140,9 @@
|
||||
android:name=".activity.UnderageActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".activity.RealNameActivity"
|
||||
android:exported="false" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.example.modulevocal.activity;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.example.modulevocal.R;
|
||||
import com.example.modulevocal.databinding.ActivityAboutUsBinding;
|
||||
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.widget.CommonAppConfig;
|
||||
@@ -17,12 +20,21 @@ public class AboutUsActivity extends BaseAppCompatActivity<ActivityAboutUsBindin
|
||||
mBinding.tvAppVersion.setText("Version " + CommonAppConfig.getInstance().getVersion());
|
||||
|
||||
mBinding.llYonghu.setOnClickListener(v -> {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6").withString("title", "用户协议").navigation();
|
||||
Intent intent = new Intent(this, WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6");
|
||||
intent.putExtra("title", "用户协议");
|
||||
startActivity(intent);
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=6").withString("title", "用户协议").navigation();
|
||||
});
|
||||
|
||||
mBinding.llYins.setOnClickListener(v -> {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", "file:///android_asset/page_show.html").withString("title", "隐私协议").navigation();
|
||||
Intent intent = new Intent(this, WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4");
|
||||
intent.putExtra("title", "隐私协议");
|
||||
startActivity(intent);
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.xscm.midi;
|
||||
package com.example.modulevocal.activity;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
@@ -11,16 +11,10 @@ import android.view.View;
|
||||
|
||||
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.xscm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.xscm.moduleutil.bean.RealNameBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.midi.databinding.ActivityRealNameBinding;
|
||||
import com.tencent.cloud.huiyansdkface.facelight.api.WbCloudFaceContant;
|
||||
import com.tencent.cloud.huiyansdkface.facelight.api.WbCloudFaceVerifySdk;
|
||||
import com.tencent.cloud.huiyansdkface.facelight.api.listeners.WbCloudFaceVerifyLoginListener;
|
||||
@@ -28,6 +22,13 @@ import com.tencent.cloud.huiyansdkface.facelight.api.listeners.WbCloudFaceVerify
|
||||
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;
|
||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.xscm.moduleutil.bean.RealNameBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.example.modulevocal.activity;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Autowired;
|
||||
@@ -11,6 +12,7 @@ import com.example.modulevocal.R;
|
||||
import com.example.modulevocal.databinding.ActivityUnderageBinding;
|
||||
import com.example.modulevocal.presenter.UnderagePresenter;
|
||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
@@ -190,8 +192,14 @@ public class UnderageActivity extends BaseMvpActivity<UnderagePresenter, Activit
|
||||
private void navigateToNextPage() {
|
||||
// ToastUtils.showShort("密码设置成功");
|
||||
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken())
|
||||
.withString("type", "1").navigation();
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken())
|
||||
// .withString("type", "1").navigation();
|
||||
Intent intent = new Intent(UnderageActivity.this, WebViewActivity.class);
|
||||
intent.putExtra("type", "1");
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken());
|
||||
startActivity(intent);
|
||||
|
||||
|
||||
mBinding.verificationcodeview.setText("");
|
||||
finish();
|
||||
// 这里可以添加页面跳转逻辑
|
||||
|
||||
@@ -19,6 +19,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.example.modulevocal.R;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.adapter.PayMethodAdapter;
|
||||
import com.example.modulevocal.conacts.WithdrawalConacts;
|
||||
import com.example.modulevocal.databinding.ActivityWithdrawalBinding;
|
||||
@@ -103,7 +104,11 @@ public class WithdrawalActivity extends BaseMvpActivity<WithdrawalPresenter, Act
|
||||
});
|
||||
|
||||
mBinding.tvLhjy.setOnClickListener(v -> {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url",walletBean.getUrl()).withString("title", walletBean.getTitle()).navigation();
|
||||
Intent intent = new Intent(this, WebViewActivity.class);
|
||||
intent.putExtra("url", walletBean.getUrl());
|
||||
intent.putExtra("title", walletBean.getTitle());
|
||||
startActivity(intent);
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url",walletBean.getUrl()).withString("title", walletBean.getTitle()).navigation();
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
tools:context=".activity.RealNameActivity">
|
||||
tools:context="com.example.modulevocal.activity.RealNameActivity">
|
||||
|
||||
<data>
|
||||
|
||||
@@ -34,7 +34,7 @@ android {
|
||||
enabled = true
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
jvmTarget = '11'
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
@@ -59,6 +59,8 @@ dependencies {
|
||||
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
|
||||
|
||||
implementation project(':moduleroom')
|
||||
|
||||
|
||||
}
|
||||
|
||||
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||
@@ -3,6 +3,7 @@ package com.example.modulevoice.fragment;
|
||||
import static android.view.View.GONE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -28,6 +29,7 @@ import com.example.modulevoice.databinding.FragmentVoiceCategoryBinding;
|
||||
import com.example.modulevoice.presenter.VoiceCategoryPresenter;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.base.RoomManager;
|
||||
import com.xscm.moduleutil.bean.BannerModel;
|
||||
@@ -125,7 +127,11 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
|
||||
* type=1时,该值表示房间id;type=2时,表示文章id
|
||||
*/
|
||||
BannerModel bannerModel = (BannerModel) model;
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", bannerModel.getUrl()).withString("title", "首页横幅").navigation();
|
||||
Intent intent=new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", bannerModel.getUrl());
|
||||
intent.putExtra("title", "首页横幅");
|
||||
startActivity(intent);
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", bannerModel.getUrl()).withString("title", "首页横幅").navigation();
|
||||
}
|
||||
});
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
|
||||
Reference in New Issue
Block a user