Compare commits
152 Commits
master_融云升
...
6.7.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 89b7e960b6 | |||
|
|
f88295077c | ||
|
|
29badbf725 | ||
|
|
e89f22329f | ||
|
|
81e08d41af | ||
| d89b356395 | |||
| 4d2985456d | |||
| 48e3ff46ab | |||
|
|
6dd3e02c1d | ||
| d8e9cc2189 | |||
|
|
0310628ba3 | ||
| 2f54fdab12 | |||
|
|
a3228f48c2 | ||
|
|
35c83a255a | ||
|
|
0aeb2d32c2 | ||
|
|
313320473f | ||
|
|
2b86927b5b | ||
|
|
bf3ebfedbd | ||
|
|
1a2db91ceb | ||
|
|
9fa4924278 | ||
|
|
3318fa761c | ||
| a7421ba1a6 | |||
|
|
40a081caa6 | ||
|
|
1485173227 | ||
|
|
d5b60523a5 | ||
|
|
309d04653e | ||
|
|
45ae3b1624 | ||
|
|
e874c2ee16 | ||
|
|
002f0ad654 | ||
|
|
bb49472817 | ||
|
|
05e4ff89d7 | ||
| 020b5c1025 | |||
|
|
2cf10cc35a | ||
|
|
4c53c990e9 | ||
|
|
cd8b58a0ec | ||
| b41bd3b89b | |||
|
|
d66f098692 | ||
|
|
f131fcf546 | ||
|
|
eeb1cc008a | ||
| 6eba9558e1 | |||
|
|
0425b56106 | ||
|
|
c5de062171 | ||
|
|
f82dbccaa5 | ||
| 07d6b959d5 | |||
| 5ae55f87fa | |||
|
|
f59e5e527a | ||
| d70c3a8b27 | |||
|
|
c20147bf8f | ||
|
|
45743e3070 | ||
|
|
b8b43c1ef2 | ||
| 73847c46a3 | |||
|
|
b7c53a3b21 | ||
| c91947ce71 | |||
|
|
62e50ae310 | ||
|
|
5baea0f156 | ||
|
|
419e3a7ab5 | ||
|
|
66822139ba | ||
|
|
5a924d9fea | ||
| cb0772c9e3 | |||
|
|
9c9eb34756 | ||
|
|
1b57d8bc8f | ||
| edc738d80b | |||
| b5417f90b4 | |||
|
|
4bd1e4bc91 | ||
|
|
cb2729433e | ||
|
|
985e626cb5 | ||
|
|
efce2ad93c | ||
|
|
6132338c6c | ||
|
|
8c89fc1de1 | ||
|
|
a061637492 | ||
| 98095e07ee | |||
| 9764b3370e | |||
|
|
bbb5a12899 | ||
|
|
680780145c | ||
|
|
19c270ad22 | ||
|
|
ce9336737f | ||
| 0396e2d06d | |||
|
|
39cf76439f | ||
|
|
11c9a53028 | ||
|
|
c4d378daba | ||
|
|
efa698ebfa | ||
|
|
6496440e5d | ||
|
|
d3de01666c | ||
| 9621d8a6d8 | |||
| 07f97fefdb | |||
| 186b9d61ee | |||
| b7c0f5d3ec | |||
| 949c0ab759 | |||
|
|
278801b77a | ||
| 5f3ebb4235 | |||
| ab24348f72 | |||
| 022806d9da | |||
|
|
b0c5d44d1c | ||
|
|
d9b1149832 | ||
|
|
9711b1f8d4 | ||
|
|
0252963b2e | ||
|
|
ff8e75768e | ||
| c92e8dd8bc | |||
|
|
01dfb81a46 | ||
|
|
0afee3543e | ||
| 8d5990c25b | |||
|
|
d5f78cc83a | ||
|
|
cf48be7d15 | ||
| 225929c891 | |||
| bc63a3e601 | |||
| c33975fe67 | |||
| c033340aad | |||
| 24170d55e2 | |||
|
|
26a71ff825 | ||
| e36fbdc6b8 | |||
|
|
b6d0ea1fba | ||
|
|
cbf517bed6 | ||
|
|
dc0ae1124f | ||
|
|
3167ab0be8 | ||
|
|
0b218157d2 | ||
|
|
6a4ac35203 | ||
|
|
93dbee14b3 | ||
|
|
cb376aa83a | ||
| 92d1861d8f | |||
| 0ff0cb52f6 | |||
|
|
afef088555 | ||
|
|
73414f3349 | ||
|
|
abfd15f751 | ||
| 8d87dda691 | |||
| fcd13751c9 | |||
| e24805cf9b | |||
| 489a99e522 | |||
| 6a51b39134 | |||
| 86bbf6a7f3 | |||
|
|
95ded2f77c | ||
| 599e88acc6 | |||
|
|
d78055cdd9 | ||
| 2093306d36 | |||
|
|
b4adf4c77c | ||
| 8e2acc3417 | |||
| d28d0dd3d7 | |||
|
|
7d46ab8520 | ||
| 150bdba795 | |||
| 651fe12edd | |||
| d0c0f8f82e | |||
| 1f12187766 | |||
|
|
754f2a9294 | ||
|
|
9320d6c209 | ||
| 1c9493d7c8 | |||
| 34e4765e13 | |||
| d4d191fad6 | |||
|
|
8228c45a4d | ||
|
|
4147e3c5f5 | ||
|
|
583740e866 | ||
|
|
0db8eefbe6 | ||
|
|
3f68e2a3aa | ||
|
|
5922f4c08b |
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'img-optimizer'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
|
||||
|
||||
android {
|
||||
@@ -33,7 +33,7 @@ android {
|
||||
versionName rootProject.ext.android.versionName
|
||||
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
abiFilters "armeabi-v7a", "arm64-v8a","x86","x86_64"
|
||||
}
|
||||
}
|
||||
aaptOptions {
|
||||
@@ -58,15 +58,15 @@ repositories {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies["appcompat-androidx"]
|
||||
implementation rootProject.ext.dependencies["recyclerview-androidx"]
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||
api rootProject.ext.dependencies["appcompat-androidx"]
|
||||
api rootProject.ext.dependencies["recyclerview-androidx"]
|
||||
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
//common
|
||||
implementation project(path: ':common')
|
||||
api project(path: ':common')
|
||||
|
||||
implementation 'com.faceunity:core:8.3.1'
|
||||
implementation 'com.faceunity:model:8.3.1'
|
||||
api 'com.faceunity:core:8.7.0'
|
||||
api 'com.faceunity:model:8.7.0'
|
||||
//implementation 'com.faceunity:nama:8.3.1' //底层库-标准版
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.yunbao.faceunity;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.platform.app.Instrimport com.yunbao.common.utils.MobclickAgent;ntationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -96,11 +96,17 @@ public class FaceManager implements SensorEventListener {
|
||||
faceUnityView.setIFaceUnityInter(new FaceUnityView.IFaceUnityInter() {
|
||||
@Override
|
||||
public void onPause() {
|
||||
if(onMirrorChanged!=null){
|
||||
onMirrorChanged.onChange(false);
|
||||
}
|
||||
pauseFace = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
if(onMirrorChanged!=null){
|
||||
onMirrorChanged.onChange(true);
|
||||
}
|
||||
pauseFace = false;
|
||||
}
|
||||
});
|
||||
@@ -295,7 +301,18 @@ public class FaceManager implements SensorEventListener {
|
||||
|
||||
}
|
||||
|
||||
OnMirrorChanged onMirrorChanged;
|
||||
|
||||
public void setOnMirrorChanged(OnMirrorChanged onMirrorChanged) {
|
||||
this.onMirrorChanged = onMirrorChanged;
|
||||
}
|
||||
|
||||
public interface FaceStatusChanged {
|
||||
void onFaceChanged(int num);
|
||||
}
|
||||
|
||||
|
||||
public interface OnMirrorChanged{
|
||||
void onChange(boolean falg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ public class FURenderer extends IFURenderer {
|
||||
|
||||
|
||||
/* 特效FURenderKit*/
|
||||
private FURenderKit mFURenderKit;
|
||||
public FURenderKit mFURenderKit;
|
||||
|
||||
/* AI道具*/
|
||||
public static String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor_lite.bundle";
|
||||
public static String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor.bundle";
|
||||
public static String BUNDLE_AI_HUMAN = "model" + File.separator + "ai_human_processor.bundle";
|
||||
|
||||
/* GL 线程 ID */
|
||||
|
||||
@@ -15,7 +15,7 @@ public class FaceUnityConfig {
|
||||
|
||||
/************************** 算法Model ******************************/
|
||||
// 人脸识别
|
||||
public static String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor_lite.bundle";
|
||||
public static String BUNDLE_AI_FACE = "model" + File.separator + "ai_face_processor.bundle";
|
||||
// 手势
|
||||
public static String BUNDLE_AI_HAND = "model" + File.separator + "ai_hand_processor.bundle";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'img-optimizer'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
|
||||
|
||||
android {
|
||||
@@ -33,7 +33,7 @@ android {
|
||||
versionName rootProject.ext.android.versionName
|
||||
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
abiFilters "armeabi-v7a", "arm64-v8a","x86","x86_64"
|
||||
}
|
||||
}
|
||||
aaptOptions {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.yunbao.share;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,26 @@ android {
|
||||
project.tasks.getByName("tasks").doFirst {
|
||||
|
||||
}
|
||||
/* flavorDimensions "packageApk"
|
||||
productFlavors {
|
||||
LinkTest {
|
||||
dimension "packageApk"
|
||||
manifestPlaceholders = [serverHost: "https://ceshi.yaoulive.com",isGooglePlay:0,isPluginModel:true]
|
||||
}
|
||||
LinkOfficial {
|
||||
dimension "packageApk"
|
||||
manifestPlaceholders = [serverHost: "https://napi.yaoulive.com",isGooglePlay:0,isPluginModel:true]
|
||||
}
|
||||
GoogleTest {
|
||||
dimension "packageApk"
|
||||
manifestPlaceholders = [serverHost: "https://ceshi.yaoulive.com",isGooglePlay:1,isPluginModel:false]
|
||||
}
|
||||
GoogleOfficial{
|
||||
dimension "packageApk"
|
||||
manifestPlaceholders = [serverHost: "https://napi.yaoulive.com",isGooglePlay:1,isPluginModel:false]
|
||||
}
|
||||
|
||||
}*/
|
||||
/* applicationVariants.all { variant ->
|
||||
variant.mergeAssetsProvider.configure {
|
||||
doLast {
|
||||
@@ -119,19 +139,32 @@ android {
|
||||
processManifestTask.doLast { pm ->
|
||||
String manifestPath = "build/intermediates/bundle_manifest/release/bundle-manifest/AndroidManifest.xml"
|
||||
def isGooglePlay = rootProject.ext.manifestPlaceholders.isGooglePlay
|
||||
if (file(manifestPath).exists() && isGooglePlay) {
|
||||
println "谷歌版本:" + isGooglePlay
|
||||
println "文件存在" + file(manifestPath).exists()
|
||||
println "" + (isGooglePlay != 0)
|
||||
println "" + (file(manifestPath).exists() && isGooglePlay != 0)
|
||||
if (file(manifestPath).exists() && isGooglePlay != 0) {
|
||||
def manifestContent = file(manifestPath).getText()
|
||||
|
||||
println "移除权限"
|
||||
manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />', '')
|
||||
manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '')
|
||||
file(manifestPath).write(manifestContent)
|
||||
} else {
|
||||
print "not Exists = " + manifestPath
|
||||
}
|
||||
manifestPath = "build/intermediates/merged_manifests/release/processReleaseManifest/AndroidManifest.xml"
|
||||
if (file(manifestPath).exists() && isGooglePlay != 0) {
|
||||
def manifestContent = file(manifestPath).getText()
|
||||
println "移除权限2"
|
||||
manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />', '')
|
||||
manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '')
|
||||
file(manifestPath).write(manifestContent)
|
||||
}
|
||||
}
|
||||
variant.mergeAssetsProvider.configure {
|
||||
doLast {
|
||||
delete(fileTree(dir: outputDir, includes: ['model/ai_bgseg_green.bundle',
|
||||
'model/ai_face_processor.bundle',
|
||||
//'model/ai_face_processor.bundle',
|
||||
//'model/ai_face_processor_lite.bundle',
|
||||
'model/ai_hairseg.bundle',
|
||||
'model/ai_hand_processor.bundle',
|
||||
@@ -158,7 +191,7 @@ android {
|
||||
]))
|
||||
println "isPluginModel = " + rootProject.ext.manifestPlaceholders.isPluginModel
|
||||
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
||||
delete(fileTree(dir: outputDir, includes: ['model/ai_face_processor_lite.bundle',
|
||||
delete(fileTree(dir: outputDir, includes: ['model/ai_face_processor.bundle',
|
||||
'graphics/face_beautification.bundle']))
|
||||
} else {
|
||||
println "不删除bundle"
|
||||
@@ -171,7 +204,7 @@ android {
|
||||
isGoogle = "谷歌"
|
||||
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) {
|
||||
isGoogle = "Huawei"
|
||||
}else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) {
|
||||
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) {
|
||||
isGoogle = "Samsung"
|
||||
}
|
||||
def isPlugin = "完整"
|
||||
@@ -183,7 +216,6 @@ android {
|
||||
isTest = "正式服"
|
||||
}
|
||||
outputFileName = "[${new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk"
|
||||
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
@@ -225,7 +257,8 @@ android {
|
||||
multiDexEnabled true
|
||||
ndk {
|
||||
// TODO: 谷歌商城需要兼容两个平台
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
//abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
abiFilters "armeabi-v7a", "arm64-v8a","x86","x86_64"
|
||||
}
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
|
||||
16
app/proguard-rules.pro
vendored
16
app/proguard-rules.pro
vendored
@@ -190,6 +190,8 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode;
|
||||
-keep class org.greenrobot.eventbus.android.AndroidComponentsImpl*
|
||||
|
||||
#--------ARouter
|
||||
|
||||
-keep public class com.alibaba.android.arouter.**{*;}
|
||||
-keep public class com.alibaba.android.arouter.routes.**{*;}
|
||||
-keep public class com.alibaba.android.arouter.facade.**{*;}
|
||||
-keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
|
||||
@@ -275,6 +277,18 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode;
|
||||
-keep class tech.sud.mgp.hello.ui.main.settings.model.** {*;}
|
||||
-keep class tech.sud.mgp.hello.ui.main.nft.model.** {*;}
|
||||
-keep class tech.sud.mgp.hello.common.event.model.** {*;}
|
||||
-keep class tech.sud.mgp.**{*;}
|
||||
|
||||
-keep class bitter.jnibridge.** { *; }
|
||||
-keep class com.google.androidgamesdk.** { *; }
|
||||
-keep class com.unity3d.** { *; }
|
||||
-keep class do.do.do.** { *; }
|
||||
-keep class do.if.do.** { *; }
|
||||
-keep class for.do.** { *; }
|
||||
-keep class if.do.do.do.** { *; }
|
||||
-keep class org.fmod.** { *; }
|
||||
-keep class tech.sud.** { *; }
|
||||
-keep class tech.unity3d.** { *; }
|
||||
|
||||
-keep class com.yunbao.common.sud.** {*;}
|
||||
|
||||
@@ -292,3 +306,5 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode;
|
||||
|
||||
-keep class com.shayu.lib_google.**{*;}
|
||||
-keep class com.shayu.lib_huawei.**{*;}
|
||||
|
||||
-keep class io.agora.**{*;}
|
||||
|
||||
@@ -89,6 +89,11 @@
|
||||
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->
|
||||
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
|
||||
|
||||
<!-- 声网新增 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
|
||||
|
||||
<queries>
|
||||
<package android:name="com.twitter.android" />
|
||||
<package android:name="jp.naver.line.android" />
|
||||
@@ -157,6 +162,12 @@
|
||||
<meta-data
|
||||
android:name="firebase_crashlytics_collection_enabled"
|
||||
android:value="${isUploadLog}" />
|
||||
<meta-data
|
||||
android:name="BUILD_TIME"
|
||||
android:value="${buildTime}" />
|
||||
<meta-data
|
||||
android:name="SW_RELEASE_MODEL"
|
||||
android:value="${swReleaseModel}" />
|
||||
<meta-data
|
||||
android:name="com.openinstall.APP_KEY"
|
||||
android:value="smvslm" />
|
||||
|
||||
@@ -30,8 +30,8 @@ import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMSimpleMsgListener;
|
||||
import com.tencent.imsdk.v2.V2TIMUserInfo;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.umeng.commonsdk.UMConfigure;
|
||||
import com.yunbao.common.manager.OpenAdManager;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.BuildConfig;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
@@ -51,9 +51,11 @@ import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.live.socket.SocketReceiveBean;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.socket.SocketSwClient;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
import com.yunbao.live.views.RecommendLiveRoomProvider;
|
||||
import com.yunbao.main.activity.LoginActivity;
|
||||
import com.yunbao.main.activity.MsgSettActivity;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -63,6 +65,7 @@ import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
@@ -108,27 +111,31 @@ public class AppContext extends CommonAppContext {
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(@NonNull Activity activity) {
|
||||
AppManager.getInstance().removeActivity(activity);
|
||||
for (WeakReference<Activity> reference : activities) {
|
||||
if (reference.get() == activity) {
|
||||
activities.remove(reference);
|
||||
return;
|
||||
}
|
||||
}
|
||||
AppManager.getInstance().removeActivity(activity);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
|
||||
activities.add(new WeakReference<>(activity));
|
||||
if (activity instanceof LoginActivity) {
|
||||
AppManager.getInstance().clear();
|
||||
}
|
||||
CrashSaveBean.getInstance().setActivitySize(activities);
|
||||
AppManager.getInstance().addActivity(activity);
|
||||
OpenAdManager.getInstance().dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(@NonNull Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,6 +149,7 @@ public class AppContext extends CommonAppContext {
|
||||
registerError();
|
||||
registerFirebaseCrash();
|
||||
LogUtils.start(this);
|
||||
//DebugDialog.getInstance().setParams("初始化","启动");
|
||||
sInstance = this;
|
||||
L.setDeBug(BuildConfig.DEBUG);
|
||||
AppEventsLogger.activateApp(this);
|
||||
@@ -164,20 +172,20 @@ public class AppContext extends CommonAppContext {
|
||||
OpenInstall.init(this);
|
||||
}
|
||||
//设置LOG开关,默认为false
|
||||
UMConfigure.setLogEnabled(true);
|
||||
//UMConfigure.setLogEnabled(true);
|
||||
|
||||
|
||||
//友盟正式初始化
|
||||
UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE, "64e40ee55488fe7b3afa2c96");
|
||||
//UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE, "64e40ee55488fe7b3afa2c96");
|
||||
|
||||
//集成umeng-crash-vx.x.x.aar,则需要关闭原有统计SDK异常捕获功能
|
||||
MobclickAgent.setCatchUncaughtExceptions(false);
|
||||
//PushSDK初始化(如使用推送SDK,必须调用此方法)
|
||||
|
||||
//统计SDK是否支持采集在子进程中打点的自定义事件,默认不支持
|
||||
UMConfigure.setProcessEvent(true);//支持多进程打点
|
||||
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO);
|
||||
UMConfigure.submitPolicyGrantResult(getApplicationContext(), true);
|
||||
//UMConfigure.setProcessEvent(true);//支持多进程打点
|
||||
//MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO);
|
||||
//UMConfigure.submitPolicyGrantResult(getApplicationContext(), true);
|
||||
|
||||
registerActivityLifecycleCallbacks(new AdjustLifecycleCallbacks());
|
||||
//初始化 AndroidUtilCode
|
||||
@@ -198,7 +206,7 @@ public class AppContext extends CommonAppContext {
|
||||
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
||||
@Override
|
||||
public boolean onReceived(io.rong.imlib.model.Message message, int i, boolean b, boolean b1) {
|
||||
Log.e("wewe", message.getConversationType() + "112121");
|
||||
Log.e("wewe", message.getConversationType() + "112121 " + message.getContent());
|
||||
MessageIMManager.get(sInstance).getSystemForRongcloud(message);
|
||||
//融云直播间聊天
|
||||
Message msg = Message.obtain();
|
||||
@@ -209,6 +217,31 @@ public class AppContext extends CommonAppContext {
|
||||
if (content.getContent().contains("_method_")) {
|
||||
msg.obj = content.getContent();
|
||||
//观众页面
|
||||
|
||||
String time = String.valueOf(new Date().getTime());
|
||||
//声网
|
||||
if (SocketSwClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
|
||||
SocketSwClient.mSocketHandler.sendMessage(msg);
|
||||
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
|
||||
SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class);
|
||||
JSONObject map = received.getMsg().getJSONObject(0);
|
||||
sendStartAnchorLive(map);
|
||||
} else if (message.getTargetId().contains("v")) {
|
||||
/*String contentJson = ((TextMessage) message.getContent()).getContent();
|
||||
Log.e("wewe", contentJson);
|
||||
SudGameSocketImEvent sudGameSocketImEvent = new Gson().fromJson(contentJson, SudGameSocketImEvent.class);
|
||||
if (sudGameSocketImEvent.getMsg().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
sudGameSocketImEvent.getMsg().get(0).setTime(time);
|
||||
Bus.get().post(sudGameSocketImEvent);*/
|
||||
}
|
||||
//主播页面
|
||||
if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketSwClient.mSocketHandler != null) {
|
||||
SocketSwClient.mSocketHandler.sendMessage(msg);
|
||||
}
|
||||
|
||||
//融云
|
||||
if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
|
||||
SocketRyClient.mSocketHandler.sendMessage(msg);
|
||||
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
|
||||
@@ -219,13 +252,16 @@ public class AppContext extends CommonAppContext {
|
||||
String contentJson = ((TextMessage) message.getContent()).getContent();
|
||||
Log.e("wewe", contentJson);
|
||||
SudGameSocketImEvent sudGameSocketImEvent = new Gson().fromJson(contentJson, SudGameSocketImEvent.class);
|
||||
if (sudGameSocketImEvent.getMsg().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
sudGameSocketImEvent.getMsg().get(0).setTime(time);
|
||||
Bus.get().post(sudGameSocketImEvent);
|
||||
}
|
||||
//主播页面
|
||||
if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketRyClient.mSocketHandler != null) {
|
||||
SocketRyClient.mSocketHandler.sendMessage(msg);
|
||||
}
|
||||
|
||||
} else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息
|
||||
EventBus.getDefault().post(message);
|
||||
}
|
||||
@@ -274,6 +310,7 @@ public class AppContext extends CommonAppContext {
|
||||
|
||||
});
|
||||
configSPApp();
|
||||
|
||||
//初始化美颜SDK
|
||||
// FaceManager.initFaceUnity(this);
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
res.updateConfiguration(config, res.getDisplayMetrics());
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
|
||||
@@ -144,7 +145,11 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
}
|
||||
};
|
||||
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
|
||||
LogUtil.uploadErrorLog(AppContext.sInstance);
|
||||
try {
|
||||
LogUtil.uploadErrorLog(AppContext.sInstance);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SpUtil.getInstance().setBooleanValue("NOTIFICATION", NotificationManagerCompat.from(this).areNotificationsEnabled());
|
||||
}
|
||||
|
||||
@@ -229,7 +234,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
} else {
|
||||
checkUidAndToken();
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
ToastUtil.show(getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ android {
|
||||
versionName rootProject.ext.android.versionName
|
||||
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a","arm64-v8a"
|
||||
abiFilters "armeabi-v7a","arm64-v8a","x86","x86_64"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
|
||||
@@ -31,7 +31,7 @@ android {
|
||||
versionName rootProject.ext.android.versionName
|
||||
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a","arm64-v8a"
|
||||
abiFilters "armeabi-v7a","arm64-v8a","x86","x86_64"
|
||||
}
|
||||
}
|
||||
aaptOptions {
|
||||
|
||||
@@ -52,4 +52,10 @@ allprojects {
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
ext {
|
||||
IS_PUBLISH_LOCAL=true
|
||||
LIB_VERSION="1.0.6"
|
||||
AGORA_RTC_SDK= 'io.agora.rtc:agora-special-full:4.2.6.12'
|
||||
// AGORA_RTC_SDK= "${rootProject.rootDir.absolutePath}/sdk"
|
||||
// AGORA_RTC_SDK="io.agora.rtc:full-sdk:4.2.6"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'img-optimizer'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
|
||||
android {
|
||||
@@ -13,7 +14,7 @@ android {
|
||||
versionName rootProject.ext.android.versionName
|
||||
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
abiFilters "armeabi-v7a", "arm64-v8a","x86","x86_64"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,9 +201,7 @@ dependencies {
|
||||
//自定义圆角图片
|
||||
api 'com.makeramen:roundedimageview:2.3.0'
|
||||
// 友盟统计SDK
|
||||
api 'com.umeng.umsdk:common:9.6.3'// 必选
|
||||
api 'com.umeng.umsdk:asms:1.8.0'// 必选
|
||||
api 'com.umeng.umsdk:uyumao:1.1.2'
|
||||
// api(name: 'umeng-common-9.6.8+000', ext: 'aar')
|
||||
//高级运营分析功能依赖库,使用卸载分析、开启反作弊能力请务必集成,以免影响高级功能使用。common需搭配v9.6.3及以上版本,asms需搭配v1.7.0及以上版本。需更新隐私声明。
|
||||
// 标准版本SudMGP SDK
|
||||
api 'tech.sud.mgp:SudMGP:1.3.3.1158'
|
||||
@@ -213,7 +212,7 @@ dependencies {
|
||||
api 'com.yanzhenjie.recyclerview:x:1.3.2'
|
||||
|
||||
//华为支付插件包
|
||||
// api project(':lib_huawei')
|
||||
//api project(':lib_huawei')
|
||||
|
||||
//google插件包
|
||||
api project(':lib_google')
|
||||
@@ -225,6 +224,10 @@ dependencies {
|
||||
api 'com.github.FlyJingFish:GradientTextView:1.2.4'
|
||||
//轮播 一屏显示多个
|
||||
api 'com.github.xiaohaibin:XBanner:androidx_v1.2.6'
|
||||
//声网SDK
|
||||
//api 'io.agora.rtc:agora-special-full:4.2.6.245'
|
||||
|
||||
|
||||
//ExoPlayer,腾讯的播放器不支持无缝切换
|
||||
api 'com.google.android.exoplayer:exoplayer:2.18.2'
|
||||
api 'com.google.android.exoplayer:exoplayer-core:2.18.2@aar'
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ public class CommonAppConfig {
|
||||
public static final boolean IS_UPLOAD_ERROR_LOG = getMetaDataBoolean("IS_UPLOAD_ERROR_LOG");
|
||||
//是否为插件包模式
|
||||
public static final boolean IS_PLUGIN_MODEL = getMetaDataBoolean("IS_PLUGIN_MODEL");
|
||||
public static final String BUILD_TIME = getMetaDataString("BUILD_TIME");
|
||||
public static final boolean IS_SW_RELEASE = getMetaDataBoolean("SW_RELEASE_MODEL");
|
||||
|
||||
//外部sd卡
|
||||
public static final String DCMI_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();
|
||||
@@ -76,7 +78,30 @@ public class CommonAppConfig {
|
||||
public static boolean isGetNewWrap = false;//是否获取到新的包裹礼物
|
||||
public static int alert_time = 1;
|
||||
public static int alert_end_time = 1;
|
||||
public static String SWToken = ""; //声网Token
|
||||
public static final String SWChannelPrefix = "g";
|
||||
//测试服
|
||||
public static final String SWAPPId_debug = "4cf0376582d742ac8a96778b25b1079e";
|
||||
//正式服
|
||||
public static final String SWAPPId = "d4a5879524d74c20a7bdd667b0f2ca21";
|
||||
|
||||
public static String getSwAppId() {
|
||||
if (IS_SW_RELEASE) {
|
||||
return SWAPPId;
|
||||
} else {
|
||||
return SWAPPId_debug;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取通道
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getChannelName() {
|
||||
return SWChannelPrefix + getInstance().getUid();
|
||||
}
|
||||
|
||||
private CommonAppConfig() {
|
||||
|
||||
@@ -119,8 +144,7 @@ public class CommonAppConfig {
|
||||
|
||||
public String getUid() {
|
||||
if (TextUtils.isEmpty(mUid)) {
|
||||
String[] uidAndToken = SpUtil.getInstance()
|
||||
.getMultiStringValue(new String[]{SpUtil.UID, SpUtil.TOKEN});
|
||||
String[] uidAndToken = SpUtil.getInstance().getMultiStringValue(new String[]{SpUtil.UID, SpUtil.TOKEN});
|
||||
if (uidAndToken != null) {
|
||||
if (!TextUtils.isEmpty(uidAndToken[0]) && !TextUtils.isEmpty(uidAndToken[1])) {
|
||||
mUid = uidAndToken[0];
|
||||
@@ -311,9 +335,7 @@ public class CommonAppConfig {
|
||||
mUid = null;
|
||||
mToken = null;
|
||||
mLoginIM = false;
|
||||
SpUtil.getInstance().removeValue(
|
||||
SpUtil.UID, SpUtil.TOKEN, SpUtil.USER_INFO, SpUtil.IM_LOGIN
|
||||
);
|
||||
SpUtil.getInstance().removeValue(SpUtil.UID, SpUtil.TOKEN, SpUtil.USER_INFO, SpUtil.IM_LOGIN);
|
||||
}
|
||||
|
||||
|
||||
@@ -349,12 +371,7 @@ public class CommonAppConfig {
|
||||
mProvince = null;
|
||||
mCity = null;
|
||||
mDistrict = null;
|
||||
SpUtil.getInstance().removeValue(
|
||||
SpUtil.LOCATION_LNG,
|
||||
SpUtil.LOCATION_LAT,
|
||||
SpUtil.LOCATION_PROVINCE,
|
||||
SpUtil.LOCATION_CITY,
|
||||
SpUtil.LOCATION_DISTRICT);
|
||||
SpUtil.getInstance().removeValue(SpUtil.LOCATION_LNG, SpUtil.LOCATION_LAT, SpUtil.LOCATION_PROVINCE, SpUtil.LOCATION_CITY, SpUtil.LOCATION_DISTRICT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -202,6 +202,8 @@ public class Constants {
|
||||
public static final String LuckyAngel = "LuckyCheck";//幸运天使
|
||||
public static final String Lucky100Check = "Lucky100Check";//幸运天使
|
||||
|
||||
public static final String PrankSendData = "PrankSendData";//整蛊进度
|
||||
|
||||
public static final int SOCKET_WHAT_CONN = 0;
|
||||
public static final int SOCKET_WHAT_DISCONN = 2;
|
||||
public static final int SOCKET_WHAT_BROADCAST = 1;
|
||||
@@ -267,11 +269,15 @@ public class Constants {
|
||||
public static final String LIVE_PK_RANDOM_START="RankingStartRandomPK";
|
||||
public static final int LIVE_SDK_KSY = 0;//金山推流
|
||||
public static final int LIVE_SDK_TX = 1;//腾讯推流
|
||||
public static final int LIVE_SDK_SW = 2;//声网
|
||||
|
||||
public static final String LIVE_SDK_IS_SW = "liveSdkIsSw"; //是否是聲網
|
||||
|
||||
public static final int LINK_MIC_TYPE_NORMAL = 0;//观众与主播连麦
|
||||
public static final int LINK_MIC_TYPE_ANCHOR = 1;//主播与主播连麦
|
||||
|
||||
public static final String SOCKET_LIVE_ANCHOR_PK_DIALOG="GuildCompetitionNotice";//公会赛弹窗
|
||||
|
||||
//视频举报获取位置
|
||||
public static int xIndex = 0;
|
||||
public static int yindex = 0;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class HtmlConfig {
|
||||
public static final String TURNTABLE_URL = CommonAppConfig.HOST + "/Appapi/Turntable/index";
|
||||
|
||||
//在线商城
|
||||
public static final String SHOP = CommonAppConfig.HOST + "/h5/shoppingMall.html";
|
||||
public static final String SHOP = CommonAppConfig.HOST + "/h5/shop/index.html";
|
||||
|
||||
//社区
|
||||
public static final String ENCOURAGE = CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ";
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
@@ -24,13 +25,12 @@ import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.LifeCycleListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.ClickUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -92,7 +92,8 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
protected void main() {
|
||||
|
||||
}
|
||||
protected void create(){
|
||||
|
||||
protected void create() {
|
||||
|
||||
}
|
||||
|
||||
@@ -107,6 +108,17 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setTitleBold(boolean bold) {
|
||||
TextView titleView = (TextView) findViewById(R.id.titleView);
|
||||
if (titleView != null) {
|
||||
if (bold) {
|
||||
titleView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
} else {
|
||||
titleView.setTypeface(Typeface.DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void backClick(View v) {
|
||||
if (v.getId() == R.id.btn_back) {
|
||||
onBackPressed();
|
||||
@@ -181,14 +193,14 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
//友盟统计
|
||||
// MobclickAgent.onResume(this);
|
||||
MobclickAgent.onPageStart(this.mTag);
|
||||
Log.e("MobclickAgent","MobclickAgent:_onResume_"+this.mTag);
|
||||
Log.e("MobclickAgent", "MobclickAgent:_onResume_" + this.mTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
MobclickAgent.onPageEnd(this.mTag);
|
||||
Log.e("MobclickAgent","MobclickAgent:_onPause_"+this.mTag);
|
||||
Log.e("MobclickAgent", "MobclickAgent:_onPause_" + this.mTag);
|
||||
if (mLifeCycleListeners != null) {
|
||||
for (LifeCycleListener listener : mLifeCycleListeners) {
|
||||
listener.onPause();
|
||||
@@ -382,11 +394,12 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
public boolean isKefu(String url){
|
||||
if(url.contains("kefu")){
|
||||
|
||||
public boolean isKefu(String url) {
|
||||
if (url.contains("kefu")) {
|
||||
return true;
|
||||
}
|
||||
if(url.contains("https://newkf.yaoulive.com/")){
|
||||
if (url.contains("https://newkf.yaoulive.com/")) {
|
||||
return true;
|
||||
}
|
||||
return url.startsWith("https://kefu.yaoulive.com");
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
@@ -100,7 +101,6 @@ public class WebViewActivity extends AbsActivity {
|
||||
ft_title = (FrameLayout) findViewById(R.id.ft_title);
|
||||
v_spacing = (View) findViewById(R.id.v_spacing);
|
||||
mWebView = findViewById(R.id.webView);
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
params.topMargin = DpUtil.dp2px(1);
|
||||
// mWebView.setLayoutParams(params);
|
||||
@@ -136,11 +136,17 @@ public class WebViewActivity extends AbsActivity {
|
||||
if (url.contains("for")) {
|
||||
mWebView.loadUrl("javascript:goAnchorTab()");
|
||||
}
|
||||
|
||||
|
||||
if(url.startsWith(HtmlConfig.SHOP)){
|
||||
//商店页不做动态变换
|
||||
return;
|
||||
}
|
||||
//真实屏幕高度-(ft_title的高度+导航栏高度)
|
||||
//屏蔽掉是因为在线客服页面 AndroidBug5497Workaround会失效
|
||||
int height = DeviceUtils.getScreenRealHeight(mContext) - DpUtil.dp2px(72) - getCurrentNavigationBarHeight(mContext);
|
||||
if (!navigationGestureEnabled(mContext)) {
|
||||
view.loadUrl("javascript:window.androidObject.setHeight(" + height + ",0,false)");
|
||||
// view.loadUrl("javascript:window.androidObject.setHeight(" + height + ",0,false)");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -194,6 +200,8 @@ public class WebViewActivity extends AbsActivity {
|
||||
mWebView.getSettings().setAllowFileAccess(true);
|
||||
mWebView.getSettings().setUseWideViewPort(true); // 关键点
|
||||
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
|
||||
mWebView.setHorizontalScrollBarEnabled(false);
|
||||
mWebView.setVerticalScrollBarEnabled(false);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
@@ -213,6 +221,9 @@ public class WebViewActivity extends AbsActivity {
|
||||
ft_title.setVisibility(View.VISIBLE);
|
||||
v_spacing.setVisibility(View.GONE);
|
||||
}
|
||||
if(!StringUtil.isEmpty(url)&&url.startsWith(HtmlConfig.SHOP)){
|
||||
ft_title.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -424,7 +435,7 @@ public class WebViewActivity extends AbsActivity {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
@@ -440,7 +451,7 @@ public class WebViewActivity extends AbsActivity {
|
||||
}
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
|
||||
} else {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseAdapter<T> extends RecyclerView.Adapter<BaseAdapter.BaseViewHolder> {
|
||||
private Context context;
|
||||
public List<T> data;
|
||||
|
||||
public BaseAdapter(Context context, List<T> data) {
|
||||
this.context = context;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(getItemLayoutId(), parent, false);
|
||||
return new BaseViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(BaseAdapter.BaseViewHolder holder, int position) {
|
||||
T t = data.get(position);
|
||||
convert(holder, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return data == null ? 0 : data.size();
|
||||
}
|
||||
|
||||
public abstract void convert(BaseViewHolder holder, T t);
|
||||
|
||||
public abstract int getItemLayoutId();
|
||||
|
||||
class BaseViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private HashMap<Integer,View> views;
|
||||
|
||||
public BaseViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
views = new HashMap<>();
|
||||
if (onItemClickListener != null){
|
||||
itemView.setOnClickListener(v ->onItemClickListener.onItemClick(getAdapterPosition()) );
|
||||
}
|
||||
}
|
||||
|
||||
public View getView(int id) {
|
||||
View view = views.get(id);
|
||||
if (view == null) {
|
||||
view = itemView.findViewById(id);
|
||||
views.put(id, view);
|
||||
if (onItemClickListener != null){
|
||||
view.setOnClickListener(v -> {
|
||||
onItemClickListener.onItemChildClick(v, getAdapterPosition());
|
||||
});
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
private void setOnItemClickListener(OnItemClickListener onItemClickListener){
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
public interface OnItemClickListener{
|
||||
default void onItemClick(int position){}
|
||||
|
||||
default void onItemChildClick(View view,int position){}
|
||||
}
|
||||
}
|
||||
@@ -40,12 +40,15 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
private final int RIGHTS_INTERESTS = 4;
|
||||
private final int RECOMMEND = 5;
|
||||
private String liveId;
|
||||
private boolean mIs_shengwang;
|
||||
|
||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||
|
||||
private List<CustomSidebarInfoModel> infoModels = new ArrayList<>();
|
||||
|
||||
public CustomDrawerPopupAdapter(Context mContext) {
|
||||
public CustomDrawerPopupAdapter(Context mContext,boolean mIs_shengwang) {
|
||||
this.mContext = mContext;
|
||||
this.mIs_shengwang = mIs_shengwang;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +117,7 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
map.put("num", "9");
|
||||
map.put("live_recommend", "sidebar");
|
||||
map.put("refresh", "1");
|
||||
map.put(" is_shengwang", mIs_shengwang?"1":"0");
|
||||
//推荐位
|
||||
MainNetManager.get((Activity) mContext)
|
||||
.anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class DebugDialogAdapter extends RecyclerView.Adapter<DebugDialogAdapter.DebugViewHolder> {
|
||||
HashMap<String, View> paramMap = new HashMap<>();
|
||||
private Context mContext;
|
||||
|
||||
public DebugDialogAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setParamMap(HashMap<String, View> paramMap) {
|
||||
Log.i("debug弹窗", "setParamMap: 添加值到view " + paramMap.size());
|
||||
this.paramMap = paramMap;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public DebugViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
Log.i("debug弹窗", "onCreateViewHolder: 创建适配器");
|
||||
return new DebugViewHolder(new LinearLayout(mContext));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull DebugViewHolder holder, int position) {
|
||||
List<String> list = new ArrayList<>(paramMap.keySet());
|
||||
Log.i("debug弹窗", "onBindViewHolder: 添加值到view " + list.size() + "|" + paramMap.size());
|
||||
holder.setData(list.get(position), paramMap.get(list.get(position)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
Log.i("debug弹窗", "getItemCount: " + paramMap.size());
|
||||
return paramMap.size();
|
||||
}
|
||||
|
||||
public class DebugViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public DebugViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
public void setData(String msg, View view) {
|
||||
Log.i("debug弹窗", "setData: 添加值到view " + view + "|" + msg + "|" + ((LinearLayout) itemView).indexOfChild(view));
|
||||
if (view instanceof TextView && StringUtil.isEmpty(((TextView) view).getText().toString())) {
|
||||
((TextView) view).setText(msg);
|
||||
}
|
||||
int indexOfChild = ((LinearLayout) itemView).indexOfChild(view);
|
||||
if (indexOfChild != -1) {
|
||||
if (((LinearLayout) itemView).getChildAt(indexOfChild) instanceof TextView) {
|
||||
((TextView) ((LinearLayout) itemView).getChildAt(indexOfChild)).setText(msg);
|
||||
} else {
|
||||
((LinearLayout) itemView).removeViewAt(indexOfChild);
|
||||
}
|
||||
} else {
|
||||
if (view.getParent() != null) {
|
||||
((ViewGroup) view.getParent()).removeView(view);
|
||||
}
|
||||
((LinearLayout) itemView).addView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/28.
|
||||
*/
|
||||
|
||||
public class ImagePreviewAdapter extends RecyclerView.Adapter<ImagePreviewAdapter.Vh> {
|
||||
|
||||
private LayoutInflater mInflater;
|
||||
private ActionListener mActionListener;
|
||||
private int mPageCount;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
private int mCurPosition;
|
||||
|
||||
public ImagePreviewAdapter(Context context, int pageCount) {
|
||||
mPageCount = pageCount;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_preview_img, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mPageCount;
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mImg;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mImg = (ImageView) itemView;
|
||||
}
|
||||
|
||||
void setData(int position) {
|
||||
if (mActionListener != null) {
|
||||
mActionListener.loadImage(mImg, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
|
||||
public void setCurPosition(int curPosition) {
|
||||
mCurPosition = curPosition;
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onPageChanged(curPosition);
|
||||
}
|
||||
}
|
||||
|
||||
public int getCurPosition(){
|
||||
return mCurPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
|
||||
super.onAttachedToRecyclerView(recyclerView);
|
||||
mLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
PagerSnapHelper pagerSnapHelper = new PagerSnapHelper();
|
||||
pagerSnapHelper.attachToRecyclerView(recyclerView);
|
||||
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
int position = mLayoutManager.findFirstCompletelyVisibleItemPosition();
|
||||
if (position >= 0 && mCurPosition != position) {
|
||||
mCurPosition = position;
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onPageChanged(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public interface ActionListener {
|
||||
void onPageChanged(int position);
|
||||
|
||||
void loadImage(ImageView imageView, int position);
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,14 @@ import com.yunbao.common.views.InteractionGamesChildViewHolder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 侧边栏游戏列表适配器,改游戏列表数量在这里改
|
||||
*/
|
||||
public class InteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
private boolean rigts;
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
private List<CustomSidebarChildModel> srcChild = new ArrayList<>();
|
||||
|
||||
public InteractionGamesAdapter(Context mContext, boolean rigts) {
|
||||
this.mContext = mContext;
|
||||
@@ -46,7 +50,7 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
long activityID = TextUtils.isEmpty(model.getSrc()) ? 0 : Long.parseLong(model.getSrc());
|
||||
if (activityID != 0) {
|
||||
Bus.get().post(new CustomDrawerPopupEvent()
|
||||
.setDisMiss(true).setInteractionID(activityID).setInteraction(true).setChild(child));
|
||||
.setDisMiss(true).setInteractionID(activityID).setInteraction(true).setChild(srcChild));
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +65,7 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
srcChild.clear();
|
||||
if (mChild.size() > 8) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
child.add(mChild.get(i));
|
||||
@@ -68,6 +73,7 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
} else {
|
||||
child.addAll(mChild);
|
||||
}
|
||||
srcChild.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -67,13 +67,14 @@ public class LiveNewRoleInteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
if (mChild.size() > 8) {
|
||||
/* if (mChild.size() > 8) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
child.add(mChild.get(i));
|
||||
}
|
||||
} else {
|
||||
child.addAll(mChild);
|
||||
}
|
||||
}*/
|
||||
child.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
/**
|
||||
* 机器人助手IM消息
|
||||
@@ -21,6 +24,9 @@ public class AiAutomaticSpeechModel extends BaseModel {
|
||||
//标签图片
|
||||
@SerializedName("icon")
|
||||
private String icon;
|
||||
@SerializedName("icon_en")
|
||||
@JSONField(name = "icon_en")
|
||||
private String iconEn;
|
||||
//气泡背景
|
||||
@SerializedName("system_bubble")
|
||||
private String systemBubble;
|
||||
@@ -35,7 +41,7 @@ public class AiAutomaticSpeechModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getAiName() {
|
||||
return aiName+":";
|
||||
return aiName + ":";
|
||||
}
|
||||
|
||||
public AiAutomaticSpeechModel setAiName(String aiName) {
|
||||
@@ -47,6 +53,16 @@ public class AiAutomaticSpeechModel extends BaseModel {
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
public String getIconEn() {
|
||||
return iconEn;
|
||||
}
|
||||
|
||||
public AiAutomaticSpeechModel setIconEn(String iconEn) {
|
||||
this.iconEn = iconEn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AiAutomaticSpeechModel setContent(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
@@ -62,6 +78,9 @@ public class AiAutomaticSpeechModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
if (!WordUtil.isNewZh() && !StringUtil.isEmpty(iconEn)) {
|
||||
return iconEn;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@ public class AnchorRecommendModel extends BaseModel {
|
||||
|
||||
@SerializedName("live_battle_pass_show_status")
|
||||
private int showWarOrder = 0;//是否显示首页戰令
|
||||
@SerializedName("live_battle_pass_image_cn")
|
||||
private String battlePassImageCn;
|
||||
@SerializedName("live_battle_pass_image_en")
|
||||
private String battlePassImageEn;
|
||||
//是否支持换一批0=不支持 1=支持
|
||||
|
||||
@SerializedName("up_show")
|
||||
@@ -58,6 +62,22 @@ public class AnchorRecommendModel extends BaseModel {
|
||||
return listShow;
|
||||
}
|
||||
|
||||
public String getBattlePassImageCn() {
|
||||
return battlePassImageCn;
|
||||
}
|
||||
|
||||
public void setBattlePassImageCn(String battlePassImageCn) {
|
||||
this.battlePassImageCn = battlePassImageCn;
|
||||
}
|
||||
|
||||
public String getBattlePassImageEn() {
|
||||
return battlePassImageEn;
|
||||
}
|
||||
|
||||
public void setBattlePassImageEn(String battlePassImageEn) {
|
||||
this.battlePassImageEn = battlePassImageEn;
|
||||
}
|
||||
|
||||
public AnchorRecommendModel setListShow(int listShow) {
|
||||
this.listShow = listShow;
|
||||
return this;
|
||||
|
||||
25
common/src/main/java/com/yunbao/common/bean/AvatarBean.java
Normal file
25
common/src/main/java/com/yunbao/common/bean/AvatarBean.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
public class AvatarBean extends BaseModel {
|
||||
private String avatar;
|
||||
private String avatarThumb;
|
||||
|
||||
public AvatarBean() {
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getAvatarThumb() {
|
||||
return avatarThumb;
|
||||
}
|
||||
|
||||
public void setAvatarThumb(String avatarThumb) {
|
||||
this.avatarThumb = avatarThumb;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.BuildConfig;
|
||||
|
||||
public class CheckLiveModel extends BaseModel {
|
||||
|
||||
@@ -13,6 +14,16 @@ public class CheckLiveModel extends BaseModel {
|
||||
private String typeMsg;
|
||||
@SerializedName("live_sdk")
|
||||
private String liveSdk;
|
||||
@SerializedName("is_shengwang")
|
||||
private String isShengwang;
|
||||
|
||||
public String getIsShengwang() {
|
||||
return isShengwang;
|
||||
}
|
||||
|
||||
public void setIsShengwang(String isShengwang) {
|
||||
this.isShengwang = isShengwang;
|
||||
}
|
||||
|
||||
public static CheckLiveModel objectFromData(String str) {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.yunbao.common.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.BuildConfig;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -59,6 +61,9 @@ public class ConfigBean extends BaseModel {
|
||||
private String txPlayUgcLicenceUrl;//腾讯短视频鉴权
|
||||
private String txVideoUgcKey;
|
||||
private String google_isup;
|
||||
|
||||
private String sud_game_speech;
|
||||
|
||||
@SerializedName("is_return_user")//是否需要弹窗(0否,1是)
|
||||
private String isReturnUser="";
|
||||
@SerializedName("popup_img_url")//弹窗图片地址
|
||||
@@ -182,6 +187,20 @@ public class ConfigBean extends BaseModel {
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
public boolean isSw(){
|
||||
return getSud_game_speech().equals("1");
|
||||
}
|
||||
|
||||
@JSONField(name = "sud_game_speech")
|
||||
public String getSud_game_speech() {
|
||||
return sud_game_speech;
|
||||
}
|
||||
|
||||
public void setSud_game_speech(String sud_game_speech) {
|
||||
this.sud_game_speech = sud_game_speech;
|
||||
}
|
||||
|
||||
@JSONField(name = "apk_ver")
|
||||
public String getVersion() {
|
||||
return version;
|
||||
|
||||
@@ -114,6 +114,17 @@ public class EnterRoomInfoModel extends BaseModel {
|
||||
@SerializedName("gift_wall_lighten_total")
|
||||
private String giftWallLightenTotal;
|
||||
|
||||
@SerializedName("connection_info")
|
||||
private LivePkMicModel connectionInfo;
|
||||
|
||||
public LivePkMicModel getConnectionInfo() {
|
||||
return connectionInfo;
|
||||
}
|
||||
|
||||
public void setConnectionInfo(LivePkMicModel connectionInfo) {
|
||||
this.connectionInfo = connectionInfo;
|
||||
}
|
||||
|
||||
public String getGiftWallLightenNumber() {
|
||||
return giftWallLightenNumber;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class EnterRoomNewModel extends BaseModel {
|
||||
private SudGameDateModel sudGameDateModel;
|
||||
@SerializedName("quick_gift_remaining_quantity")
|
||||
private int quickGiftRemainingQuantity;//剩余的小PD礼物数量
|
||||
|
||||
@SerializedName("if_viewing_duration_complete")
|
||||
private int ifViewingDurationComplete;//通过观看时间获取小PD礼物的次数
|
||||
@SerializedName("sendMoneyLongStatus")
|
||||
|
||||
@@ -7,12 +7,21 @@ import java.util.Map;
|
||||
|
||||
public class LiveBattlePassRewardsBean extends BaseModel{
|
||||
private int level;
|
||||
private int is_received;
|
||||
private List<BattlePassType> live_battle_pass_type;
|
||||
private Map<Integer,Map<Integer,LiveBattlePassReward>> live_battle_pass_rewards;
|
||||
|
||||
public LiveBattlePassRewardsBean() {
|
||||
}
|
||||
|
||||
public int getIs_received() {
|
||||
return is_received;
|
||||
}
|
||||
|
||||
public void setIs_received(int is_received) {
|
||||
this.is_received = is_received;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LivePkMicModel extends BaseModel {
|
||||
@SerializedName("pkuid")
|
||||
private String pkuid;
|
||||
@SerializedName("pkuname")
|
||||
private String pkuname;
|
||||
@SerializedName("pkuimg")
|
||||
private String pkuimg;
|
||||
|
||||
public String getPkuid() {
|
||||
return pkuid;
|
||||
}
|
||||
|
||||
public void setPkuid(String pkuid) {
|
||||
this.pkuid = pkuid;
|
||||
}
|
||||
|
||||
public String getPkuname() {
|
||||
return pkuname;
|
||||
}
|
||||
|
||||
public void setPkuname(String pkuname) {
|
||||
this.pkuname = pkuname;
|
||||
}
|
||||
|
||||
public String getPkuimg() {
|
||||
return pkuimg;
|
||||
}
|
||||
|
||||
public void setPkuimg(String pkuimg) {
|
||||
this.pkuimg = pkuimg;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import java.text.ParseException;
|
||||
@@ -22,6 +21,8 @@ public class OpenAdModel extends BaseModel {
|
||||
public static final int SHOW_ONE = 3;//3. 仅弹出一次;
|
||||
@SerializedName("id")
|
||||
private int id;
|
||||
@SerializedName("popup_name")
|
||||
private String name;
|
||||
@SerializedName("popup_location")
|
||||
private int type = TYPE_HOME;
|
||||
@SerializedName("activity_url")
|
||||
@@ -35,24 +36,27 @@ public class OpenAdModel extends BaseModel {
|
||||
@SerializedName("popup_model")
|
||||
private int model = MODEL_SQUARE;
|
||||
@SerializedName("start_show_time")
|
||||
private String startTime;//活动开始时间
|
||||
private String startTime;//活动开始时间 1
|
||||
@SerializedName("end_show_time")
|
||||
private String endTime;//活动结束时间
|
||||
private String endTime;//活动结束时间 5
|
||||
@SerializedName("popup_permission")
|
||||
private int permission;
|
||||
@SerializedName("popup_frequency")
|
||||
private int showModel = SHOW_DEF;//显示模式,1:杀死程序后弹出 2:指定时间内(本机时间) 3:1. 仅弹出一次
|
||||
@SerializedName("popup_frequency_time")
|
||||
private String section = "0";// SHOW_DEF = 2
|
||||
|
||||
private String section = "0";// SHOW_DEF = 2 1
|
||||
@SerializedName("popup_sort")
|
||||
private int popupSort = 1;//弹框类型 1.图片 2.H5
|
||||
@SerializedName("sort")
|
||||
private int sort = 0;
|
||||
|
||||
public OpenAdModel() {
|
||||
}
|
||||
|
||||
public static OpenAdModel createTestData() {
|
||||
OpenAdModel model = new OpenAdModel();
|
||||
model.id=3;
|
||||
model.type=1;
|
||||
model.id = 3;
|
||||
model.type = 1;
|
||||
model.url = "/h5/GuildTournament/20230821/rank.html";
|
||||
model.imageUrl = "https://ceshi.yaoulive.com/data/upload/20230913/1694589490.png";
|
||||
model.showTime = 10;
|
||||
@@ -66,6 +70,30 @@ public class OpenAdModel extends BaseModel {
|
||||
return model;
|
||||
}
|
||||
|
||||
public int getPopupSort() {
|
||||
return popupSort;
|
||||
}
|
||||
|
||||
public int getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(int sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public void setPopupSort(int popupSort) {
|
||||
this.popupSort = popupSort;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getShowModel() {
|
||||
return showModel;
|
||||
}
|
||||
@@ -91,12 +119,13 @@ public class OpenAdModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
if (!url.startsWith("http://") || !url.startsWith("https://")) {
|
||||
url = CommonAppConfig.HOST + url;
|
||||
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
||||
url = CommonAppConfig.HOST + (url.startsWith("/") ? url : "/" + url);
|
||||
}
|
||||
return url + "?t=" + System.currentTimeMillis() / 1000;
|
||||
return url;
|
||||
}
|
||||
public String getOriginalUrl(){
|
||||
|
||||
public String getOriginalUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -198,6 +227,7 @@ public class OpenAdModel extends BaseModel {
|
||||
public String toString() {
|
||||
return "OpenAdModel{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", type=" + type +
|
||||
", url='" + url + '\'' +
|
||||
", imageUrl='" + imageUrl + '\'' +
|
||||
@@ -206,7 +236,10 @@ public class OpenAdModel extends BaseModel {
|
||||
", model=" + model +
|
||||
", startTime='" + startTime + '\'' +
|
||||
", endTime='" + endTime + '\'' +
|
||||
", permission='" + permission + '\'' +
|
||||
", permission=" + permission +
|
||||
", showModel=" + showModel +
|
||||
", section='" + section + '\'' +
|
||||
", sort=" + popupSort +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,15 @@ public class PrankGiftBean extends BaseModel{
|
||||
public void setGiftId(String giftId) {
|
||||
this.giftId = giftId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PrankGiftBean{" +
|
||||
"title='" + title + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", icon='" + icon + '\'' +
|
||||
", num=" + num +
|
||||
", giftId='" + giftId + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PrankGiftResultBean extends BaseModel{
|
||||
private List<PrankGiftBean> prank_list;
|
||||
private String status;
|
||||
private String prank_type;
|
||||
|
||||
public List<PrankGiftBean> getPrank_list() {
|
||||
return prank_list;
|
||||
}
|
||||
|
||||
public void setPrank_list(List<PrankGiftBean> prank_list) {
|
||||
this.prank_list = prank_list;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getPrank_type() {
|
||||
return prank_type;
|
||||
}
|
||||
|
||||
public void setPrank_type(String prank_type) {
|
||||
this.prank_type = prank_type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PrankProgressBean extends BaseModel {
|
||||
private int status;//整蛊状态 0.关闭 1.开启
|
||||
private int prank_turntable_status;// 转盘整蛊状态 0=关闭 1=开启
|
||||
private int prank_type;// 整蛊类型 1.礼物整蛊 2.连击整蛊
|
||||
private List<PrankList> prank_list;// 整蛊进度
|
||||
private List<PrankList> completed_list;// 待完成的整蛊
|
||||
|
||||
public PrankProgressBean(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class PrankList{
|
||||
private int gift_id;// 礼物ID
|
||||
private int gift_num;// 整蛊需要的礼物数量
|
||||
private String prank_content; // 整蛊内容
|
||||
private int send_num; // 用户已赠送的礼物数量
|
||||
private int completed_num;// 待完成的整蛊次数
|
||||
private String gift_name;// 礼物名称
|
||||
private String gift_icon; // 礼物图片链接
|
||||
|
||||
private String gift_name_en;
|
||||
|
||||
private int continuous_click_num;
|
||||
|
||||
public int getContinuous_click_num() {
|
||||
return continuous_click_num;
|
||||
}
|
||||
|
||||
public void setContinuous_click_num(int continuous_click_num) {
|
||||
this.continuous_click_num = continuous_click_num;
|
||||
}
|
||||
|
||||
public String getGift_name_en() {
|
||||
return gift_name_en;
|
||||
}
|
||||
|
||||
public void setGift_name_en(String gift_name_en) {
|
||||
this.gift_name_en = gift_name_en;
|
||||
}
|
||||
|
||||
public int getGift_id() {
|
||||
return gift_id;
|
||||
}
|
||||
|
||||
public void setGift_id(int gift_id) {
|
||||
this.gift_id = gift_id;
|
||||
}
|
||||
|
||||
public int getGift_num() {
|
||||
return gift_num;
|
||||
}
|
||||
|
||||
public void setGift_num(int gift_num) {
|
||||
this.gift_num = gift_num;
|
||||
}
|
||||
|
||||
public String getPrank_content() {
|
||||
return prank_content;
|
||||
}
|
||||
|
||||
public void setPrank_content(String prank_content) {
|
||||
this.prank_content = prank_content;
|
||||
}
|
||||
|
||||
public int getSend_num() {
|
||||
return send_num;
|
||||
}
|
||||
|
||||
public void setSend_num(int send_num) {
|
||||
this.send_num = send_num;
|
||||
}
|
||||
|
||||
public int getCompleted_num() {
|
||||
return completed_num;
|
||||
}
|
||||
|
||||
public void setCompleted_num(int completed_num) {
|
||||
this.completed_num = completed_num;
|
||||
}
|
||||
|
||||
public String getGift_name() {
|
||||
return gift_name;
|
||||
}
|
||||
|
||||
public void setGift_name(String gift_name) {
|
||||
this.gift_name = gift_name;
|
||||
}
|
||||
|
||||
public String getGift_icon() {
|
||||
return gift_icon;
|
||||
}
|
||||
|
||||
public void setGift_icon(String gift_icon) {
|
||||
this.gift_icon = gift_icon;
|
||||
}
|
||||
|
||||
//计算完成度
|
||||
public double getCompletionRate() {
|
||||
if (gift_num == 0) return 0; // Avoid division by zero
|
||||
return (double) send_num / gift_num;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PrankList{" +
|
||||
"gift_id=" + gift_id +
|
||||
", gift_num=" + gift_num +
|
||||
", prank_content='" + prank_content + '\'' +
|
||||
", send_num=" + send_num +
|
||||
", completed_num=" + completed_num +
|
||||
", gift_name='" + gift_name + '\'' +
|
||||
", gift_icon='" + gift_icon + '\'' +
|
||||
", gift_name_en='" + gift_name_en + '\'' +
|
||||
", continuous_click_num=" + continuous_click_num +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getPrank_type() {
|
||||
return prank_type;
|
||||
}
|
||||
|
||||
public void setPrank_type(int prank_type) {
|
||||
this.prank_type = prank_type;
|
||||
}
|
||||
|
||||
public List<PrankList> getPrank_list() {
|
||||
return prank_list;
|
||||
}
|
||||
|
||||
public void setPrank_list(List<PrankList> prank_list) {
|
||||
this.prank_list = prank_list;
|
||||
}
|
||||
|
||||
public List<PrankList> getCompleted_list() {
|
||||
return completed_list;
|
||||
}
|
||||
|
||||
public void setCompleted_list(List<PrankList> completed_list) {
|
||||
this.completed_list = completed_list;
|
||||
}
|
||||
|
||||
public int getPrank_turntable_status() {
|
||||
return prank_turntable_status;
|
||||
}
|
||||
|
||||
public void setPrank_turntable_status(int prank_turntable_status) {
|
||||
this.prank_turntable_status = prank_turntable_status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PrankProgressBean{" +
|
||||
"status=" + status +
|
||||
", prank_turntable_status=" + prank_turntable_status +
|
||||
", prank_type=" + prank_type +
|
||||
", prank_list=" + prank_list +
|
||||
", completed_list=" + completed_list +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,16 @@ public class RedPacketInfoModel extends BaseModel {
|
||||
//超级红包ID
|
||||
@SerializedName("super_jackpot_id")
|
||||
private String superJackpotId;
|
||||
@SerializedName("red_packet_type")
|
||||
private int redPacketType;// 1.普通红包 2.特殊红包
|
||||
|
||||
public int getRedPacketType() {
|
||||
return redPacketType;
|
||||
}
|
||||
|
||||
public void setRedPacketType(int redPacketType) {
|
||||
this.redPacketType = redPacketType;
|
||||
}
|
||||
|
||||
public String getSuperJackpotId() {
|
||||
return superJackpotId;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
/**
|
||||
* 声网token
|
||||
*/
|
||||
public class SwTokenModel extends BaseModel {
|
||||
private String token;
|
||||
|
||||
public SwTokenModel() {
|
||||
}
|
||||
|
||||
public SwTokenModel(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
}
|
||||
@@ -865,11 +865,20 @@ public class UserBean implements Parcelable {
|
||||
private String medal;
|
||||
private String bubble;
|
||||
private String medal_new;
|
||||
private String medal_new_en;
|
||||
|
||||
public String getMedal_new() {
|
||||
return medal_new;
|
||||
}
|
||||
|
||||
public String getMedal_new_en() {
|
||||
return medal_new_en;
|
||||
}
|
||||
|
||||
public void setMedal_new_en(String medal_new_en) {
|
||||
this.medal_new_en = medal_new_en;
|
||||
}
|
||||
|
||||
public void setMedal_new(String medal_new) {
|
||||
this.medal_new = medal_new;
|
||||
}
|
||||
@@ -898,6 +907,66 @@ public class UserBean implements Parcelable {
|
||||
this.bubble = bubble;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserBean{" +
|
||||
"id='" + id + '\'' +
|
||||
", userNiceName='" + userNiceName + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", avatarThumb='" + avatarThumb + '\'' +
|
||||
", sex=" + sex +
|
||||
", signature='" + signature + '\'' +
|
||||
", coin='" + coin + '\'' +
|
||||
", gold='" + gold + '\'' +
|
||||
", votes='" + votes + '\'' +
|
||||
", consumption='" + consumption + '\'' +
|
||||
", votestotal='" + votestotal + '\'' +
|
||||
", province='" + province + '\'' +
|
||||
", city='" + city + '\'' +
|
||||
", location='" + location + '\'' +
|
||||
", birthday='" + birthday + '\'' +
|
||||
", level=" + level +
|
||||
", levelAnchor=" + levelAnchor +
|
||||
", lives=" + lives +
|
||||
", follows=" + follows +
|
||||
", fans=" + fans +
|
||||
", vip=" + vip +
|
||||
", liang=" + liang +
|
||||
", car=" + car +
|
||||
", medal_level=" + medal_level +
|
||||
", medal_name='" + medal_name + '\'' +
|
||||
", Dress=" + Dress +
|
||||
", noble_id='" + noble_id + '\'' +
|
||||
", yuanbao='" + yuanbao + '\'' +
|
||||
", noble_name='" + noble_name + '\'' +
|
||||
", islive='" + islive + '\'' +
|
||||
", medal_no_display_src='" + medal_no_display_src + '\'' +
|
||||
", hot_num='" + hot_num + '\'' +
|
||||
", goodnum='" + goodnum + '\'' +
|
||||
", fans_pic='" + fans_pic + '\'' +
|
||||
", gifticon='" + gifticon + '\'' +
|
||||
", department_name='" + department_name + '\'' +
|
||||
", token_rong='" + token_rong + '\'' +
|
||||
", noble_end_time='" + noble_end_time + '\'' +
|
||||
", slide='" + slide + '\'' +
|
||||
", users_type='" + users_type + '\'' +
|
||||
", is_bind='" + is_bind + '\'' +
|
||||
", mobile='" + mobile + '\'' +
|
||||
", front_task='" + front_task + '\'' +
|
||||
", is_admin='" + is_admin + '\'' +
|
||||
", praise=" + praise +
|
||||
", isHide=" + isHide +
|
||||
", randomPk=" + randomPk +
|
||||
", mRankPkImgUrl='" + mRankPkImgUrl + '\'' +
|
||||
", user_info_complete=" + user_info_complete +
|
||||
", fansLevel=" + fansLevel +
|
||||
", typeMic=" + typeMic +
|
||||
", isMicList=" + isMicList +
|
||||
", isRequest=" + isRequest +
|
||||
", fansEnterRoomUrl='" + fansEnterRoomUrl + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.yunbao.common.custom;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
import com.stx.xhb.androidx.transformers.BasePageTransformer;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
public class LiveGuardScalePageTransformer extends BasePageTransformer {
|
||||
/**
|
||||
* author: xiaohaibin.
|
||||
* time: 2018/10/9
|
||||
* mail:xhb_199409@163.com
|
||||
* github:https://github.com/xiaohaibin
|
||||
* describe: 适用于一屏显示多个模式
|
||||
*/
|
||||
private float mMinScale = 0.85f;
|
||||
private float mMinAlpha = 1f;
|
||||
|
||||
public LiveGuardScalePageTransformer() {
|
||||
}
|
||||
|
||||
public LiveGuardScalePageTransformer(float minAlpha, float minScale) {
|
||||
setMinAlpha(minAlpha);
|
||||
setMinScale(minScale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleInvisiblePage(View view, float position) {
|
||||
ViewCompat.setAlpha(view, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLeftPage(View view, float position) {
|
||||
float scale = Math.max(mMinScale, 1 + position);
|
||||
float vertMargin = view.getHeight() * (1 - scale) / 2;
|
||||
float horzMargin = view.getWidth() * (1 - scale) / 2;
|
||||
view.setTranslationX(horzMargin - vertMargin / 2);
|
||||
view.setScaleX(scale);
|
||||
view.setScaleY( scale);
|
||||
view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRightPage(View view, float position) {
|
||||
float scale = Math.max(mMinScale, 1 - position);
|
||||
float vertMargin = view.getHeight() * (1 - scale) / 2;
|
||||
float horzMargin = view.getWidth() * (1 - scale) / 2;
|
||||
view.setTranslationX( -horzMargin + vertMargin / 2);
|
||||
view.setScaleX( scale);
|
||||
|
||||
view.setScaleY( scale);
|
||||
view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
|
||||
}
|
||||
|
||||
public void setMinAlpha(float minAlpha) {
|
||||
if (minAlpha >= 0.6f && minAlpha <= 1.0f) {
|
||||
mMinAlpha = minAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMinScale(float minScale) {
|
||||
if (minScale >= 0.6f && minScale <= 1.0f) {
|
||||
mMinScale = minScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CoolConfig;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.lxj.xpopup.enums.PopupPosition;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
@@ -45,6 +46,9 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 半屏创建游戏房间
|
||||
*/
|
||||
public class CreateSudGamePopup extends BottomPopupView {
|
||||
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
|
||||
private TextView createGameType, selectCurrencyType;
|
||||
@@ -150,8 +154,6 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 4, customSidebarChildModels, interactionID))
|
||||
.show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.room_back),
|
||||
@@ -279,7 +281,11 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
public void onSuccess(CreateSudRoomModel data) {
|
||||
if (isHome) {
|
||||
dialog.dismiss();
|
||||
RouteUtil.forwardSudGameActivity(new Gson().toJson(data));
|
||||
if(CommonAppConfig.getInstance().getConfig().isSw()){
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(data),true,isHome);
|
||||
}else{
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(data),true,isHome);
|
||||
}
|
||||
} else {
|
||||
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data));
|
||||
|
||||
@@ -312,20 +318,50 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
animator.setDuration(animDuration);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.currency_type));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 5, currencyTypeName,isYuanbao)
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeAnimSudGameListEvent();
|
||||
}
|
||||
})
|
||||
)
|
||||
.show();
|
||||
if (hasMoveUp) {
|
||||
InputMethodManager imm = getSystemService(getContext(), InputMethodManager.class);
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(roomName.getWindowToken(), 0);
|
||||
imm.hideSoftInputFromWindow(gameSill.getWindowToken(), 0);
|
||||
}
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.currency_type));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 5, currencyTypeName,isYuanbao)
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeAnimSudGameListEvent();
|
||||
}
|
||||
})
|
||||
)
|
||||
.show();
|
||||
}
|
||||
}, 500);
|
||||
}else {
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.currency_type));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 5, currencyTypeName,isYuanbao)
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeAnimSudGameListEvent();
|
||||
}
|
||||
})
|
||||
)
|
||||
.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
172
common/src/main/java/com/yunbao/common/dialog/DebugDialog.java
Normal file
172
common/src/main/java/com/yunbao/common/dialog/DebugDialog.java
Normal file
@@ -0,0 +1,172 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.lzf.easyfloat.interfaces.OnPermissionResult;
|
||||
import com.lzf.easyfloat.permission.PermissionUtils;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.adapter.DebugDialogAdapter;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
||||
public class DebugDialog {
|
||||
RecyclerView recyclerView;
|
||||
LinkedHashMap<String, View> params;
|
||||
DebugDialogAdapter adapter;
|
||||
private static DebugDialog debugDialog;
|
||||
Context mContext;
|
||||
private ShowPattern showPattern = ShowPattern.CURRENT_ACTIVITY;
|
||||
|
||||
private DebugDialogRunnable runnable;
|
||||
|
||||
public static void getInstance(DebugDialogRunnable runnable) {
|
||||
if (debugDialog == null) {
|
||||
debugDialog = new DebugDialog(runnable);
|
||||
} else {
|
||||
runnable.run(debugDialog);
|
||||
}
|
||||
debugDialog.showPattern = ShowPattern.CURRENT_ACTIVITY;
|
||||
}
|
||||
|
||||
public static boolean checkShow() {
|
||||
return EasyFloat.isShow("debug");
|
||||
}
|
||||
|
||||
public DebugDialog clear() {
|
||||
params.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setParams(String tag, String msg) {
|
||||
Log.i("debug弹窗", "setParams: " + tag + "|" + msg);
|
||||
if (params.containsKey(tag)) {
|
||||
((TextView) params.get(tag)).setText(tag + ":" + msg);
|
||||
} else {
|
||||
TextView textView = new TextView(mContext);
|
||||
textView.setText(tag + ":" + msg);
|
||||
params.put(tag, textView);
|
||||
adapter.setParamMap(params);
|
||||
}
|
||||
EasyFloat.updateFloat("debug");
|
||||
}
|
||||
|
||||
private DebugDialog(DebugDialogRunnable runnable) {
|
||||
this.runnable = runnable;
|
||||
if (params == null) {
|
||||
Log.i("debug弹窗", "DebugDialog: 初始化参数");
|
||||
params = new LinkedHashMap<>();
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
this.mContext = AppManager.getInstance().getMainActivity();
|
||||
if (mContext == null) {
|
||||
startWaitMainActivity();
|
||||
return;
|
||||
}
|
||||
runnable.run(this);
|
||||
// createView();
|
||||
}
|
||||
|
||||
private void startWaitMainActivity() {
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i("debug弹窗", "run: " + AppManager.getInstance().getMainActivity());
|
||||
if (AppManager.getInstance().getMainActivity() != null) {
|
||||
init();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}, 0, 1000);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
EasyFloat.dismiss("debug");
|
||||
}
|
||||
|
||||
public void show() {
|
||||
if (recyclerView != null) return;
|
||||
if (showPattern == ShowPattern.CURRENT_ACTIVITY) {
|
||||
createView();
|
||||
return;
|
||||
}
|
||||
if (PermissionUtils.checkPermission(mContext)) {
|
||||
createView();
|
||||
} else {
|
||||
PermissionUtils.requestPermission((Activity) mContext, new OnPermissionResult() {
|
||||
@Override
|
||||
public void permissionResult(boolean b) {
|
||||
ToastUtil.show("悬浮权限" + b);
|
||||
if (b) {
|
||||
createView();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected void createView() {
|
||||
recyclerView = new RecyclerView(mContext);
|
||||
adapter = new DebugDialogAdapter(mContext);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setBackgroundColor(Color.WHITE);
|
||||
TextView textView = new TextView(mContext);
|
||||
textView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ToastUtil.show("debug弹窗:" + params.size());
|
||||
EasyFloat.updateFloat("debug");
|
||||
}
|
||||
});
|
||||
params.put("发包时间:" + CommonAppConfig.BUILD_TIME, textView);
|
||||
adapter.setParamMap(params);
|
||||
|
||||
EasyFloat.with(mContext)
|
||||
.setTag("debug")
|
||||
.setShowPattern(this.showPattern)
|
||||
.setLayout(recyclerView)
|
||||
.show();
|
||||
runnable.run(this);
|
||||
Log.i("debug弹窗", "createView: 创建");
|
||||
}
|
||||
|
||||
public void setView(String value, View view, View.OnClickListener onClickListener) {
|
||||
if (params.containsKey(value)) {
|
||||
params.get(value).setOnClickListener(onClickListener);
|
||||
} else {
|
||||
view.setOnClickListener(onClickListener);
|
||||
params.put(value, view);
|
||||
}
|
||||
adapter.setParamMap(params);
|
||||
EasyFloat.updateFloat("debug");
|
||||
}
|
||||
|
||||
public void setShowPattern(ShowPattern showPattern) {
|
||||
this.showPattern = showPattern;
|
||||
}
|
||||
|
||||
public interface DebugDialogRunnable {
|
||||
void run(DebugDialog dialog);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.ImagePreviewAdapter;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
/**
|
||||
* Created by Martin on 2024/3/15.
|
||||
* 图片预览弹窗
|
||||
*/
|
||||
|
||||
public class ImagePreviewDialog extends AbsDialogFragment implements View.OnClickListener {
|
||||
|
||||
private View mBg;
|
||||
private RecyclerView mRecyclerView;
|
||||
private ValueAnimator mAnimator;
|
||||
private int mPosition;
|
||||
private int mPageCount;
|
||||
private ActionListener mActionListener;
|
||||
private TextView mCount;
|
||||
private ImagePreviewAdapter mAdapter;
|
||||
private boolean mNeedDelete;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_preview_image;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mBg = mRootView.findViewById(R.id.bg);
|
||||
mCount = (TextView) findViewById(R.id.count);
|
||||
findViewById(R.id.btn_close).setOnClickListener(this);
|
||||
if (mNeedDelete) {
|
||||
View btnDelete = findViewById(R.id.btn_delete);
|
||||
btnDelete.setVisibility(View.VISIBLE);
|
||||
btnDelete.setOnClickListener(this);
|
||||
}
|
||||
mRecyclerView = mRootView.findViewById(R.id.recyclerView);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
||||
mAnimator = ValueAnimator.ofFloat(0, 1);
|
||||
mAnimator.setDuration(150);
|
||||
mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
float v = (float) animation.getAnimatedValue();
|
||||
mBg.setAlpha(v);
|
||||
}
|
||||
});
|
||||
mAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (mRecyclerView != null && mPageCount > 0) {
|
||||
ImagePreviewAdapter adapter = new ImagePreviewAdapter(mContext, mPageCount);
|
||||
mAdapter = adapter;
|
||||
adapter.setActionListener(new ImagePreviewAdapter.ActionListener() {
|
||||
@Override
|
||||
public void onPageChanged(int position) {
|
||||
if (mCount != null) {
|
||||
mCount.setText(StringUtil.contact(String.valueOf(position + 1), "/", String.valueOf(mPageCount)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadImage(ImageView imageView, int position) {
|
||||
if (mActionListener != null) {
|
||||
mActionListener.loadImage(imageView, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
if (mPosition >= 0 && mPosition < mPageCount) {
|
||||
adapter.setCurPosition(mPosition);
|
||||
mRecyclerView.scrollToPosition(mPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
mAnimator.start();
|
||||
}
|
||||
|
||||
public void setImageInfo(int pageCount, int position, boolean needDelete, ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
mPageCount = pageCount;
|
||||
mPosition = position;
|
||||
mNeedDelete = needDelete;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (mAnimator != null) {
|
||||
mAnimator.cancel();
|
||||
}
|
||||
mContext = null;
|
||||
mActionListener = null;
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_close) {
|
||||
dismiss();
|
||||
} else if (i == R.id.btn_delete) {
|
||||
delete();
|
||||
}
|
||||
}
|
||||
|
||||
private void delete() {
|
||||
if (mAdapter != null && mActionListener != null) {
|
||||
mActionListener.onDeleteClick(mAdapter.getCurPosition());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public interface ActionListener {
|
||||
void loadImage(ImageView imageView, int position);
|
||||
|
||||
void onDeleteClick(int position);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//游戏弹窗
|
||||
public class LiveNewRolePopup extends BottomPopupView {
|
||||
private boolean showRed = false;
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -9,12 +13,21 @@ import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
|
||||
private ImageView mImageView;
|
||||
private ImageView mClose;
|
||||
private LinearLayout contentLayout;
|
||||
private OpenAdModel model;
|
||||
private OnItemClickListener<OpenAdModel> mListener;
|
||||
|
||||
@@ -27,6 +40,11 @@ public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
builder.animationDuration(0);
|
||||
builder.hasShadowBg(true);
|
||||
if(model.getPopupSort()==2){
|
||||
builder.dismissOnTouchOutside(false);
|
||||
builder.dismissOnBackPressed(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,8 +69,63 @@ public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
mImageView = findViewById(R.id.img);
|
||||
contentLayout = findViewById(R.id.content_layout);
|
||||
mClose = findViewById(R.id.close);
|
||||
if (model.getPopupSort() == 1) {
|
||||
setImage();
|
||||
} else {
|
||||
setWeb();
|
||||
}
|
||||
|
||||
mClose.setOnClickListener(v -> dismiss());
|
||||
if (model.getShowTime() > 0) {
|
||||
mClose.postDelayed(this::dismiss, model.getShowTime());
|
||||
}
|
||||
}
|
||||
|
||||
private void setWeb() {
|
||||
WebView mWebView = new WebView(mContext);
|
||||
mWebView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
|
||||
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext((Activity) mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
|
||||
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||
mWebView.getSettings().setDomStorageEnabled(true);
|
||||
String appCachePath = mContext.getCacheDir().getAbsolutePath();
|
||||
// mWebView.getSettings().setAppCachePath(appCachePath);
|
||||
mWebView.getSettings().setAllowFileAccess(true);
|
||||
mWebView.getSettings().setUseWideViewPort(true); // 关键点
|
||||
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
|
||||
mWebView.setHorizontalScrollBarEnabled(false);
|
||||
mWebView.setVerticalScrollBarEnabled(false);
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
L.e("H5-------->" + url);
|
||||
view.loadUrl(url);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
}
|
||||
});
|
||||
String url=model.getUrl();
|
||||
if(url.contains("?")){
|
||||
url+="&uid="+ IMLoginManager.get(mContext).getUserInfo().getId()+"&token="+IMLoginManager.get(mContext).getUserInfo().getToken();
|
||||
}else{
|
||||
url+="?uid="+ IMLoginManager.get(mContext).getUserInfo().getId()+"&token="+IMLoginManager.get(mContext).getUserInfo().getToken();
|
||||
}
|
||||
mWebView.loadUrl(url);
|
||||
contentLayout.addView(mWebView);
|
||||
}
|
||||
|
||||
private void setImage() {
|
||||
int width = ScreenDimenUtil.getInstance().getScreenWdith();
|
||||
int height = (int) (width * 1.4);
|
||||
|
||||
ImageView mImageView = new ImageView(mContext);
|
||||
mImageView.setLayoutParams(new LinearLayout.LayoutParams(width, height));
|
||||
mImageView.setOnClickListener(v -> {
|
||||
WebViewActivity.forward(mContext, model.getUrl(), model.getType() != OpenAdModel.TYPE_HOME);
|
||||
if (mListener != null) {
|
||||
@@ -61,10 +134,12 @@ public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
mClose.setOnClickListener(v -> dismiss());
|
||||
ImgLoader.display(mContext, model.getImageUrl(), mImageView);
|
||||
if (model.getShowTime() > 0) {
|
||||
mClose.postDelayed(this::dismiss, model.getShowTime());
|
||||
}
|
||||
contentLayout.addView(mImageView);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,44 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowInsets;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
||||
private ImageView mImageView;
|
||||
private LinearLayout contentLayout;
|
||||
private ImageView mClose;
|
||||
private OpenAdModel model;
|
||||
private OnItemClickListener<OpenAdModel> mListener;
|
||||
@@ -39,7 +59,8 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
builder.hasShadowBg(false);
|
||||
builder.hasShadowBg(true);
|
||||
builder.shadowBgColor(Color.parseColor("#80000000"));
|
||||
builder.animationDuration(0);
|
||||
}
|
||||
|
||||
@@ -61,12 +82,103 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Log.e("-----弹窗-----", "onCreate: 创建弹窗" );
|
||||
mImageView = findViewById(R.id.img);
|
||||
Log.e("-----弹窗-----", "onCreate: 创建弹窗");
|
||||
contentLayout = findViewById(R.id.content_layout);
|
||||
mClose = findViewById(R.id.close);
|
||||
findViewById(R.id.layout).setOnClickListener(v -> dismiss());
|
||||
|
||||
|
||||
contentLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
boolean isShow = false;
|
||||
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
if (isShow)
|
||||
return;
|
||||
isShow = true;
|
||||
int width = contentLayout.getWidth() - DpUtil.dp2px(20);
|
||||
int height = (int) (width * 1.5);
|
||||
if (model.getModel() == OpenAdModel.MODEL_SQUARE) {
|
||||
height = (int) (width * 1.2);
|
||||
}
|
||||
Log.i("-----弹窗-----", "高度:" + height + " 宽度:" + width + " 屏幕宽度: " + ScreenDimenUtil.getInstance().getScreenWdith());
|
||||
/*DebugDialog.getInstance(new DebugDialog.DebugDialogRunnable() {
|
||||
@Override
|
||||
public void run(DebugDialog dialog) {
|
||||
dialog.setShowPattern(ShowPattern.ALL_TIME);
|
||||
dialog.show();
|
||||
int width = contentLayout.getWidth() - DpUtil.dp2px(10);
|
||||
int height = (int) (width * 1.5);
|
||||
if (model.getModel() == OpenAdModel.MODEL_SQUARE) {
|
||||
height = (int) (width * 1.2);
|
||||
}
|
||||
Log.i("-----弹窗-----", "弹框debug高宽 高度:" + height + " 宽度:" + width);
|
||||
dialog.setParams(model.getName() + "弹框高宽", "高度:" + height + " 宽度:" + width);
|
||||
}
|
||||
});*/
|
||||
if (model.getPopupSort() == 1) {
|
||||
setImage(model, width, height);
|
||||
findViewById(R.id.layout).setOnClickListener(v -> dismiss());
|
||||
} else {
|
||||
setWeb(model, width, height);
|
||||
}
|
||||
mClose.setOnClickListener(v -> dismiss());
|
||||
if (model.getShowTime() > 0) {
|
||||
mClose.postDelayed(OpenAdCenterDialogPopup.this::dismiss, model.getShowTime());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setWeb(OpenAdModel model, int width, int height) {
|
||||
WebView mWebView = new WebView(mContext);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, height);
|
||||
params.gravity = Gravity.CENTER;
|
||||
mWebView.setLayoutParams(params);
|
||||
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext((Activity) mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
|
||||
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||
mWebView.getSettings().setDomStorageEnabled(true);
|
||||
String appCachePath = mContext.getCacheDir().getAbsolutePath();
|
||||
// mWebView.getSettings().setAppCachePath(appCachePath);
|
||||
mWebView.getSettings().setAllowFileAccess(true);
|
||||
mWebView.getSettings().setUseWideViewPort(true); // 关键点
|
||||
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
|
||||
mWebView.setHorizontalScrollBarEnabled(false);
|
||||
mWebView.setVerticalScrollBarEnabled(false);
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
L.e("H5-------->" + url);
|
||||
view.loadUrl(url);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
}
|
||||
});
|
||||
String url = model.getUrl();
|
||||
if (url.contains("?")) {
|
||||
url += "&uid=" + IMLoginManager.get(mContext).getUserInfo().getId() + "&token=" + IMLoginManager.get(mContext).getUserInfo().getToken();
|
||||
} else {
|
||||
url += "?uid=" + IMLoginManager.get(mContext).getUserInfo().getId() + "&token=" + IMLoginManager.get(mContext).getUserInfo().getToken();
|
||||
}
|
||||
Log.i("-----弹窗-----", "setWeb: " + url);
|
||||
mWebView.loadUrl(url);
|
||||
contentLayout.addView(mWebView);
|
||||
}
|
||||
|
||||
private void setImage(OpenAdModel model, int width, int height) {
|
||||
mImageView = new ImageView(mContext);
|
||||
mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, height);
|
||||
params.gravity = Gravity.CENTER;
|
||||
mImageView.setLayoutParams(params);
|
||||
|
||||
mImageView.setOnClickListener(v -> {
|
||||
if("home_page_banner_battle".equals(model.getOriginalUrl())){
|
||||
if ("home_page_banner_battle".equals(model.getOriginalUrl())) {
|
||||
RouteUtil.forwardBattlePass();
|
||||
dismiss();
|
||||
return;
|
||||
@@ -78,19 +190,12 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
mClose.setOnClickListener(v -> dismiss());
|
||||
ImgLoader.display(mContext, model.getImageUrl(), mImageView);
|
||||
int width = ScreenDimenUtil.getInstance().getScreenWdith() - DpUtil.dp2px(40);
|
||||
int height = (int) (width * 1.4);
|
||||
if (model.getModel() == OpenAdModel.MODEL_SQUARE) {
|
||||
height = width;
|
||||
}
|
||||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mImageView.getLayoutParams();
|
||||
params.width = width;
|
||||
params.height = height;
|
||||
mImageView.setLayoutParams(params);
|
||||
if (model.getShowTime() > 0) {
|
||||
mClose.postDelayed(this::dismiss, model.getShowTime());
|
||||
}
|
||||
contentLayout.addView(mImageView);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.yunbao.common.event.LiveSudGameHistoryEvent;
|
||||
import com.yunbao.common.event.RoomHolderTypeEvent;
|
||||
import com.yunbao.common.event.SudGameListEvent;
|
||||
import com.yunbao.common.event.SudGameListSillEvent;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
@@ -87,6 +88,11 @@ public class SudGameListSelectPopup extends AttachPopupView {
|
||||
if (mType == 0 || mType == 4) {
|
||||
topSelect.setText(getContext().getString(R.string.interactive_game_room_all));
|
||||
for (int i = 0; i < customSidebarChildModels.size(); i++) {
|
||||
/* if (!IMLoginManager.get(getContext()).getUserInfo().anchorUserType()) {
|
||||
if ("1490944230389182466".equals(customSidebarChildModels.get(i).getSrc())) {//友尽闯关
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
selectString.add(customSidebarChildModels.get(i).getTitle());
|
||||
if (TextUtils.equals(String.valueOf(interactionID), customSidebarChildModels.get(i).getSrc())) {
|
||||
index = i;
|
||||
|
||||
@@ -37,6 +37,8 @@ public class AllServerNotifyFFGGGDJANEvent extends BaseModel {
|
||||
private List<ButtonStyleDTO> buttonStyle;
|
||||
@SerializedName("h5_type")
|
||||
private String h5Type;
|
||||
@SerializedName("left_image")
|
||||
private String leftImage;
|
||||
|
||||
public String getH5Type() {
|
||||
return h5Type;
|
||||
@@ -47,6 +49,14 @@ public class AllServerNotifyFFGGGDJANEvent extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLeftImage() {
|
||||
return leftImage;
|
||||
}
|
||||
|
||||
public void setLeftImage(String leftImage) {
|
||||
this.leftImage = leftImage;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,36 @@ public class SendBlindGiftEvent extends BaseModel {
|
||||
private String liveGiftNotify;
|
||||
@SerializedName("userNiceName")
|
||||
private String userNiceName;
|
||||
@SerializedName("special_gift")
|
||||
private int specialGift;
|
||||
@SerializedName("special_gift_name")
|
||||
private String specialGiftName;
|
||||
@SerializedName("special_gift_name_en")
|
||||
private String specialGiftNameEn;
|
||||
|
||||
public int getSpecialGift() {
|
||||
return specialGift;
|
||||
}
|
||||
|
||||
public void setSpecialGift(int specialGift) {
|
||||
this.specialGift = specialGift;
|
||||
}
|
||||
|
||||
public String getSpecialGiftName() {
|
||||
return specialGiftName;
|
||||
}
|
||||
|
||||
public void setSpecialGiftName(String specialGiftName) {
|
||||
this.specialGiftName = specialGiftName;
|
||||
}
|
||||
|
||||
public String getSpecialGiftNameEn() {
|
||||
return specialGiftNameEn;
|
||||
}
|
||||
|
||||
public void setSpecialGiftNameEn(String specialGiftNameEn) {
|
||||
this.specialGiftNameEn = specialGiftNameEn;
|
||||
}
|
||||
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
|
||||
public class SubGameEvent {
|
||||
int type;
|
||||
HttpCallbackModel model;
|
||||
String dataJson;
|
||||
|
||||
public SubGameEvent(int type, HttpCallbackModel model, String dataJson) {
|
||||
this.type = type;
|
||||
this.model = model;
|
||||
this.dataJson = dataJson;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public HttpCallbackModel getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(HttpCallbackModel model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public String getDataJson() {
|
||||
return dataJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SubGameEvent{" +
|
||||
"type=" + type +
|
||||
", model=" + model +
|
||||
", dataJson='" + dataJson + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,15 @@ public class SudGameSocketImEvent extends BaseModel {
|
||||
private String method;
|
||||
@SerializedName("equipment")
|
||||
private String equipment;
|
||||
private String time;
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -226,14 +227,20 @@ public class ImgLoader {
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
public static void displayDrawable(Context context, String url, final DrawableCallback callback) {
|
||||
displayDrawable(context, url, -1, -1, callback);
|
||||
}
|
||||
public static void displayDrawable(Context context, String url, int width, int height, final DrawableCallback callback) {
|
||||
|
||||
if (TextUtils.isEmpty(url) || !contextIsExist(context)) {
|
||||
if (callback != null)
|
||||
callback.onLoadFailed();
|
||||
} else {
|
||||
Glide.with(context).asDrawable().load(url).thumbnail(thumbnail).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() {
|
||||
RequestBuilder<Drawable> builder = Glide.with(context).asDrawable().load(url);
|
||||
if (width != -1 && height != -1) {
|
||||
builder = builder.override(width, height);
|
||||
}
|
||||
builder.thumbnail(thumbnail).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() {
|
||||
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
|
||||
@@ -42,7 +42,7 @@ import java.util.Locale;
|
||||
*/
|
||||
|
||||
public class CommonHttpUtil {
|
||||
|
||||
public static final String GET_UPLOAD_QI_NIU_TOKEN = "getUploadQiNiuToken";
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
@@ -450,6 +450,16 @@ public class CommonHttpUtil {
|
||||
public static void getUserBaseinfo(String touid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO).params("touid", touid).execute(callback);
|
||||
}
|
||||
/**
|
||||
* 上传文件 获取七牛云token的接口
|
||||
*/
|
||||
public static void getUploadQiNiuToken(HttpCallback callback, boolean isImg) {
|
||||
HttpClient.getInstance().get("Pdluserhome.getQiNiuToken2", "Pdluserhome.getQiNiuToken2")
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.params("token", CommonAppConfig.getInstance().getToken())
|
||||
.params("ext", isImg ? ".jpeg" : ".mp4")
|
||||
.execute(callback);
|
||||
}
|
||||
//
|
||||
// //埋点唯一性
|
||||
// public static void setAdvertisingChannels(String operation, HttpCallback callback) {
|
||||
|
||||
@@ -764,7 +764,7 @@ public class LiveHttpUtil {
|
||||
* @param file 封面图片文件
|
||||
* @param callback
|
||||
*/
|
||||
public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, int clarityType, HttpCallback callback) {
|
||||
public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, int clarityType,boolean isSw, HttpCallback callback) {
|
||||
|
||||
PostRequest<JsonBean> request = HttpClient.getInstance().post("Live.createRoom2", LiveHttpConsts.CREATE_ROOM)
|
||||
.params("title", title)
|
||||
@@ -773,6 +773,7 @@ public class LiveHttpUtil {
|
||||
.params("landscape", "2")
|
||||
.params("class_type", "0")
|
||||
.params("type_val", typeVal)
|
||||
.params("is_shengwang",isSw?1:0)
|
||||
.params("clarityType", clarityType);
|
||||
if (file != null) {
|
||||
request.params("file", file);
|
||||
@@ -817,6 +818,15 @@ public class LiveHttpUtil {
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否是声网开播
|
||||
* @param callback
|
||||
*/
|
||||
public static void getIsSw(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Tx.setRtcFirm", "Tx.setRtcFirm")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 腾讯sdk 跟主播连麦时,获取主播的低延时流
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BattlePassPoints;
|
||||
import com.yunbao.common.bean.BattlePassTask;
|
||||
@@ -53,7 +54,9 @@ import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankGiftResultBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.PrankProgressBean;
|
||||
import com.yunbao.common.bean.QuickGiftSendGiftModel;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
@@ -70,6 +73,7 @@ import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.SudGameUserModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.bean.SudgameCodeModel;
|
||||
import com.yunbao.common.bean.SwTokenModel;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
import com.yunbao.common.bean.UserAvatarSelectBean;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
@@ -82,10 +86,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.MultipartBody;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Part;
|
||||
import retrofit2.http.Query;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
@@ -111,7 +118,7 @@ public interface PDLiveApi {
|
||||
@Field("uuid_Device") String uuidDevice,
|
||||
@Field("pushid") String pushid,
|
||||
@Field("lastlogindevice") String lastlogindevice,
|
||||
@Field("langue")String langue
|
||||
@Field("langue") String langue
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -211,7 +218,7 @@ public interface PDLiveApi {
|
||||
);
|
||||
|
||||
/**
|
||||
* 关注主播
|
||||
* 关注主播···································································
|
||||
*
|
||||
* @param liveuid
|
||||
* @return
|
||||
@@ -500,7 +507,16 @@ public interface PDLiveApi {
|
||||
* 获取整蛊列表
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.prankList")
|
||||
Observable<ResponseModel<List<PrankGiftBean>>> prankList(@Query("anchor_id") String anchor_id);
|
||||
Observable<ResponseModel<PrankGiftResultBean>>prankList(
|
||||
@Query("anchor_id") String anchor_id,
|
||||
@Query("prank_type") String prank_type
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取整蛊进度列表
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.prankCompletedList")
|
||||
Observable<ResponseModel<PrankProgressBean>> getPrankProgressList(@Query("anchor_id") String anchor_id);
|
||||
|
||||
/**
|
||||
* 设置礼物整蛊
|
||||
@@ -508,9 +524,11 @@ public interface PDLiveApi {
|
||||
@GET("/api/public/?service=Prank.setPrank")
|
||||
Observable<ResponseModel<List<BaseModel>>> setPrank(
|
||||
@Query("anchor_id") String anchor_id,
|
||||
@Query("gift_id") String gift_id,
|
||||
@Query("gift_num") String gift_num,
|
||||
@Query("prank_content") String prank_content
|
||||
@Query("status") String status,
|
||||
@Query("prank_json") String prank_json,
|
||||
@Query("prank_type") String prank_type,
|
||||
@Query("is_cleared") String is_cleared
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1186,10 +1204,61 @@ public interface PDLiveApi {
|
||||
|
||||
@GET("/api/public/?service=Guard.participateMoneyLong")
|
||||
Observable<ResponseModel<String>> participateMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey);
|
||||
|
||||
@GET("/api/public/?service=Guard.endSendMoneyLong")
|
||||
Observable<ResponseModel<SendMoneyLongModel>> endSendMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey);
|
||||
|
||||
@GET("/api/public/?service=Guard.checkUpgrades")
|
||||
Observable<ResponseModel<CheckUpgradesModel>> checkUpgrades(@Query("liveuid") String liveUid);
|
||||
|
||||
@GET("/api/public/?service=Guard.getRewards")
|
||||
Observable<ResponseModel<Object>> guardGetRewards(@Query("guard_level") String guardLevel,@Query("liveuid") String liveUid);
|
||||
Observable<ResponseModel<Object>> guardGetRewards(@Query("guard_level") String guardLevel, @Query("liveuid") String liveUid);
|
||||
|
||||
@Multipart
|
||||
@POST("/api/public/?service=Pdlinfos.updateAvatar")
|
||||
Observable<ResponseModel<AvatarBean>> updateFile(@Part MultipartBody.Part file, @Query("uid") String uid, @Query("token") String token);
|
||||
|
||||
@GET("/api/public/?service=User.userFeedback")
|
||||
Observable<ResponseModel<List<BaseModel>>> feedback(@Query("problem_description") String content, @Query("problem_image") String images, @Query("contact_information") String ci);
|
||||
|
||||
|
||||
@GET("/api/public/?service=User.userFeedbackRestrict")
|
||||
Observable<ResponseModel<List<BaseModel>>> checkFeedback();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
* @param cmd 事件名称 生命值:addHeart 自动跳:hit
|
||||
* @param value 价格
|
||||
* @param gameId 游戏ID
|
||||
* @param fromUid 付费用户uid
|
||||
* @param toUid 目标用户uid
|
||||
* @param payload 附加值
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgameserver.createOrder")
|
||||
Observable<ResponseModel<List<BaseModel>>> createGameOrder(
|
||||
@Query("room_id")String roomId,
|
||||
@Query("cmd")String cmd,
|
||||
@Query("value")String value,
|
||||
@Query("mg_id")String gameId,
|
||||
@Query("from_uid")String fromUid,
|
||||
@Query("to_uid")String toUid,
|
||||
@Query("payload")String payload
|
||||
);
|
||||
@GET("/api/public/?service=Tx.getShengwangToken")
|
||||
Observable<ResponseModel<SwTokenModel>> getSwToken();
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param anchor_id
|
||||
* @param gift_id
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Prank.anchorClickFinish")
|
||||
Observable<ResponseModel<List<BaseModel>>> anchorClickFinish(
|
||||
@Query("anchor_id")String anchor_id,
|
||||
@Query("gift_id")String gift_id
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,12 @@ import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BattlePassPoints;
|
||||
import com.yunbao.common.bean.BattlePassTask;
|
||||
@@ -51,7 +54,9 @@ import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankGiftResultBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.PrankProgressBean;
|
||||
import com.yunbao.common.bean.QuickGiftSendGiftModel;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
@@ -66,6 +71,7 @@ import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.SudGameUserModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.bean.SudgameCodeModel;
|
||||
import com.yunbao.common.bean.SwTokenModel;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
import com.yunbao.common.bean.UserAvatarSelectBean;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
@@ -79,6 +85,7 @@ import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -88,6 +95,10 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
|
||||
/**
|
||||
@@ -871,9 +882,9 @@ public class LiveNetManager {
|
||||
/**
|
||||
* 获取转盘整蛊列表
|
||||
*/
|
||||
public void getPrankGiftList(String mLiveUid, HttpCallback<List<PrankGiftBean>> callback) {
|
||||
public void getPrankGiftList(String mLiveUid, String prank_type,HttpCallback<PrankGiftResultBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.prankList(mLiveUid)
|
||||
.prankList(mLiveUid,prank_type)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(responseModel -> {
|
||||
@@ -890,12 +901,31 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取整蛊进度列表
|
||||
*/
|
||||
public void getPrankProgressList(String mLiveUid, HttpCallback<PrankProgressBean> callback){
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getPrankProgressList(mLiveUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(responseModel->{
|
||||
if (callback != null){
|
||||
callback.onSuccess(responseModel.getData().getInfo());
|
||||
}
|
||||
},throwable->{
|
||||
if (callback != null){
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
} ).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置礼物整蛊
|
||||
*/
|
||||
public void setPrankGift(String mLiveUid, String gift_id, String gift_num, String prank_content, HttpCallback<PrankHttpTurntableBean> callback) {
|
||||
public void setPrankGift(String mLiveUid, String status, String prank_json,String prank_type,String is_cleared, HttpCallback<PrankHttpTurntableBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setPrank(mLiveUid, gift_id, gift_num, prank_content)
|
||||
.setPrank(mLiveUid, status, prank_json, prank_type,is_cleared)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(responseModel -> {
|
||||
@@ -3133,7 +3163,6 @@ public class LiveNetManager {
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
|
||||
}
|
||||
|
||||
public void guardGetRewards(String guardLevel, String liveUid, HttpCallback<Object> callback) {
|
||||
@@ -3160,6 +3189,172 @@ public class LiveNetManager {
|
||||
|
||||
}
|
||||
|
||||
public void getSwToken( HttpCallback<SwTokenModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getSwToken()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<SwTokenModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<SwTokenModel> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
|
||||
}
|
||||
|
||||
public void anchorClickFinish(String mLiveId, String giftId, HttpCallback<List<BaseModel>>callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.anchorClickFinish(mLiveId, giftId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void updateFile(File file, HttpCallback<AvatarBean> callback) {
|
||||
MultipartBody.Part uploadFile = createUploadFile(file);
|
||||
API.get().pdLiveApi(mContext)
|
||||
.updateFile(uploadFile, CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<AvatarBean>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<AvatarBean> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void feedback(
|
||||
String content,
|
||||
JSONArray images,
|
||||
String ci
|
||||
, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.feedback(content, images.toString(), ci)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> responseModel) {
|
||||
if (callback != null) {
|
||||
HttpCallbackModel model = new HttpCallbackModel();
|
||||
model.setCode(responseModel.getData().getCode());
|
||||
model.setMsg(responseModel.getData().getMsg());
|
||||
callback.onSuccess(model);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void checkFeedback(
|
||||
HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.checkFeedback()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> responseModel) {
|
||||
if (callback != null) {
|
||||
HttpCallbackModel model = new HttpCallbackModel();
|
||||
model.setCode(responseModel.getData().getCode());
|
||||
model.setMsg(responseModel.getData().getMsg());
|
||||
callback.onSuccess(model);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void createGameOrder(
|
||||
String roomId,
|
||||
String cmd,
|
||||
String value,
|
||||
String gameId,
|
||||
String fromUid,
|
||||
String toUid,
|
||||
String roundId,
|
||||
String payload
|
||||
, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.createGameOrder(roomId, cmd, value, gameId, fromUid, toUid,payload)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> responseModel) {
|
||||
if (callback != null) {
|
||||
HttpCallbackModel model = new HttpCallbackModel();
|
||||
model.setCode(responseModel.getData().getCode());
|
||||
model.setMsg(responseModel.getData().getMsg());
|
||||
callback.onSuccess(model);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
private MultipartBody.Part createUploadFile(File file) {
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
||||
@@ -96,27 +96,27 @@ public class MainNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 猜你喜欢
|
||||
*
|
||||
* @param num 请求数量
|
||||
* @return
|
||||
*/
|
||||
public void anchorRecommend(String num, HttpCallback<AnchorRecommendModel> httpCallback) {
|
||||
API.get().pdLiveApi(mContext).anchorRecommend(num)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(anchorRecommendModelResponseModel -> {
|
||||
if (httpCallback != null) {
|
||||
AnchorRecommendModel model = anchorRecommendModelResponseModel.getData().getInfo();
|
||||
httpCallback.onSuccess(model);
|
||||
}
|
||||
}, throwable -> {
|
||||
if (httpCallback != null) {
|
||||
httpCallback.onError(throwable.getMessage());
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
// /**
|
||||
// * 猜你喜欢
|
||||
// *
|
||||
// * @param num 请求数量
|
||||
// * @return
|
||||
// */
|
||||
// public void anchorRecommend(String num, String is_shengwang,HttpCallback<AnchorRecommendModel> httpCallback) {
|
||||
// API.get().pdLiveApi(mContext).anchorRecommend(num,is_shengwang)
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(anchorRecommendModelResponseModel -> {
|
||||
// if (httpCallback != null) {
|
||||
// AnchorRecommendModel model = anchorRecommendModelResponseModel.getData().getInfo();
|
||||
// httpCallback.onSuccess(model);
|
||||
// }
|
||||
// }, throwable -> {
|
||||
// if (httpCallback != null) {
|
||||
// httpCallback.onError(throwable.getMessage());
|
||||
// }
|
||||
// }).isDisposed();
|
||||
// }
|
||||
|
||||
public void anchorRecommend(Map<String, Object> map, HttpCallback<AnchorRecommendModel> httpCallback) {
|
||||
API.get().pdLiveApi(mContext).anchorRecommend(map)
|
||||
@@ -140,11 +140,12 @@ public class MainNetManager {
|
||||
* @param num 请求数量
|
||||
* @return
|
||||
*/
|
||||
public void anchorRecommendType(String num, HttpCallback<AnchorRecommendModel> httpCallback) {
|
||||
public void anchorRecommendType(String num, String is_shengwang,HttpCallback<AnchorRecommendModel> httpCallback) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("num", num);
|
||||
map.put("live_recommend", "slide");
|
||||
map.put("type", "1");
|
||||
map.put(" is_shengwang", is_shengwang);
|
||||
API.get().pdLiveApi(mContext).anchorRecommend(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
||||
@@ -1,16 +1,62 @@
|
||||
package com.yunbao.common.interfaces;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.upload.UploadBean;
|
||||
import com.yunbao.common.upload.UploadCallback;
|
||||
import com.yunbao.common.upload.UploadQnImpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/29.
|
||||
*/
|
||||
|
||||
public interface ImageResultCallback {
|
||||
public abstract class ImageResultCallback {
|
||||
//跳转相机前执行
|
||||
void beforeCamera();
|
||||
public void beforeCamera() {
|
||||
}
|
||||
|
||||
void onSuccess(File file);
|
||||
public void onSuccess(File file) {
|
||||
}
|
||||
|
||||
void onFailure();
|
||||
}
|
||||
public void onFailure() {
|
||||
}
|
||||
|
||||
public void onSuccessToUrl(File file, OnItemClickListener<String> listener) {
|
||||
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||
.updateFile(file, new com.yunbao.common.http.base.HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
public void onSuccess(AvatarBean data) {
|
||||
listener.onItemClick(data.getAvatar(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
listener.onItemClick(error, -1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onSuccessToQiNiuUrl(Context mContext, File file, OnItemClickListener<String> listener) {
|
||||
UploadQnImpl mUploadStrategy = new UploadQnImpl(mContext);
|
||||
List<UploadBean> beans = new ArrayList<>();
|
||||
beans.add(new UploadBean(file, UploadBean.IMG));
|
||||
mUploadStrategy.upload(beans, true, new UploadCallback() {
|
||||
@Override
|
||||
public void onFinish(List<UploadBean> list, boolean success) {
|
||||
if (success) {
|
||||
listener.onItemClick("https://downs.yaoulive.com/" + list.get(0).getRemoteAccessUrl(), 0);
|
||||
} else {
|
||||
listener.onItemClick(null, -1);
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import androidx.annotation.NonNull;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.event.DataUserInfoEvent;
|
||||
|
||||
@@ -1,25 +1,34 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.dialog.DebugDialog;
|
||||
import com.yunbao.common.dialog.OpenAdBottomDialogPopup;
|
||||
import com.yunbao.common.dialog.OpenAdCenterDialogPopup;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class OpenAdManager {
|
||||
public static final int TYPE_HOME = 1;
|
||||
@@ -28,19 +37,42 @@ public class OpenAdManager {
|
||||
private Map<Integer, Boolean> showMap;
|
||||
private List<OpenAdModel> list = null;
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
private Map<Integer, AdRunnable> runnableMap = new HashMap<>();
|
||||
private Map<Integer, AdRunnable> runnableMap = new LinkedHashMap<>();
|
||||
private Map<AdRunnable, Integer> waitRunnableMap = new LinkedHashMap<>();//等待运行的弹窗
|
||||
private int showType;
|
||||
private WeakReference<AdRunnable> runNowRunnable;
|
||||
private static final boolean IS_QUEUE_SHOW = true;//是否按队列显示弹窗,true就会等待上一个弹窗关闭后弹出,false就按原逻辑顺序直接弹出
|
||||
|
||||
private OpenAdManager() {
|
||||
showMap = new HashMap<>();
|
||||
init(false);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
public void close() {
|
||||
dismiss();
|
||||
runnableMap.clear();
|
||||
showMap.clear();
|
||||
list.clear();
|
||||
clear();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
if (runnableMap != null) {
|
||||
runnableMap.clear();
|
||||
}
|
||||
if (showMap != null) {
|
||||
showMap.clear();
|
||||
}
|
||||
if (list != null) {
|
||||
list.clear();
|
||||
}
|
||||
if (waitRunnableMap != null) {
|
||||
waitRunnableMap.clear();
|
||||
}
|
||||
list = null;
|
||||
runNowRunnable = null;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
Log.i(TAG, "reset: ");
|
||||
next();
|
||||
}
|
||||
|
||||
private static final class MInstanceHolder {
|
||||
@@ -55,13 +87,14 @@ public class OpenAdManager {
|
||||
if (list != null && list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Context context = CommonAppContext.getTopActivity();
|
||||
Context context = AppManager.getInstance().getMainActivity();
|
||||
if (context == null) {
|
||||
context = CommonAppContext.sInstance;
|
||||
}
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
LiveNetManager.get(context).activityPopup(new HttpCallback<List<OpenAdModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<OpenAdModel> data) {
|
||||
@@ -70,35 +103,64 @@ public class OpenAdManager {
|
||||
list = new ArrayList<>();
|
||||
return;
|
||||
}
|
||||
Collections.sort(data, new AdListComparator());
|
||||
list = data;
|
||||
if (isShow) {
|
||||
show(TYPE_HOME, false);
|
||||
if (showType == 0) {
|
||||
show(TYPE_HOME, false);
|
||||
} else {
|
||||
show(showType, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
System.err.println("弹框列表:" + error);
|
||||
Log.e(TAG, "弹框列表:" + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static long showTime=0;
|
||||
private static long showTime = 0;
|
||||
private OnItemClickListener<String> onItemClickListener=new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
public synchronized void show(int type, boolean isGuard) {
|
||||
showType = type;
|
||||
if (list == null) {
|
||||
init(true);
|
||||
return;
|
||||
}
|
||||
if(System.currentTimeMillis()-showTime<100){
|
||||
Log.i(TAG, "show: 调用显示 " + type + " " + isGuard);
|
||||
if (System.currentTimeMillis() - showTime < 100) {
|
||||
return;
|
||||
}
|
||||
showTime=System.currentTimeMillis();
|
||||
showType = type;
|
||||
/*DebugDialog.getInstance(new DebugDialog.DebugDialogRunnable() {
|
||||
@Override
|
||||
public void run(DebugDialog dialog) {
|
||||
dialog.setShowPattern(ShowPattern.ALL_TIME);
|
||||
dialog.show();
|
||||
onItemClickListener = new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
dialog.setParams(bean, "剩余:" + position);
|
||||
}
|
||||
};
|
||||
}
|
||||
});*/
|
||||
showTime = System.currentTimeMillis();
|
||||
waitRunnableMap.clear();
|
||||
runnableMap.clear();
|
||||
runNowRunnable = null;
|
||||
for (OpenAdModel model : list) {
|
||||
if (model.getType() == type) {
|
||||
if (type == OpenAdModel.TYPE_LIVE && !model.userIsPermission(isGuard)) {
|
||||
/* if (type == OpenAdModel.TYPE_LIVE && !model.userIsPermission(isGuard)) {
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
if (model.getShowModel() == OpenAdModel.SHOW_ONE) {
|
||||
if (SpUtil.getInstance().getBooleanValue("open_ad_popup_" + model.getId())) {
|
||||
continue;
|
||||
@@ -122,13 +184,22 @@ public class OpenAdManager {
|
||||
|
||||
if (!isShow(model)) {
|
||||
Log.i(TAG, "show: " + model);
|
||||
handler.postDelayed(new AdRunnable(model), model.getDelayShowTime());
|
||||
if (IS_QUEUE_SHOW) {
|
||||
waitRunnableMap.put(new AdRunnable(model), model.getDelayShowTime());
|
||||
} else {
|
||||
handler.postDelayed(new AdRunnable(model), model.getDelayShowTime());
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG, "notshow: " + model);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Log.i(TAG, "show: 循环完毕,调用next");
|
||||
if (IS_QUEUE_SHOW) {
|
||||
onItemClickListener.onItemClick("接口返回需要展示的弹窗数:", waitRunnableMap.size());
|
||||
next();
|
||||
}
|
||||
Log.i(TAG, "------------------------------");
|
||||
|
||||
}
|
||||
@@ -144,6 +215,9 @@ public class OpenAdManager {
|
||||
}
|
||||
}
|
||||
runnableMap.clear();
|
||||
if (runNowRunnable != null && runNowRunnable.get() != null) {
|
||||
handler.removeCallbacks(runNowRunnable.get());
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized boolean isShow(OpenAdModel type) {
|
||||
@@ -153,11 +227,45 @@ public class OpenAdManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
int getNowType() {
|
||||
Activity lastActivity = AppManager.getInstance().getLastActivity();
|
||||
if (lastActivity == null) {
|
||||
return -1;
|
||||
}
|
||||
if (AppManager.getInstance().isLiveActivity()) {
|
||||
return TYPE_LIVE;
|
||||
} else if (AppManager.getInstance().isMainActivity()) {
|
||||
return TYPE_HOME;
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
|
||||
void next() {
|
||||
Log.i(TAG, "next: 剩余数" + waitRunnableMap.size());
|
||||
if (waitRunnableMap.isEmpty()) return;
|
||||
for (AdRunnable next : waitRunnableMap.keySet()) {
|
||||
Log.i(TAG, "next: " + next.model);
|
||||
if (next.model.getType() == getNowType()) {
|
||||
Integer i = waitRunnableMap.get(next);
|
||||
if (i == null) {
|
||||
i = 0;
|
||||
}
|
||||
onItemClickListener.onItemClick("当前加载id:" + next.model.getId() + " " + next.model.getName() + " 延迟展示时间:" + i, (waitRunnableMap.size() - 1));
|
||||
handler.postDelayed(next, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AdRunnable implements Runnable {
|
||||
OpenAdModel model;
|
||||
AdRunnable runnable;
|
||||
|
||||
public AdRunnable(OpenAdModel model) {
|
||||
this.model = model;
|
||||
this.runnable = this;
|
||||
runNowRunnable = new WeakReference<>(this);
|
||||
runnableMap.put(model.getId(), this);
|
||||
}
|
||||
|
||||
@@ -170,36 +278,100 @@ public class OpenAdManager {
|
||||
Log.i(TAG, "run: " + model);
|
||||
if (model == null) {
|
||||
ToastUtil.showDebug("model为空");
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick("", -2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!model.isInTime()) {
|
||||
ToastUtil.showDebug("不在展示时间内:" + model.getStartTime() + "|" + model.getEndTime());
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick("", -2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (isShow(model)) {
|
||||
ToastUtil.showDebug(model.getId() + "|model展示过了");
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick("", -2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (model.getType() != showType) {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick("", -2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(isShow(model)){
|
||||
Log.i(TAG,"展示过:"+model);
|
||||
if (isShow(model)) {
|
||||
Log.i(TAG, "展示过:" + model);
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick("", -2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (model.getType() == OpenAdModel.TYPE_HOME && !AppManager.getInstance().isMainActivity()) {
|
||||
Log.i(TAG, "首页类型弹窗,但当前不是首页");
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick("", -2);
|
||||
}
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
if (model.getType() == TYPE_LIVE && !AppManager.getInstance().isLiveActivity()) {
|
||||
Log.i(TAG, "直播类型弹窗,但当前不是直播");
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick("", -2);
|
||||
}
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
|
||||
showMap.put(model.getId(), true);
|
||||
if (model.getShowModel() == OpenAdModel.SHOW_DIY) {
|
||||
String nextTime= String.valueOf(System.currentTimeMillis() + (Long.parseLong(model.getSection()) * 60 * 1000));
|
||||
String nextTime = String.valueOf(System.currentTimeMillis() + (Long.parseLong(model.getSection()) * 60 * 1000));
|
||||
SpUtil.setStringValue("open_ad_popup_time_" + model.getId(), nextTime);
|
||||
showMap.remove(model.getId());
|
||||
}
|
||||
if (model.getModel() == OpenAdModel.MODEL_BOTTOM) {
|
||||
new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
|
||||
new OpenAdBottomDialogPopup(AppManager.getInstance().getLastActivity(), model).setListener((bean, position) -> {
|
||||
Log.i(TAG, "run: 弹框回调:" + position + " id = " + model.getId());
|
||||
if (IS_QUEUE_SHOW) {
|
||||
removeList(bean);
|
||||
if (position == 0) {
|
||||
next();
|
||||
}
|
||||
}
|
||||
}).showDialog();
|
||||
} else {
|
||||
new OpenAdCenterDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
|
||||
new OpenAdCenterDialogPopup(AppManager.getInstance().getLastActivity(), model).setListener((bean, position) -> {
|
||||
Log.i(TAG, "run: 弹框回调:" + position + " id = " + model.getId());
|
||||
if (IS_QUEUE_SHOW) {
|
||||
removeList(bean);
|
||||
if (position == 0) {
|
||||
next();
|
||||
}
|
||||
}
|
||||
}).showDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void removeList(OpenAdModel model) {
|
||||
Log.i(TAG, "removeList: " + model);
|
||||
for (AdRunnable next : waitRunnableMap.keySet()) {
|
||||
if (next.model.getId() == model.getId()) {
|
||||
waitRunnableMap.remove(next);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class AdListComparator implements Comparator<OpenAdModel> {
|
||||
|
||||
@Override
|
||||
public int compare(OpenAdModel openAdModel, OpenAdModel t1) {
|
||||
return openAdModel.getSort() - t1.getSort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +143,9 @@ public class RandomPkManager {
|
||||
.randomPK(new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
if (debugUid != null) {
|
||||
pkUid = data = debugUid;
|
||||
}
|
||||
try {
|
||||
Integer.parseInt(data);//检测返回的data是否为数字uid,不是的话开始下一轮
|
||||
} catch (Exception e) {
|
||||
@@ -152,9 +155,8 @@ public class RandomPkManager {
|
||||
return;
|
||||
}
|
||||
pkUid = data;
|
||||
if (debugUid != null) {
|
||||
pkUid = data = debugUid;
|
||||
}
|
||||
|
||||
ToastUtil.showDebug("随机PK:"+pkUid+"|"+data);
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onStartPK(data);
|
||||
}
|
||||
@@ -343,7 +345,7 @@ public class RandomPkManager {
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
|
||||
//ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
public class GameMicManager {
|
||||
public class GameRyMicManager {
|
||||
MeetingCallback mMeetingCallback = null;
|
||||
private RCRTCRoom mRtcRoom = null;
|
||||
private String mRoomID = "";
|
||||
@@ -367,7 +367,7 @@ public class GameMicManager {
|
||||
RCRTCEngine.getInstance().joinRoom("v" + roomId, roomConfig, new IRCRTCResultDataCallback<RCRTCRoom>() {
|
||||
@Override
|
||||
public void onSuccess(final RCRTCRoom rcrtcRoom) {
|
||||
GameMicManager.this.mRtcRoom = rcrtcRoom;
|
||||
GameRyMicManager.this.mRtcRoom = rcrtcRoom;
|
||||
// 注册房间回调
|
||||
rcrtcRoom.registerRoomListener(roomEventsListener);
|
||||
try {
|
||||
@@ -484,7 +484,7 @@ public class GameMicManager {
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
|
||||
TextMessage messageContent = TextMessage.obtain(new Gson().toJson(sudGameSocketImEvent));
|
||||
Message message = Message.obtain("v" + mRoomID, conversationType, messageContent);
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(Message message) {
|
||||
|
||||
@@ -0,0 +1,565 @@
|
||||
package com.yunbao.common.manager.imrongcloud;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.SudGameChatImModel;
|
||||
import com.yunbao.common.bean.SudGameUserModel;
|
||||
import com.yunbao.common.event.SudGameSocketImEvent;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.RCRTCRemoteUser;
|
||||
import cn.rongcloud.rtc.api.RCRTCRoom;
|
||||
import cn.rongcloud.rtc.api.RCRTCRoomConfig;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
|
||||
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
|
||||
import cn.rongcloud.rtc.base.RCRTCParamsType;
|
||||
import cn.rongcloud.rtc.base.RCRTCRoomType;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.IRongCoreCallback;
|
||||
import io.rong.imlib.IRongCoreEnum;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.chatroom.base.RongChatRoomClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
public class GameSwMicManager {
|
||||
MeetingCallback mMeetingCallback = null;
|
||||
private RCRTCRoom mRtcRoom = null;
|
||||
private String mRoomID = "";
|
||||
|
||||
public void setmRoomID(String mRoomID) {
|
||||
this.mRoomID = mRoomID;
|
||||
}
|
||||
|
||||
private final IRCRTCRoomEventsListener roomEventsListener = new IRCRTCRoomEventsListener() {
|
||||
/**
|
||||
* 房间内用户发布资源
|
||||
*
|
||||
* @param rcrtcRemoteUser 远端用户
|
||||
* @param list 发布的资源
|
||||
*/
|
||||
@Override
|
||||
public void onRemoteUserPublishResource(RCRTCRemoteUser rcrtcRemoteUser, final List<RCRTCInputStream> list) {
|
||||
// subscribeAVStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteUserMuteAudio(RCRTCRemoteUser rcrtcRemoteUser, RCRTCInputStream rcrtcInputStream, boolean b) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteUserMuteVideo(RCRTCRemoteUser rcrtcRemoteUser, RCRTCInputStream rcrtcInputStream, boolean b) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRemoteUserUnpublishResource(RCRTCRemoteUser rcrtcRemoteUser, List<RCRTCInputStream> list) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户加入房间
|
||||
*
|
||||
* @param rcrtcRemoteUser 远端用户
|
||||
*/
|
||||
@Override
|
||||
public void onUserJoined(final RCRTCRemoteUser rcrtcRemoteUser) {
|
||||
try {
|
||||
getView().onUserJoined(rcrtcRemoteUser);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户离开房间
|
||||
*
|
||||
* @param rcrtcRemoteUser 远端用户
|
||||
*/
|
||||
@Override
|
||||
public void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser) {
|
||||
try {
|
||||
getView().onUserLeft(rcrtcRemoteUser);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserOffline(RCRTCRemoteUser rcrtcRemoteUser) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPublishLiveStreams(List<RCRTCInputStream> list) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnpublishLiveStreams(List<RCRTCInputStream> list) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自己退出房间。 例如断网退出等
|
||||
* @param i 状态码
|
||||
*/
|
||||
@Override
|
||||
public void onLeaveRoom(int i) {
|
||||
}
|
||||
};
|
||||
|
||||
protected MeetingCallback getView() {
|
||||
if (mMeetingCallback == null) {
|
||||
throw new IllegalStateException("view is not attached");
|
||||
} else {
|
||||
return mMeetingCallback;
|
||||
}
|
||||
}
|
||||
|
||||
public void attachView(MeetingCallback callback) {
|
||||
mMeetingCallback = callback;
|
||||
}
|
||||
|
||||
public void detachView() {
|
||||
mMeetingCallback = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主动订阅远端用户发布的流
|
||||
* 视频流需要用户设置用于显示载体的videoview
|
||||
*/
|
||||
public void subscribeAVStream() {
|
||||
if (mRtcRoom == null || mRtcRoom.getRemoteUsers() == null) {
|
||||
return;
|
||||
}
|
||||
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
|
||||
for (final RCRTCRemoteUser remoteUser : mRtcRoom.getRemoteUsers()) {
|
||||
if (remoteUser.getStreams().size() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
inputStreams.addAll(remoteUser.getStreams());
|
||||
|
||||
}
|
||||
|
||||
if (inputStreams.size() == 0) {
|
||||
return;
|
||||
}
|
||||
mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
|
||||
try {
|
||||
getView().onSubscribeSuccess(inputStreams);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
try {
|
||||
getView().onSubscribeFailed();
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void refreshStreams(List<SudGameUserModel> personList) {
|
||||
|
||||
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
|
||||
if(mRtcRoom!=null){
|
||||
for (SudGameUserModel sudGameUserModel : personList) {
|
||||
List<RCRTCRemoteUser> rcrtcRemoteUsers = mRtcRoom.getRemoteUsers();
|
||||
|
||||
for (RCRTCRemoteUser rcrtcRemoteUser : rcrtcRemoteUsers) {
|
||||
if (TextUtils.equals(rcrtcRemoteUser.getUserId(), String.valueOf(sudGameUserModel.getId()))) {
|
||||
for (RCRTCInputStream rcrtcInputStream : rcrtcRemoteUser.getStreams()) {
|
||||
rcrtcInputStream.mute(sudGameUserModel.getMicStatus() == 3);
|
||||
}
|
||||
inputStreams.addAll(rcrtcRemoteUser.getStreams());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inputStreams.size() == 0) {
|
||||
return;
|
||||
}
|
||||
mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
|
||||
try {
|
||||
getView().onSubscribeSuccess(inputStreams);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
try {
|
||||
getView().onSubscribeFailed();
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshStreams(String userID, boolean mute, int position) {
|
||||
|
||||
final List<RCRTCInputStream> inputStreams = new ArrayList<>();
|
||||
|
||||
List<RCRTCRemoteUser> rcrtcRemoteUsers = mRtcRoom.getRemoteUsers();
|
||||
|
||||
for (RCRTCRemoteUser rcrtcRemoteUser : rcrtcRemoteUsers) {
|
||||
if (TextUtils.equals(rcrtcRemoteUser.getUserId(), String.valueOf(userID))) {
|
||||
for (RCRTCInputStream rcrtcInputStream : rcrtcRemoteUser.getStreams()) {
|
||||
rcrtcInputStream.mute(mute);
|
||||
}
|
||||
inputStreams.addAll(rcrtcRemoteUser.getStreams());
|
||||
}
|
||||
}
|
||||
if (inputStreams.size() == 0) {
|
||||
return;
|
||||
}
|
||||
mRtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
try {
|
||||
getView().onSubscribeSuccess(userID, mute, position);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
try {
|
||||
getView().onSubscribeFailed(userID);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void unPublishStreams() {
|
||||
if (mRtcRoom == null) {
|
||||
return;
|
||||
}
|
||||
mRtcRoom.getLocalUser().unpublishStream(RCRTCEngine.getInstance().getDefaultAudioStream(), new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
try {
|
||||
getView().onUnPublishStreamsSuccess();
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
try {
|
||||
getView().onUnPublishStreamsFailed();
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布默认流
|
||||
*/
|
||||
public void publishDefaultAVStream() {
|
||||
if (mRtcRoom == null) {
|
||||
return;
|
||||
}
|
||||
mRtcRoom.getLocalUser().publishStream(RCRTCEngine.getInstance().getDefaultAudioStream(), new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
try {
|
||||
getView().onPublishSuccess();
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode rtcErrorCode) {
|
||||
try {
|
||||
getView().onPublishFailed();
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 配置rtc sdk
|
||||
*/
|
||||
public void config(Context context) {
|
||||
|
||||
// RCRTCConfig.Builder configBuilder = RCRTCConfig.Builder.create();
|
||||
// // 是否硬解码
|
||||
// configBuilder.enableHardwareDecoder(true);
|
||||
// // 是否硬编码
|
||||
// configBuilder.enableHardwareEncoder(true);
|
||||
//
|
||||
// // init 需结合 uninit 使用,否则有些配置无法重新初始化
|
||||
// RCRTCEngine.getInstance().unInit();
|
||||
// RCRTCEngine.getInstance().init(context, configBuilder.build());
|
||||
|
||||
// RCRTCVideoStreamConfig.Builder videoConfigBuilder = RCRTCVideoStreamConfig.Builder.create();
|
||||
// // 设置分辨率
|
||||
// videoConfigBuilder.setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280);
|
||||
// // 设置帧率
|
||||
// videoConfigBuilder.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_30);
|
||||
// /**
|
||||
// * 设置最小码率,可根据分辨率RCRTCVideoResolution设置
|
||||
// * {@link RCRTCParamsType.RCRTCVideoResolution)}
|
||||
// */
|
||||
// videoConfigBuilder.setMinRate(250);
|
||||
// /**
|
||||
// * 设置最大码率,可根据分辨率RCRTCVideoResolution设置
|
||||
// * {@link RCRTCParamsType.RCRTCVideoResolution)}
|
||||
// */
|
||||
// videoConfigBuilder.setMaxRate(2200);
|
||||
// RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(videoConfigBuilder.build());
|
||||
//打开扬声器。
|
||||
RCRTCEngine.getInstance().enableSpeaker(true);
|
||||
// 启用耳返功能
|
||||
RCRTCEngine.getInstance().getDefaultAudioStream().enableEarMonitoring(true);
|
||||
RCRTCEngine.getInstance().getDefaultAudioStream().setMicrophoneDisable(false);
|
||||
RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC_HIGH, RCRTCParamsType.AudioScenario.MUSIC_CHATROOM);
|
||||
}
|
||||
|
||||
public void joinRoom(String roomId, boolean imOff) {
|
||||
mRoomID = roomId;
|
||||
if (imOff) {
|
||||
|
||||
RCRTCRoomConfig roomConfig = RCRTCRoomConfig.Builder.create()
|
||||
// 根据实际场景,选择音视频直播:LIVE_AUDIO_VIDEO 或音频直播:LIVE_AUDIO
|
||||
.setRoomType(RCRTCRoomType.MEETING)
|
||||
|
||||
.build();
|
||||
RCRTCEngine.getInstance().joinRoom("v" + roomId, roomConfig, new IRCRTCResultDataCallback<RCRTCRoom>() {
|
||||
@Override
|
||||
public void onSuccess(final RCRTCRoom rcrtcRoom) {
|
||||
GameSwMicManager.this.mRtcRoom = rcrtcRoom;
|
||||
// 注册房间回调
|
||||
rcrtcRoom.registerRoomListener(roomEventsListener);
|
||||
try {
|
||||
getView().onJoinRoomSuccess(rcrtcRoom);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode rtcErrorCode) {
|
||||
try {
|
||||
getView().onJoinRoomFailed(rtcErrorCode);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RongChatRoomClient.getInstance().joinChatRoom("v" + roomId, -1, new IRongCoreCallback.OperationCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.i("tx", "加入成功");
|
||||
enterRoom();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
|
||||
Log.i("tx", "加入" + "失败" + coreErrorCode);
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("網絡不佳無法連接,請重新進入");
|
||||
} else {
|
||||
ToastUtil.show("The network is not connected, please re-enter");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void leaveRoom() {
|
||||
RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode rtcErrorCode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
}
|
||||
});
|
||||
RongChatRoomClient.getInstance().quitChatRoom("v" + mRoomID, new IRongCoreCallback.OperationCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.i("tx", "退出成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
|
||||
Log.i("tx", "退出" + "" + coreErrorCode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理游戏房Im消息
|
||||
*/
|
||||
public void processingMessage(SudGameSocketImEvent socketImModel) {
|
||||
|
||||
List<SudGameSocketImEvent.MsgDTO> msgDTOS = socketImModel.getMsg();
|
||||
if (msgDTOS.isEmpty()) return;
|
||||
SudGameSocketImEvent.MsgDTO msgDTO = msgDTOS.get(0);
|
||||
|
||||
|
||||
//正常文字消息
|
||||
if (TextUtils.equals(msgDTO.getMethod(), "SendMsg")) {
|
||||
getView().insertItem(new SudGameChatImModel().setWelcomMessage(false).setNickname(msgDTO.getUname()).setTextMessage(msgDTO.getCt()));
|
||||
} else if (TextUtils.equals(msgDTO.getMethod(), "welcomMessage")) {
|
||||
// 欢迎(用户名)进入房间 Welcome (username) to the room
|
||||
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (WordUtil.isNewZh()) {
|
||||
stringBuffer.append("歡迎 ").append(msgDTO.getCt()).append(" 進入房間");
|
||||
} else {
|
||||
stringBuffer.append("Welcome ").append(msgDTO.getCt()).append(" to enter the room");
|
||||
}
|
||||
|
||||
getView().insertItem(new SudGameChatImModel().setWelcomMessage(true).setNickname(msgDTO.getCt()).setTextMessage(stringBuffer.toString()));
|
||||
} else if (TextUtils.equals(msgDTO.getMethod(), "sudGameRoomVoiceList")) {
|
||||
List<SudGameUserModel> personList = new Gson().fromJson(msgDTO.getCt(), new TypeToken<List<SudGameUserModel>>() {
|
||||
}.getType());
|
||||
getView().refreshSudGameUserList(personList);
|
||||
|
||||
refreshStreams(personList);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void sendChatMessage(String textMessage, String method) {
|
||||
IMLoginModel loginModel = IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getUserInfo();
|
||||
SudGameSocketImEvent sudGameSocketImEvent = new SudGameSocketImEvent();
|
||||
sudGameSocketImEvent.setRetcode("000000");
|
||||
sudGameSocketImEvent.setRetmsg("ok");
|
||||
|
||||
SudGameSocketImEvent.MsgDTO msgDTO = new SudGameSocketImEvent.MsgDTO();
|
||||
msgDTO.setAction("0")
|
||||
.setCt(textMessage)
|
||||
.setEquipment("app")
|
||||
.setUid(String.valueOf(loginModel.getId()))
|
||||
.setMethod(method)
|
||||
.setUname(loginModel.getUserNicename())
|
||||
.setRoomnum(mRoomID);
|
||||
|
||||
List<SudGameSocketImEvent.MsgDTO> msgDTOS = new ArrayList<>();
|
||||
msgDTOS.add(msgDTO);
|
||||
sudGameSocketImEvent.setMsg(msgDTOS);
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM;
|
||||
TextMessage messageContent = TextMessage.obtain(new Gson().toJson(sudGameSocketImEvent));
|
||||
Message message = Message.obtain("v" + mRoomID, conversationType, messageContent);
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
Log.i("tx", "发送成功");
|
||||
String contentJson = ((TextMessage) message.getContent()).getContent();
|
||||
Log.e("wewe", contentJson);
|
||||
SudGameSocketImEvent sudGameSocketImEvent = new Gson().fromJson(contentJson, SudGameSocketImEvent.class);
|
||||
sudGameSocketImEvent.getMsg().get(0).setTime("11");
|
||||
processingMessage(sudGameSocketImEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.i("tx", "发送成功" + errorCode.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送聊天信息
|
||||
*
|
||||
* @param textMessage
|
||||
*/
|
||||
public void sendMessage(String textMessage) {
|
||||
sendChatMessage(textMessage, "SendMsg");
|
||||
}
|
||||
|
||||
/**
|
||||
* 进房间
|
||||
*/
|
||||
public void enterRoom() {
|
||||
IMLoginModel loginModel = IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getUserInfo();
|
||||
sendChatMessage(loginModel.getUserNicename(), "welcomMessage");
|
||||
}
|
||||
|
||||
/**
|
||||
* activity相关回调
|
||||
*/
|
||||
public interface MeetingCallback {
|
||||
void onJoinRoomSuccess(RCRTCRoom rcrtcRoom);
|
||||
|
||||
void onJoinRoomFailed(RTCErrorCode rtcErrorCode);
|
||||
|
||||
void onPublishSuccess();
|
||||
|
||||
|
||||
void onPublishFailed();
|
||||
|
||||
void onUnPublishStreamsSuccess();
|
||||
|
||||
void onUnPublishStreamsFailed();
|
||||
|
||||
void onSubscribeSuccess(List<RCRTCInputStream> inputStreamList);
|
||||
|
||||
void onSubscribeFailed();
|
||||
|
||||
void onSubscribeSuccess(String userID, boolean mute, int position);
|
||||
|
||||
void onSubscribeFailed(String userID);
|
||||
|
||||
void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser);
|
||||
|
||||
void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser);
|
||||
|
||||
void insertItem(SudGameChatImModel sudGameChatImModel);
|
||||
|
||||
void refreshSudGameUserList(List<SudGameUserModel> personList);
|
||||
}
|
||||
}
|
||||
@@ -15,9 +15,14 @@ import com.bumptech.glide.request.RequestOptions;
|
||||
import com.iflytek.cloud.SpeechConstant;
|
||||
import com.iflytek.cloud.SpeechUtility;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.dialog.DebugDialog;
|
||||
import com.yunbao.common.event.RongIMConnectionStatusEvent;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
@@ -25,6 +30,7 @@ import io.rong.imkit.GlideKitImageEngine;
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.RongIM;
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
@@ -112,12 +118,31 @@ public class RongcloudIMManager {
|
||||
|
||||
}
|
||||
|
||||
public static void connectIM(Context context) {
|
||||
connectIM(context, new RongIMClient.ConnectCallback() {
|
||||
@Override
|
||||
public void onSuccess(String t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ConnectionErrorCode e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接融云服务器
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void connectIM(Context context) {
|
||||
public static void connectIM(Context context, RongIMClient.ConnectCallback callback) {
|
||||
MessageIMManager.get(context).addImRongCloudObserver();
|
||||
MessageIMManager.get(context).getSystemMessages();
|
||||
IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo();
|
||||
@@ -129,6 +154,7 @@ public class RongcloudIMManager {
|
||||
RongIM.connect(IMToken, 0, new RongIMClient.ConnectCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
callback.onSuccess(s);
|
||||
//连接成功,如果 onDatabaseOpened() 时没有页面跳转,也可在此时进行跳转。
|
||||
Log.e(CLASSNAME, "onSuccess:" + s);
|
||||
isReady = true;
|
||||
@@ -138,6 +164,7 @@ public class RongcloudIMManager {
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ConnectionErrorCode connectionErrorCode) {
|
||||
callback.onError(connectionErrorCode);
|
||||
if (connectionErrorCode.equals(RongIMClient.ConnectionErrorCode.RC_CONN_TOKEN_EXPIRE)) {
|
||||
//从 APP 服务请求新 token,获取到新 token 后重新 connect()
|
||||
Log.e(CLASSNAME, "onError:(从 APP 服务请求新 token)" + RongIMClient.ConnectionErrorCode.RC_CONN_TOKEN_EXPIRE);
|
||||
@@ -152,6 +179,7 @@ public class RongcloudIMManager {
|
||||
|
||||
@Override
|
||||
public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus databaseOpenStatus) {
|
||||
callback.onDatabaseOpened(databaseOpenStatus);
|
||||
if (RongIMClient.DatabaseOpenStatus.DATABASE_OPEN_SUCCESS.equals(databaseOpenStatus)) {
|
||||
//本地数据库打开,跳转到会话列表页面
|
||||
Log.e(CLASSNAME, "onDatabaseOpened:(本地数据库打开)" + databaseOpenStatus);
|
||||
@@ -225,4 +253,66 @@ public class RongcloudIMManager {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送消息失败重连次数,超过3就重新登录
|
||||
*/
|
||||
private static int reconnectIndex = 0;
|
||||
|
||||
public static void sendMessage(final Message message, final String pushContent, final String pushData, final IRongCallback.ISendMessageCallback callback) {
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, pushContent, pushData, new IRongCallback.ISendMessageCallback() {
|
||||
|
||||
@Override
|
||||
public void onAttached(Message message) {
|
||||
if (callback != null) {
|
||||
callback.onAttached(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
reconnectIndex = 0;
|
||||
if (callback != null) {
|
||||
callback.onSuccess(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
|
||||
if (reconnectIndex > 2) {
|
||||
reconnectIndex = 0;
|
||||
ToastUtil.show(WordUtil.getNewString(R.string.login_invalid));
|
||||
EventBus.getDefault().post(new RongIMConnectionStatusEvent());
|
||||
return;
|
||||
}
|
||||
if (errorCode.code == 33000) {
|
||||
reconnectIndex++;
|
||||
connectIM(AppManager.getInstance().getMainActivity(), new RongIMClient.ConnectCallback() {
|
||||
@Override
|
||||
public void onSuccess(String t) {
|
||||
sendMessage(message, pushContent, pushData, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ConnectionErrorCode e) {
|
||||
sendMessage(message, pushContent, pushData, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) {
|
||||
if (RongIMClient.DatabaseOpenStatus.DATABASE_OPEN_ERROR.equals(code)) {
|
||||
sendMessage(message, pushContent, pushData, callback);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (callback != null) {
|
||||
callback.onError(message, errorCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.sud.decorator.SudFSMMGCache;
|
||||
import com.yunbao.common.sud.decorator.SudFSMMGDecorator;
|
||||
import com.yunbao.common.sud.decorator.SudFSMMGListener;
|
||||
@@ -16,7 +17,10 @@ import com.yunbao.common.sud.decorator.SudFSTAPPDecorator;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.sud.model.GameViewInfoModel;
|
||||
import com.yunbao.common.sud.state.MGStateResponse;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.SudJsonUtils;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
import tech.sud.mgp.core.ISudFSTAPP;
|
||||
@@ -142,7 +146,10 @@ public abstract class BaseGameViewModel implements SudFSMMGListener {
|
||||
|
||||
// 给装饰类设置回调
|
||||
sudFSMMGDecorator.setSudFSMMGListener(this);
|
||||
|
||||
sudFSMMGDecorator.setGameId(gameId);
|
||||
sudFSMMGDecorator.setRoomId(gameRoomId);
|
||||
sudFSMMGDecorator.setUserId(getUserId());
|
||||
Log.i("游戏回调", code + " " + gameId + " " + gameRoomId + " ");
|
||||
// 调用游戏sdk加载游戏
|
||||
ISudFSTAPP iSudFSTAPP = SudMGP.loadMG(activity, getUserId(), gameRoomId, code, gameId, getLanguageCode(), sudFSMMGDecorator);
|
||||
|
||||
@@ -282,6 +289,28 @@ public abstract class BaseGameViewModel implements SudFSMMGListener {
|
||||
public void onGameLog(String str) {
|
||||
SudFSMMGListener.super.onGameLog(str);
|
||||
Log.e("onGameStarted", "游戏日志:" + str);
|
||||
if (!StringUtil.isEmpty()) {
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(str);
|
||||
if ("error".equals(json.getString("level"))) {
|
||||
String msg = json.getString("msg");
|
||||
JSONObject error = JSONObject.parseObject(msg);
|
||||
if (error.containsKey("msg")) {
|
||||
int resultCode = error.getInteger("resultCode");
|
||||
switch (resultCode) {
|
||||
case 100503:
|
||||
ToastUtil.show(WordUtil.isNewZh()?"有玩家未点击准备":":There are players who haven't clicked \"Ready\" yet.");
|
||||
break;
|
||||
case 100504:
|
||||
ToastUtil.show(WordUtil.isNewZh()?"小于游戏最小开始人数":"The number of players is less than the minimum required to start the game.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,7 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
/**
|
||||
* 游戏的语言代码
|
||||
*/
|
||||
public String languageCode = "zh-CN";
|
||||
public String languageCode = "zh-TW";
|
||||
|
||||
public final MutableLiveData<View> gameViewLiveData = new MutableLiveData<>(); // 游戏View回调
|
||||
|
||||
@@ -69,7 +69,7 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
@Override
|
||||
protected void getCode(Activity activity, String userId, String appId, GameGetCodeListener listener) {
|
||||
if (IMLoginManager.get(activity).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
languageCode = "zh-CN";
|
||||
languageCode = "zh-TW";
|
||||
}else {
|
||||
languageCode = "en-US";
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
*/
|
||||
public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
|
||||
private static final String TAG = "游戏回调";
|
||||
private long gameId;
|
||||
private String gameRoomId;
|
||||
private String userId;
|
||||
// 回调
|
||||
private SudFSMMGListener sudFSMMGListener;
|
||||
|
||||
@@ -227,10 +231,10 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
}
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_GAME_STATE: // 10. 游戏状态
|
||||
Log.e("onGameStateChange", "mg_common_game_state:::::" + "dataJson:::::"+dataJson);
|
||||
Log.e("onGameStateChange", "mg_common_game_state:::::" + "dataJson:::::" + dataJson);
|
||||
SudMGPMGState.MGCommonGameState mgCommonGameState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameState.class);
|
||||
sudFSMMGCache.onGameMGCommonGameState(mgCommonGameState);
|
||||
if (mgCommonGameState.gameState==2){
|
||||
if (mgCommonGameState.gameState == 2) {
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_STATE));
|
||||
}
|
||||
if (listener == null) {
|
||||
@@ -354,6 +358,14 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_GAME_CREATE_ORDER: // 25. 创建订单
|
||||
SudMGPMGState.MGCommonGameCreateOrder mgCommonGameCreateOrder = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameCreateOrder.class);
|
||||
if (mgCommonGameCreateOrder != null) {
|
||||
mgCommonGameCreateOrder.gameId = gameId;
|
||||
mgCommonGameCreateOrder.gameRoomId = gameRoomId;
|
||||
mgCommonGameCreateOrder.userId = userId;
|
||||
mgCommonGameCreateOrder.dataJson = dataJson;
|
||||
}
|
||||
|
||||
Log.i(TAG, "onGameStateChange: " + dataJson);
|
||||
if (listener == null) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
} else {
|
||||
@@ -1021,4 +1033,15 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
return sudFSMMGCache;
|
||||
}
|
||||
|
||||
public void setGameId(long gameId) {
|
||||
this.gameId = gameId;
|
||||
}
|
||||
|
||||
public void setRoomId(String gameRoomId) {
|
||||
this.gameRoomId = gameRoomId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package com.yunbao.common.sud.decorator;
|
||||
|
||||
import com.yunbao.common.sud.decorator.game.JumpEvent;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.ISudFSMStateHandleUtils;
|
||||
|
||||
@@ -271,7 +272,13 @@ public interface SudFSMMGListener {
|
||||
* mg_common_game_create_order
|
||||
*/
|
||||
default void onGameMGCommonGameCreateOrder(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameCreateOrder model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
if ("addHeart".equals(model.cmd)) {
|
||||
JumpEvent.addHeart(model);
|
||||
} else if ("hit".equals(model.cmd)) {
|
||||
JumpEvent.hit(model);
|
||||
} else {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.yunbao.common.sud.decorator.game;
|
||||
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.event.SubGameEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
public class JumpEvent {
|
||||
private static long clickTimer = 0;
|
||||
|
||||
public static void addHeart(SudMGPMGState.MGCommonGameCreateOrder order) {
|
||||
createOrder(order);
|
||||
}
|
||||
|
||||
public static void hit(SudMGPMGState.MGCommonGameCreateOrder order) {
|
||||
createOrder(order);
|
||||
}
|
||||
|
||||
private synchronized static void createOrder(SudMGPMGState.MGCommonGameCreateOrder order) {
|
||||
if (System.currentTimeMillis() - clickTimer < 500) {
|
||||
//TODO 防止重复点击
|
||||
HttpCallbackModel _data=new HttpCallbackModel(1001,"");
|
||||
Bus.get().post(new SubGameEvent(0, _data,order.dataJson));
|
||||
return;
|
||||
}
|
||||
clickTimer = System.currentTimeMillis();
|
||||
LiveNetManager.get(AppManager.getInstance().getLastActivity())
|
||||
.createGameOrder(order.gameRoomId,
|
||||
order.cmd,
|
||||
order.value + "",
|
||||
order.gameId + "",
|
||||
order.fromUid,
|
||||
order.toUid,
|
||||
order.gameRoomId,
|
||||
order.payload,
|
||||
new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() != 0) {
|
||||
ToastUtil.show(data.getMsg());
|
||||
Bus.get().post(new SubGameEvent(0, data,order.dataJson));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -496,6 +496,11 @@ public class SudMGPMGState implements Serializable {
|
||||
public String toUid; // 目标用户uid
|
||||
public long value; // 所属的游戏价值
|
||||
public String payload; // 扩展数据 json 字符串, 特殊可选
|
||||
|
||||
public long gameId;
|
||||
public String gameRoomId;
|
||||
public String userId;
|
||||
public String dataJson;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
105
common/src/main/java/com/yunbao/common/upload/UploadBean.java
Normal file
105
common/src/main/java/com/yunbao/common/upload/UploadBean.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package com.yunbao.common.upload;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/16.
|
||||
*/
|
||||
|
||||
public class UploadBean {
|
||||
|
||||
public static final int IMG = 0;
|
||||
public static final int VIDEO = 1;
|
||||
public static final int VOICE = 2;
|
||||
private File mOriginFile;//要被上传的源文件
|
||||
private File mCompressFile;//压缩后的图片文件
|
||||
private String mRemoteFileName;//上传成功后在云存储上的文件名字
|
||||
private String mRemoteAccessUrl;//上传成功后在云存储上的访问地址
|
||||
private boolean mSuccess;//是否上传成功了
|
||||
private int mType;
|
||||
private Object mTag;
|
||||
|
||||
public UploadBean() {
|
||||
}
|
||||
|
||||
public UploadBean(File originFile, int type) {
|
||||
mOriginFile = originFile;
|
||||
mType = type;
|
||||
}
|
||||
|
||||
public File getOriginFile() {
|
||||
return mOriginFile;
|
||||
}
|
||||
|
||||
public void setOriginFile(File originFile) {
|
||||
mOriginFile = originFile;
|
||||
}
|
||||
|
||||
public String getRemoteFileName() {
|
||||
return mRemoteFileName;
|
||||
}
|
||||
|
||||
public void setRemoteFileName(String remoteFileName) {
|
||||
mRemoteFileName = remoteFileName;
|
||||
}
|
||||
|
||||
public String getRemoteAccessUrl() {
|
||||
return mRemoteAccessUrl;
|
||||
}
|
||||
|
||||
public void setRemoteAccessUrl(String remoteAccessUrl) {
|
||||
mRemoteAccessUrl = remoteAccessUrl;
|
||||
}
|
||||
|
||||
public File getCompressFile() {
|
||||
return mCompressFile;
|
||||
}
|
||||
|
||||
public void setCompressFile(File compressFile) {
|
||||
mCompressFile = compressFile;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return mSuccess;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
mSuccess = success;
|
||||
}
|
||||
|
||||
|
||||
public void setEmpty() {
|
||||
mOriginFile = null;
|
||||
mRemoteFileName = null;
|
||||
mRemoteAccessUrl = null;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return mOriginFile == null && mRemoteFileName == null && mRemoteAccessUrl == null;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return mType;
|
||||
}
|
||||
|
||||
public Object getTag() {
|
||||
return mTag;
|
||||
}
|
||||
|
||||
public void setTag(Object tag) {
|
||||
mTag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UploadBean{" +
|
||||
"mOriginFile=" + mOriginFile +
|
||||
", mCompressFile=" + mCompressFile +
|
||||
", mRemoteFileName='" + mRemoteFileName + '\'' +
|
||||
", mRemoteAccessUrl='" + mRemoteAccessUrl + '\'' +
|
||||
", mSuccess=" + mSuccess +
|
||||
", mType=" + mType +
|
||||
", mTag=" + mTag +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.yunbao.common.upload;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/16.
|
||||
*/
|
||||
|
||||
public interface UploadCallback {
|
||||
void onFinish(List<UploadBean> list, boolean success);
|
||||
}
|
||||
224
common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java
Normal file
224
common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java
Normal file
@@ -0,0 +1,224 @@
|
||||
package com.yunbao.common.upload;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.qiniu.android.common.ServiceAddress;
|
||||
import com.qiniu.android.common.Zone;
|
||||
import com.qiniu.android.http.ResponseInfo;
|
||||
import com.qiniu.android.storage.Configuration;
|
||||
import com.qiniu.android.storage.UpCompletionHandler;
|
||||
import com.qiniu.android.storage.UploadManager;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import top.zibin.luban.Luban;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/16.
|
||||
* 七牛上传文件
|
||||
*/
|
||||
|
||||
public class UploadQnImpl implements UploadStrategy {
|
||||
|
||||
private static final String TAG = "UploadQnImpl";
|
||||
private Context mContext;
|
||||
private List<UploadBean> mList;
|
||||
private int mIndex;
|
||||
private boolean mNeedCompress;
|
||||
private UploadCallback mUploadCallback;
|
||||
private HttpCallback mGetUploadTokenCallback;
|
||||
private String mToken;
|
||||
private UploadManager mUploadManager;
|
||||
private UpCompletionHandler mCompletionHandler;//上传回调
|
||||
private Luban.Builder mLubanBuilder;
|
||||
|
||||
public UploadQnImpl(Context context) {
|
||||
mContext = context;
|
||||
mCompletionHandler = new UpCompletionHandler() {
|
||||
@Override
|
||||
public void complete(String key, ResponseInfo info, JSONObject response) {
|
||||
System.out.println("UploadQnImpl 上传-----ok----> " + info.isOK() + "--key---> " + "---response---> " + (response != null ? response.toString() : null));
|
||||
//L.e("UploadQnImpl 上传-----ok----> " + info.isOK() + "--key---> " + "---response---> " + (response != null ? response.toString() : null));
|
||||
try {
|
||||
assert response != null;
|
||||
mList.get(mIndex).setRemoteAccessUrl(response.getString("key"));
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (mList == null || mList.size() == 0) {
|
||||
if (mUploadCallback != null) {
|
||||
mUploadCallback.onFinish(mList, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
UploadBean uploadBean = mList.get(mIndex);
|
||||
if (info.isOK()) {
|
||||
uploadBean.setSuccess(true);
|
||||
if (uploadBean.getType() == UploadBean.IMG && mNeedCompress) {
|
||||
//上传完成后把 压缩后的图片 删掉
|
||||
File compressedFile = uploadBean.getCompressFile();
|
||||
if (compressedFile != null && compressedFile.exists()) {
|
||||
File originFile = uploadBean.getOriginFile();
|
||||
if (originFile != null && !compressedFile.getAbsolutePath().equals(originFile.getAbsolutePath())) {
|
||||
compressedFile.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
mIndex++;
|
||||
if (mIndex < mList.size()) {
|
||||
uploadNext();
|
||||
} else {
|
||||
if (mUploadCallback != null) {
|
||||
mUploadCallback.onFinish(mList, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
upload(mList.get(mIndex));//上传失败后 重新上传
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upload(List<UploadBean> list, boolean needCompress, UploadCallback callback, boolean isImg) {
|
||||
System.err.println("-------upload------>" + list.size());
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
if (list == null || list.size() == 0) {
|
||||
callback.onFinish(list, false);
|
||||
return;
|
||||
}
|
||||
boolean hasFile = false;
|
||||
for (UploadBean bean : list) {
|
||||
if (bean.getOriginFile() != null) {
|
||||
hasFile = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasFile) {
|
||||
callback.onFinish(list, true);
|
||||
return;
|
||||
}
|
||||
mList = list;
|
||||
mNeedCompress = needCompress;
|
||||
mUploadCallback = callback;
|
||||
mIndex = 0;
|
||||
|
||||
if (mGetUploadTokenCallback == null) {
|
||||
mGetUploadTokenCallback = new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
mToken = info[0];
|
||||
System.err.println("-------上传的token------>" + mToken);
|
||||
L.e(TAG, "-------上传的token------>" + mToken);
|
||||
uploadNext();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
CommonHttpUtil.getUploadQiNiuToken(mGetUploadTokenCallback, isImg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelUpload() {
|
||||
CommonHttpUtil.cancel(CommonHttpUtil.GET_UPLOAD_QI_NIU_TOKEN);
|
||||
if (mList != null) {
|
||||
mList.clear();
|
||||
}
|
||||
mUploadCallback = null;
|
||||
}
|
||||
|
||||
private void uploadNext() {
|
||||
UploadBean bean = null;
|
||||
while (mIndex < mList.size() && (bean = mList.get(mIndex)).getOriginFile() == null) {
|
||||
mIndex++;
|
||||
}
|
||||
System.err.println("-------mIndex >= mList.size() mIndex------>" + mIndex);
|
||||
if (mIndex >= mList.size()) {
|
||||
System.err.println("-------mIndex >= mList.size()------>" + mList.size());
|
||||
if (mUploadCallback != null) {
|
||||
mUploadCallback.onFinish(mList, true);
|
||||
}
|
||||
System.err.println("-------mIndex >= mList.returnreturnreturnreturn------>" + mList.size());
|
||||
return;
|
||||
}
|
||||
if (bean.getType() == UploadBean.IMG) {
|
||||
bean.setRemoteFileName(StringUtil.contact(StringUtil.generateFileName(), ".jpg"));
|
||||
} else if (bean.getType() == UploadBean.VIDEO) {
|
||||
bean.setRemoteFileName(StringUtil.contact(StringUtil.generateFileName(), ".mp4"));
|
||||
} else if (bean.getType() == UploadBean.VOICE) {
|
||||
bean.setRemoteFileName(StringUtil.contact(StringUtil.generateFileName(), ".m4a"));
|
||||
}
|
||||
System.err.println("-------mIndex >= bean.getType() == UploadBean.IMG------>" + bean);
|
||||
upload(bean);
|
||||
/*if (bean.getType() == UploadBean.IMG && mNeedCompress) {
|
||||
System.err.println("-------UploadBean.IMG && mNeedCompress------>" + bean + "UploadBean.IMG:" + UploadBean.IMG + "__mNeedCompress" + mNeedCompress);
|
||||
if (mLubanBuilder == null) {
|
||||
mLubanBuilder = Luban.with(mContext).ignoreBy(8)//8k以下不压缩
|
||||
.setTargetDir(CommonAppConfig.INNER_PATH).setRenameListener(new OnRenameListener() {
|
||||
@Override
|
||||
public String rename(String filePath) {
|
||||
return mList.get(mIndex).getRemoteFileName();
|
||||
}
|
||||
}).setCompressListener(new OnCompressListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
UploadBean uploadBean = mList.get(mIndex);
|
||||
uploadBean.setCompressFile(file);
|
||||
upload(uploadBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
upload(mList.get(mIndex));
|
||||
}
|
||||
});
|
||||
}
|
||||
mLubanBuilder.load(bean.getOriginFile()).launch();
|
||||
} else {
|
||||
System.err.println("-------bean.getType() == UploadBean.IMG && mNeedCompress else");
|
||||
upload(bean);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void upload(UploadBean bean) {
|
||||
System.err.println("-------upload(UploadBean bean)------>" + bean);
|
||||
if (bean != null && !TextUtils.isEmpty(mToken) && mCompletionHandler != null) {
|
||||
System.err.println("bean != null && !TextUtils.isEmpty(mToken) && mCompletionHandler != null");
|
||||
if (mUploadManager == null) {
|
||||
Zone zone = new Zone(new ServiceAddress("http://upload-z0.qiniup.com"), new ServiceAddress("http://up-z0.qiniup.com"));
|
||||
Configuration configuration = new Configuration.Builder().zone(zone).build();
|
||||
mUploadManager = new UploadManager(configuration);
|
||||
}
|
||||
File uploadFile = bean.getOriginFile();
|
||||
if (bean.getType() == UploadBean.IMG && mNeedCompress) {
|
||||
File compressedFile = bean.getCompressFile();
|
||||
if (compressedFile != null && compressedFile.exists()) {
|
||||
uploadFile = compressedFile;
|
||||
}
|
||||
}
|
||||
mUploadManager.put(uploadFile, bean.getRemoteFileName(), mToken, mCompletionHandler, null);
|
||||
} else {
|
||||
System.err.println("else bean != null && !TextUtils.isEmpty(mToken) && mCompletionHandler != null");
|
||||
if (mUploadCallback != null) {
|
||||
mUploadCallback.onFinish(mList, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yunbao.common.upload;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/16.
|
||||
*/
|
||||
|
||||
public interface UploadStrategy {
|
||||
|
||||
/**
|
||||
* 执行上传
|
||||
*
|
||||
* @param list 被上传的文件列表
|
||||
* @param needCompress 是否需要压缩
|
||||
* @param callback 上传回调
|
||||
*/
|
||||
void upload(List<UploadBean> list, boolean needCompress, UploadCallback callback,boolean isImg);
|
||||
|
||||
/**
|
||||
* 取消上传
|
||||
*/
|
||||
void cancelUpload();
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.yunbao.common.BuildConfig;
|
||||
import com.yunbao.common.manager.OpenAdManager;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
@@ -11,6 +13,7 @@ public class AppManager {
|
||||
private static Stack<Activity> activityStack;
|
||||
|
||||
public AppManager() {
|
||||
activityStack = new Stack<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,6 +23,55 @@ public class AppManager {
|
||||
return SingleApp.INSTANCE;
|
||||
}
|
||||
|
||||
public static Activity getActivity(String activityName) {
|
||||
for (Activity activity : activityStack) {
|
||||
if (activity.getClass().getSimpleName().contains(activityName)) {
|
||||
return activity;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Activity getMainActivity() {
|
||||
for (Activity activity : activityStack) {
|
||||
if (activity.getClass().getSimpleName().contains("MainActivity")) {
|
||||
return activity;
|
||||
}
|
||||
}
|
||||
return getLastActivity();
|
||||
}
|
||||
|
||||
public Activity getLiveActivity() {
|
||||
for (Activity activity : activityStack) {
|
||||
if (activity.getClass().getSimpleName().contains("LiveActivity")) {
|
||||
return activity;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
activityStack.clear();
|
||||
OpenAdManager.getInstance().clear();
|
||||
}
|
||||
|
||||
public boolean isMainActivity() {
|
||||
Activity lastActivity = getLastActivity();
|
||||
if (lastActivity == null) {
|
||||
return false;
|
||||
}
|
||||
return lastActivity.getClass().getSimpleName().contains("MainActivity");
|
||||
}
|
||||
|
||||
//TODO 首页类型没展示完进直播间会不展示直播间的。
|
||||
public boolean isLiveActivity() {
|
||||
Activity lastActivity = getLastActivity();
|
||||
if (lastActivity == null) {
|
||||
return false;
|
||||
}
|
||||
return lastActivity.getClass().getSimpleName().contains("LiveAudienceActivity");
|
||||
}
|
||||
|
||||
public static class SingleApp {
|
||||
public static AppManager INSTANCE = new AppManager();
|
||||
}
|
||||
@@ -31,6 +83,10 @@ public class AppManager {
|
||||
if (activityStack == null) {
|
||||
activityStack = new Stack<Activity>();
|
||||
}
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>class com.yunbao.main.activity.MsgAddressBookActivity
|
||||
if (getActivity(activity.getClass()) != null) {
|
||||
activityStack.remove(getActivity(activity.getClass()));
|
||||
}
|
||||
activityStack.add(activity);
|
||||
}
|
||||
|
||||
@@ -58,7 +114,14 @@ public class AppManager {
|
||||
* 获取当前显示Activity(堆栈中最后一个传入的activity)
|
||||
*/
|
||||
public Activity getLastActivity() {
|
||||
if (activityStack.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Activity activity = activityStack.lastElement();
|
||||
if (activity == null || activity.isFinishing()) {
|
||||
activityStack.remove(activity);
|
||||
return getLastActivity();
|
||||
}
|
||||
return activity;
|
||||
}
|
||||
|
||||
@@ -117,7 +180,7 @@ public class AppManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*仅在debug下运行的代码
|
||||
* 仅在debug下运行的代码
|
||||
*/
|
||||
public static void runDebugCode(Runnable runnable) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
|
||||
@@ -358,6 +358,8 @@ public class DialogUitl {
|
||||
private boolean mCancelable;
|
||||
private boolean mBackgroundDimEnabled;//显示区域以外是否使用黑色半透明背景
|
||||
private boolean mInput;//是否是输入框的
|
||||
private boolean isShowCancelButton=true;
|
||||
private boolean isSHowConfirmButton=true;
|
||||
private String mHint;
|
||||
private int mInputType;
|
||||
private int mLength;
|
||||
@@ -454,6 +456,16 @@ public class DialogUitl {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setShowCancelButton(boolean showCancelButton) {
|
||||
isShowCancelButton = showCancelButton;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setShowConfirmButton(boolean showConfirmButton) {
|
||||
isSHowConfirmButton = showConfirmButton;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Dialog build() {
|
||||
final Dialog dialog = new Dialog(mContext, mBackgroundDimEnabled ? R.style.dialog : R.style.dialog2);
|
||||
if (mView != 0) {
|
||||
@@ -493,10 +505,22 @@ public class DialogUitl {
|
||||
TextView btnConfirm = (TextView) dialog.findViewById(R.id.btn_confirm);
|
||||
if (!TextUtils.isEmpty(mConfirmString)) {
|
||||
btnConfirm.setText(mConfirmString);
|
||||
btnConfirm.setVisibility(View.VISIBLE);
|
||||
}else if(mConfirmString==null){
|
||||
// btnConfirm.setVisibility(View.GONE);
|
||||
}
|
||||
TextView btnCancel = (TextView) dialog.findViewById(R.id.btn_cancel);
|
||||
if (!TextUtils.isEmpty(mCancelString)) {
|
||||
btnCancel.setText(mCancelString);
|
||||
btnCancel.setVisibility(View.VISIBLE);
|
||||
}else if(mCancelString==null){
|
||||
//btnCancel.setVisibility(View.GONE);
|
||||
}
|
||||
if(!isSHowConfirmButton){
|
||||
btnConfirm.setVisibility(View.GONE);
|
||||
}
|
||||
if(!isShowCancelButton){
|
||||
btnCancel.setVisibility(View.GONE);
|
||||
}
|
||||
View.OnClickListener listener = new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -285,7 +285,7 @@ public class JavascriptInterfaceUtils {
|
||||
liveBean.setGiftId(giftId);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
|
||||
|
||||
if (!"".endsWith(Constants.mStream)) {
|
||||
|
||||
@@ -295,7 +295,7 @@ public class JavascriptInterfaceUtils {
|
||||
}
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
|
||||
} else {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
|
||||
}
|
||||
androidGoBack();
|
||||
}
|
||||
|
||||
@@ -12,10 +12,18 @@ public class L {
|
||||
|
||||
private final static String TAG = "log--->";
|
||||
|
||||
private final static String TAG_SW = "log--->TAG_SW";
|
||||
|
||||
public static void e(String s) {
|
||||
e(TAG, s);
|
||||
}
|
||||
|
||||
public static void eSw(String s) {
|
||||
if (sDeBug) {
|
||||
Log.e(TAG_SW, s);
|
||||
}
|
||||
}
|
||||
|
||||
public static void e(String tag, String s) {
|
||||
if (sDeBug) {
|
||||
Log.e(tag, s);
|
||||
|
||||
@@ -33,6 +33,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
private LiveBean mLiveBean;
|
||||
private ActionListener mActionListener;
|
||||
private int mLiveSdk;
|
||||
private boolean isSw;
|
||||
//搜索页面不提示密码
|
||||
public static boolean isRoom = false;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
@Override
|
||||
public void forwardNormalRoom(CheckLiveModel model) {
|
||||
if (actionListener != null) {
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk(),model.getIsShengwang().equals("1"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +75,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
if (model.getTypeMsg().equalsIgnoreCase(password)) {
|
||||
dialog.dismiss();
|
||||
if (actionListener != null) {
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk(),model.getIsShengwang().equals("1"));
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(mContext.getString(R.string.live_password_error));
|
||||
@@ -93,7 +94,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (actionListener != null) {
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk(),model.getIsShengwang().equals("1"));
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
@@ -139,6 +140,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
mLiveTypeMsg = obj.getString("type_msg");
|
||||
if (CommonAppConfig.LIVE_SDK_CHANGED) {
|
||||
mLiveSdk = obj.getIntValue("live_sdk");
|
||||
isSw= obj.getString("is_shengwang").equals("1");
|
||||
} else {
|
||||
mLiveSdk = CommonAppConfig.LIVE_SDK_USED;
|
||||
}
|
||||
@@ -263,17 +265,16 @@ public class LiveRoomCheckLivePresenter {
|
||||
*/
|
||||
private void enterLiveRoom() {
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onLiveRoomChanged(mLiveBean, mLiveType, mLiveTypeVal, mLiveSdk);
|
||||
mActionListener.onLiveRoomChanged(mLiveBean, mLiveType, mLiveTypeVal, mLiveSdk,isSw);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface ActionListener {
|
||||
void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk);
|
||||
void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk,boolean isSw);
|
||||
}
|
||||
|
||||
public interface NewActionListener {
|
||||
void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk);
|
||||
void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw);
|
||||
|
||||
void onCheckError(String contextError);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
public class MobclickAgent {
|
||||
public static void onEvent(Context content, String key, Object value){
|
||||
|
||||
}
|
||||
|
||||
public static void setCatchUncaughtExceptions(boolean b) {
|
||||
}
|
||||
public static void setPageCollectionMode(int type){
|
||||
|
||||
}
|
||||
|
||||
public static void onPageStart(String mTag) {
|
||||
|
||||
}
|
||||
|
||||
public static void onPageEnd(String mTag) {
|
||||
}
|
||||
|
||||
public static void onProfileSignOff() {
|
||||
|
||||
}
|
||||
|
||||
public static void onProfileSignIn(String s) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,12 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.yalantis.ucrop.UCrop;
|
||||
import com.yalantis.ucrop.util.FileUtils;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.interfaces.ActivityResultCallback;
|
||||
@@ -36,6 +38,11 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
private File mCorpResult;//裁剪后得到的图片
|
||||
private ImageResultCallback mResultCallback;
|
||||
private boolean mNeedCrop;//是否需要裁剪
|
||||
private boolean mNeedGif;//允许gif图
|
||||
|
||||
public void setNeedGif(boolean mNeedGif) {
|
||||
this.mNeedGif = mNeedGif;
|
||||
}
|
||||
|
||||
public ProcessImageUtil(FragmentActivity activity) {
|
||||
super(activity);
|
||||
@@ -93,17 +100,41 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
@Override
|
||||
public void onFailure() {
|
||||
ToastUtil.show(mContext.getString(R.string.img_camera_cancel));
|
||||
if (mResultCallback != null) {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
}
|
||||
};
|
||||
mAlumbResultCallback = new ActivityResultCallback() {
|
||||
@Override
|
||||
public void onSuccess(Intent intent) {
|
||||
if (!mNeedCrop) {
|
||||
if (mResultCallback != null) {
|
||||
if (intent.getData() == null) {
|
||||
if (mResultCallback != null) {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
return;
|
||||
}
|
||||
String path = FileUtils.getPath(mContext, intent.getData());
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
mResultCallback.onSuccess(file);
|
||||
} else {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
crop(intent.getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
ToastUtil.show(mContext.getString(R.string.img_alumb_cancel));
|
||||
if (mResultCallback != null) {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
}
|
||||
};
|
||||
mCropResultCallback = new ActivityResultCallback() {
|
||||
@@ -117,6 +148,9 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
@Override
|
||||
public void onFailure() {
|
||||
ToastUtil.show(mContext.getString(R.string.img_crop_cancel));
|
||||
if (mResultCallback != null) {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -143,6 +177,11 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
requestPermissions(mAlumbPermissions, mAlumbPermissionCallback);
|
||||
}
|
||||
|
||||
public void getImageByAlumb(boolean needCrop) {
|
||||
this.mNeedCrop = needCrop;
|
||||
requestPermissions(mAlumbPermissions, mAlumbPermissionCallback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开启摄像头,执行照相
|
||||
@@ -163,7 +202,9 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
}
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
|
||||
startActivityForResult(intent, mCameraResultCallback);
|
||||
}catch (Exception e){e.printStackTrace();}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private File getNewFile() {
|
||||
@@ -180,9 +221,14 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
* 打开相册,选择文件
|
||||
*/
|
||||
private void chooseFile() {
|
||||
String[] mimeTypes = {"image/png", "image/jpg", "image/jpeg"};
|
||||
Intent intent = new Intent();
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("image/*");
|
||||
intent.setType("*/*");
|
||||
if (mNeedGif) {
|
||||
mimeTypes = new String[]{"image/png", "image/jpg", "image/jpeg", "image/gif"};
|
||||
}
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
|
||||
if (Build.VERSION.SDK_INT < 19) {
|
||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
} else {
|
||||
|
||||
@@ -46,24 +46,42 @@ public class RouteUtil {
|
||||
public static final String PATH_RED_PACKET_LIST = "/main/RedPacketListActivity";
|
||||
public static final String PATH_RED_PACKET_INFO = "/main/RedPacketInfoActivity";
|
||||
public static final String PATH_RED_PACKET_USER = "/main/RedPacketUsersActivity";
|
||||
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
|
||||
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
|
||||
public static final String PATH_SELECT_AVATAR = "/main/UserAvatarSelectActivity";
|
||||
public static final String PATH_BattlePassActivity = "/main/BattlePassActivity";
|
||||
public static final String PATH_SudSwGameActivity = "/live/SudSwGameActivity";
|
||||
public static final String PATH_SudRyGameActivity = "/live/SudRyGameActivity";
|
||||
|
||||
public static final String PATH_COMMUNITY_Activity = "/main/MainHomeCommunityActivity";
|
||||
public static final String PATH_SudGameActivity="/live/SudGameActivity";
|
||||
public static final String PATH_COMMUNITY_Activity="/main/MainHomeCommunityActivity";
|
||||
public static final String PATH_FEEDBACK_SUCCESS_ACTIVITY = "/main/FeedbackSuccessActivity";
|
||||
public static final String PATH_FEEDBACK_ACTIVITY = "/main/FeedbackActivity";
|
||||
public static final String PATH_FEEDBACK_EDIT_ACTIVITY = "/main/FeedbackEditActivity";
|
||||
|
||||
|
||||
public static void forwardCommunityActivity() {
|
||||
ARouter.getInstance().build(PATH_COMMUNITY_Activity)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
public static void forwardFansActivity(String uid) {
|
||||
ARouter.getInstance().build(PATH_FANSACTIVITY)
|
||||
.withString(Constants.TO_UID, uid)
|
||||
.navigation();
|
||||
}
|
||||
public static void forwardSudGameActivity(String CreateSudRoom) {
|
||||
ARouter.getInstance().build(PATH_SudGameActivity)
|
||||
|
||||
public static void forwardSwSudGameActivity(String CreateSudRoom, boolean isAn, boolean isHome) {
|
||||
ARouter.getInstance().build(PATH_SudSwGameActivity)
|
||||
.withString("CreateSudRoom", CreateSudRoom)
|
||||
.withBoolean("CreateIsAn", isAn)
|
||||
.withBoolean("CreateIsHome", isHome)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
public static void forwardRySudGameActivity(String CreateSudRoom, boolean isAn, boolean isHome) {
|
||||
ARouter.getInstance().build(PATH_SudRyGameActivity)
|
||||
.withString("CreateSudRoom", CreateSudRoom)
|
||||
.withBoolean("CreateIsAn", isAn)
|
||||
.withBoolean("CreateIsHome", isHome)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
@@ -215,7 +233,7 @@ public class RouteUtil {
|
||||
* 跳转到充值页面
|
||||
*/
|
||||
public static void forwardMyCoin(Context context) {
|
||||
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=zhifu&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
||||
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=zhifu&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
||||
ARouter.getInstance().build(PATH_COIN).withString("url", url).navigation();
|
||||
}
|
||||
|
||||
@@ -247,7 +265,7 @@ public class RouteUtil {
|
||||
/**
|
||||
* 打开直播页面
|
||||
*/
|
||||
public static void forwardLiveAudienceActivity(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) {
|
||||
public static void forwardLiveAudienceActivity(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal, boolean isSw) {
|
||||
if (MicStatusManager.getInstance().isMic(mLiveBean.getUid())) {
|
||||
MicStatusManager.getInstance().showDownMicDialog(CommonAppContext.activityWeakReference.get());
|
||||
return;
|
||||
@@ -257,7 +275,9 @@ public class RouteUtil {
|
||||
.withParcelable(Constants.LIVE_BEAN, mLiveBean)
|
||||
.withInt(Constants.LIVE_TYPE, mLiveType)
|
||||
.withInt(Constants.LIVE_SDK, mLiveSDK)
|
||||
.withBoolean(Constants.LIVE_SDK_IS_SW, isSw)
|
||||
.withInt(Constants.LIVE_TYPE_VAL, mLiveTypeVal);
|
||||
|
||||
if (mLiveBean.getParams() != null) {
|
||||
for (String key : mLiveBean.getParams().keySet()) {
|
||||
postcard.withString(key, mLiveBean.getParams().get(key));
|
||||
@@ -266,14 +286,14 @@ public class RouteUtil {
|
||||
postcard.navigation();
|
||||
}
|
||||
|
||||
public static void forwardGiftWallActivity(String mStream, String mAnchorName, String mLiveUid, String mAvatarUrl, int isAttention,boolean isLive) {
|
||||
public static void forwardGiftWallActivity(String mStream, String mAnchorName, String mLiveUid, String mAvatarUrl, int isAttention, boolean isLive) {
|
||||
ARouter.getInstance().build(PATH_GIFT_WALL)
|
||||
.withString(Constants.LIVE_UID, mLiveUid)
|
||||
.withString(Constants.STREAM, mStream)
|
||||
.withString("mAnchorName", mAnchorName)
|
||||
.withString("mAvatarUrl", mAvatarUrl)
|
||||
.withInt("isAttention", isAttention)
|
||||
.withBoolean("isLive",isLive)
|
||||
.withBoolean("isLive", isLive)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
@@ -355,4 +375,8 @@ public class RouteUtil {
|
||||
ARouter.getInstance().build(PATH_BattlePassActivity)
|
||||
.navigation();
|
||||
}
|
||||
public static void forwardActivity(String path){
|
||||
ARouter.getInstance().build(path)
|
||||
.navigation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.io.File;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
@@ -160,4 +161,15 @@ public class StringUtil {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机文件名
|
||||
*/
|
||||
public static String generateFileName() {
|
||||
return contact("android_",
|
||||
CommonAppConfig.getInstance().getUid(),
|
||||
"_",
|
||||
DateFormatUtil.getVideoCurTimeString(),
|
||||
UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
12
common/src/main/java/com/yunbao/common/utils/ViewUtils.java
Normal file
12
common/src/main/java/com/yunbao/common/utils/ViewUtils.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public class ViewUtils {
|
||||
public static <T extends View> T findViewById(View view,int id,Class<T> clazz){
|
||||
return view.findViewById(id);
|
||||
}
|
||||
public static <T extends View> T findViewById(View view,int id){
|
||||
return view.findViewById(id);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.yunbao.common.views;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
@@ -44,6 +45,7 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
private ProgressBar progressBar;
|
||||
private Activity mContext;
|
||||
private boolean mInside;
|
||||
private DialogInterface.OnDismissListener onDismissListener;
|
||||
|
||||
public APKUpdateCustomPopup(@NonNull Activity context, boolean inside) {
|
||||
super(context);
|
||||
@@ -57,6 +59,11 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
return R.layout.apk_update_custom_popup;
|
||||
}
|
||||
|
||||
public APKUpdateCustomPopup setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
|
||||
this.onDismissListener = onDismissListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
@@ -69,6 +76,14 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
if (onDismissListener != null) {
|
||||
onDismissListener.onDismiss(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
if (!mInside) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 0 && APKManager.get().getAPKGoogleIsUp() == 1) {
|
||||
|
||||
@@ -65,6 +65,16 @@ public abstract class AbsViewHolder implements LifeCycleListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeView(){
|
||||
if (mParentView != null && mContentView != null) {
|
||||
mParentView.removeView(mContentView);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShow(){
|
||||
return mParentView.indexOfChild(mContentView)>-1;
|
||||
}
|
||||
|
||||
public void removeFromParent() {
|
||||
ViewParent parent = mContentView.getParent();
|
||||
if (parent != null) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.List;
|
||||
|
||||
public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
private Context mContext;
|
||||
private boolean mIs_shengwang;
|
||||
|
||||
private RecyclerView drawerList;
|
||||
private CustomDrawerPopupAdapter adapter;
|
||||
@@ -45,9 +46,10 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupView(@NonNull Context context) {
|
||||
public CustomDrawerPopupView(@NonNull Context context, boolean is_shengwang) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
mIs_shengwang = is_shengwang;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,7 +74,7 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
|
||||
private void initView() {
|
||||
drawerList = findViewById(R.id.drawerList);
|
||||
adapter = new CustomDrawerPopupAdapter(mContext);
|
||||
adapter = new CustomDrawerPopupAdapter(mContext,mIs_shengwang);
|
||||
adapter.setList(list).setLiveId(liveId);
|
||||
drawerList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
drawerList.setAdapter(adapter);
|
||||
|
||||
@@ -9,7 +9,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.FunGamesAdapter;
|
||||
|
||||
@@ -9,7 +9,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.InteractionGamesAdapter;
|
||||
import com.yunbao.common.adapter.LiveNewRoleInteractionGamesAdapter;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yunbao.common.views;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
@@ -9,6 +10,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
@@ -17,16 +19,19 @@ import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.dialog.DebugDialog;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.event.HideShowEvent;
|
||||
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
|
||||
import com.yunbao.common.event.ShowHideEvent;
|
||||
import com.yunbao.common.event.SubGameEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.sud.QuickStartGameViewModel;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.sud.state.SudMGPAPPState;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@@ -229,7 +234,7 @@ public class LiveSudGamePopup extends BottomPopupView {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("貨幣数量不足 ");
|
||||
} else {
|
||||
ToastUtil.show("Shortage of money");
|
||||
ToastUtil.show("Insufficient number of currency");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -240,7 +245,7 @@ public class LiveSudGamePopup extends BottomPopupView {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("貨幣数量不足 ");
|
||||
} else {
|
||||
ToastUtil.show("Shortage of money");
|
||||
ToastUtil.show("Insufficient number of currency");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -276,4 +281,16 @@ public class LiveSudGamePopup extends BottomPopupView {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameStatus(SubGameEvent event) {
|
||||
if (event.getType() == 0) {
|
||||
Log.i("游戏回调", "onGameStateChange: event :" + event.toString());
|
||||
if (event.getModel().getCode() == 1001 || event.getModel().getCode() == 1002) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("result", 0);
|
||||
gameViewModel.sudFSTAPPDecorator.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_CREATE_ORDER_RESULT, jsonObject.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
@@ -106,8 +107,11 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
createSudRoomModel.setSudGameName(model.getSudGameName());
|
||||
if (isHome) {
|
||||
if (TextUtils.equals(model.getLiveUid(), "0")) {
|
||||
RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel));
|
||||
|
||||
if(CommonAppConfig.getInstance().getConfig().isSw()){
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome);
|
||||
}else{
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome);
|
||||
}
|
||||
} else {
|
||||
String yes = "是";
|
||||
if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
@@ -131,8 +135,8 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -155,8 +159,11 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
RouteUtil.forwardSudGameActivity(new Gson().toJson(createSudRoomModel));
|
||||
if(CommonAppConfig.getInstance().getConfig().isSw()){
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome);
|
||||
}else{
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
|
||||
|
||||
5
common/src/main/res/drawable/live_room_menu_red.xml
Normal file
5
common/src/main/res/drawable/live_room_menu_red.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="320dp" />
|
||||
<solid android:color="#FD2D48" />
|
||||
</shape>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rootView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -15,6 +16,7 @@
|
||||
android:id="@+id/ft_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
|
||||
android:paddingTop="24dp"
|
||||
android:background="@color/white">
|
||||
|
||||
@@ -67,6 +69,5 @@
|
||||
<WebView
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
@@ -182,10 +182,34 @@
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
<RelativeLayout
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/icon_zhenggu" />
|
||||
android:layout_height="40dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/icon_zhenggu" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/red_menu"
|
||||
android:layout_width="6dp"
|
||||
android:layout_height="6dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@drawable/live_room_menu_red"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:minWidth="14dp"
|
||||
android:paddingLeft="3dp"
|
||||
android:paddingRight="3dp"
|
||||
android:textColor="#fff"
|
||||
android:textSize="10sp"
|
||||
android:translationY="-4dp"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -5,16 +5,19 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img"
|
||||
<LinearLayout
|
||||
android:id="@+id/content_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:adjustViewBounds="true"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:srcCompat="@mipmap/background_gift_wall" />
|
||||
app:srcCompat="@mipmap/background_gift_wall">
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close"
|
||||
@@ -22,7 +25,7 @@
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/img"
|
||||
app:layout_constraintBottom_toTopOf="@+id/content_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:srcCompat="@mipmap/ic_open_ad_close" />
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user