Compare commits
191 Commits
dev_6.6.6_
...
dev_sudgam
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2eea1f1b75 | ||
| 3f1fe93f3d | |||
|
|
8c9cf4e3a8 | ||
| 0451f518d5 | |||
| a154f480f6 | |||
|
|
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 | ||
|
|
11ba2c45f8 | ||
|
|
320584769d | ||
|
|
5922f4c08b | ||
|
|
b29b0a1688 | ||
|
|
f88356cea2 | ||
|
|
2a67cf7228 | ||
|
|
a100ab1a4a | ||
|
|
69b45f1d21 | ||
|
|
479a743d29 | ||
|
|
382c53ab1f | ||
|
|
1c22f5fd48 | ||
|
|
09bef7afa6 | ||
|
|
88b96267ef | ||
|
|
7c006e8e03 | ||
|
|
f35b547c0d | ||
|
|
490c558e03 | ||
|
|
bbf5d159b4 | ||
|
|
e982994ecd | ||
|
|
a0294a8405 | ||
|
|
756cbb1ce1 | ||
| 9e5427bd35 | |||
|
|
f626ab03d4 | ||
|
|
0d7bdce4f0 | ||
|
|
cd3feebb94 | ||
|
|
3cca1a9e54 | ||
|
|
0b7b959151 | ||
| 1f1ac71bb0 | |||
|
|
ce7b6decc1 | ||
|
|
4a4a52aa61 | ||
|
|
123b9dd74a | ||
|
|
285515345b | ||
|
|
f24744afe8 | ||
|
|
1e466ac13d | ||
|
|
a61bc8fbb8 | ||
| 9db23a32d1 | |||
| f7845dde6f | |||
|
|
1023c0ab4d |
@@ -1,8 +1,8 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'img-optimizer'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
apply from: "../package_config.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
@@ -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,4 +1,6 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply from: "../package_config.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
@@ -21,4 +23,5 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// api 'com.google.code.gson:gson:2.8.8'
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'img-optimizer'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
apply from: "../package_config.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
154
app/build.gradle
154
app/build.gradle
@@ -3,36 +3,12 @@ apply plugin: 'img-optimizer'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
apply from: "../package_config.gradle"
|
||||
|
||||
android {
|
||||
dexOptions {
|
||||
jumboMode = true
|
||||
}
|
||||
project.tasks.getByName("tasks").doFirst {
|
||||
|
||||
}
|
||||
/* applicationVariants.all { variant ->
|
||||
variant.mergeAssetsProvider.configure {
|
||||
doLast {
|
||||
delete(fileTree(dir: outputDir, includes: [
|
||||
'model/ai_bgseg_green.bundle',
|
||||
'model/ai_face_processor.bundle',
|
||||
'model/ai_face_processor_lite.bundle',
|
||||
'model/ai_hairseg.bundle',
|
||||
'model/ai_hand_processor.bundle',
|
||||
'model/ai_human_processor.bundle',
|
||||
'model/ai_human_processor_gpu.bundle',
|
||||
'model/ai_human_processor_mb_fast.bundle',
|
||||
'graphics/body_slim.bundle',
|
||||
'graphics/controller_cpp.bundle',
|
||||
'graphics/face_beautification.bundle',
|
||||
'graphics/face_makeup.bundle',
|
||||
'graphics/fuzzytoonfilter.bundle',
|
||||
'graphics/fxaa.bundle',
|
||||
'graphics/tongue.bundle'
|
||||
]))
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
@@ -108,30 +84,48 @@ android {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
println "清空build文件夹";
|
||||
for (final def project in rootProject.getAllprojects()) {
|
||||
delete project.buildDir
|
||||
println project.buildDir
|
||||
}
|
||||
/* for (final def project in rootProject.getAllprojects()) {
|
||||
def name = variant.name.replace('Debug', '').replace('Release', '').toLowerCase()
|
||||
delete project.buildDir
|
||||
delete project.rootDir.absolutePath+File.separator+"app"+File.separator+name
|
||||
println project.buildDir
|
||||
}*/
|
||||
//delete project.rootDir.absolutePath + File.separator + "outputs"
|
||||
String variantName = variant.name.capitalize()
|
||||
def processManifestTask = project.tasks.getByName("process${variantName}Manifest")
|
||||
processManifestTask.doLast { pm ->
|
||||
String manifestPath = "build/intermediates/bundle_manifest/release/bundle-manifest/AndroidManifest.xml"
|
||||
def isGooglePlay = rootProject.ext.manifestPlaceholders.isGooglePlay
|
||||
String manifestPath = "build/intermediates/bundle_manifest/google_onlineRelease/bundle-manifest/AndroidManifest.xml"
|
||||
def isGooglePlay = variant.name.contains("google")
|
||||
println "谷歌版本:" + isGooglePlay
|
||||
println "文件存在" + file(manifestPath).exists()
|
||||
println "" + (isGooglePlay != 0)
|
||||
println "" + (file(manifestPath).exists() && isGooglePlay)
|
||||
if (file(manifestPath).exists() && isGooglePlay) {
|
||||
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/google_onlineRelease/processReleaseManifest/AndroidManifest.xml"
|
||||
if (file(manifestPath).exists() && isGooglePlay) {
|
||||
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,33 +152,64 @@ 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
variant.outputs.all {
|
||||
def isGoogle = "链接"
|
||||
if (rootProject.ext.manifestPlaceholders.isGooglePlay == 1) {
|
||||
isGoogle = "谷歌"
|
||||
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) {
|
||||
isGoogle = "Huawei"
|
||||
}else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) {
|
||||
isGoogle = "Samsung"
|
||||
variant.assemble.doLast { vt ->
|
||||
def channel = ''
|
||||
def server = ''
|
||||
if (variant.name.contains('huawei')) {
|
||||
channel = "华为"
|
||||
} else if (variant.name.contains('samsung')) {
|
||||
channel = "三星"
|
||||
} else if (variant.name.contains('google')) {
|
||||
channel = "谷歌"
|
||||
} else {
|
||||
channel = "链接"
|
||||
}
|
||||
def isPlugin = "完整"
|
||||
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
||||
isPlugin = "插件"
|
||||
if (variant.name.contains('online')) {
|
||||
server = '正式服'
|
||||
} else {
|
||||
server = '测试服'
|
||||
}
|
||||
def isTest = "测试服"
|
||||
if (rootProject.ext.manifestPlaceholders.serverHost == "https://napi.yaoulive.com") {
|
||||
isTest = "正式服"
|
||||
def fileName = "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${defaultConfig.versionCode}-${channel}-${server}-${variant.buildType.name}.apk"
|
||||
variant.outputs.forEach { fe ->
|
||||
copy {
|
||||
from fe.outputFile
|
||||
into file("${project.rootDir}\\outputs\\apk\\")
|
||||
rename { fn ->
|
||||
fileName
|
||||
}
|
||||
}
|
||||
}
|
||||
outputFileName = "[${new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk"
|
||||
|
||||
}
|
||||
tasks.named("sign${variant.name.capitalize()}Bundle", com.android.build.gradle.internal.tasks.FinalizeBundleTask) {
|
||||
File file = finalBundleFile.asFile.get()
|
||||
def channel = ''
|
||||
def server = ''
|
||||
if (variant.name.startsWith('huawei')) {
|
||||
channel = "华为"
|
||||
} else if (variant.name.startsWith('samsung')) {
|
||||
channel = "三星"
|
||||
} else if (variant.name.startsWith('google')) {
|
||||
channel = "谷歌"
|
||||
} else {
|
||||
channel = "链接"
|
||||
}
|
||||
if (variant.name.contains('online')) {
|
||||
server = '正式服'
|
||||
} else {
|
||||
server = '测试服'
|
||||
}
|
||||
def fileName = "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${defaultConfig.versionCode}-${channel}-${server}-${variant.buildType.name}.aab"
|
||||
File finalFile = new File("${project.rootDir}\\outputs\\aab", fileName)
|
||||
finalBundleFile.set(finalFile)
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -224,8 +249,17 @@ android {
|
||||
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
||||
multiDexEnabled true
|
||||
ndk {
|
||||
// TODO: 谷歌商城需要兼容两个平台
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
Gradle gradle = getGradle()
|
||||
String tskReqStr = gradle.getStartParameter().getTaskRequests().args.toString()
|
||||
println("处理ndk 版本 = " + tskReqStr)
|
||||
def isLink = tskReqStr.contains("Link")
|
||||
if (isLink) {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
||||
println("打包ndk 链接")
|
||||
} else {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
println("打包ndk其他")
|
||||
}
|
||||
}
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
@@ -280,18 +314,4 @@ dependencies {
|
||||
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
|
||||
|
||||
|
||||
}
|
||||
// 链接包需要注释掉 否正无法更新 谷歌包需要打开
|
||||
/*
|
||||
project.afterEvaluate {
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
output.processResources.doFirst { pm->
|
||||
String manifestPath = output.processResources.manifestFile;
|
||||
def manifestContent = file(manifestPath).getText()
|
||||
manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '')
|
||||
file(manifestPath).write(manifestContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
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 {
|
||||
|
||||
12
build.gradle
12
build.gradle
@@ -1,7 +1,7 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
apply from: "config.gradle"
|
||||
apply from: "dependencies.gradle"
|
||||
|
||||
apply from: "config.gradle"
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.6.20'
|
||||
@@ -49,7 +49,13 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
/*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,11 +1,11 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'img-optimizer'
|
||||
|
||||
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "../package_config.gradle"
|
||||
android {
|
||||
publishNonDefault true
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
@@ -13,7 +13,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 +200,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'
|
||||
@@ -212,11 +210,17 @@ dependencies {
|
||||
//侧滑删除
|
||||
api 'com.yanzhenjie.recyclerview:x:1.3.2'
|
||||
|
||||
//华为支付插件包
|
||||
//api project(':lib_huawei')
|
||||
huawei_onlineImplementation project(':lib_huawei')
|
||||
huawei_testImplementation project(':lib_huawei')
|
||||
|
||||
//google插件包
|
||||
api project(':lib_google')
|
||||
samsung_onlineImplementation project(":lib_google")
|
||||
samsung_testImplementation project(":lib_google")
|
||||
|
||||
google_onlineImplementation project(":lib_google")
|
||||
google_testImplementation project(":lib_google")
|
||||
|
||||
link_onlineImplementation project(":lib_google")
|
||||
link_testImplementation project(":lib_google")
|
||||
|
||||
//samsung插件包
|
||||
api project(':IAP6Helper')
|
||||
@@ -225,6 +229,12 @@ 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'
|
||||
|
||||
api rootProject.ext.dependencies["blank-utilcode"]
|
||||
}
|
||||
|
||||
@@ -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> {
|
||||
public 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 item);
|
||||
|
||||
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;
|
||||
|
||||
public 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.SudSettleBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SudGameAdapter extends BaseAdapter<SudSettleBean> {
|
||||
public SudGameAdapter(Context context, List<SudSettleBean> data) {
|
||||
super(context, data);
|
||||
}
|
||||
|
||||
private AppCompatImageView sub_rank_image;
|
||||
private RoundedImageView sub_head;
|
||||
private AppCompatTextView sub_rank_text,sub_name,sub_score;
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void convert(BaseAdapter<SudSettleBean>.BaseViewHolder holder, SudSettleBean item) {
|
||||
sub_rank_image = (AppCompatImageView) holder.getView(R.id.sub_rank_image);
|
||||
sub_rank_text = (AppCompatTextView) holder.getView(R.id.sub_rank_text);
|
||||
sub_head = (RoundedImageView) holder.getView(R.id.sub_head);
|
||||
sub_name = (AppCompatTextView) holder.getView(R.id.sub_name);
|
||||
sub_score = (AppCompatTextView) holder.getView(R.id.sub_score);
|
||||
|
||||
switch (item.getRank()){
|
||||
case 1:
|
||||
sub_rank_text.setVisibility(View.GONE);
|
||||
sub_rank_image.setVisibility(View.VISIBLE);
|
||||
sub_rank_image.setImageResource(R.mipmap.sub_1);
|
||||
break;
|
||||
case 2:
|
||||
sub_rank_text.setVisibility(View.GONE);
|
||||
sub_rank_image.setVisibility(View.VISIBLE);
|
||||
sub_rank_image.setImageResource(R.mipmap.sub_2);
|
||||
break;
|
||||
case 3:
|
||||
sub_rank_text.setVisibility(View.GONE);
|
||||
sub_rank_image.setVisibility(View.VISIBLE);
|
||||
sub_rank_image.setImageResource(R.mipmap.sub_3);
|
||||
break;
|
||||
default:
|
||||
sub_rank_text.setVisibility(View.VISIBLE);
|
||||
sub_rank_image.setVisibility(View.GONE);
|
||||
sub_rank_text.setText(String.valueOf(item.getRank()));
|
||||
break;
|
||||
}
|
||||
|
||||
ImgLoader.display(context, item.getAvatar_url(),sub_head);
|
||||
sub_name.setText(item.getNick_name());
|
||||
if (item.getWin_num()>0){
|
||||
sub_score.setText("+"+item.getWin_num());
|
||||
}else {
|
||||
sub_score.setText(String.valueOf(item.getWin_num()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemLayoutId() {
|
||||
return R.layout.view_sub_rank;
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
@@ -38,6 +38,17 @@ public class GuardGetGuardUserInfoModel extends BaseModel {
|
||||
private String userLanguage;
|
||||
@SerializedName("live_language")
|
||||
private String liveLanguage;
|
||||
@SerializedName("is_open")
|
||||
private String isOpen;
|
||||
|
||||
public String getIsOpen() {
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
public GuardGetGuardUserInfoModel setIsOpen(String isOpen) {
|
||||
this.isOpen = isOpen;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
|
||||
@@ -8,6 +8,17 @@ public class GuardModel extends BaseModel {
|
||||
private String type;
|
||||
@SerializedName("endtime")
|
||||
private String endtime;
|
||||
@SerializedName("guard_type")
|
||||
private String guardType;
|
||||
|
||||
public String getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
public GuardModel setGuardType(String guardType) {
|
||||
this.guardType = guardType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class GuardUserInfoModel extends BaseModel {
|
||||
@SerializedName("live_avatar")
|
||||
private String liveAvatar;
|
||||
@SerializedName("guard_type")
|
||||
private String guardType;
|
||||
private int guardType;
|
||||
@SerializedName("exp")
|
||||
private String exp;
|
||||
@SerializedName("level")
|
||||
@@ -38,6 +38,17 @@ public class GuardUserInfoModel extends BaseModel {
|
||||
private String userLanguage;
|
||||
@SerializedName("live_language")
|
||||
private String liveLanguage;
|
||||
@SerializedName("is_open")
|
||||
private String isOpen;
|
||||
|
||||
public String getIsOpen() {
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
public GuardUserInfoModel setIsOpen(String isOpen) {
|
||||
this.isOpen = isOpen;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
@@ -75,11 +86,11 @@ public class GuardUserInfoModel extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGuardType() {
|
||||
public int getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
public GuardUserInfoModel setGuardType(String guardType) {
|
||||
public GuardUserInfoModel setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class NewGuardLevelModel extends BaseModel{
|
||||
|
||||
@SerializedName("guard_type")
|
||||
private int guardType;
|
||||
@SerializedName("cn")
|
||||
private String cn;
|
||||
@SerializedName("en")
|
||||
private String en;
|
||||
|
||||
public int getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
public void setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
}
|
||||
|
||||
public String getCn() {
|
||||
return cn;
|
||||
}
|
||||
|
||||
public void setCn(String cn) {
|
||||
this.cn = cn;
|
||||
}
|
||||
|
||||
public String getEn() {
|
||||
return en;
|
||||
}
|
||||
|
||||
public void setEn(String en) {
|
||||
this.en = en;
|
||||
}
|
||||
}
|
||||
@@ -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,10 +119,14 @@ 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() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
@@ -195,6 +227,7 @@ public class OpenAdModel extends BaseModel {
|
||||
public String toString() {
|
||||
return "OpenAdModel{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", type=" + type +
|
||||
", url='" + url + '\'' +
|
||||
", imageUrl='" + imageUrl + '\'' +
|
||||
@@ -203,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,60 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
public class SudGameInfoBean {
|
||||
private String uid;//玩家id
|
||||
private String nick_name;//玩家昵称
|
||||
private String avatar_url;//玩家头像
|
||||
private String gender;//玩家性别
|
||||
private int is_ai;//是否是ai
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getNick_name() {
|
||||
return nick_name;
|
||||
}
|
||||
|
||||
public void setNick_name(String nick_name) {
|
||||
this.nick_name = nick_name;
|
||||
}
|
||||
|
||||
public String getAvatar_url() {
|
||||
return avatar_url;
|
||||
}
|
||||
|
||||
public void setAvatar_url(String avatar_url) {
|
||||
this.avatar_url = avatar_url;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public int getIs_ai() {
|
||||
return is_ai;
|
||||
}
|
||||
|
||||
public void setIs_ai(int is_ai) {
|
||||
this.is_ai = is_ai;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SudGameInfoBean{" +
|
||||
"uid=" + uid +
|
||||
", nick_name='" + nick_name + '\'' +
|
||||
", avatar_url='" + avatar_url + '\'' +
|
||||
", gender='" + gender + '\'' +
|
||||
", is_ai=" + is_ai +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
public class SudGameScoreBean extends BaseModel{
|
||||
private int golden_bean_remaining_balance;//
|
||||
private int room_sill;//房间的金豆门槛
|
||||
private int room_ticket;//收取的门票费
|
||||
private int room_win_num;//赢家获得的金豆
|
||||
private int game_mode;//1.双人对战 2.多人游戏
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SudGameScoreBean{" +
|
||||
"golden_bean_remaining_balance=" + golden_bean_remaining_balance +
|
||||
", room_sill=" + room_sill +
|
||||
", room_ticket=" + room_ticket +
|
||||
", room_win_num=" + room_win_num +
|
||||
", game_mode=" + game_mode +
|
||||
'}';
|
||||
}
|
||||
|
||||
public int getGame_mode() {
|
||||
return game_mode;
|
||||
}
|
||||
|
||||
public void setGame_mode(int game_mode) {
|
||||
this.game_mode = game_mode;
|
||||
}
|
||||
|
||||
public int getGolden_bean_remaining_balance() {
|
||||
return golden_bean_remaining_balance;
|
||||
}
|
||||
|
||||
public void setGolden_bean_remaining_balance(int golden_bean_remaining_balance) {
|
||||
this.golden_bean_remaining_balance = golden_bean_remaining_balance;
|
||||
}
|
||||
|
||||
public int getRoom_sill() {
|
||||
return room_sill;
|
||||
}
|
||||
|
||||
public void setRoom_sill(int room_sill) {
|
||||
this.room_sill = room_sill;
|
||||
}
|
||||
|
||||
public int getRoom_ticket() {
|
||||
return room_ticket;
|
||||
}
|
||||
|
||||
public void setRoom_ticket(int room_ticket) {
|
||||
this.room_ticket = room_ticket;
|
||||
}
|
||||
|
||||
public int getRoom_win_num() {
|
||||
return room_win_num;
|
||||
}
|
||||
|
||||
public void setRoom_win_num(int room_win_num) {
|
||||
this.room_win_num = room_win_num;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SudSettleBean {
|
||||
private String uid;//玩家id
|
||||
private String nick_name;//玩家昵称
|
||||
private String avatar_url;//玩家头像
|
||||
private int rank;//玩家排名
|
||||
private int win_num;//赢得或者失去的金豆
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getNick_name() {
|
||||
return nick_name;
|
||||
}
|
||||
|
||||
public void setNick_name(String nick_name) {
|
||||
this.nick_name = nick_name;
|
||||
}
|
||||
|
||||
public String getAvatar_url() {
|
||||
return avatar_url;
|
||||
}
|
||||
|
||||
public void setAvatar_url(String avatar_url) {
|
||||
this.avatar_url = avatar_url;
|
||||
}
|
||||
|
||||
public int getRank() {
|
||||
return rank;
|
||||
}
|
||||
|
||||
public void setRank(int rank) {
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
public int getWin_num() {
|
||||
return win_num;
|
||||
}
|
||||
|
||||
public void setWin_num(int win_num) {
|
||||
this.win_num = win_num;
|
||||
}
|
||||
|
||||
|
||||
public SudSettleBean(String uid, String nick_name, String avatar_url, int rank, int win_num) {
|
||||
this.uid = uid;
|
||||
this.nick_name = nick_name;
|
||||
this.avatar_url = avatar_url;
|
||||
this.rank = rank;
|
||||
this.win_num = win_num;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SudSettleBean{" +
|
||||
"uid='" + uid + '\'' +
|
||||
", nick_name='" + nick_name + '\'' +
|
||||
", avatar_url='" + avatar_url + '\'' +
|
||||
", rank=" + rank +
|
||||
", win_num=" + win_num +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,11 @@ public abstract class AbsDialogCenterPopupWindow extends CenterPopupView {
|
||||
public abstract void buildDialog(XPopup.Builder builder);
|
||||
public abstract int bindLayoutId();
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return bindLayoutId();
|
||||
@@ -36,4 +41,24 @@ public abstract class AbsDialogCenterPopupWindow extends CenterPopupView {
|
||||
buildDialog(builder);
|
||||
builder.asCustom(this).show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss监听
|
||||
*/
|
||||
private OnDismissListener onDismissListener;
|
||||
public interface OnDismissListener{
|
||||
void onDismiss();
|
||||
}
|
||||
|
||||
public void setOnDismissListener(OnDismissListener onDismissListener) {
|
||||
this.onDismissListener = onDismissListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
if (onDismissListener != null){
|
||||
onDismissListener.onDismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
@@ -43,39 +42,49 @@ public class GuardBuyTipsDialog {
|
||||
contentTextView.setVisibility(View.VISIBLE);
|
||||
buyTypeTextView.setVisibility(View.VISIBLE);
|
||||
content2.setVisibility(View.GONE);
|
||||
if (!isOpen) {
|
||||
if (!TextUtils.isEmpty(coin)) {
|
||||
contentTextView.setText(context.getString(R.string.guard_buy_tips_1, coin));
|
||||
}
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
buyTypeTextView.setText("【" + content + "】");
|
||||
}
|
||||
if (TextUtils.isEmpty(coin) && mGuardUserInfoModel == null && !isOpen && guardType == -200) {
|
||||
content1.setVisibility(View.GONE);
|
||||
contentTextView.setVisibility(View.VISIBLE);
|
||||
buyTypeTextView.setVisibility(View.GONE);
|
||||
content2.setVisibility(View.GONE);
|
||||
contentTextView.setText(content);
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(coin)) {
|
||||
contentTextView.setText(context.getString(R.string.guard_buy_tips_2, coin));
|
||||
if (!isOpen) {
|
||||
if (!TextUtils.isEmpty(coin)) {
|
||||
contentTextView.setText(context.getString(R.string.guard_buy_tips_1, coin));
|
||||
}
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
buyTypeTextView.setText("【" + content + "】");
|
||||
}
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(coin)) {
|
||||
contentTextView.setText(context.getString(R.string.guard_buy_tips_2, coin));
|
||||
}
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
buyTypeTextView.setText("【" + content + "】");
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
buyTypeTextView.setText("【" + content + "】");
|
||||
}
|
||||
}
|
||||
if (mGuardUserInfoModel != null) {
|
||||
if (mGuardUserInfoModel.getGuardType() != 0) {
|
||||
if (guardType < mGuardUserInfoModel.getGuardType()) {
|
||||
content1.setVisibility(View.GONE);
|
||||
contentTextView.setVisibility(View.GONE);
|
||||
buyTypeTextView.setVisibility(View.GONE);
|
||||
content2.setVisibility(View.VISIBLE);
|
||||
if (mGuardUserInfoModel != null) {
|
||||
if (mGuardUserInfoModel.getGuardType() != 0) {
|
||||
if (TextUtils.equals(mGuardUserInfoModel.getIsOpen(), "1") &&
|
||||
guardType < mGuardUserInfoModel.getGuardType()) {
|
||||
content1.setVisibility(View.GONE);
|
||||
contentTextView.setVisibility(View.GONE);
|
||||
buyTypeTextView.setVisibility(View.GONE);
|
||||
content2.setVisibility(View.VISIBLE);
|
||||
|
||||
} else if (guardType==mGuardUserInfoModel.getGuardType()){
|
||||
} else if (TextUtils.equals(mGuardUserInfoModel.getIsOpen(), "1") && guardType > mGuardUserInfoModel.getGuardType()) {
|
||||
content1.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
content1.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
content1.setVisibility(View.GONE);
|
||||
}else {
|
||||
content1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
content1.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
content1.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() {
|
||||
@@ -88,9 +97,9 @@ public class GuardBuyTipsDialog {
|
||||
btn_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (content2.getVisibility()==View.VISIBLE){
|
||||
if (content2.getVisibility() == View.VISIBLE) {
|
||||
dialog.dismiss();
|
||||
}else {
|
||||
} else {
|
||||
simpleCallback.onConfirmClick(dialog, "");
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ public class GuardUpgradePopup extends CenterPopupView {
|
||||
} else {
|
||||
hintStringBuffer.append("Your guardian level has reached level ")
|
||||
.append(mUpgradesModel.getLevel())
|
||||
.append(" You can receive the following rewards")
|
||||
;
|
||||
}
|
||||
leave_hint.setText(hintStringBuffer.toString());
|
||||
@@ -148,11 +149,11 @@ public class GuardUpgradePopup extends CenterPopupView {
|
||||
IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo();
|
||||
htmlUrl.append(CommonAppConfig.HOST)
|
||||
.append("/h5/Guard/level.html?")
|
||||
.append("&token=")
|
||||
.append("token=")
|
||||
.append(userInfo.getToken())
|
||||
.append("&uid=")
|
||||
.append(userInfo.getId())
|
||||
.append("&&anchorUid=")
|
||||
.append("&anchorUid=")
|
||||
.append(mLiveUid)
|
||||
.append("&isZh=")
|
||||
.append(((WordUtil.isNewZh()) ? "1" : "0"));
|
||||
|
||||
@@ -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,23 +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;
|
||||
@@ -38,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);
|
||||
}
|
||||
|
||||
@@ -60,11 +82,107 @@ 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())) {
|
||||
RouteUtil.forwardBattlePass();
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
WebViewActivity.forward(mContext, model.getUrl(), model.getType() != OpenAdModel.TYPE_HOME);
|
||||
if (mListener != null) {
|
||||
mListener.onItemClick(model, 1);
|
||||
@@ -72,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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class SkitCheckInWasSuccessfulPopup extends CenterPopupView {
|
||||
public SkitCheckInWasSuccessfulPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.skit_check_in_was_successful_popup;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.icon_slice_368), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
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.SudSettleBean;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 双人小游戏结算弹窗
|
||||
*/
|
||||
public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow{
|
||||
public SudGameDoubleDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_sub_double;
|
||||
}
|
||||
|
||||
private AppCompatImageView sub_win_hat,sub_leave,sub_again,sub_title;
|
||||
private RoundedImageView sub_win_head,sub_loss_head;
|
||||
private AppCompatTextView sub_win_name,sub_win_score,sub_loss_name,sub_loss_score,sub_time;
|
||||
private CountDownTimer countDownTimer;
|
||||
private List<SudSettleBean> settleBeans = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
builder.dismissOnTouchOutside(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
sub_title = findViewById(R.id.sub_title);//弹窗标题
|
||||
sub_win_hat = findViewById(R.id.sub_win_hat);//胜利皇冠(平局隐藏)
|
||||
sub_leave = findViewById(R.id.sub_leave);//离开按钮
|
||||
sub_again = findViewById(R.id.sub_again);//再来一局按钮
|
||||
sub_win_head = findViewById(R.id.sub_win_head);//胜利方头像
|
||||
sub_loss_head = findViewById(R.id.sub_loss_head);//失败方头像
|
||||
sub_win_name = findViewById(R.id.sub_win_name);//胜利方昵称
|
||||
sub_win_score = findViewById(R.id.sub_win_score);//胜利方分数
|
||||
sub_loss_name = findViewById(R.id.sub_loss_name);//失败方昵称
|
||||
sub_loss_score = findViewById(R.id.sub_loss_score);//失败方分数
|
||||
sub_time = findViewById(R.id.sub_time);//关闭倒计时
|
||||
|
||||
|
||||
initData();
|
||||
|
||||
if (WordUtil.isNewZh()){
|
||||
sub_leave.setImageResource(R.mipmap.sub_leave_zh);
|
||||
sub_again.setImageResource(R.mipmap.sub_again_zh);
|
||||
}else {
|
||||
sub_leave.setImageResource(R.mipmap.sub_leave_en);
|
||||
sub_again.setImageResource(R.mipmap.sub_again_en);
|
||||
}
|
||||
|
||||
sub_leave.setOnClickListener(v-> destroyDialog());
|
||||
sub_again.setOnClickListener(v-> {
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
destroyDialog();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void initData() {
|
||||
if (settleBeans.size() == 2){
|
||||
sortByWinNum(settleBeans);
|
||||
SudSettleBean sudSettleBean1 = settleBeans.get(0); // 第一名
|
||||
SudSettleBean sudSettleBean2 = settleBeans.get(1); // 第二名
|
||||
|
||||
ImgLoader.display(mContext,sudSettleBean1.getAvatar_url(),sub_win_head);
|
||||
ImgLoader.display(mContext,sudSettleBean2.getAvatar_url(),sub_loss_head);
|
||||
sub_win_name.setText(sudSettleBean1.getNick_name());
|
||||
sub_loss_name.setText(sudSettleBean2.getNick_name());
|
||||
if (sudSettleBean1.getWin_num()>0){
|
||||
sub_win_score.setText("+"+sudSettleBean1.getWin_num());
|
||||
}else {
|
||||
sub_win_score.setText(String.valueOf(sudSettleBean1.getWin_num()));
|
||||
}
|
||||
sub_loss_score.setText(String.valueOf(sudSettleBean2.getWin_num()));
|
||||
|
||||
if (sudSettleBean1.getWin_num() == sudSettleBean2.getWin_num()){
|
||||
//平局
|
||||
if (WordUtil.isNewZh()){
|
||||
sub_title.setImageResource(R.mipmap.sub_draw_zh);
|
||||
}else {
|
||||
sub_title.setImageResource(R.mipmap.sub_draw_en);
|
||||
}
|
||||
sub_win_hat.setVisibility(View.GONE);
|
||||
}else {
|
||||
//有胜负
|
||||
sub_win_hat.setVisibility(View.VISIBLE);
|
||||
if (CommonAppConfig.getInstance().getUid().equals(sudSettleBean1.getUid())){
|
||||
//本人胜利
|
||||
if (WordUtil.isNewZh()){
|
||||
sub_title.setImageResource(R.mipmap.sub_win_zh);
|
||||
}else {
|
||||
sub_title.setImageResource(R.mipmap.sub_win_en);
|
||||
}
|
||||
}else {
|
||||
//本人失败
|
||||
if (WordUtil.isNewZh()){
|
||||
sub_title.setImageResource(R.mipmap.sub_loss_zh);
|
||||
}else {
|
||||
sub_title.setImageResource(R.mipmap.sub_loss_en);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
//关闭倒计时
|
||||
countDownTimer = new CountDownTimer(10000, 1000){
|
||||
|
||||
@Override
|
||||
public void onTick(long l) {
|
||||
sub_time.setText(String.valueOf((l+500)/1000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
destroyDialog();
|
||||
}
|
||||
}.start();
|
||||
initData();
|
||||
}
|
||||
|
||||
public void setSudSettleList(List<SudSettleBean> data){
|
||||
settleBeans.clear();
|
||||
settleBeans.addAll(data);
|
||||
LogUtils.e("yqw=====>"+settleBeans);
|
||||
}
|
||||
|
||||
private void sortByWinNum(List<SudSettleBean> list){
|
||||
// 按照胜利数排序 settleBeans 列表
|
||||
Collections.sort(list, (bean1, bean2) -> {
|
||||
return Integer.compare(bean2.getWin_num(), bean1.getWin_num()); // 从大到小排序
|
||||
});
|
||||
}
|
||||
|
||||
private void destroyDialog(){
|
||||
dismiss();
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.SudGameAdapter;
|
||||
import com.yunbao.common.bean.SudSettleBean;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 多人小游戏弹窗
|
||||
*/
|
||||
public class SudGameMultipleDialog extends AbsDialogCenterPopupWindow{
|
||||
public SudGameMultipleDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_sub_multiple;
|
||||
}
|
||||
|
||||
private RecyclerView sub_recycle_rank;
|
||||
private AppCompatImageView sub_leave,sub_again,sub_title;
|
||||
private AppCompatTextView sub_time;
|
||||
private CountDownTimer countDownTimer;
|
||||
private SudGameAdapter sudGameAdapter;
|
||||
private final List<SudSettleBean> settleBeans = new ArrayList<>();
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
builder.dismissOnTouchOutside(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
sub_recycle_rank = findViewById(R.id.sub_recycle_rank);//分数排名
|
||||
sub_leave = findViewById(R.id.sub_leave);//离开按钮
|
||||
sub_again = findViewById(R.id.sub_again);//再来一局按钮
|
||||
sub_title = findViewById(R.id.sub_title);//弹窗标题
|
||||
sub_time = findViewById(R.id.sub_time);//关闭倒计时
|
||||
|
||||
if (WordUtil.isNewZh()){
|
||||
sub_leave.setImageResource(R.mipmap.sub_leave_zh);
|
||||
sub_again.setImageResource(R.mipmap.sub_again_zh);
|
||||
sub_title.setImageResource(R.mipmap.sub_over_zh);
|
||||
}else {
|
||||
sub_leave.setImageResource(R.mipmap.sub_leave_en);
|
||||
sub_again.setImageResource(R.mipmap.sub_again_en);
|
||||
sub_title.setImageResource(R.mipmap.sub_over_en);
|
||||
}
|
||||
|
||||
sub_leave.setOnClickListener(v-> destroyDialog());
|
||||
sub_again.setOnClickListener(v-> {
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
destroyDialog();
|
||||
});
|
||||
|
||||
//设置排名数据
|
||||
sudGameAdapter = new SudGameAdapter(mContext,settleBeans);
|
||||
sub_recycle_rank.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
sub_recycle_rank.setAdapter(sudGameAdapter);
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
//关闭倒计时
|
||||
countDownTimer = new CountDownTimer(10000, 1000){
|
||||
|
||||
@Override
|
||||
public void onTick(long l) {
|
||||
sub_time.setText(String.valueOf((l+500)/1000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
destroyDialog();
|
||||
}
|
||||
}.start();
|
||||
sudGameAdapter.notifyDataSetChanged();
|
||||
// limitItem();
|
||||
}
|
||||
|
||||
public void setSudSettleList(List<SudSettleBean> data){
|
||||
settleBeans.clear();
|
||||
settleBeans.addAll(data);
|
||||
}
|
||||
|
||||
//设置最多显示的高度
|
||||
private void limitItem(){
|
||||
sub_recycle_rank.post(() -> {
|
||||
View itemView = sub_recycle_rank.getChildAt(0);
|
||||
if (itemView != null){
|
||||
int height = (int) (itemView.getHeight()*3.5);
|
||||
ViewGroup.LayoutParams layoutParams = sub_recycle_rank.getLayoutParams();
|
||||
layoutParams.height = height;
|
||||
sub_recycle_rank.setLayoutParams(layoutParams);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void destroyDialog(){
|
||||
dismiss();
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
public class SudLoadDialog extends AbsDialogCenterPopupWindow{
|
||||
public SudLoadDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private LinearLayoutCompat sud_load_bg;
|
||||
private AppCompatImageView sud_load,sud_load_skip,sud_load_again;
|
||||
private ProgressBar sud_load_bar_double,sud_load_bar_multiple;
|
||||
private int isDouble = 0;//游戏模式 1:双人对战 2:多人游戏
|
||||
private int clickStatus = 0;//0:什么都不点击 1:点击跳过 2:点击再来一局
|
||||
|
||||
public int getClickStatus() {
|
||||
return clickStatus;
|
||||
}
|
||||
|
||||
public void setClickStatus(int clickStatus) {
|
||||
this.clickStatus = clickStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
builder.dismissOnTouchOutside(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_sud_load;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
sud_load_bg = findViewById(R.id.sud_load_bg);
|
||||
sud_load = findViewById(R.id.sud_load);
|
||||
sud_load_skip = findViewById(R.id.sud_load_skip);
|
||||
sud_load_again = findViewById(R.id.sud_load_again);
|
||||
sud_load_bar_double = findViewById(R.id.sud_load_bar_double);
|
||||
sud_load_bar_multiple = findViewById(R.id.sud_load_bar_multiple);
|
||||
|
||||
if (WordUtil.isNewZh()){
|
||||
sud_load.setImageResource(R.mipmap.sud_load_zh);
|
||||
sud_load_skip.setImageResource(R.mipmap.sud_load_skip_zh);
|
||||
sud_load_again.setImageResource(R.mipmap.sub_again_zh);
|
||||
}else {
|
||||
sud_load.setImageResource(R.mipmap.sud_load_en);
|
||||
sud_load_skip.setImageResource(R.mipmap.sud_load_skip_en);
|
||||
sud_load_again.setImageResource(R.mipmap.sub_again_en);
|
||||
}
|
||||
|
||||
sud_load_skip.setOnClickListener(v->{
|
||||
clickStatus = 1;
|
||||
dismiss();
|
||||
});
|
||||
|
||||
sud_load_again.setOnClickListener(v->{
|
||||
clickStatus = 2;
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
if (isDouble == 1){
|
||||
sud_load_bg.setBackground(ContextCompat.getDrawable(mContext,R.mipmap.sud_load_bg_double));
|
||||
sud_load_bar_double.setVisibility(View.VISIBLE);
|
||||
sud_load_bar_multiple.setVisibility(View.GONE);
|
||||
}else {
|
||||
sud_load_bg.setBackground(ContextCompat.getDrawable(mContext,R.mipmap.sud_load_bg_multiple));
|
||||
sud_load_bar_double.setVisibility(View.GONE);
|
||||
sud_load_bar_multiple.setVisibility(View.VISIBLE);
|
||||
}
|
||||
// new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
// if (this.isShow()){
|
||||
// dismiss();
|
||||
// }
|
||||
// },10000);
|
||||
}
|
||||
|
||||
public void setDouble(int isDouble){
|
||||
this.isDouble = isDouble;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AllServerNotifyFFGGGDJANEvent extends BaseModel {
|
||||
|
||||
@SerializedName("_method_")
|
||||
private String method;
|
||||
@SerializedName("action")
|
||||
private String action;
|
||||
@SerializedName("msg_cn")
|
||||
private String msgCn;
|
||||
@SerializedName("msg_en")
|
||||
private String msgEn;
|
||||
@SerializedName("uid")
|
||||
private String uid;
|
||||
@SerializedName("liveuid")
|
||||
private String liveuid;
|
||||
@SerializedName("background_image")
|
||||
private String backgroundImage;
|
||||
@SerializedName("style")
|
||||
private List<StyleDTO> style;
|
||||
@SerializedName("jump_type")
|
||||
private String jumpType;
|
||||
@SerializedName("link")
|
||||
private String link;
|
||||
@SerializedName("button_image")
|
||||
private String buttonImage;
|
||||
@SerializedName("button_msg_cn")
|
||||
private String buttonMsgCn;
|
||||
@SerializedName("button_msg_en")
|
||||
private String buttonMsgEn;
|
||||
@SerializedName("button_style")
|
||||
private List<ButtonStyleDTO> buttonStyle;
|
||||
@SerializedName("h5_type")
|
||||
private String h5Type;
|
||||
@SerializedName("left_image")
|
||||
private String leftImage;
|
||||
|
||||
public String getH5Type() {
|
||||
return h5Type;
|
||||
}
|
||||
|
||||
public AllServerNotifyFFGGGDJANEvent setH5Type(String h5Type) {
|
||||
this.h5Type = h5Type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLeftImage() {
|
||||
return leftImage;
|
||||
}
|
||||
|
||||
public void setLeftImage(String leftImage) {
|
||||
this.leftImage = leftImage;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getMsgCn() {
|
||||
return msgCn;
|
||||
}
|
||||
|
||||
public void setMsgCn(String msgCn) {
|
||||
this.msgCn = msgCn;
|
||||
}
|
||||
|
||||
public String getMsgEn() {
|
||||
return msgEn;
|
||||
}
|
||||
|
||||
public void setMsgEn(String msgEn) {
|
||||
this.msgEn = msgEn;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public void setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
}
|
||||
|
||||
public String getBackgroundImage() {
|
||||
return backgroundImage;
|
||||
}
|
||||
|
||||
public void setBackgroundImage(String backgroundImage) {
|
||||
this.backgroundImage = backgroundImage;
|
||||
}
|
||||
|
||||
public List<StyleDTO> getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public void setStyle(List<StyleDTO> style) {
|
||||
this.style = style;
|
||||
}
|
||||
|
||||
public String getJumpType() {
|
||||
return jumpType;
|
||||
}
|
||||
|
||||
public void setJumpType(String jumpType) {
|
||||
this.jumpType = jumpType;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
public String getButtonImage() {
|
||||
return buttonImage;
|
||||
}
|
||||
|
||||
public void setButtonImage(String buttonImage) {
|
||||
this.buttonImage = buttonImage;
|
||||
}
|
||||
|
||||
public String getButtonMsgCn() {
|
||||
return buttonMsgCn;
|
||||
}
|
||||
|
||||
public void setButtonMsgCn(String buttonMsgCn) {
|
||||
this.buttonMsgCn = buttonMsgCn;
|
||||
}
|
||||
|
||||
public String getButtonMsgEn() {
|
||||
return buttonMsgEn;
|
||||
}
|
||||
|
||||
public void setButtonMsgEn(String buttonMsgEn) {
|
||||
this.buttonMsgEn = buttonMsgEn;
|
||||
}
|
||||
|
||||
public List<ButtonStyleDTO> getButtonStyle() {
|
||||
return buttonStyle;
|
||||
}
|
||||
|
||||
public void setButtonStyle(List<ButtonStyleDTO> buttonStyle) {
|
||||
this.buttonStyle = buttonStyle;
|
||||
}
|
||||
|
||||
public static class StyleDTO {
|
||||
@SerializedName("str_cn")
|
||||
private String strCn;
|
||||
@SerializedName("str_en")
|
||||
private String strEn;
|
||||
@SerializedName("colour")
|
||||
private String colour;
|
||||
|
||||
public String getStrCn() {
|
||||
return strCn;
|
||||
}
|
||||
|
||||
public void setStrCn(String strCn) {
|
||||
this.strCn = strCn;
|
||||
}
|
||||
|
||||
public String getStrEn() {
|
||||
return strEn;
|
||||
}
|
||||
|
||||
public void setStrEn(String strEn) {
|
||||
this.strEn = strEn;
|
||||
}
|
||||
|
||||
public String getColour() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
public void setColour(String colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ButtonStyleDTO {
|
||||
@SerializedName("str_cn")
|
||||
private String strCn;
|
||||
@SerializedName("str_en")
|
||||
private String strEn;
|
||||
@SerializedName("colour")
|
||||
private String colour;
|
||||
|
||||
public String getStrCn() {
|
||||
return strCn;
|
||||
}
|
||||
|
||||
public void setStrCn(String strCn) {
|
||||
this.strCn = strCn;
|
||||
}
|
||||
|
||||
public String getStrEn() {
|
||||
return strEn;
|
||||
}
|
||||
|
||||
public void setStrEn(String strEn) {
|
||||
this.strEn = strEn;
|
||||
}
|
||||
|
||||
public String getColour() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
public void setColour(String colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,22 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
|
||||
public class CheckRemainingBalanceEvent extends BaseModel {
|
||||
public int seatIndex=0;
|
||||
private String SudMGPMGState;
|
||||
private boolean subReady = false;//是否直接自动准备
|
||||
private SudMGPMGState.MGCommonGameSettle mgCommonGameSettle;//结算数据
|
||||
|
||||
public SudMGPMGState.MGCommonGameSettle getMgCommonGameSettle() {
|
||||
return mgCommonGameSettle;
|
||||
}
|
||||
|
||||
public CheckRemainingBalanceEvent setMgCommonGameSettle(SudMGPMGState.MGCommonGameSettle mgCommonGameSettle) {
|
||||
this.mgCommonGameSettle = mgCommonGameSettle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudMGPMGState() {
|
||||
return SudMGPMGState;
|
||||
@@ -23,4 +35,13 @@ public class CheckRemainingBalanceEvent extends BaseModel {
|
||||
this.seatIndex = seatIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CheckRemainingBalanceEvent setSubReady(boolean subReady){
|
||||
this.subReady = subReady;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getSubReady(){
|
||||
return subReady;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
@@ -208,6 +208,10 @@ public class CommonHttpUtil {
|
||||
JSONArray levelArray = obj.getJSONArray("liveclass");
|
||||
new LiveClassManager(context).UpDataLiveClass(levelArray.toJSONString());
|
||||
}
|
||||
if (obj.containsKey("guard_type")) {
|
||||
JSONArray levelArray = obj.getJSONArray("guard_type");
|
||||
new NewLevelManager(context).upDataGuardLevel(levelArray.toJSONString());
|
||||
}
|
||||
if (obj.containsKey("apk_ver")) {
|
||||
APKManager.get().setApkVer(obj.getString("apk_ver"));
|
||||
}
|
||||
@@ -446,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;
|
||||
@@ -67,9 +70,12 @@ import com.yunbao.common.bean.SendMoneyLongModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.SudGameInfoBean;
|
||||
import com.yunbao.common.bean.SudGameScoreBean;
|
||||
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 +88,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;
|
||||
|
||||
@@ -110,7 +119,8 @@ public interface PDLiveApi {
|
||||
@Field("user_pass") String passWord,
|
||||
@Field("uuid_Device") String uuidDevice,
|
||||
@Field("pushid") String pushid,
|
||||
@Field("lastlogindevice") String lastlogindevice
|
||||
@Field("lastlogindevice") String lastlogindevice,
|
||||
@Field("langue") String langue
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -210,7 +220,7 @@ public interface PDLiveApi {
|
||||
);
|
||||
|
||||
/**
|
||||
* 关注主播
|
||||
* 关注主播···································································
|
||||
*
|
||||
* @param liveuid
|
||||
* @return
|
||||
@@ -499,7 +509,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);
|
||||
|
||||
/**
|
||||
* 设置礼物整蛊
|
||||
@@ -507,9 +526,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
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1003,6 +1024,22 @@ public interface PDLiveApi {
|
||||
@GET("/api/public/?service=Sudgame.getCode")
|
||||
Observable<ResponseModel<List<SudgameCodeModel>>> getCode();
|
||||
|
||||
/**
|
||||
* 获取房间金豆门槛和赢家获得的金豆
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgameserver.checkRemainingBalance")
|
||||
Observable<ResponseModel<SudGameScoreBean>> getScore(
|
||||
@Query("room_id") String roomId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取游戏中玩家的信息
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgameserver.getGameUser")
|
||||
Observable<ResponseModel<List<SudGameInfoBean>>> getSudGameInfo(
|
||||
@Query("room_id") String roomId
|
||||
);
|
||||
|
||||
/**
|
||||
* 创建游戏房
|
||||
*
|
||||
@@ -1185,10 +1222,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;
|
||||
@@ -63,9 +68,12 @@ import com.yunbao.common.bean.RoomMicStatusModel;
|
||||
import com.yunbao.common.bean.SendMoneyLongModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.SudGameInfoBean;
|
||||
import com.yunbao.common.bean.SudGameScoreBean;
|
||||
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 +87,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 +97,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 +884,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 +903,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 -> {
|
||||
@@ -2264,6 +2296,48 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取房间金豆门槛和赢家获得的金豆
|
||||
* @param roomId
|
||||
* @param callback
|
||||
*/
|
||||
public void getScore(String roomId,HttpCallback<SudGameScoreBean> callback){
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getScore(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(sudGameScoreBeanResponseModel -> {
|
||||
if (callback != null){
|
||||
callback.onSuccess(sudGameScoreBeanResponseModel.getData().getInfo());
|
||||
}
|
||||
}, throwable -> {
|
||||
if (callback != null){
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏中所有玩家的信息
|
||||
* @param roomId
|
||||
* @param callback
|
||||
*/
|
||||
public void getSudGameInfo(String roomId,HttpCallback<List<SudGameInfoBean>> callback){
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getSudGameInfo(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(infoModel->{
|
||||
if (callback != null){
|
||||
callback.onSuccess(infoModel.getData().getInfo());
|
||||
}
|
||||
},throwable -> {
|
||||
if (callback != null){
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void createSudRoom(String roomName, String goldenBeanNumber, String currencyType, String gameId, HttpCallback<CreateSudRoomModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.createSudRoom(roomName, goldenBeanNumber, currencyType, gameId)
|
||||
@@ -3133,7 +3207,6 @@ public class LiveNetManager {
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
|
||||
}
|
||||
|
||||
public void guardGetRewards(String guardLevel, String liveUid, HttpCallback<Object> callback) {
|
||||
@@ -3160,6 +3233,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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseData;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -54,7 +55,7 @@ public class MainNetManager {
|
||||
* @param callback 网络请求回调
|
||||
*/
|
||||
public void login(String phoneNum, String pwd, String uuid, HttpCallback<IMLoginModel> callback) {
|
||||
API.get().pdLiveApi(mContext).loginByManager(phoneNum, pwd, uuid, "", "Android")
|
||||
API.get().pdLiveApi(mContext).loginByManager(phoneNum, pwd, uuid, "", "Android", WordUtil.isNewZh()?"chinese":"english")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<IMLoginModel>>() {
|
||||
@@ -95,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)
|
||||
@@ -139,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;
|
||||
@@ -54,6 +54,15 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
|
||||
private final String KEY_LANGUAGE = "language";
|
||||
private final String KEY_GAME = "key_game";
|
||||
private final String GUARD_TYPE = "key_GUARD_TYPE";
|
||||
|
||||
public void setGuardType(int guardType) {
|
||||
put(GUARD_TYPE, guardType);
|
||||
}
|
||||
|
||||
public int getGuardType() {
|
||||
return getInt(GUARD_TYPE, 0);
|
||||
}
|
||||
|
||||
public void setRedPoint() {
|
||||
put("RedPoint", "1");
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.bean.FansModel;
|
||||
import com.yunbao.common.bean.NewGuardLevelModel;
|
||||
import com.yunbao.common.bean.NewLevelModel;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
|
||||
@@ -19,10 +20,12 @@ public class NewLevelManager extends BaseCacheManager {
|
||||
private final String KEY_ANCHOR_LEVEL = "keyAnchorLevel";
|
||||
private final String KEY_LIVE_LEVEL = "keyLiveLevel";
|
||||
private final String KEY_FANS_LEVEL = "keyFansLevel";
|
||||
private final String KEY_GUARD_LEVEL = "keyGuardLevel";
|
||||
|
||||
private List<NewLevelModel> newLevelModels = new ArrayList<>();
|
||||
private List<NewLevelModel> keyAnchorLevel = new ArrayList<>();
|
||||
private List<FansModel> fansModels = new ArrayList<>();
|
||||
private List<NewGuardLevelModel> newGuardLevelModels = new ArrayList<>();
|
||||
|
||||
public NewLevelManager(Context context) {
|
||||
super(context);
|
||||
@@ -62,6 +65,29 @@ public class NewLevelManager extends BaseCacheManager {
|
||||
return fansModel;
|
||||
}
|
||||
|
||||
public void upDataGuardLevel(String json) {
|
||||
newGuardLevelModels = new Gson().fromJson(json, new TypeToken<List<NewGuardLevelModel>>() {
|
||||
}.getType());
|
||||
put(KEY_GUARD_LEVEL, newGuardLevelModels);
|
||||
}
|
||||
|
||||
public List<NewGuardLevelModel> getGuardLevel() {
|
||||
newGuardLevelModels = getList(KEY_GUARD_LEVEL, new TypeToken<List<NewGuardLevelModel>>() {
|
||||
}.getType());
|
||||
return newGuardLevelModels;
|
||||
}
|
||||
|
||||
public NewGuardLevelModel getGuardModel(int type) {
|
||||
getGuardLevel();
|
||||
NewGuardLevelModel guardLevelModel = null;
|
||||
for (NewGuardLevelModel model : newGuardLevelModels) {
|
||||
if (model.getGuardType() == type) {
|
||||
guardLevelModel = model;
|
||||
}
|
||||
}
|
||||
return guardLevelModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取等级数据
|
||||
*
|
||||
|
||||
@@ -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,8 +17,13 @@ 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.sud.state.SudMGPMGState;
|
||||
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.logger.LogUtils;
|
||||
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
import tech.sud.mgp.core.ISudFSTAPP;
|
||||
import tech.sud.mgp.core.ISudListenerInitSDK;
|
||||
@@ -142,7 +148,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 +291,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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -450,4 +481,13 @@ public abstract class BaseGameViewModel implements SudFSMMGListener {
|
||||
return sudFSMMGDecorator.getSudFSMMGCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏结算状态
|
||||
*/
|
||||
@Override
|
||||
public void onGameMGCommonGameSettle(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSettle model) {
|
||||
LogUtils.e("yqw=====>"+model);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,13 @@ import android.view.View;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.PrankProgressBean;
|
||||
import com.yunbao.common.bean.SudGameInfoBean;
|
||||
import com.yunbao.common.bean.SudGameScoreBean;
|
||||
import com.yunbao.common.bean.SudSettleBean;
|
||||
import com.yunbao.common.bean.SudgameCodeModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
@@ -15,9 +20,14 @@ import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.sud.model.GameViewInfoModel;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import tech.sud.mgp.core.ISudFSMMG;
|
||||
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
@@ -59,9 +69,25 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
/**
|
||||
* 游戏的语言代码
|
||||
*/
|
||||
public String languageCode = "zh-CN";
|
||||
public String languageCode = "zh-TW";
|
||||
|
||||
public final MutableLiveData<View> gameViewLiveData = new MutableLiveData<>(); // 游戏View回调
|
||||
private SudGameScoreBean sudGameScoreBean;//房间金豆的门槛和赢家奖励
|
||||
private List<SudGameInfoBean> sudGameInfoBeanList = new ArrayList<>();//玩家信息
|
||||
public final MutableLiveData<List<SudSettleBean>> listMutableLiveData = new MutableLiveData<>();//玩家排名信息
|
||||
|
||||
public void setSudGameInfoBeanList(List<SudGameInfoBean> sudGameInfoBeanList) {
|
||||
this.sudGameInfoBeanList = sudGameInfoBeanList;
|
||||
}
|
||||
|
||||
|
||||
public SudGameScoreBean getSudGameScoreBean() {
|
||||
return sudGameScoreBean;
|
||||
}
|
||||
|
||||
public void setSudGameScoreBean(SudGameScoreBean sudGameScoreBean) {
|
||||
this.sudGameScoreBean = sudGameScoreBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向接入方服务器获取code
|
||||
@@ -69,8 +95,8 @@ 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";
|
||||
}else {
|
||||
languageCode = "zh-TW";
|
||||
} else {
|
||||
languageCode = "en-US";
|
||||
}
|
||||
// TODO: 2022/6/10 注意,这里是演示使用OkHttpClient请求hello-sud服务
|
||||
@@ -147,6 +173,81 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取房间的金豆数量和赢家获得的金豆
|
||||
*/
|
||||
public void getScore(String roomId, Activity activity) {
|
||||
LiveNetManager.get(activity).getScore(roomId, new HttpCallback<SudGameScoreBean>() {
|
||||
@Override
|
||||
public void onSuccess(SudGameScoreBean data) {
|
||||
sudGameScoreBean = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行排名和结算
|
||||
*/
|
||||
public void sudGameRank(SudMGPMGState.MGCommonGameSettle mgCommonGameSettle) {
|
||||
List<SudSettleBean> settleBeans = new ArrayList<>();
|
||||
int playerNum = mgCommonGameSettle.results.size();//玩家人数
|
||||
int winnerNUm = countWinners(mgCommonGameSettle.results);//第一名人数
|
||||
int winNum;//赢得或者失去的金豆
|
||||
// 构建结算信息
|
||||
for (SudMGPMGState.MGCommonGameSettle.PlayerResult playerResult : mgCommonGameSettle.results) {
|
||||
String uid = playerResult.uid;
|
||||
int rank = playerResult.rank;
|
||||
SudGameInfoBean sudGameInfoBean = findGameInfoBean(uid);
|
||||
if (sudGameInfoBean == null) return;
|
||||
|
||||
if (sudGameScoreBean.getGame_mode() == 1) {
|
||||
//双人游戏
|
||||
if (winnerNUm == 1){
|
||||
winNum = (rank == 1) ? (int) (sudGameScoreBean.getRoom_sill() * 0.8) : -sudGameScoreBean.getRoom_sill();
|
||||
}else {
|
||||
winNum = -sudGameScoreBean.getRoom_ticket();
|
||||
}
|
||||
} else {
|
||||
//多人游戏
|
||||
if (rank == 1){
|
||||
winNum = (playerNum*sudGameScoreBean.getRoom_win_num()-winnerNUm*sudGameScoreBean.getRoom_sill())/winnerNUm;
|
||||
}else {
|
||||
winNum = -sudGameScoreBean.getRoom_sill();
|
||||
}
|
||||
}
|
||||
settleBeans.add(new SudSettleBean(uid,sudGameInfoBean.getNick_name(),sudGameInfoBean.getAvatar_url(),rank,winNum));
|
||||
}
|
||||
// 更新LiveData
|
||||
listMutableLiveData.setValue(settleBeans);
|
||||
}
|
||||
|
||||
// 统计第一名的玩家数量
|
||||
private int countWinners(List<SudMGPMGState.MGCommonGameSettle.PlayerResult> results) {
|
||||
int count = 0;
|
||||
for (SudMGPMGState.MGCommonGameSettle.PlayerResult result : results) {
|
||||
if (result.rank == 1) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// 根据uid查找对应的游戏信息Bean
|
||||
private SudGameInfoBean findGameInfoBean(String uid) {
|
||||
for (SudGameInfoBean sudGameInfoBean : sudGameInfoBeanList) {
|
||||
if (sudGameInfoBean.getUid().equals(uid)) {
|
||||
return sudGameInfoBean;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置当前用户id(接入方定义)
|
||||
*/
|
||||
@@ -255,7 +356,7 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
@Override
|
||||
public void onGameMGCommonGameState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameState model) {
|
||||
super.onGameMGCommonGameState(handle, model);
|
||||
Log.e("QuickStartGameViewModel",model.toString());
|
||||
Log.e("QuickStartGameViewModel", model.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ package com.yunbao.common.sud.decorator;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
@@ -23,6 +24,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;
|
||||
|
||||
@@ -173,11 +178,11 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
} else {
|
||||
listener.onGameMGCommonGameSettle(handle, mgCommonGameSettle);
|
||||
}
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_SETTLE));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_SETTLE).setMgCommonGameSettle(mgCommonGameSettle));
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN: // 4. 加入游戏按钮点击状态
|
||||
SudMGPMGState.MGCommonSelfClickJoinBtn mgCommonSelfClickJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickJoinBtn.class);
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSeatIndex(mgCommonSelfClickJoinBtn.seatIndex).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSeatIndex(mgCommonSelfClickJoinBtn.seatIndex).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN).setSubReady(false));
|
||||
// if (listener == null) {
|
||||
// ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
// } else {
|
||||
@@ -227,10 +232,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) {
|
||||
@@ -254,7 +259,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
// } else {
|
||||
// listener.onGameMGCommonSelfClickGameSettleAgainBtn(handle, mgCommonSelfClickGameSettleAgainBtn);
|
||||
// }
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_GAME_SOUND_LIST: // 13. 游戏上报游戏中的声音列表(2021-12-30新增,现在只支持碰碰我最强)
|
||||
SudMGPMGState.MGCommonGameSoundList mgCommonGameSoundList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSoundList.class);
|
||||
@@ -354,6 +359,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 +1034,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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -170,6 +170,15 @@ public class SudMGPMGState implements Serializable {
|
||||
// 游戏结果玩家列表
|
||||
public List<PlayerResult> results;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MGCommonGameSettle{" +
|
||||
"gameMode=" + gameMode +
|
||||
", gameRoundId='" + gameRoundId + '\'' +
|
||||
", results=" + results +
|
||||
'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏结果玩家定义
|
||||
*/
|
||||
@@ -181,6 +190,19 @@ public class SudMGPMGState implements Serializable {
|
||||
public int isEscaped; // 是否逃跑 1:逃跑 0:非逃跑
|
||||
public String killerId; // 杀自己的玩家的id
|
||||
public int isAI; // 是否是AI玩家,1为AI
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlayerResult{" +
|
||||
"uid='" + uid + '\'' +
|
||||
", rank=" + rank +
|
||||
", award=" + award +
|
||||
", score=" + score +
|
||||
", isEscaped=" + isEscaped +
|
||||
", killerId='" + killerId + '\'' +
|
||||
", isAI=" + isAI +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,6 +518,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();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user