Compare commits
65 Commits
dev_6.6.3
...
dev_6.6.4_
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a5e581978 | |||
| 8a7b65955c | |||
|
|
3445ee2a56 | ||
| cf2274195f | |||
|
|
aad607ace8 | ||
| 17506f6cbf | |||
|
|
418073f07e | ||
|
|
319295de57 | ||
| 30bdf83724 | |||
| fbb801bf62 | |||
|
|
44601c74b4 | ||
| 2808e41288 | |||
| 05aea2448f | |||
| 34986d6897 | |||
| 924afce81e | |||
| 48dcfd4a04 | |||
|
|
163ab1c80d | ||
| e06f944def | |||
|
|
a5d546d1d1 | ||
| 1304ec6cde | |||
|
|
f46d14ce28 | ||
| e2005582fe | |||
| a56a5849fe | |||
|
|
1495bfee99 | ||
| 19eecd7022 | |||
|
|
d415efde35 | ||
| 61ee585ae9 | |||
|
|
7b103aaf7c | ||
|
|
9eba98f709 | ||
| dea3264577 | |||
|
|
42cfcce1dc | ||
|
|
ac78268a85 | ||
| d001712067 | |||
|
|
dc28a3d81e | ||
| 728dec9d97 | |||
|
|
215a2f8927 | ||
| 58ace7d613 | |||
|
|
3982afb0d3 | ||
|
|
280920d5f0 | ||
|
|
e353638ec1 | ||
|
|
65a3a64d7d | ||
| b10312118b | |||
|
|
419b5d08b4 | ||
|
|
b146f93029 | ||
|
|
ef34a6cf4f | ||
| cdf3c4e411 | |||
|
|
d0b7b065b2 | ||
| 53e6cb5a70 | |||
|
|
5895fa8d71 | ||
|
|
48886374d5 | ||
|
|
32d0fe497d | ||
|
|
6347473d0c | ||
| 6df819f3b1 | |||
| 39fbe90e8b | |||
|
|
3396ca63d0 | ||
|
|
484891cfe7 | ||
|
|
5c00e065d2 | ||
| ef76b2c7e4 | |||
| 0c7ae4e4f7 | |||
|
|
b35d5d242e | ||
| b8264997f4 | |||
|
|
9dba41c22f | ||
|
|
7c44f09803 | ||
|
|
0b89ac21e8 | ||
|
|
238181deca |
@@ -34,14 +34,14 @@ public class ShareBuilder {
|
|||||||
"/index.php?g=Appapi&m=home&a=share&uid=%s&user_id=%s&isGoogle=%s",
|
"/index.php?g=Appapi&m=home&a=share&uid=%s&user_id=%s&isGoogle=%s",
|
||||||
anchorId,
|
anchorId,
|
||||||
shareUid,
|
shareUid,
|
||||||
CommonAppConfig.IS_GOOGLE_PLAY ? "1" : "0"
|
CommonAppConfig.IS_GOOGLE_PLAY
|
||||||
) ;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createInviteLink(String shareUid) {
|
public static String createInviteLink(String shareUid) {
|
||||||
return String.format("https://www.pdlive.com/public/app/download/index.html?user_id=%s&isGoogle=%s",
|
return String.format("https://www.pdlive.com/public/app/download/index.html?user_id=%s&isGoogle=%s",
|
||||||
shareUid,
|
shareUid,
|
||||||
CommonAppConfig.IS_GOOGLE_PLAY ? "1" : "0"
|
CommonAppConfig.IS_GOOGLE_PLAY
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InvitePopDialog setUrl(String data) {
|
public InvitePopDialog setUrl(String data) {
|
||||||
this.url = data + "&isGoogle=" + (CommonAppConfig.IS_GOOGLE_PLAY ? "1" : "0");
|
this.url = data + "&isGoogle=" + CommonAppConfig.IS_GOOGLE_PLAY;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,21 +26,21 @@
|
|||||||
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
|
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
|
||||||
},
|
},
|
||||||
"client":{
|
"client":{
|
||||||
"cp_id":"30086000612391734",
|
"cp_id":"30852000032486141",
|
||||||
"product_id":"99536292102564216",
|
"product_id":"388421841221767494",
|
||||||
"client_id":"964994320723627840",
|
"client_id":"1283893262452580800",
|
||||||
"client_secret":"6D5FE29D85B967D3A66BDCD473641E4C7B5524F7F4935CA0EF4A842730C3402D",
|
"client_secret":"17BC070420691D35650C694230D6348075CB549F7BBA94EDD49FA9E61A9E5434",
|
||||||
"project_id":"99536292102564216",
|
"project_id":"388421841221767494",
|
||||||
"app_id":"106936673",
|
"app_id":"109612651",
|
||||||
"api_key":"DAEDADYGta/0O4ZSdrnug52NgC67/w/RIyTq9A8LyAY0+mp6g6XeJDbxugpluFPLAhaqjaMs5c0PLnRx14UzWbPPADgi1EqihbWLoA==",
|
"api_key":"DAEDAAlBbTFuTuyQWQsyYBZLuyjALH9Y9BNFkVZl1GhI0tRaa6HF1LgzXWy2MZiSFrmpbn1aAvcvzP6aKZtR6MVikS8V4SbBlYUPfQ==",
|
||||||
"package_name":"com.pdlive.shayu"
|
"package_name":"com.pdlive.shayu"
|
||||||
},
|
},
|
||||||
"oauth_client":{
|
"oauth_client":{
|
||||||
"client_id":"106936673",
|
"client_id":"109612651",
|
||||||
"client_type":1
|
"client_type":1
|
||||||
},
|
},
|
||||||
"app_info":{
|
"app_info":{
|
||||||
"app_id":"106936673",
|
"app_id":"109612651",
|
||||||
"package_name":"com.pdlive.shayu"
|
"package_name":"com.pdlive.shayu"
|
||||||
},
|
},
|
||||||
"service":{
|
"service":{
|
||||||
@@ -53,6 +53,10 @@
|
|||||||
"resource_id":"p1",
|
"resource_id":"p1",
|
||||||
"channel_id":""
|
"channel_id":""
|
||||||
},
|
},
|
||||||
|
"edukit":{
|
||||||
|
"edu_url":"edukit.cloud.huawei.com.cn",
|
||||||
|
"dh_url":"edukit.cloud.huawei.com.cn"
|
||||||
|
},
|
||||||
"search":{
|
"search":{
|
||||||
"url":"https://search-drcn.cloud.huawei.com"
|
"url":"https://search-drcn.cloud.huawei.com"
|
||||||
},
|
},
|
||||||
@@ -77,15 +81,15 @@
|
|||||||
{
|
{
|
||||||
"package_name":"com.pdlive.shayu",
|
"package_name":"com.pdlive.shayu",
|
||||||
"client":{
|
"client":{
|
||||||
"app_id":"106936673"
|
"app_id":"109612651"
|
||||||
},
|
},
|
||||||
"app_info":{
|
"app_info":{
|
||||||
"package_name":"com.pdlive.shayu",
|
"package_name":"com.pdlive.shayu",
|
||||||
"app_id":"106936673"
|
"app_id":"109612651"
|
||||||
},
|
},
|
||||||
"oauth_client":{
|
"oauth_client":{
|
||||||
"client_type":1,
|
"client_type":1,
|
||||||
"client_id":"106936673"
|
"client_id":"109612651"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -130,58 +130,57 @@ android {
|
|||||||
}
|
}
|
||||||
variant.mergeAssetsProvider.configure {
|
variant.mergeAssetsProvider.configure {
|
||||||
doLast {
|
doLast {
|
||||||
delete(fileTree(dir: outputDir, includes: [
|
delete(fileTree(dir: outputDir, includes: ['model/ai_bgseg_green.bundle',
|
||||||
'model/ai_bgseg_green.bundle',
|
'model/ai_face_processor.bundle',
|
||||||
'model/ai_face_processor.bundle',
|
//'model/ai_face_processor_lite.bundle',
|
||||||
//'model/ai_face_processor_lite.bundle',
|
'model/ai_hairseg.bundle',
|
||||||
'model/ai_hairseg.bundle',
|
'model/ai_hand_processor.bundle',
|
||||||
'model/ai_hand_processor.bundle',
|
'model/ai_human_processor.bundle',
|
||||||
'model/ai_human_processor.bundle',
|
'model/ai_human_processor_gpu.bundle',
|
||||||
'model/ai_human_processor_gpu.bundle',
|
'model/ai_human_processor_mb_fast.bundle',
|
||||||
'model/ai_human_processor_mb_fast.bundle',
|
'graphics/body_slim.bundle',
|
||||||
'graphics/body_slim.bundle',
|
'graphics/controller_cpp.bundle',
|
||||||
'graphics/controller_cpp.bundle',
|
//'graphics/face_beautification.bundle',
|
||||||
//'graphics/face_beautification.bundle',
|
'graphics/face_makeup.bundle',
|
||||||
'graphics/face_makeup.bundle',
|
'graphics/fuzzytoonfilter.bundle',
|
||||||
'graphics/fuzzytoonfilter.bundle',
|
'graphics/fxaa.bundle',
|
||||||
'graphics/fxaa.bundle',
|
'graphics/tongue.bundle',
|
||||||
'graphics/tongue.bundle',
|
//旧美颜
|
||||||
//旧美颜
|
'model-all.zip',
|
||||||
'model-all.zip',
|
'filterData.zip',
|
||||||
'filterData.zip',
|
'KSYResource/*',
|
||||||
'KSYResource/*',
|
'Resources/*',
|
||||||
'Resources/*',
|
'Asset/*',
|
||||||
'Asset/*',
|
'image_effect_shaders/*',
|
||||||
'image_effect_shaders/*',
|
'internal/*'
|
||||||
'internal/*'
|
//美颜基础组件
|
||||||
//美颜基础组件
|
|
||||||
|
|
||||||
]))
|
]))
|
||||||
println "isPluginModel = " + rootProject.ext.manifestPlaceholders.isPluginModel
|
println "isPluginModel = " + rootProject.ext.manifestPlaceholders.isPluginModel
|
||||||
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
||||||
delete(fileTree(dir: outputDir, includes: [
|
delete(fileTree(dir: outputDir, includes: ['model/ai_face_processor_lite.bundle',
|
||||||
'model/ai_face_processor_lite.bundle',
|
'graphics/face_beautification.bundle']))
|
||||||
'graphics/face_beautification.bundle'
|
|
||||||
]))
|
|
||||||
} else {
|
} else {
|
||||||
println "不删除bundle"
|
println "不删除bundle"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
variant.outputs.all {
|
variant.outputs.all {
|
||||||
def isGoogle = "link"
|
def isGoogle = "链接"
|
||||||
if (rootProject.ext.manifestPlaceholders.isGooglePlay) {
|
if (rootProject.ext.manifestPlaceholders.isGooglePlay == 1) {
|
||||||
isGoogle = "Google"
|
isGoogle = "谷歌"
|
||||||
|
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) {
|
||||||
|
isGoogle = "Huawei"
|
||||||
}
|
}
|
||||||
def isPlugin = "all"
|
def isPlugin = "完整"
|
||||||
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
|
||||||
isPlugin = "plugin"
|
isPlugin = "插件"
|
||||||
}
|
}
|
||||||
def isTest = "测试服"
|
def isTest = "测试服"
|
||||||
if (rootProject.ext.manifestPlaceholders.serverHost == "https://napi.yaoulive.com") {
|
if (rootProject.ext.manifestPlaceholders.serverHost == "https://napi.yaoulive.com") {
|
||||||
isTest = "正式服"
|
isTest = "正式服"
|
||||||
}
|
}
|
||||||
outputFileName = "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk"
|
outputFileName = "[${new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,7 +230,6 @@ android {
|
|||||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@@ -266,8 +264,8 @@ dependencies {
|
|||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||||
|
|
||||||
implementation platform('com.google.firebase:firebase-bom:30.5.0')
|
//implementation platform('com.google.firebase:firebase-bom:30.5.0')
|
||||||
implementation 'com.google.firebase:firebase-crashlytics'
|
//implementation 'com.google.firebase:firebase-crashlytics'
|
||||||
|
|
||||||
//直播
|
//直播
|
||||||
api project(':main')
|
api project(':main')
|
||||||
|
|||||||
15
app/proguard-rules.pro
vendored
@@ -277,3 +277,18 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode;
|
|||||||
-keep class tech.sud.mgp.hello.common.event.model.** {*;}
|
-keep class tech.sud.mgp.hello.common.event.model.** {*;}
|
||||||
|
|
||||||
-keep class com.yunbao.common.sud.** {*;}
|
-keep class com.yunbao.common.sud.** {*;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-ignorewarnings
|
||||||
|
-keepattributes *Annotation*
|
||||||
|
-keepattributes Exceptions
|
||||||
|
-keepattributes InnerClasses
|
||||||
|
-keepattributes Signature
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
-keep class com.huawei.hianalytics.**{*;}
|
||||||
|
-keep class com.huawei.updatesdk.**{*;}
|
||||||
|
-keep class com.huawei.hms.**{*;}
|
||||||
|
|
||||||
|
-keep class com.shayu.lib_google.**{*;}
|
||||||
|
-keep class com.shayu.lib_huawei.**{*;}
|
||||||
|
|||||||
@@ -194,12 +194,13 @@
|
|||||||
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
|
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<!-- <meta-data-->
|
|
||||||
<!-- android:name="com.huawei.hms.client.appid"-->
|
<meta-data
|
||||||
<!-- android:value="106936673"/>-->
|
android:name="com.huawei.hms.client.appid"
|
||||||
<!-- <meta-data-->
|
android:value="109612651" />
|
||||||
<!-- android:name="com.huawei.hms.client.cpid"-->
|
<meta-data
|
||||||
<!-- android:value="30086000612391734"/>-->
|
android:name="com.huawei.hms.client.cpid"
|
||||||
|
android:value="30852000032486141" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -6,7 +6,6 @@ import android.app.Activity;
|
|||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.http.HttpResponseCache;
|
import android.net.http.HttpResponseCache;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@@ -24,9 +23,6 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.blankj.utilcode.util.Utils;
|
import com.blankj.utilcode.util.Utils;
|
||||||
import com.facebook.appevents.AppEventsLogger;
|
import com.facebook.appevents.AppEventsLogger;
|
||||||
import com.fm.openinstall.OpenInstall;
|
import com.fm.openinstall.OpenInstall;
|
||||||
import com.google.firebase.FirebaseApp;
|
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
|
||||||
import com.shayu.phonelive.utils.LogUtils;
|
import com.shayu.phonelive.utils.LogUtils;
|
||||||
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
|
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
|
||||||
import com.tencent.imsdk.v2.V2TIMManager;
|
import com.tencent.imsdk.v2.V2TIMManager;
|
||||||
@@ -46,9 +42,9 @@ import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
|||||||
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
|
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
|
||||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||||
import com.yunbao.common.utils.AppManager;
|
import com.yunbao.common.utils.AppManager;
|
||||||
|
import com.yunbao.common.utils.GoogleUtils;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.SpUtil;
|
import com.yunbao.common.utils.SpUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
|
||||||
import com.yunbao.live.socket.SocketReceiveBean;
|
import com.yunbao.live.socket.SocketReceiveBean;
|
||||||
import com.yunbao.live.socket.SocketRyClient;
|
import com.yunbao.live.socket.SocketRyClient;
|
||||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||||
@@ -62,7 +58,6 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.rong.imkit.config.RongConfigCenter;
|
import io.rong.imkit.config.RongConfigCenter;
|
||||||
@@ -145,7 +140,6 @@ public class AppContext extends CommonAppContext {
|
|||||||
sInstance = this;
|
sInstance = this;
|
||||||
L.setDeBug(BuildConfig.DEBUG);
|
L.setDeBug(BuildConfig.DEBUG);
|
||||||
AppEventsLogger.activateApp(this);
|
AppEventsLogger.activateApp(this);
|
||||||
FirebaseAnalytics.getInstance(this);
|
|
||||||
|
|
||||||
File httpCacheDir = new File(getCacheDir(), "https");
|
File httpCacheDir = new File(getCacheDir(), "https");
|
||||||
try {
|
try {
|
||||||
@@ -160,7 +154,6 @@ public class AppContext extends CommonAppContext {
|
|||||||
}
|
}
|
||||||
ARouter.init(this);
|
ARouter.init(this);
|
||||||
|
|
||||||
|
|
||||||
//初始化 邀请码库
|
//初始化 邀请码库
|
||||||
if (isMainProcess()) {
|
if (isMainProcess()) {
|
||||||
OpenInstall.init(this);
|
OpenInstall.init(this);
|
||||||
@@ -170,8 +163,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
|
|
||||||
|
|
||||||
//友盟正式初始化
|
//友盟正式初始化
|
||||||
UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE,
|
UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE, "64e40ee55488fe7b3afa2c96");
|
||||||
"64e40ee55488fe7b3afa2c96");
|
|
||||||
|
|
||||||
//集成umeng-crash-vx.x.x.aar,则需要关闭原有统计SDK异常捕获功能
|
//集成umeng-crash-vx.x.x.aar,则需要关闭原有统计SDK异常捕获功能
|
||||||
MobclickAgent.setCatchUncaughtExceptions(false);
|
MobclickAgent.setCatchUncaughtExceptions(false);
|
||||||
@@ -212,9 +204,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
if (content.getContent().contains("_method_")) {
|
if (content.getContent().contains("_method_")) {
|
||||||
msg.obj = content.getContent();
|
msg.obj = content.getContent();
|
||||||
//观众页面
|
//观众页面
|
||||||
if (SocketRyClient.mSocketHandler != null
|
if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
|
||||||
&& (TextUtils.equals("__system__", message.getTargetId())
|
|
||||||
|| ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) {
|
|
||||||
SocketRyClient.mSocketHandler.sendMessage(msg);
|
SocketRyClient.mSocketHandler.sendMessage(msg);
|
||||||
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
|
} else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知
|
||||||
SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class);
|
SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class);
|
||||||
@@ -313,40 +303,37 @@ public class AppContext extends CommonAppContext {
|
|||||||
* 注册全局异常捕获,有需要时可以在onCreate调用
|
* 注册全局异常捕获,有需要时可以在onCreate调用
|
||||||
*/
|
*/
|
||||||
private void registerError() {
|
private void registerError() {
|
||||||
NeverCrashUtils.getInstance()
|
NeverCrashUtils.getInstance().setDebugMode(BuildConfig.DEBUG).setMainCrashHandler((t, e) -> {
|
||||||
.setDebugMode(BuildConfig.DEBUG)
|
Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
||||||
.setMainCrashHandler((t, e) -> {
|
e.printStackTrace();
|
||||||
Log.e("ApplicationError", "主线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
AppManager.runDebugCode(() -> {
|
||||||
e.printStackTrace();
|
//闪退后finish所有Activity并且杀死进程
|
||||||
AppManager.runDebugCode(() -> {
|
for (WeakReference<Activity> activity : activities) {
|
||||||
//闪退后finish所有Activity并且杀死进程
|
if (activity != null && activity.get() != null) {
|
||||||
for (WeakReference<Activity> activity : activities) {
|
activity.get().finish();
|
||||||
if (activity != null && activity.get() != null) {
|
}
|
||||||
activity.get().finish();
|
}
|
||||||
}
|
Process.killProcess(Process.myPid());
|
||||||
}
|
System.exit(0);
|
||||||
Process.killProcess(Process.myPid());
|
setFirebaseCrashData();
|
||||||
System.exit(0);
|
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||||
setFirebaseCrashData();
|
throw new RuntimeException(e);
|
||||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
}, 100);
|
||||||
throw new RuntimeException(e);
|
});
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
|
|
||||||
})
|
}).setUncaughtCrashHandler((t, e) -> {
|
||||||
.setUncaughtCrashHandler((t, e) -> {
|
Log.e("ApplicationError", "子线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
||||||
Log.e("ApplicationError", "子线程异常");//此处log只是展示,当debug为true时,主类内部log会打印异常信息
|
e.printStackTrace();
|
||||||
e.printStackTrace();
|
}).register(this);
|
||||||
})
|
|
||||||
.register(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerFirebaseCrash() {
|
public void registerFirebaseCrash() {
|
||||||
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
|
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FirebaseAnalytics.getInstance(this);
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
FirebaseApp.initializeApp(this);
|
GoogleUtils.newInstance(this).initializeApp(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -355,21 +342,5 @@ public class AppContext extends CommonAppContext {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String uid = CommonAppConfig.getInstance().getUid();
|
String uid = CommonAppConfig.getInstance().getUid();
|
||||||
FirebaseCrashlytics.getInstance().setUserId(CommonAppConfig.getInstance().getUid());
|
|
||||||
if (uid != null && !uid.isEmpty()) {
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("uid", uid);
|
|
||||||
} else {
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("uid", "uid is null");
|
|
||||||
}
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("userData", SpUtil.getInstance().getStringValue(SpUtil.USER_INFO));
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY);
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("PhoneName", Build.BRAND);
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("Phone", Build.MODEL);
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("CPU", Arrays.toString(Build.SUPPORTED_ABIS));
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("RunTime", (System.currentTimeMillis() - CrashSaveBean.getInstance().getStartTime()));
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("enterRoom", CrashSaveBean.getInstance().getEnterRoom());
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("slidingRoom", CrashSaveBean.getInstance().getSlidingRoom());
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("playSvga", CrashSaveBean.getInstance().getPlaySvga());
|
|
||||||
FirebaseCrashlytics.getInstance().setCustomKey("ActivitySize", CrashSaveBean.getInstance().getActivitySize());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import android.os.Looper;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
|
||||||
import com.yunbao.common.BuildConfig;
|
import com.yunbao.common.BuildConfig;
|
||||||
import com.yunbao.common.bean.CrashSaveBean;
|
import com.yunbao.common.bean.CrashSaveBean;
|
||||||
import com.yunbao.common.utils.AppManager;
|
import com.yunbao.common.utils.AppManager;
|
||||||
@@ -108,7 +107,6 @@ public class NeverCrashUtils {
|
|||||||
}
|
}
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
AppContext.setFirebaseCrashData();
|
AppContext.setFirebaseCrashData();
|
||||||
FirebaseCrashlytics.getInstance().recordException(e);
|
|
||||||
AppManager.runDebugCode(() -> Toast.makeText(application, "发生闪退:" + e.getMessage(), Toast.LENGTH_SHORT).show());
|
AppManager.runDebugCode(() -> Toast.makeText(application, "发生闪退:" + e.getMessage(), Toast.LENGTH_SHORT).show());
|
||||||
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log");
|
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log");
|
||||||
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
|
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/*
|
||||||
package com.shayu.phonelive.utils;
|
package com.shayu.phonelive.utils;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
@@ -108,3 +109,4 @@ public class MyNotificationService extends FirebaseMessagingService {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ buildscript {
|
|||||||
maven { url 'https://maven.fabric.io/public' }
|
maven { url 'https://maven.fabric.io/public' }
|
||||||
maven { url 'http://maven.faceunity.com/repository/maven-public/' }//美颜库
|
maven { url 'http://maven.faceunity.com/repository/maven-public/' }//美颜库
|
||||||
maven { url 'https://repo1.maven.org/maven2/' }//埋点
|
maven { url 'https://repo1.maven.org/maven2/' }//埋点
|
||||||
|
maven {url 'https://developer.huawei.com/repo/'}
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
@@ -24,6 +25,7 @@ buildscript {
|
|||||||
classpath 'com.google.gms:google-services:4.3.3'
|
classpath 'com.google.gms:google-services:4.3.3'
|
||||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
|
||||||
classpath "com.alibaba:arouter-register:1.0.2"
|
classpath "com.alibaba:arouter-register:1.0.2"
|
||||||
|
classpath 'com.huawei.agconnect:agcp:1.5.2.300'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,11 @@ dependencies {
|
|||||||
|
|
||||||
//谷歌支付
|
//谷歌支付
|
||||||
//谷歌内购
|
//谷歌内购
|
||||||
api 'com.android.billingclient:billing:5.0.0'
|
//api 'com.android.billingclient:billing:5.0.0'
|
||||||
|
|
||||||
|
//api 'com.google.firebase:firebase-messaging:23.0.6'
|
||||||
|
//api 'com.google.firebase:firebase-analytics:21.1.0'
|
||||||
|
|
||||||
api 'com.squareup.picasso:picasso:2.5.2'
|
api 'com.squareup.picasso:picasso:2.5.2'
|
||||||
api "com.immomo.cosmos.mediax:beautyutils:2.2.1_01071700"
|
api "com.immomo.cosmos.mediax:beautyutils:2.2.1_01071700"
|
||||||
api files('libs/liteavsdk.jar')
|
api files('libs/liteavsdk.jar')
|
||||||
@@ -180,15 +184,14 @@ dependencies {
|
|||||||
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
|
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
|
||||||
//loading样式库
|
//loading样式库
|
||||||
api 'com.wang.avi:library:2.1.3'
|
api 'com.wang.avi:library:2.1.3'
|
||||||
api 'com.google.firebase:firebase-messaging:23.0.6'
|
|
||||||
api 'com.google.firebase:firebase-analytics:21.1.0'
|
|
||||||
// api 'com.huawei.hms:push:4.0.2.300'
|
// api 'com.huawei.hms:push:4.0.2.300'
|
||||||
implementation 'com.github.tajchert:WaitingDots:0.6.1'
|
implementation 'com.github.tajchert:WaitingDots:0.6.1'
|
||||||
//悬浮窗
|
//悬浮窗
|
||||||
api 'com.github.princekin-f:EasyFloat:2.0.4'
|
api 'com.github.princekin-f:EasyFloat:2.0.4'
|
||||||
api files('libs/Msc.jar')
|
api files('libs/Msc.jar')
|
||||||
|
|
||||||
api 'com.github.li-xiaojun:XPopup:2.9.1'
|
api 'com.github.li-xiaojun:XPopup:2.10.0'
|
||||||
|
|
||||||
api 'com.github.shenbengit:PagerGridLayoutManager:1.1.7'
|
api 'com.github.shenbengit:PagerGridLayoutManager:1.1.7'
|
||||||
//选择器
|
//选择器
|
||||||
@@ -206,4 +209,11 @@ dependencies {
|
|||||||
|
|
||||||
// 多语言语音识别扩展库(可选)
|
// 多语言语音识别扩展库(可选)
|
||||||
api 'tech.sud.mgp:SudASR:1.3.3.1158'
|
api 'tech.sud.mgp:SudASR:1.3.3.1158'
|
||||||
|
|
||||||
|
//华为支付插件包
|
||||||
|
//api project(':lib_huawei')
|
||||||
|
|
||||||
|
//google插件包
|
||||||
|
api project(':lib_google')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yunbao.common.bean.ConfigBean;
|
import com.yunbao.common.bean.ConfigBean;
|
||||||
import com.yunbao.common.bean.FansMedalBean;
|
import com.yunbao.common.bean.FansMedalBean;
|
||||||
import com.yunbao.common.bean.LevelBean;
|
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.bean.UserItemBean;
|
import com.yunbao.common.bean.UserItemBean;
|
||||||
import com.yunbao.common.http.CommonHttpUtil;
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
@@ -29,12 +28,11 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Created by cxf on 2017/8/4.
|
* Created by cxf on 2017/8/4.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CommonAppConfig {
|
public class CommonAppConfig {
|
||||||
//域名
|
//域名
|
||||||
public static final String HOST = getMetaDataString("SERVER_HOST");
|
public static final String HOST = getMetaDataString("SERVER_HOST");
|
||||||
//是否使用谷歌支付
|
//是否使用谷歌支付
|
||||||
public static final boolean IS_GOOGLE_PLAY = getMetaDataBoolean("IS_GOOGLE_PLAY");
|
public static final int IS_GOOGLE_PLAY = getMetaDataInt("IS_GOOGLE_PLAY");
|
||||||
//是否开启上报错误日志功能
|
//是否开启上报错误日志功能
|
||||||
public static final boolean IS_UPLOAD_ERROR_LOG = getMetaDataBoolean("IS_UPLOAD_ERROR_LOG");
|
public static final boolean IS_UPLOAD_ERROR_LOG = getMetaDataBoolean("IS_UPLOAD_ERROR_LOG");
|
||||||
//是否为插件包模式
|
//是否为插件包模式
|
||||||
@@ -109,8 +107,6 @@ public class CommonAppConfig {
|
|||||||
private boolean mLaunched;//App是否启动了
|
private boolean mLaunched;//App是否启动了
|
||||||
private String mJPushAppKey;//极光推送的AppKey
|
private String mJPushAppKey;//极光推送的AppKey
|
||||||
private List<UserItemBean> mUserItemList;//个人中心功能列表
|
private List<UserItemBean> mUserItemList;//个人中心功能列表
|
||||||
private SparseArray<LevelBean> mLevelMap;
|
|
||||||
private SparseArray<LevelBean> mAnchorLevelMap;
|
|
||||||
private SparseArray<FansMedalBean> mAnchorFansMedalMap;
|
private SparseArray<FansMedalBean> mAnchorFansMedalMap;
|
||||||
private String mGiftListJson;
|
private String mGiftListJson;
|
||||||
private String mWrapListJson;
|
private String mWrapListJson;
|
||||||
@@ -470,6 +466,18 @@ public class CommonAppConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static int getMetaDataInt(String key) {
|
||||||
|
int res = 0;
|
||||||
|
try {
|
||||||
|
ApplicationInfo appInfo = CommonAppContext.sInstance.getPackageManager().getApplicationInfo(CommonAppContext.sInstance.getPackageName(), PackageManager.GET_META_DATA);
|
||||||
|
res = appInfo.metaData.getInt(key);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人中心功能列表
|
* 个人中心功能列表
|
||||||
*/
|
*/
|
||||||
@@ -509,46 +517,6 @@ public class CommonAppConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存用户等级信息
|
|
||||||
*/
|
|
||||||
public void setLevel(String levelJson) {
|
|
||||||
if (TextUtils.isEmpty(levelJson)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<LevelBean> list = JSON.parseArray(levelJson, LevelBean.class);
|
|
||||||
if (list == null || list.size() == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mLevelMap == null) {
|
|
||||||
mLevelMap = new SparseArray<>();
|
|
||||||
}
|
|
||||||
mLevelMap.clear();
|
|
||||||
for (LevelBean bean : list) {
|
|
||||||
mLevelMap.put(bean.getLevel(), bean);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存主播等级信息
|
|
||||||
*/
|
|
||||||
public void setAnchorLevel(String anchorLevelJson) {
|
|
||||||
if (TextUtils.isEmpty(anchorLevelJson)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<LevelBean> list = JSON.parseArray(anchorLevelJson, LevelBean.class);
|
|
||||||
if (list == null || list.size() == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mAnchorLevelMap == null) {
|
|
||||||
mAnchorLevelMap = new SparseArray<>();
|
|
||||||
}
|
|
||||||
mAnchorLevelMap.clear();
|
|
||||||
for (LevelBean bean : list) {
|
|
||||||
mAnchorLevelMap.put(bean.getLevel(), bean);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存主播粉丝徽章信息
|
* 保存主播粉丝徽章信息
|
||||||
*/
|
*/
|
||||||
@@ -587,40 +555,6 @@ public class CommonAppConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户等级
|
|
||||||
*/
|
|
||||||
public LevelBean getLevel(int level) {
|
|
||||||
if (mLevelMap == null) {
|
|
||||||
String configString = SpUtil.getInstance().getStringValue(SpUtil.CONFIG);
|
|
||||||
if (!TextUtils.isEmpty(configString)) {
|
|
||||||
JSONObject obj = JSON.parseObject(configString);
|
|
||||||
setLevel(obj.getString("level"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mLevelMap == null || mLevelMap.size() == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return mLevelMap.get(level);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取主播等级
|
|
||||||
*/
|
|
||||||
public LevelBean getAnchorLevel(int level) {
|
|
||||||
if (mAnchorLevelMap == null) {
|
|
||||||
String configString = SpUtil.getInstance().getStringValue(SpUtil.CONFIG);
|
|
||||||
if (!TextUtils.isEmpty(configString)) {
|
|
||||||
JSONObject obj = JSON.parseObject(configString);
|
|
||||||
setAnchorLevel(obj.getString("levelanchor"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mAnchorLevelMap == null || mAnchorLevelMap.size() == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return mAnchorLevelMap.get(level);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGiftListJson() {
|
public String getGiftListJson() {
|
||||||
return mGiftListJson;
|
return mGiftListJson;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,9 +55,11 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
// RongPushClient.setPushConfig(config); //将推送相关配置设置到 SDK
|
// RongPushClient.setPushConfig(config); //将推送相关配置设置到 SDK
|
||||||
//设置新加坡融云服务器 有时候国内收不到推送是因为这个
|
//设置新加坡融云服务器 有时候国内收不到推送是因为这个
|
||||||
RongIMClient.setServerInfo("navsg01.cn.ronghub.com", null);
|
RongIMClient.setServerInfo("navsg01.cn.ronghub.com", null);
|
||||||
//谷歌推送
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
PushConfig gconfig = new PushConfig.Builder().enableFCM(true).build();
|
//谷歌推送
|
||||||
RongPushClient.setPushConfig(gconfig);
|
PushConfig gconfig = new PushConfig.Builder().enableFCM(true).build();
|
||||||
|
RongPushClient.setPushConfig(gconfig);
|
||||||
|
}
|
||||||
//初始化友盟统计
|
//初始化友盟统计
|
||||||
// UMConfigure.init(this, UMConfigure.DEVICE_TYPE_PHONE, null);
|
// UMConfigure.init(this, UMConfigure.DEVICE_TYPE_PHONE, null);
|
||||||
FacebookSdk.sdkInitialize(getApplicationContext());
|
FacebookSdk.sdkInitialize(getApplicationContext());
|
||||||
|
|||||||
@@ -263,6 +263,8 @@ public class Constants {
|
|||||||
|
|
||||||
public static final String LIVE_SDK = "liveSdk";
|
public static final String LIVE_SDK = "liveSdk";
|
||||||
public static final String LIVE_KSY_CONFIG = "liveKsyConfig";
|
public static final String LIVE_KSY_CONFIG = "liveKsyConfig";
|
||||||
|
|
||||||
|
public static final String LIVE_PK_RANDOM_START="RankingStartRandomPK";
|
||||||
public static final int LIVE_SDK_KSY = 0;//金山推流
|
public static final int LIVE_SDK_KSY = 0;//金山推流
|
||||||
public static final int LIVE_SDK_TX = 1;//腾讯推流
|
public static final int LIVE_SDK_TX = 1;//腾讯推流
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,175 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class BattlePassPoints extends BaseModel{
|
||||||
|
private int id;
|
||||||
|
private int type;
|
||||||
|
@SerializedName("rewards_name")
|
||||||
|
private String rewardsName;
|
||||||
|
@SerializedName("rewards_id")
|
||||||
|
private int rewardsId;
|
||||||
|
@SerializedName("image_url")
|
||||||
|
private String imageUrl;
|
||||||
|
@SerializedName("points_threshold")
|
||||||
|
private String pointsThreshold;
|
||||||
|
@SerializedName("points_threshold_text")
|
||||||
|
private String pointsThresholdText;
|
||||||
|
@SerializedName("rewards_value")
|
||||||
|
private String rewardsValue;
|
||||||
|
@SerializedName("battle_pass_level")
|
||||||
|
private int battlePassLevel;
|
||||||
|
@SerializedName("exchange_quantity")
|
||||||
|
private int exchangeQuantity;
|
||||||
|
@SerializedName("live_battle_pass_type_id")
|
||||||
|
private int liveBattlePassTypeId;
|
||||||
|
private String description;
|
||||||
|
@SerializedName("restrict_time")
|
||||||
|
private int restrictTime;
|
||||||
|
private int sort;
|
||||||
|
@SerializedName("exchange_status")
|
||||||
|
private int exchangeStatus;
|
||||||
|
@SerializedName("user_quinty_count")
|
||||||
|
private int userQuintyCount;
|
||||||
|
@SerializedName("exchange_status_remark")
|
||||||
|
private String exchangeMark;
|
||||||
|
|
||||||
|
public BattlePassPoints() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRewardsName() {
|
||||||
|
return rewardsName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRewardsName(String rewardsName) {
|
||||||
|
this.rewardsName = rewardsName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRewardsId() {
|
||||||
|
return rewardsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRewardsId(int rewardsId) {
|
||||||
|
this.rewardsId = rewardsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImageUrl() {
|
||||||
|
return imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageUrl(String imageUrl) {
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPointsThreshold() {
|
||||||
|
return pointsThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPointsThreshold(String pointsThreshold) {
|
||||||
|
this.pointsThreshold = pointsThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRewardsValue() {
|
||||||
|
return rewardsValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRewardsValue(String rewardsValue) {
|
||||||
|
this.rewardsValue = rewardsValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBattlePassLevel() {
|
||||||
|
return battlePassLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBattlePassLevel(int battlePassLevel) {
|
||||||
|
this.battlePassLevel = battlePassLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExchangeQuantity() {
|
||||||
|
return exchangeQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExchangeQuantity(int exchangeQuantity) {
|
||||||
|
this.exchangeQuantity = exchangeQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLiveBattlePassTypeId() {
|
||||||
|
return liveBattlePassTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLiveBattlePassTypeId(int liveBattlePassTypeId) {
|
||||||
|
this.liveBattlePassTypeId = liveBattlePassTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRestrictTime() {
|
||||||
|
return restrictTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRestrictTime(int restrictTime) {
|
||||||
|
this.restrictTime = restrictTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(int sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExchangeStatus() {
|
||||||
|
return exchangeStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExchangeStatus(int exchangeStatus) {
|
||||||
|
this.exchangeStatus = exchangeStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserQuintyCount() {
|
||||||
|
return userQuintyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserQuintyCount(int userQuintyCount) {
|
||||||
|
this.userQuintyCount = userQuintyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExchangeMark() {
|
||||||
|
return exchangeMark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExchangeMark(String exchangeMark) {
|
||||||
|
this.exchangeMark = exchangeMark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPointsThresholdText() {
|
||||||
|
return pointsThresholdText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPointsThresholdText(String pointsThresholdText) {
|
||||||
|
this.pointsThresholdText = pointsThresholdText;
|
||||||
|
}
|
||||||
|
}
|
||||||
157
common/src/main/java/com/yunbao/common/bean/BattlePassTask.java
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BattlePassTask extends BaseModel {
|
||||||
|
private List<Task> daily;// 每日任务
|
||||||
|
private List<Task> season;// 每期任务
|
||||||
|
|
||||||
|
public BattlePassTask() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Task> getDaily() {
|
||||||
|
return daily;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDaily(List<Task> daily) {
|
||||||
|
this.daily = daily;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Task> getSeason() {
|
||||||
|
return season;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeason(List<Task> season) {
|
||||||
|
this.season = season;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Task {
|
||||||
|
private int id;// 任务ID
|
||||||
|
private String type;// 任务类型
|
||||||
|
@SerializedName("task_success")
|
||||||
|
private int taskSuccess;// 任务可以重复的次数
|
||||||
|
@SerializedName("name_en")
|
||||||
|
private String nameEn;// 任务名称英文
|
||||||
|
@SerializedName("remark_en")
|
||||||
|
private String remarkEn;// 任务备注英文
|
||||||
|
private String name;// 任务名称中文
|
||||||
|
private String remark; // 任务备注中文
|
||||||
|
@SerializedName("image_path")
|
||||||
|
private String imagePath;// 图标path
|
||||||
|
@SerializedName("user_task_success")
|
||||||
|
private int userTaskSuccess;// 用户完成的任务次数
|
||||||
|
@SerializedName("received_task")
|
||||||
|
private int receivedTask;// 用户已经领取的任务数量
|
||||||
|
@SerializedName("not_received_task")
|
||||||
|
private int notReceivedTask; // 用户未领取的任务数量
|
||||||
|
public boolean isBuy(){
|
||||||
|
return taskSuccess==0;
|
||||||
|
}
|
||||||
|
public String getNameText(){
|
||||||
|
return WordUtil.isNewZh()?name:nameEn;
|
||||||
|
}
|
||||||
|
public String getRemarkText(){
|
||||||
|
return WordUtil.isNewZh()?remark:remarkEn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTaskSuccess() {
|
||||||
|
return taskSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskSuccess(int taskSuccess) {
|
||||||
|
this.taskSuccess = taskSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNameEn() {
|
||||||
|
return nameEn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameEn(String nameEn) {
|
||||||
|
this.nameEn = nameEn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemarkEn() {
|
||||||
|
return remarkEn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemarkEn(String remarkEn) {
|
||||||
|
this.remarkEn = remarkEn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImagePath() {
|
||||||
|
return imagePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImagePath(String imagePath) {
|
||||||
|
this.imagePath = imagePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserTaskSuccess() {
|
||||||
|
return userTaskSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserTaskSuccess(int userTaskSuccess) {
|
||||||
|
this.userTaskSuccess = userTaskSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getReceivedTask() {
|
||||||
|
return receivedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceivedTask(int receivedTask) {
|
||||||
|
this.receivedTask = receivedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNotReceivedTask() {
|
||||||
|
return notReceivedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotReceivedTask(int notReceivedTask) {
|
||||||
|
this.notReceivedTask = notReceivedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BattlePassUserInfoBean extends BaseModel{
|
||||||
|
private String uid;
|
||||||
|
private int points;
|
||||||
|
@SerializedName("battle_pass_exp")
|
||||||
|
private int battlePassExp;
|
||||||
|
@SerializedName("battle_pass_user_records_1")
|
||||||
|
private int battlePassUserRecords1;
|
||||||
|
@SerializedName("battle_pass_user_records_2")
|
||||||
|
private int battlePassUserRecords2;
|
||||||
|
@SerializedName("battle_pass_user_records_3")
|
||||||
|
private int battlePassUserRecords3;
|
||||||
|
private int level;
|
||||||
|
@SerializedName("last_level_exp")
|
||||||
|
private int lastLevelExp;
|
||||||
|
@SerializedName("next_level_exp")
|
||||||
|
private int nextLevelExp;
|
||||||
|
private String id;
|
||||||
|
@SerializedName("battle_pass_name")
|
||||||
|
private String battlePassName;
|
||||||
|
@SerializedName("start_time")
|
||||||
|
private String startTime;
|
||||||
|
@SerializedName("end_time")
|
||||||
|
private String endTime;
|
||||||
|
@SerializedName("battle_pass_status")
|
||||||
|
private boolean battlePassStatus;
|
||||||
|
@SerializedName("max_level_exp")
|
||||||
|
private long maxLevelExp;
|
||||||
|
@SerializedName("max_level")
|
||||||
|
private int maxLevel;
|
||||||
|
|
||||||
|
private List<LiveBattlePassRewardsBean.BattlePassType> live_battle_pass_type;
|
||||||
|
|
||||||
|
public BattlePassUserInfoBean() {
|
||||||
|
}
|
||||||
|
public List<LiveBattlePassRewardsBean.BattlePassType> getLive_battle_pass_type() {
|
||||||
|
return live_battle_pass_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLive_battle_pass_type(List<LiveBattlePassRewardsBean.BattlePassType> live_battle_pass_type) {
|
||||||
|
this.live_battle_pass_type = live_battle_pass_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(String uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPoints() {
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoints(int points) {
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBattlePassExp() {
|
||||||
|
return battlePassExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBattlePassExp(int battlePassExp) {
|
||||||
|
this.battlePassExp = battlePassExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBattlePassUserRecords1() {
|
||||||
|
return battlePassUserRecords1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBattlePassUserRecords1(int battlePassUserRecords1) {
|
||||||
|
this.battlePassUserRecords1 = battlePassUserRecords1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBattlePassUserRecords2() {
|
||||||
|
return battlePassUserRecords2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBattlePassUserRecords2(int battlePassUserRecords2) {
|
||||||
|
this.battlePassUserRecords2 = battlePassUserRecords2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBattlePassUserRecords3() {
|
||||||
|
return battlePassUserRecords3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBattlePassUserRecords3(int battlePassUserRecords3) {
|
||||||
|
this.battlePassUserRecords3 = battlePassUserRecords3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLastLevelExp() {
|
||||||
|
return lastLevelExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastLevelExp(int lastLevelExp) {
|
||||||
|
this.lastLevelExp = lastLevelExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNextLevelExp() {
|
||||||
|
return nextLevelExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNextLevelExp(int nextLevelExp) {
|
||||||
|
this.nextLevelExp = nextLevelExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBattlePassName() {
|
||||||
|
return battlePassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBattlePassName(String battlePassName) {
|
||||||
|
this.battlePassName = battlePassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(String startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndTime(String endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBattlePassStatus() {
|
||||||
|
return battlePassStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBattlePassStatus(boolean battlePassStatus) {
|
||||||
|
this.battlePassStatus = battlePassStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMaxLevelExp() {
|
||||||
|
return maxLevelExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxLevelExp(long maxLevelExp) {
|
||||||
|
this.maxLevelExp = maxLevelExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxLevel() {
|
||||||
|
return maxLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxLevel(int maxLevel) {
|
||||||
|
this.maxLevel = maxLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.yunbao.common.bean;
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
public class CoolConfig extends BaseModel {
|
public class CoolConfig extends BaseModel {
|
||||||
private int rate;
|
private int rate=1;
|
||||||
private String ticketCount="0" ;
|
private String ticketCount="0" ;
|
||||||
|
|
||||||
public String getTicketCount() {
|
public String getTicketCount() {
|
||||||
|
|||||||
@@ -0,0 +1,162 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class LiveBattlePassRewardsBean extends BaseModel{
|
||||||
|
private int level;
|
||||||
|
private List<BattlePassType> live_battle_pass_type;
|
||||||
|
private Map<Integer,Map<Integer,LiveBattlePassReward>> live_battle_pass_rewards;
|
||||||
|
|
||||||
|
public LiveBattlePassRewardsBean() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BattlePassType> getLive_battle_pass_type() {
|
||||||
|
return live_battle_pass_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLive_battle_pass_type(List<BattlePassType> live_battle_pass_type) {
|
||||||
|
this.live_battle_pass_type = live_battle_pass_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Integer,Map<Integer,LiveBattlePassReward>> getLive_battle_pass_rewards() {
|
||||||
|
return live_battle_pass_rewards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLive_battle_pass_rewards(Map<Integer,Map<Integer,LiveBattlePassReward>> live_battle_pass_rewards) {
|
||||||
|
this.live_battle_pass_rewards = live_battle_pass_rewards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BattlePassType extends BaseModel{
|
||||||
|
private int id;
|
||||||
|
private String battle_pass_name;
|
||||||
|
private int sort;
|
||||||
|
private int diamond_value;
|
||||||
|
private int lock;
|
||||||
|
|
||||||
|
public BattlePassType() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBattle_pass_name() {
|
||||||
|
return battle_pass_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBattle_pass_name(String battle_pass_name) {
|
||||||
|
this.battle_pass_name = battle_pass_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(int sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDiamond_value() {
|
||||||
|
return diamond_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDiamond_value(int diamond_value) {
|
||||||
|
this.diamond_value = diamond_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLock() {
|
||||||
|
return lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLock(int lock) {
|
||||||
|
this.lock = lock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class LiveBattlePassReward extends BaseModel{
|
||||||
|
private int id;
|
||||||
|
@SerializedName("live_battle_pass_level")
|
||||||
|
private int liveBattlePassLevel;
|
||||||
|
@SerializedName("live_battle_pass_type_id")
|
||||||
|
private int liveBattlePassTypeId;
|
||||||
|
@SerializedName("reward_name")
|
||||||
|
private String rewardName;
|
||||||
|
@SerializedName("image_url")
|
||||||
|
private String imageUrl;
|
||||||
|
private int lock;
|
||||||
|
private int received;
|
||||||
|
|
||||||
|
public LiveBattlePassReward() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLiveBattlePassLevel() {
|
||||||
|
return liveBattlePassLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLiveBattlePassLevel(int liveBattlePassLevel) {
|
||||||
|
this.liveBattlePassLevel = liveBattlePassLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLiveBattlePassTypeId() {
|
||||||
|
return liveBattlePassTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLiveBattlePassTypeId(int liveBattlePassTypeId) {
|
||||||
|
this.liveBattlePassTypeId = liveBattlePassTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRewardName() {
|
||||||
|
return rewardName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRewardName(String rewardName) {
|
||||||
|
this.rewardName = rewardName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImageUrl() {
|
||||||
|
return imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageUrl(String imageUrl) {
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLock() {
|
||||||
|
return lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLock(int lock) {
|
||||||
|
this.lock = lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getReceived() {
|
||||||
|
return received;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceived(int received) {
|
||||||
|
this.received = received;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.style.ImageSpan;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.lxj.xpopup.XPopup;
|
||||||
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.utils.DeviceUtils;
|
||||||
|
import com.yunbao.common.utils.DpUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
|
public class ActivateEliteBattleOrderPopupWindow extends CenterPopupView {
|
||||||
|
private boolean elites;//是否精英战令
|
||||||
|
private String spendMoney;//花费钱
|
||||||
|
private View buttonWarOrder;
|
||||||
|
private LiberalBattlePassPopupWindow.LiberalBattlePassCallback mPassCallback;
|
||||||
|
private String mBattlePassTypeId;
|
||||||
|
|
||||||
|
public ActivateEliteBattleOrderPopupWindow(@NonNull Context context, String mSpendMoney,
|
||||||
|
boolean elites,
|
||||||
|
LiberalBattlePassPopupWindow.LiberalBattlePassCallback passCallback
|
||||||
|
, String battlePassTypeId) {
|
||||||
|
super(context);
|
||||||
|
this.elites = elites;
|
||||||
|
spendMoney = mSpendMoney;
|
||||||
|
mPassCallback=passCallback;
|
||||||
|
mBattlePassTypeId = battlePassTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getImplLayoutId() {
|
||||||
|
return R.layout.activate_elite_battle_order_popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
buttonWarOrder = findViewById(R.id.button_war_order);
|
||||||
|
if (elites) {
|
||||||
|
findViewById(R.id.gift_overvalue).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.gift_overvalue3).setVisibility(GONE);
|
||||||
|
findViewById(R.id.enjoy_image).setVisibility(GONE);
|
||||||
|
findViewById(R.id.elites_image).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.gift_overvalue).setVisibility(VISIBLE);
|
||||||
|
((TextView)findViewById(R.id.gift3_text)).setText(WordUtil.getNewString(R.string.unlock_more_gifts));
|
||||||
|
} else {
|
||||||
|
findViewById(R.id.gift_overvalue).setVisibility(GONE);
|
||||||
|
findViewById(R.id.gift_overvalue3).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.enjoy_image).setVisibility(VISIBLE);
|
||||||
|
findViewById(R.id.elites_image).setVisibility(GONE);
|
||||||
|
findViewById(R.id.gift_overvalue).setVisibility(GONE);
|
||||||
|
((TextView)findViewById(R.id.gift3_text)).setText(WordUtil.getNewString(R.string.unlock_more_gifts2));
|
||||||
|
}
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.war_order_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//中文按钮文字
|
||||||
|
|
||||||
|
((TextView)findViewById(R.id.button_war_order_text)).setText(spendMoney);
|
||||||
|
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(buttonWarOrder, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
dialog.dismiss();
|
||||||
|
new XPopup.Builder(getContext())
|
||||||
|
.enableDrag(false)
|
||||||
|
.maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34))
|
||||||
|
.asCustom(new LiberalBattlePassPopupWindow(getContext(), spendMoney, elites,mPassCallback,mBattlePassTypeId))
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
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 ActivityEndPopupWindow extends CenterPopupView {
|
||||||
|
public ActivityEndPopupWindow(@NonNull Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getImplLayoutId() {
|
||||||
|
return R.layout.activity_end_popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.confirm), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableStringBuilder;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.http.ResponseModel;
|
||||||
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
|
public class LiberalBattlePassPopupWindow extends CenterPopupView {
|
||||||
|
private String spendMoney;//花费钱
|
||||||
|
private boolean mElites;//是否精英战令
|
||||||
|
private TextView liberalBattlePass;
|
||||||
|
private LiberalBattlePassCallback mPassCallback;
|
||||||
|
private String mBattlePassTypeId;
|
||||||
|
|
||||||
|
public LiberalBattlePassPopupWindow(@NonNull Context context, String mSpendMoney, boolean elites, LiberalBattlePassCallback passCallback, String battlePassTypeId) {
|
||||||
|
super(context);
|
||||||
|
spendMoney = mSpendMoney;
|
||||||
|
mElites = elites;
|
||||||
|
mPassCallback = passCallback;
|
||||||
|
mBattlePassTypeId = battlePassTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getImplLayoutId() {
|
||||||
|
return R.layout.liberal_battle_pass_popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
liberalBattlePass = findViewById(R.id.liberal_battle_pass);
|
||||||
|
//中文版
|
||||||
|
StringBuffer liberalBattlePassHint = new StringBuffer();
|
||||||
|
liberalBattlePassHint.append(WordUtil.isNewZh()?"是否花費":"Did you spend ");
|
||||||
|
liberalBattlePassHint.append(spendMoney).append(mElites ?
|
||||||
|
WordUtil.isNewZh()?"鑽石開通精英戰令!":"diamonds to activate the Elite BattlePass":
|
||||||
|
WordUtil.isNewZh()?"鑽石開通尊享戰令!":"diamonds to activate the Luxury BattlePass");
|
||||||
|
//英文版
|
||||||
|
|
||||||
|
//设置样式
|
||||||
|
String liberalBattlePassStr = liberalBattlePassHint.toString();
|
||||||
|
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||||
|
builder.append(liberalBattlePassStr);
|
||||||
|
int spendMoneyIndex = liberalBattlePassStr.indexOf(spendMoney);
|
||||||
|
int spendMoneySize = spendMoneyIndex + spendMoney.length();
|
||||||
|
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#CE2BFF")), spendMoneyIndex, spendMoneySize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
liberalBattlePass.setText(builder);
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cancel), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.liberal_battle_sure), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
LiveNetManager.get(getContext()).
|
||||||
|
upgradesBattlePass(mBattlePassTypeId, new HttpCallback<ResponseModel<Object>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ResponseModel<Object> data) {
|
||||||
|
|
||||||
|
dialog.dismiss();
|
||||||
|
if (mPassCallback != null) {
|
||||||
|
mPassCallback.onCallback(data.getData().getCode(), data.getData().getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
dialog.dismiss();
|
||||||
|
if (mPassCallback != null) {
|
||||||
|
mPassCallback.onCallback(102, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface LiberalBattlePassCallback {
|
||||||
|
void onCallback(int code, String msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildDialog(XPopup.Builder builder) {
|
public void buildDialog(XPopup.Builder builder) {
|
||||||
|
builder.animationDuration(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.yunbao.common.dialog;
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -21,6 +22,10 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
|||||||
private OpenAdModel model;
|
private OpenAdModel model;
|
||||||
private OnItemClickListener<OpenAdModel> mListener;
|
private OnItemClickListener<OpenAdModel> mListener;
|
||||||
|
|
||||||
|
public OpenAdCenterDialogPopup(@NonNull Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
public OpenAdCenterDialogPopup(@NonNull Context context, OpenAdModel model) {
|
public OpenAdCenterDialogPopup(@NonNull Context context, OpenAdModel model) {
|
||||||
super(context);
|
super(context);
|
||||||
this.model = model;
|
this.model = model;
|
||||||
@@ -33,6 +38,8 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildDialog(XPopup.Builder builder) {
|
public void buildDialog(XPopup.Builder builder) {
|
||||||
|
builder.hasShadowBg(false);
|
||||||
|
builder.animationDuration(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,6 +60,7 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate() {
|
protected void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
Log.e("-----弹窗-----", "onCreate: 创建弹窗" );
|
||||||
mImageView = findViewById(R.id.img);
|
mImageView = findViewById(R.id.img);
|
||||||
mClose = findViewById(R.id.close);
|
mClose = findViewById(R.id.close);
|
||||||
findViewById(R.id.layout).setOnClickListener(v -> dismiss());
|
findViewById(R.id.layout).setOnClickListener(v -> dismiss());
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.http.ResponseModel;
|
||||||
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 战令等级 经验
|
||||||
|
*/
|
||||||
|
public class OrderLevelPopupWindow extends CenterPopupView {
|
||||||
|
private TextView orderLevel, orderLevelDiamond, balanceDiamond, current,expText;
|
||||||
|
private int currentExperience, totalExperience;//当前经验,全部经验
|
||||||
|
private String buyExp = "100", currentLevel, balance;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
private OrderLevelCallback orderLevelCallback;
|
||||||
|
private long maxExp;
|
||||||
|
|
||||||
|
public OrderLevelPopupWindow(@NonNull Context context,
|
||||||
|
int mCurrentExperience, int mTotalExperience,
|
||||||
|
String mCurrentLevel, String mBalance,long maxExp, OrderLevelCallback mOrderLevelCallback) {
|
||||||
|
super(context);
|
||||||
|
currentExperience = mCurrentExperience;
|
||||||
|
totalExperience = mTotalExperience;
|
||||||
|
currentLevel = mCurrentLevel;
|
||||||
|
balance = mBalance;
|
||||||
|
this.maxExp=maxExp;
|
||||||
|
orderLevelCallback = mOrderLevelCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getImplLayoutId() {
|
||||||
|
return R.layout.order_level_popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
orderLevel = findViewById(R.id.tickets_plus_minus);
|
||||||
|
orderLevelDiamond = findViewById(R.id.order_level_diamond);
|
||||||
|
balanceDiamond = findViewById(R.id.balance_diamond);
|
||||||
|
current = findViewById(R.id.current);
|
||||||
|
progressBar = findViewById(R.id.progressBar);
|
||||||
|
expText = findViewById(R.id.exp_text);
|
||||||
|
orderLevel.setText(buyExp);
|
||||||
|
progressBar.setMax(totalExperience);
|
||||||
|
progressBar.setProgress(currentExperience);
|
||||||
|
expText.setText(String.format("%s/%s", currentExperience, totalExperience));
|
||||||
|
current.setText(String.format("Lv%s", currentLevel));
|
||||||
|
balanceDiamond.setText(balance);
|
||||||
|
findViewById(R.id.sub).setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
float exp = new BigDecimal(buyExp).floatValue();
|
||||||
|
if (exp > 100) {
|
||||||
|
BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).subtract(new BigDecimal("100"));
|
||||||
|
buyExp = String.valueOf(buyExpBigDecimal.intValue());
|
||||||
|
orderLevelDiamond.setText(String.valueOf(buyExpBigDecimal.floatValue()));
|
||||||
|
orderLevel.setText(buyExp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
findViewById(R.id.add).setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
float exp = new BigDecimal(buyExp).floatValue();
|
||||||
|
if (exp < maxExp && exp < 10000) {
|
||||||
|
BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("100"));
|
||||||
|
buyExp = String.valueOf(buyExpBigDecimal.intValue());
|
||||||
|
orderLevelDiamond.setText(String.valueOf(buyExpBigDecimal.floatValue()));
|
||||||
|
orderLevel.setText(buyExp);
|
||||||
|
}else if(exp>=maxExp){
|
||||||
|
ToastUtil.show(WordUtil.isNewZh()?"经验已滿":"Experience full");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.war_order_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.buying_experience), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
LiveNetManager.get(getContext())
|
||||||
|
.buyingExperiencePoint(buyExp, new HttpCallback<ResponseModel<Object>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ResponseModel<Object> data) {
|
||||||
|
if (orderLevelCallback != null) {
|
||||||
|
orderLevelCallback.onCallback(data.getData().getCode(), data.getMsg());
|
||||||
|
}dialog.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
if (orderLevelCallback != null) {
|
||||||
|
orderLevelCallback.onCallback(102, error);
|
||||||
|
} dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OrderLevelCallback {
|
||||||
|
void onCallback(int code, String msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.lxj.xpopup.XPopup;
|
||||||
|
import com.lxj.xpopup.core.BasePopupView;
|
||||||
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.bean.BattlePassUserInfoBean;
|
||||||
|
import com.yunbao.common.utils.DeviceUtils;
|
||||||
|
import com.yunbao.common.utils.DpUtil;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 升級精英/尊享戰令
|
||||||
|
*/
|
||||||
|
public class PromotionElitePopupWindow extends CenterPopupView {
|
||||||
|
private String enjoySpendMoney, quintessenceSpendMoney;//花费钱
|
||||||
|
private LiberalBattlePassPopupWindow.LiberalBattlePassCallback mPassCallback;
|
||||||
|
private String elitesTypeId,enjoyTypeId;
|
||||||
|
private BattlePassUserInfoBean data;
|
||||||
|
|
||||||
|
public PromotionElitePopupWindow(@NonNull Context context, String mEnjoySpendMoney,
|
||||||
|
String mQuintessenceSpendMoney, LiberalBattlePassPopupWindow.LiberalBattlePassCallback passCallback,
|
||||||
|
String elitesTypeId, String enjoyTypeId) {
|
||||||
|
super(context);
|
||||||
|
enjoySpendMoney = mEnjoySpendMoney;
|
||||||
|
quintessenceSpendMoney = mQuintessenceSpendMoney;
|
||||||
|
mPassCallback = passCallback;
|
||||||
|
this.elitesTypeId = elitesTypeId;
|
||||||
|
this.enjoyTypeId = enjoyTypeId;
|
||||||
|
}
|
||||||
|
public PromotionElitePopupWindow setUserData(BattlePassUserInfoBean data) {
|
||||||
|
this.data=data;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getImplLayoutId() {
|
||||||
|
return R.layout.promotion_elite_popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.button_quintessence), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
if(data!=null && data.getBattlePassUserRecords2()==2){
|
||||||
|
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_buy_max));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.dismiss();
|
||||||
|
new XPopup.Builder(getContext())
|
||||||
|
.enableDrag(false)
|
||||||
|
.maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34))
|
||||||
|
.asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), quintessenceSpendMoney, true, mPassCallback, elitesTypeId))
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.button_enjoy), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
if(data!=null && data.getBattlePassUserRecords3()==2){
|
||||||
|
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_buy_max));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.dismiss();
|
||||||
|
new XPopup.Builder(getContext())
|
||||||
|
.enableDrag(false)
|
||||||
|
.maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34))
|
||||||
|
.asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), enjoySpendMoney, false, mPassCallback, enjoyTypeId))
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
|
||||||
|
public class RuleOfWarPopupWindow extends CenterPopupView {
|
||||||
|
public RuleOfWarPopupWindow(@NonNull Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
private TextView rule;
|
||||||
|
@Override
|
||||||
|
protected int getImplLayoutId() {
|
||||||
|
return R.layout.rule_of_war_popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
rule=findViewById(R.id.rule);
|
||||||
|
findViewById(R.id.close).setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
private void initData(){
|
||||||
|
LiveNetManager.get(getContext())
|
||||||
|
.getBattlePassRule(new HttpCallback<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String data) {
|
||||||
|
rule.setText(data.replace("\n","\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.http.ResponseModel;
|
||||||
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 战令兑换详情
|
||||||
|
*/
|
||||||
|
public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView {
|
||||||
|
private TextView orderLevel, pointExchange;
|
||||||
|
private String buyExp = "1";
|
||||||
|
private int mPoint, mLimitQuantity, mScale;
|
||||||
|
private String mImageUrl;
|
||||||
|
private ImageView exchangeParticulars;
|
||||||
|
private String battlePassPointsId;
|
||||||
|
private WarOrderExchangeDetailsCallback orderExchangeDetailsCallback;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param limitQuantity 最大限制数量
|
||||||
|
* @param point 自己的积分
|
||||||
|
* @param scale 兑换比例
|
||||||
|
* @param imageUrl 物品图片的url
|
||||||
|
*/
|
||||||
|
public WarOrderExchangeDetailsPopupWindow(@NonNull Context context, int limitQuantity,
|
||||||
|
int point, int scale, String imageUrl, String battlePassPointsId, WarOrderExchangeDetailsCallback orderExchangeDetailsCallback) {
|
||||||
|
super(context);
|
||||||
|
mPoint = point;
|
||||||
|
mLimitQuantity = limitQuantity;
|
||||||
|
mScale = scale;
|
||||||
|
mImageUrl = imageUrl;
|
||||||
|
this.battlePassPointsId = battlePassPointsId;
|
||||||
|
this.orderExchangeDetailsCallback = orderExchangeDetailsCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getImplLayoutId() {
|
||||||
|
return R.layout.war_order_exchange_details_popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
orderLevel = findViewById(R.id.tickets_plus_minus);
|
||||||
|
exchangeParticulars = findViewById(R.id.exchange_particulars);
|
||||||
|
pointExchange = findViewById(R.id.point_exchange);
|
||||||
|
orderLevel.setText(buyExp);
|
||||||
|
BigDecimal needExpBigDecimal = new BigDecimal(buyExp).multiply(new BigDecimal(mScale));
|
||||||
|
pointExchange.setText(String.format("%s",needExpBigDecimal));
|
||||||
|
ImgLoader.display(getContext(), mImageUrl, exchangeParticulars);
|
||||||
|
findViewById(R.id.sub).setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
float exp = new BigDecimal(buyExp).floatValue();
|
||||||
|
if (exp > 1) {
|
||||||
|
BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).subtract(new BigDecimal("1"));
|
||||||
|
buyExp = String.valueOf(buyExpBigDecimal.intValue());
|
||||||
|
orderLevel.setText(buyExp);
|
||||||
|
BigDecimal needExpBigDecimal = buyExpBigDecimal.multiply(new BigDecimal(mScale));
|
||||||
|
pointExchange.setText(String.format("%s",needExpBigDecimal));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
findViewById(R.id.add).setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
int number = new BigDecimal(mScale).multiply(new BigDecimal(buyExp)).intValue();
|
||||||
|
int exp = new BigDecimal(buyExp).intValue();
|
||||||
|
if (exp < mLimitQuantity && number < mPoint) {
|
||||||
|
BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("1"));
|
||||||
|
buyExp = String.valueOf(buyExpBigDecimal.intValue());
|
||||||
|
orderLevel.setText(buyExp);
|
||||||
|
BigDecimal needExpBigDecimal = buyExpBigDecimal.multiply(new BigDecimal(mScale));
|
||||||
|
pointExchange.setText(String.format("%s",needExpBigDecimal));
|
||||||
|
}else if(exp >= mLimitQuantity){
|
||||||
|
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_exchange_buy_max));
|
||||||
|
}else {
|
||||||
|
ToastUtil.show(WordUtil.getNewString(R.string.battlepass_exchange_buy_integral));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
findViewById(R.id.war_order_close).setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.point_exchange_linear), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
LiveNetManager.get(getContext())
|
||||||
|
.pointsExchange(battlePassPointsId, buyExp, new HttpCallback<ResponseModel<Object>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ResponseModel<Object> data) {
|
||||||
|
dialog.dismiss();
|
||||||
|
if (orderExchangeDetailsCallback != null) {
|
||||||
|
orderExchangeDetailsCallback.onCallback(data.getData().getCode(), data.getData().getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
dialog.dismiss();
|
||||||
|
if (orderExchangeDetailsCallback != null) {
|
||||||
|
orderExchangeDetailsCallback.onCallback(102, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface WarOrderExchangeDetailsCallback {
|
||||||
|
void onCallback(int code, String msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,6 +70,13 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
* 请求数据
|
* 请求数据
|
||||||
*/
|
*/
|
||||||
protected abstract void loadData();
|
protected abstract void loadData();
|
||||||
|
public void updateData(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends View> T findViewById(int id){
|
||||||
|
return contentView.findViewById(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ public class LoadingDialog extends AbsDialogFragment {
|
|||||||
private TextView hint;
|
private TextView hint;
|
||||||
private String showText = "";
|
private String showText = "";
|
||||||
|
|
||||||
|
public boolean isShow;
|
||||||
|
|
||||||
public void setShowText(String showText) {
|
public void setShowText(String showText) {
|
||||||
this.showText = showText;
|
this.showText = showText;
|
||||||
|
isShow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -44,19 +46,28 @@ public class LoadingDialog extends AbsDialogFragment {
|
|||||||
hint = (TextView) findViewById(R.id.hint);
|
hint = (TextView) findViewById(R.id.hint);
|
||||||
dots.start();
|
dots.start();
|
||||||
hint.setText(showText);
|
hint.setText(showText);
|
||||||
|
isShow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHintText(String text) {
|
||||||
|
if (hint != null) {
|
||||||
|
hint.setText(text);
|
||||||
|
}
|
||||||
|
isShow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
dots.stop();
|
dots.stop();
|
||||||
|
isShow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setWindowAttributes(Window window) {
|
protected void setWindowAttributes(Window window) {
|
||||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||||
WindowManager.LayoutParams params = window.getAttributes();
|
WindowManager.LayoutParams params = window.getAttributes();
|
||||||
params.width = DeviceUtils.getScreenWidth(getActivity())/2;
|
params.width = DeviceUtils.getScreenWidth(getActivity()) / 2;
|
||||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||||
params.gravity = Gravity.CENTER;
|
params.gravity = Gravity.CENTER;
|
||||||
window.setAttributes(params);
|
window.setAttributes(params);
|
||||||
|
|||||||
@@ -173,106 +173,95 @@ public class CommonHttpUtil {
|
|||||||
}
|
}
|
||||||
Log.i("来了", lang);
|
Log.i("来了", lang);
|
||||||
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
|
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
|
||||||
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG)
|
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG).params("langue", lang).params("version", "" + VersionUtil.getVersion()).params("from", "android").params("appType", "1").execute(new HttpCallback() {
|
||||||
.params("langue", lang)
|
@Override
|
||||||
.params("version", "" + VersionUtil.getVersion())
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
.params("from", "android")
|
if (code == 0 && info.length > 0) {
|
||||||
.params("appType", "1")
|
try {
|
||||||
.execute(new HttpCallback() {
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
@Override
|
ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class);
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
CommonAppConfig.getInstance().setConfig(bean);
|
||||||
if (code == 0 && info.length > 0) {
|
CommonAppConfig.getInstance().alert_time = obj.getInteger("alert_time");
|
||||||
try {
|
CommonAppConfig.getInstance().alert_end_time = obj.getInteger("alert_end_time");
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
//解析粉丝徽章
|
||||||
ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class);
|
CommonAppConfig.getInstance().setAnchorFansMedal(obj.getString("levelfans"));
|
||||||
CommonAppConfig.getInstance().setConfig(bean);
|
SpUtil.getInstance().setStringValue(SpUtil.CONFIG, info[0]);
|
||||||
CommonAppConfig.getInstance().setLevel(obj.getString("level"));
|
|
||||||
CommonAppConfig.getInstance().setAnchorLevel(obj.getString("levelanchor"));
|
|
||||||
CommonAppConfig.getInstance().alert_time = obj.getInteger("alert_time");
|
|
||||||
CommonAppConfig.getInstance().alert_end_time = obj.getInteger("alert_end_time");
|
|
||||||
//解析粉丝徽章
|
|
||||||
CommonAppConfig.getInstance().setAnchorFansMedal(obj.getString("levelfans"));
|
|
||||||
SpUtil.getInstance().setStringValue(SpUtil.CONFIG, info[0]);
|
|
||||||
if (commonCallback != null) {
|
|
||||||
commonCallback.callback(bean);
|
|
||||||
}
|
|
||||||
if (obj.containsKey("is_chat")) {
|
|
||||||
IMLoginManager.get(context).initChat(String.valueOf(obj.getInteger("is_chat")));
|
|
||||||
}
|
|
||||||
if (obj.containsKey("levelfans")) {
|
|
||||||
JSONArray levelArray = obj.getJSONArray("levelfans");
|
|
||||||
new NewLevelManager(context).upDataFansLevel(levelArray.toJSONString());
|
|
||||||
}
|
|
||||||
if (obj.containsKey("level_new")) {//缓存等级数据
|
|
||||||
JSONArray levelArray = obj.getJSONArray("level_new");
|
|
||||||
new NewLevelManager(context).UpDataLevel(levelArray.toJSONString());
|
|
||||||
}
|
|
||||||
if (obj.containsKey("levelanchor_new")) {//缓存等级数据
|
|
||||||
JSONArray levelArray = obj.getJSONArray("levelanchor_new");
|
|
||||||
new NewLevelManager(context).UpAnchorDataLevel(levelArray.toJSONString());
|
|
||||||
}
|
|
||||||
if (obj.containsKey("liveclass")) {//缓存直播间分类
|
|
||||||
JSONArray levelArray = obj.getJSONArray("liveclass");
|
|
||||||
new LiveClassManager(context).UpDataLiveClass(levelArray.toJSONString());
|
|
||||||
}
|
|
||||||
if (obj.containsKey("apk_ver")) {
|
|
||||||
APKManager.get().setApkVer(obj.getString("apk_ver"));
|
|
||||||
}
|
|
||||||
if (obj.containsKey("apk_url")) {
|
|
||||||
APKManager.get().setAPKUrl(obj.getString("apk_url"));
|
|
||||||
}
|
|
||||||
if (obj.containsKey("apk_des")) {
|
|
||||||
APKManager.get().setAPKDes(obj.getString("apk_des"));
|
|
||||||
}
|
|
||||||
if (obj.containsKey("google_isup")) {
|
|
||||||
APKManager.get().setAPKGoogleIsUp(obj.getInteger("google_isup"));
|
|
||||||
}
|
|
||||||
if (obj.containsKey("isup")) {
|
|
||||||
APKManager.get().setAPKIsUp(obj.getInteger("isup"));
|
|
||||||
}
|
|
||||||
if (obj.containsKey("clarity")) {
|
|
||||||
IMLoginManager.get(context).setClarity(obj.getString("clarity"));
|
|
||||||
}
|
|
||||||
if (obj.containsKey("defaultBubbleUrl")) {
|
|
||||||
IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl"));
|
|
||||||
}
|
|
||||||
if (obj.containsKey("gift_quantity")) {
|
|
||||||
JSONArray giftQuantity = obj.getJSONArray("gift_quantity");
|
|
||||||
new GiftQuantityManager(context).UpGiftQuantity(giftQuantity.toJSONString());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();
|
|
||||||
ErrorActivity.forward("GetConfig接口返回数据异常", error);
|
|
||||||
}
|
|
||||||
} else if (code == 1000) {
|
|
||||||
new DialogUitl
|
|
||||||
.Builder(context)
|
|
||||||
.setContent(msg)
|
|
||||||
.setCancelable(false)
|
|
||||||
.setClickCallback3(new DialogUitl.SimpleCallback3() {
|
|
||||||
@Override
|
|
||||||
public void onConfirmClick(Dialog dialog) {
|
|
||||||
AppManager.getInstance().AppExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCancel() {
|
|
||||||
AppManager.getInstance().AppExit();
|
|
||||||
}
|
|
||||||
}).build().show();
|
|
||||||
} else {
|
|
||||||
ToastUtil.show(context.getString(R.string.net_error) + "code:" + code + " msg:" + msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
if (commonCallback != null) {
|
if (commonCallback != null) {
|
||||||
commonCallback.callback(null);
|
commonCallback.callback(bean);
|
||||||
}
|
}
|
||||||
|
if (obj.containsKey("is_chat")) {
|
||||||
|
IMLoginManager.get(context).initChat(String.valueOf(obj.getInteger("is_chat")));
|
||||||
|
}
|
||||||
|
if (obj.containsKey("levelfans")) {
|
||||||
|
JSONArray levelArray = obj.getJSONArray("levelfans");
|
||||||
|
new NewLevelManager(context).upDataFansLevel(levelArray.toJSONString());
|
||||||
|
}
|
||||||
|
if (obj.containsKey("level_new")) {//缓存等级数据
|
||||||
|
JSONArray levelArray = obj.getJSONArray("level_new");
|
||||||
|
new NewLevelManager(context).UpDataLevel(levelArray.toJSONString());
|
||||||
|
}
|
||||||
|
if (obj.containsKey("levelanchor_new")) {//缓存等级数据
|
||||||
|
JSONArray levelArray = obj.getJSONArray("levelanchor_new");
|
||||||
|
new NewLevelManager(context).UpAnchorDataLevel(levelArray.toJSONString());
|
||||||
|
}
|
||||||
|
if (obj.containsKey("liveclass")) {//缓存直播间分类
|
||||||
|
JSONArray levelArray = obj.getJSONArray("liveclass");
|
||||||
|
new LiveClassManager(context).UpDataLiveClass(levelArray.toJSONString());
|
||||||
|
}
|
||||||
|
if (obj.containsKey("apk_ver")) {
|
||||||
|
APKManager.get().setApkVer(obj.getString("apk_ver"));
|
||||||
|
}
|
||||||
|
if (obj.containsKey("apk_url")) {
|
||||||
|
APKManager.get().setAPKUrl(obj.getString("apk_url"));
|
||||||
|
}
|
||||||
|
if (obj.containsKey("apk_des")) {
|
||||||
|
APKManager.get().setAPKDes(obj.getString("apk_des"));
|
||||||
|
}
|
||||||
|
if (obj.containsKey("google_isup")) {
|
||||||
|
APKManager.get().setAPKGoogleIsUp(obj.getInteger("google_isup"));
|
||||||
|
}
|
||||||
|
if (obj.containsKey("isup")) {
|
||||||
|
APKManager.get().setAPKIsUp(obj.getInteger("isup"));
|
||||||
|
}
|
||||||
|
if (obj.containsKey("clarity")) {
|
||||||
|
IMLoginManager.get(context).setClarity(obj.getString("clarity"));
|
||||||
|
}
|
||||||
|
if (obj.containsKey("defaultBubbleUrl")) {
|
||||||
|
IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl"));
|
||||||
|
}
|
||||||
|
if (obj.containsKey("gift_quantity")) {
|
||||||
|
JSONArray giftQuantity = obj.getJSONArray("gift_quantity");
|
||||||
|
new GiftQuantityManager(context).UpGiftQuantity(giftQuantity.toJSONString());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();
|
||||||
|
ErrorActivity.forward("GetConfig接口返回数据异常", error);
|
||||||
}
|
}
|
||||||
});
|
} else if (code == 1000) {
|
||||||
|
new DialogUitl.Builder(context).setContent(msg).setCancelable(false).setClickCallback3(new DialogUitl.SimpleCallback3() {
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick(Dialog dialog) {
|
||||||
|
AppManager.getInstance().AppExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel() {
|
||||||
|
AppManager.getInstance().AppExit();
|
||||||
|
}
|
||||||
|
}).build().show();
|
||||||
|
} else {
|
||||||
|
ToastUtil.show(context.getString(R.string.net_error) + "code:" + code + " msg:" + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
if (commonCallback != null) {
|
||||||
|
commonCallback.callback(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -280,20 +269,18 @@ public class CommonHttpUtil {
|
|||||||
* QQ登录的时候 获取unionID 与PC端互通的时候用
|
* QQ登录的时候 获取unionID 与PC端互通的时候用
|
||||||
*/
|
*/
|
||||||
public static void getQQLoginUnionID(String accessToken, final CommonCallback<String> commonCallback) {
|
public static void getQQLoginUnionID(String accessToken, final CommonCallback<String> commonCallback) {
|
||||||
OkGo.<String>get("https://graph.qq.com/oauth2.0/me?access_token=" + accessToken + "&unionid=1")
|
OkGo.<String>get("https://graph.qq.com/oauth2.0/me?access_token=" + accessToken + "&unionid=1").tag(CommonHttpConsts.GET_QQ_LOGIN_UNION_ID).execute(new StringCallback() {
|
||||||
.tag(CommonHttpConsts.GET_QQ_LOGIN_UNION_ID)
|
@Override
|
||||||
.execute(new StringCallback() {
|
public void onSuccess(Response<String> response) {
|
||||||
@Override
|
if (commonCallback != null) {
|
||||||
public void onSuccess(Response<String> response) {
|
String data = response.body();
|
||||||
if (commonCallback != null) {
|
data = data.substring(data.indexOf("{"), data.lastIndexOf("}") + 1);
|
||||||
String data = response.body();
|
L.e("getQQLoginUnionID------>" + data);
|
||||||
data = data.substring(data.indexOf("{"), data.lastIndexOf("}") + 1);
|
JSONObject obj = JSON.parseObject(data);
|
||||||
L.e("getQQLoginUnionID------>" + data);
|
commonCallback.callback(obj.getString("unionid"));
|
||||||
JSONObject obj = JSON.parseObject(data);
|
}
|
||||||
commonCallback.callback(obj.getString("unionid"));
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -312,13 +299,11 @@ public class CommonHttpUtil {
|
|||||||
ToastUtil.show(WordUtil.getString(R.string.cannot_follow_self));
|
ToastUtil.show(WordUtil.getString(R.string.cannot_follow_self));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HttpClient.getInstance().get("User.setAttents", tag)
|
HttpClient.getInstance().get("User.setAttents", tag).params("touid", touid).execute(new HttpCallback() {
|
||||||
.params("touid", touid)
|
@Override
|
||||||
.execute(new HttpCallback() {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
@Override
|
if (code == 0 && info.length > 0 || code == 1001) {
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
int isAttention = JSON.parseObject(info[0]).getIntValue("isattent");//1是 关注 0是未关注
|
||||||
if (code == 0 && info.length > 0 || code == 1001) {
|
|
||||||
int isAttention = JSON.parseObject(info[0]).getIntValue("isattent");//1是 关注 0是未关注
|
|
||||||
/* if (code == 1001) {
|
/* if (code == 1001) {
|
||||||
if (WordUtil.isNewZh()) {
|
if (WordUtil.isNewZh()) {
|
||||||
ToastUtil.show("粉絲團等級已清零,待領取獎勵已自動領取至【個性裝扮】");
|
ToastUtil.show("粉絲團等級已清零,待領取獎勵已自動領取至【個性裝扮】");
|
||||||
@@ -326,13 +311,13 @@ public class CommonHttpUtil {
|
|||||||
ToastUtil.show("The level of the fan club has been cleared, and the rewards to be claimed have been automatically received to [Personalized Dressing]");
|
ToastUtil.show("The level of the fan club has been cleared, and the rewards to be claimed have been automatically received to [Personalized Dressing]");
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
EventBus.getDefault().post(new FollowEvent(touid, isAttention));
|
EventBus.getDefault().post(new FollowEvent(touid, isAttention));
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.callback(isAttention);
|
callback.callback(isAttention);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -340,15 +325,14 @@ public class CommonHttpUtil {
|
|||||||
*/
|
*/
|
||||||
public static void getBalance(HttpCallback callback) {
|
public static void getBalance(HttpCallback callback) {
|
||||||
String isGoogle;
|
String isGoogle;
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
isGoogle = "1";
|
isGoogle = "1";
|
||||||
|
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||||
|
isGoogle = "2";
|
||||||
} else {
|
} else {
|
||||||
isGoogle = "-1";
|
isGoogle = "-1";
|
||||||
}
|
}
|
||||||
HttpClient.getInstance().get("User.getBalance", CommonHttpConsts.GET_BALANCE)
|
HttpClient.getInstance().get("User.getBalance", CommonHttpConsts.GET_BALANCE).params("type", 0).params("isGooglePay", isGoogle).execute(callback);
|
||||||
.params("type", 0)
|
|
||||||
.params("isGooglePay", isGoogle)
|
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -357,8 +341,7 @@ public class CommonHttpUtil {
|
|||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
public static void getAliOrder(String parmas, HttpCallback callback) {
|
public static void getAliOrder(String parmas, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_ALI_ORDER)
|
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_ALI_ORDER).execute(callback);
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -367,8 +350,7 @@ public class CommonHttpUtil {
|
|||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
public static void getWxOrder(String parmas, HttpCallback callback) {
|
public static void getWxOrder(String parmas, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_ORDER)
|
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_ORDER).execute(callback);
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -379,8 +361,7 @@ public class CommonHttpUtil {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public static void getCashierOrder(String parmas, HttpCallback callback) {
|
public static void getCashierOrder(String parmas, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_CASHIER_ORDER)
|
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_CASHIER_ORDER).execute(callback);
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -392,8 +373,7 @@ public class CommonHttpUtil {
|
|||||||
|
|
||||||
|
|
||||||
public static void getWxH5Order(String parmas, HttpCallback callback) {
|
public static void getWxH5Order(String parmas, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_H5ORDER)
|
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_H5ORDER).execute(callback);
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -401,8 +381,7 @@ public class CommonHttpUtil {
|
|||||||
* 检查token是否失效
|
* 检查token是否失效
|
||||||
*/
|
*/
|
||||||
public static void checkTokenInvalid() {
|
public static void checkTokenInvalid() {
|
||||||
HttpClient.getInstance().get("User.ifToken", CommonHttpConsts.CHECK_TOKEN_INVALID)
|
HttpClient.getInstance().get("User.ifToken", CommonHttpConsts.CHECK_TOKEN_INVALID).execute(NO_CALLBACK);
|
||||||
.execute(NO_CALLBACK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -410,32 +389,15 @@ public class CommonHttpUtil {
|
|||||||
* 谷歌支付成功后,通知自己服务器
|
* 谷歌支付成功后,通知自己服务器
|
||||||
*/
|
*/
|
||||||
public static void notifyMeGoogle(String purchaseToken, String productId, String orderno, HttpCallback callback) {
|
public static void notifyMeGoogle(String purchaseToken, String productId, String orderno, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE)
|
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE).params("purchaseToken", purchaseToken).params("productId", productId).params("orderno", orderno).params("package_name", "com.pdlive.shayu").execute(callback);
|
||||||
.params("purchaseToken", purchaseToken)
|
|
||||||
.params("productId", productId)
|
|
||||||
.params("orderno", orderno)
|
|
||||||
.params("package_name", "com.pdlive.shayu")
|
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void notifyGoogle(String purchaseToken, String orderNo, String tradeNo, String allData, String gps_adid, HttpCallback callback) {
|
public static void notifyGoogle(String purchaseToken, String orderNo, String tradeNo, String allData, String gps_adid, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE)
|
HttpClient.getInstance().get(CommonHttpConsts.NOTIFY_GOOGLE, CommonHttpConsts.NOTIFY_GOOGLE).params("purchaseToken", purchaseToken).params("orderno", orderNo).params("trade_no", tradeNo).params("allData", allData).params("gps_adid", gps_adid).params("package_name", "com.pdlive.shayu").execute(callback);
|
||||||
.params("purchaseToken", purchaseToken)
|
|
||||||
.params("orderno", orderNo)
|
|
||||||
.params("trade_no", tradeNo)
|
|
||||||
.params("allData", allData)
|
|
||||||
.params("gps_adid", gps_adid)
|
|
||||||
.params("package_name", "com.pdlive.shayu")
|
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Google_sec_pay(String purchaseToken, String orderNo, String tradeNo, HttpCallback callback) {
|
public static void Google_sec_pay(String purchaseToken, String orderNo, String tradeNo, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get("Charge.Google_sec_pay", "Charge.Google_sec_pay")
|
HttpClient.getInstance().get("Charge.Google_sec_pay", "Charge.Google_sec_pay").params("purchaseToken", purchaseToken).params("orderno", orderNo).params("trade_no", tradeNo).params("package_name", "com.pdlive.shayu").execute(callback);
|
||||||
.params("purchaseToken", purchaseToken)
|
|
||||||
.params("orderno", orderNo)
|
|
||||||
.params("trade_no", tradeNo)
|
|
||||||
.params("package_name", "com.pdlive.shayu")
|
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//不做任何操作的HttpCallback
|
//不做任何操作的HttpCallback
|
||||||
@@ -452,20 +414,9 @@ public class CommonHttpUtil {
|
|||||||
public static void setCommunityReport(String community_type, String comment_id, String dynamic_id, String content, File file1, File file2, File file3, String report_type, HttpCallback callback) {
|
public static void setCommunityReport(String community_type, String comment_id, String dynamic_id, String content, File file1, File file2, File file3, String report_type, HttpCallback callback) {
|
||||||
PostRequest<JsonBean> request;
|
PostRequest<JsonBean> request;
|
||||||
if ("2".equals(community_type)) {
|
if ("2".equals(community_type)) {
|
||||||
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT)
|
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT).isMultipart(true).params("dynamic_id", dynamic_id).params("report_type", report_type).params("content", content).params("community_type", community_type).params("comment_id", comment_id);
|
||||||
.isMultipart(true)
|
|
||||||
.params("dynamic_id", dynamic_id)
|
|
||||||
.params("report_type", report_type)
|
|
||||||
.params("content", content)
|
|
||||||
.params("community_type", community_type)
|
|
||||||
.params("comment_id", comment_id);
|
|
||||||
} else {
|
} else {
|
||||||
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT)
|
request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT).isMultipart(true).params("dynamic_id", dynamic_id).params("report_type", report_type).params("content", content).params("community_type", community_type);
|
||||||
.isMultipart(true)
|
|
||||||
.params("dynamic_id", dynamic_id)
|
|
||||||
.params("report_type", report_type)
|
|
||||||
.params("content", content)
|
|
||||||
.params("community_type", community_type);
|
|
||||||
}
|
}
|
||||||
if (file1 != null) {
|
if (file1 != null) {
|
||||||
request.params("file1", file1);
|
request.params("file1", file1);
|
||||||
@@ -483,9 +434,7 @@ public class CommonHttpUtil {
|
|||||||
* 用户个人主页信息
|
* 用户个人主页信息
|
||||||
*/
|
*/
|
||||||
public static void getUserBaseinfo(String touid, HttpCallback callback) {
|
public static void getUserBaseinfo(String touid, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO)
|
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO).params("touid", touid).execute(callback);
|
||||||
.params("touid", touid)
|
|
||||||
.execute(callback);
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// //埋点唯一性
|
// //埋点唯一性
|
||||||
|
|||||||
@@ -350,7 +350,11 @@ public class LiveHttpUtil {
|
|||||||
.params("p", p)
|
.params("p", p)
|
||||||
.execute(callback);
|
.execute(callback);
|
||||||
}
|
}
|
||||||
|
public static void getContactMsg(int page, HttpCallback callback) {
|
||||||
|
HttpClient.getInstance().get("Live.getContactMsg", "getContactMsg")
|
||||||
|
.params("p", page)
|
||||||
|
.execute(callback);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 观众跟主播连麦时,获取自己的流地址
|
* 观众跟主播连麦时,获取自己的流地址
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import com.yunbao.common.bean.ActiveModel;
|
|||||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||||
import com.yunbao.common.bean.BaseModel;
|
import com.yunbao.common.bean.BaseModel;
|
||||||
|
import com.yunbao.common.bean.BattlePassPoints;
|
||||||
|
import com.yunbao.common.bean.BattlePassTask;
|
||||||
|
import com.yunbao.common.bean.BattlePassUserInfoBean;
|
||||||
import com.yunbao.common.bean.BlindBoxInfoModel;
|
import com.yunbao.common.bean.BlindBoxInfoModel;
|
||||||
import com.yunbao.common.bean.CheckLiveModel;
|
import com.yunbao.common.bean.CheckLiveModel;
|
||||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||||
@@ -31,6 +34,7 @@ import com.yunbao.common.bean.ListInfoMessageModel;
|
|||||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||||
import com.yunbao.common.bean.LiveAnchorCallMeModel;
|
import com.yunbao.common.bean.LiveAnchorCallMeModel;
|
||||||
import com.yunbao.common.bean.LiveAnchorSayModel;
|
import com.yunbao.common.bean.LiveAnchorSayModel;
|
||||||
|
import com.yunbao.common.bean.LiveBattlePassRewardsBean;
|
||||||
import com.yunbao.common.bean.LiveDataInfoModel;
|
import com.yunbao.common.bean.LiveDataInfoModel;
|
||||||
import com.yunbao.common.bean.LiveInfoModel;
|
import com.yunbao.common.bean.LiveInfoModel;
|
||||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||||
@@ -555,7 +559,7 @@ public interface PDLiveApi {
|
|||||||
/**
|
/**
|
||||||
* 机器人删除话术
|
* 机器人删除话术
|
||||||
*/
|
*/
|
||||||
@GET("/api/public/?service=Live.delAiAutomaticSpeech ")
|
@GET("/api/public/?service=Live.delAiAutomaticSpeech")
|
||||||
Observable<ResponseModel<List<String>>> delAiAutomaticSpeech(
|
Observable<ResponseModel<List<String>>> delAiAutomaticSpeech(
|
||||||
@Query("type") String type,
|
@Query("type") String type,
|
||||||
@Query("id") String id
|
@Query("id") String id
|
||||||
@@ -663,7 +667,9 @@ public interface PDLiveApi {
|
|||||||
* 获取收件箱信息
|
* 获取收件箱信息
|
||||||
*/
|
*/
|
||||||
@GET("/api/public/?service=Live.getContactMsg")
|
@GET("/api/public/?service=Live.getContactMsg")
|
||||||
Observable<ResponseModel<List<LiveUserMailBoxModel>>> getContactMsg();
|
Observable<ResponseModel<List<LiveUserMailBoxModel>>> getContactMsg(
|
||||||
|
@Query("p") int page
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除联系方式信件
|
* 删除联系方式信件
|
||||||
@@ -1091,4 +1097,42 @@ public interface PDLiveApi {
|
|||||||
Observable<ResponseModel<Object>> buyTicket(
|
Observable<ResponseModel<Object>> buyTicket(
|
||||||
@Field("quantity") String quantity
|
@Field("quantity") String quantity
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@GET("/api/public/?service=Livebattlepass.upgradesBattlePass")
|
||||||
|
Observable<ResponseModel<Object>> upgradesBattlePass(@Query("battle_pass_type_id") String battlePassTypeId);
|
||||||
|
|
||||||
|
@GET("/api/public/?service=Livebattlepass.buyingExperiencePoint")
|
||||||
|
Observable<ResponseModel<Object>> buyingExperiencePoint(@Query("exp_count") String expCount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* battle_pass_points_id => 兑换列表ID
|
||||||
|
* count => 兑换物品的数量
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livebattlepass.pointsExchange")
|
||||||
|
Observable<ResponseModel<Object>> pointsExchange(
|
||||||
|
@Query("battle_pass_points_id") String battlePassPointsId,
|
||||||
|
@Query("count") String count
|
||||||
|
);
|
||||||
|
@GET("/api/public/?service=Livebattlepass.getBattlePassUserInfo")
|
||||||
|
Observable<ResponseModel<BattlePassUserInfoBean>> getBattlePassUserInfo();
|
||||||
|
|
||||||
|
@GET("/api/public/?service=Livebattlepass.getLiveBattlePassRewards")
|
||||||
|
Observable<ResponseModel<LiveBattlePassRewardsBean>> getLiveBattlePassRewards();
|
||||||
|
@GET("/api/public/?service=Livebattlepass.getRewards")
|
||||||
|
Observable<ResponseModel<List<BaseModel>>> getRewards(
|
||||||
|
@Query("live_battle_pass_level_id")String rewardLevelId,
|
||||||
|
@Query("live_battle_pass_rewards_id")String rewardId
|
||||||
|
);
|
||||||
|
@GET("/api/public/?service=Livebattlepass.getBattlePassTask")
|
||||||
|
Observable<ResponseModel<BattlePassTask>> getBattlePassTask();
|
||||||
|
@GET("/api/public/?service=Livebattlepass.getTask")
|
||||||
|
Observable<ResponseModel<List<BaseModel>>> getTask(@Query("task_id")String taskId);
|
||||||
|
@GET("/api/public/?service=Livebattlepass.getBattlePassPoints")
|
||||||
|
Observable<ResponseModel<List<BattlePassPoints>>> getBattlePassPoints();
|
||||||
|
@GET("/api/public/?service=Livebattlepass.battlePassRule")
|
||||||
|
Observable<ResponseModel<String>> battlePassRule();
|
||||||
|
@GET("/api/public/?service=Livebattlepass.addChatCount")
|
||||||
|
Observable<ResponseModel<List<BaseModel>>> addChatCount();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import com.yunbao.common.Constants;
|
|||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.bean.ActiveModel;
|
import com.yunbao.common.bean.ActiveModel;
|
||||||
import com.yunbao.common.bean.BaseModel;
|
import com.yunbao.common.bean.BaseModel;
|
||||||
|
import com.yunbao.common.bean.BattlePassPoints;
|
||||||
|
import com.yunbao.common.bean.BattlePassTask;
|
||||||
|
import com.yunbao.common.bean.BattlePassUserInfoBean;
|
||||||
import com.yunbao.common.bean.BlindBoxInfoModel;
|
import com.yunbao.common.bean.BlindBoxInfoModel;
|
||||||
import com.yunbao.common.bean.CheckLiveModel;
|
import com.yunbao.common.bean.CheckLiveModel;
|
||||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||||
@@ -31,6 +34,7 @@ import com.yunbao.common.bean.ListInfoMessageModel;
|
|||||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||||
import com.yunbao.common.bean.LiveAnchorCallMeModel;
|
import com.yunbao.common.bean.LiveAnchorCallMeModel;
|
||||||
import com.yunbao.common.bean.LiveAnchorSayModel;
|
import com.yunbao.common.bean.LiveAnchorSayModel;
|
||||||
|
import com.yunbao.common.bean.LiveBattlePassRewardsBean;
|
||||||
import com.yunbao.common.bean.LiveDataInfoModel;
|
import com.yunbao.common.bean.LiveDataInfoModel;
|
||||||
import com.yunbao.common.bean.LiveInfoModel;
|
import com.yunbao.common.bean.LiveInfoModel;
|
||||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||||
@@ -1263,20 +1267,25 @@ public class LiveNetManager {
|
|||||||
*
|
*
|
||||||
* @param callback 回调
|
* @param callback 回调
|
||||||
*/
|
*/
|
||||||
public void getContactMsg(HttpCallback<List<LiveUserMailBoxModel>> callback) {
|
private Disposable contactMsgApi;
|
||||||
API.get().pdLiveApi(mContext)
|
|
||||||
.getContactMsg()
|
public synchronized void getContactMsg(int page, HttpCallback<List<LiveUserMailBoxModel>> callback) {
|
||||||
|
contactMsgApi = API.get().pdLiveApi(mContext)
|
||||||
|
.getContactMsg(page)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(listResponseModel -> {
|
.subscribe(listResponseModel -> {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
|
|
||||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||||
}
|
}
|
||||||
|
contactMsgApi = null;
|
||||||
}, throwable -> {
|
}, throwable -> {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onError(throwable.getMessage());
|
callback.onError(throwable.getMessage());
|
||||||
}
|
}
|
||||||
}).isDisposed();
|
contactMsgApi = null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2460,6 +2469,72 @@ public class LiveNetManager {
|
|||||||
}).isDisposed();
|
}).isDisposed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void pointsExchange(String battlePassPointsId, String count, HttpCallback<ResponseModel<Object>> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.pointsExchange(battlePassPointsId, count)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(objectResponseModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(mContext.getString(R.string.net_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void buyingExperiencePoint(String expCount, HttpCallback<ResponseModel<Object>> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.buyingExperiencePoint(expCount)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(objectResponseModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(mContext.getString(R.string.net_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void upgradesBattlePass(String battlePassTypeId, HttpCallback<ResponseModel<Object>> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.upgradesBattlePass(battlePassTypeId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||||
|
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(objectResponseModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(mContext.getString(R.string.net_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
public void quickGiftSendGift(String quickGiftNumber, String liveUid, String stream, HttpCallback<QuickGiftSendGiftModel> callback) {
|
public void quickGiftSendGift(String quickGiftNumber, String liveUid, String stream, HttpCallback<QuickGiftSendGiftModel> callback) {
|
||||||
API.get().pdLiveApi(mContext)
|
API.get().pdLiveApi(mContext)
|
||||||
.quickGiftSendGift(quickGiftNumber, liveUid, stream)
|
.quickGiftSendGift(quickGiftNumber, liveUid, stream)
|
||||||
@@ -2550,6 +2625,170 @@ public class LiveNetManager {
|
|||||||
}).isDisposed();
|
}).isDisposed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getBattlePassUserInfo(HttpCallback<BattlePassUserInfoBean> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getBattlePassUserInfo()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(checkRemainingBalanceResponseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(checkRemainingBalanceResponseModel.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 getLiveBattlePassRewards(HttpCallback<LiveBattlePassRewardsBean> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getLiveBattlePassRewards()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(checkRemainingBalanceResponseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(checkRemainingBalanceResponseModel.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 getRewards(String rewardLevelId, String rewardId, HttpCallback<HttpCallbackModel> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getRewards(rewardLevelId, rewardId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(responseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 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 getBattlePassTask(HttpCallback<BattlePassTask> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getBattlePassTask()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(checkRemainingBalanceResponseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(checkRemainingBalanceResponseModel.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 getBattlePassTaskOver(String taskId, HttpCallback<HttpCallbackModel> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getTask(taskId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(responseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 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 getBattlePassPoints(HttpCallback<List<BattlePassPoints>> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getBattlePassPoints()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(checkRemainingBalanceResponseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(checkRemainingBalanceResponseModel.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 getBattlePassRule(HttpCallback<String> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.battlePassRule()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(checkRemainingBalanceResponseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(checkRemainingBalanceResponseModel.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 addChatCount(HttpCallback<HttpCallbackModel> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.addChatCount()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(responseModel -> {
|
||||||
|
if (callback != null) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(new HttpCallbackModel(responseModel.getData().getCode(), responseModel.getData().getMsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 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();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 直播间取消网络请求
|
* 直播间取消网络请求
|
||||||
*/
|
*/
|
||||||
@@ -2563,5 +2802,8 @@ public class LiveNetManager {
|
|||||||
if (randomPkApi != null) {
|
if (randomPkApi != null) {
|
||||||
randomPkApi.dispose();
|
randomPkApi.dispose();
|
||||||
}
|
}
|
||||||
|
if (contactMsgApi != null) {
|
||||||
|
contactMsgApi.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class IMLoginManager extends BaseCacheManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getRedPoint() {
|
public boolean getRedPoint() {
|
||||||
return !TextUtils.isEmpty(getString("RedPoint")) && !TextUtils.equals(getString("RedPoint"), "1");
|
return !TextUtils.isEmpty(getString("RedPoint")) || !TextUtils.equals(getString("RedPoint"), "1");
|
||||||
}
|
}
|
||||||
public void setQuickGiftIfFirst() {
|
public void setQuickGiftIfFirst() {
|
||||||
put("quick_gift_if_first", "1");
|
put("quick_gift_if_first", "1");
|
||||||
|
|||||||
@@ -83,12 +83,16 @@ public class OpenAdManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long showTime=0;
|
||||||
public synchronized void show(int type, boolean isGuard) {
|
public synchronized void show(int type, boolean isGuard) {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
init(true);
|
init(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(System.currentTimeMillis()-showTime<100){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showTime=System.currentTimeMillis();
|
||||||
showType = type;
|
showType = type;
|
||||||
for (OpenAdModel model : list) {
|
for (OpenAdModel model : list) {
|
||||||
if (model.getType() == type) {
|
if (model.getType() == type) {
|
||||||
@@ -179,10 +183,15 @@ public class OpenAdManager {
|
|||||||
if (model.getType() != showType) {
|
if (model.getType() != showType) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(isShow(model)){
|
||||||
|
Log.i(TAG,"展示过:"+model);
|
||||||
|
return;
|
||||||
|
}
|
||||||
showMap.put(model.getId(), true);
|
showMap.put(model.getId(), true);
|
||||||
if (model.getShowModel() == OpenAdModel.SHOW_DIY) {
|
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);
|
SpUtil.setStringValue("open_ad_popup_time_" + model.getId(), nextTime);
|
||||||
|
showMap.remove(model.getId());
|
||||||
}
|
}
|
||||||
if (model.getModel() == OpenAdModel.MODEL_BOTTOM) {
|
if (model.getModel() == OpenAdModel.MODEL_BOTTOM) {
|
||||||
new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
|
new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
|
||||||
|
|||||||
@@ -4,12 +4,8 @@ import android.app.Activity;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.android.billingclient.api.Purchase;
|
|
||||||
import com.android.billingclient.api.SkuDetails;
|
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
@@ -19,16 +15,12 @@ import com.yunbao.common.event.CoinChangeEvent;
|
|||||||
import com.yunbao.common.http.CommonHttpUtil;
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.pay.wx.WxPayBuilder;
|
import com.yunbao.common.pay.wx.WxPayBuilder;
|
||||||
import com.yunbao.common.utils.GoogleBillingUtil;
|
|
||||||
import com.yunbao.common.utils.OnGoogleBillingListener;
|
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cxf on 2019/4/22.
|
* Created by cxf on 2019/4/22.
|
||||||
@@ -48,7 +40,7 @@ public class PayPresenter {
|
|||||||
private PayCallback mPayCallback;
|
private PayCallback mPayCallback;
|
||||||
|
|
||||||
|
|
||||||
private GoogleBillingUtil googleBillingUtil;
|
//private GoogleBillingUtil googleBillingUtil;
|
||||||
private String TAG = "PayPresenter";
|
private String TAG = "PayPresenter";
|
||||||
private String[] arrPro = {"1"};
|
private String[] arrPro = {"1"};
|
||||||
private String mOrderid;
|
private String mOrderid;
|
||||||
@@ -174,12 +166,12 @@ public class PayPresenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initGooglePay() {
|
private void initGooglePay() {
|
||||||
GoogleBillingUtil.isDebug(true);
|
/*GoogleBillingUtil.isDebug(true);
|
||||||
GoogleBillingUtil.setSkus(arrPro, null);
|
GoogleBillingUtil.setSkus(arrPro, null);
|
||||||
GoogleBillingUtil.setIsAutoAcknowledgePurchase(true);//设置自动确认购买
|
GoogleBillingUtil.setIsAutoAcknowledgePurchase(true);//设置自动确认购买
|
||||||
googleBillingUtil = GoogleBillingUtil.getInstance()
|
googleBillingUtil = GoogleBillingUtil.getInstance()
|
||||||
.addOnGoogleBillingListener(mActivity, mOnMyGoogleBillingListener)
|
.addOnGoogleBillingListener(mActivity, mOnMyGoogleBillingListener)
|
||||||
.build(mActivity);
|
.build(mActivity);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paypalPay(String orderParams) {
|
private void paypalPay(String orderParams) {
|
||||||
@@ -370,125 +362,10 @@ public class PayPresenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private OnGoogleBillingListener mOnMyGoogleBillingListener = new OnGoogleBillingListener() {
|
//private OnGoogleBillingListener mOnMyGoogleBillingListener = null;
|
||||||
@Override
|
|
||||||
public void onSetupSuccess(boolean isSelf) {
|
|
||||||
super.onSetupSuccess(isSelf);
|
|
||||||
Log.d(TAG, "内购服务初始化完成");
|
|
||||||
checkSubs();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onQuerySuccess(@NonNull String skuType, @NonNull List<SkuDetails> list, boolean isSelf) {
|
|
||||||
// if(!isSelf) return;
|
|
||||||
// StringBuffer tempBuffer =new StringBuffer();
|
|
||||||
// tempBuffer.append("查询商品信息成功,数量=" + list.size() + "\n");
|
|
||||||
// Log.d(TAG,tempBuffer.toString());
|
|
||||||
// if (list.size()<=0){
|
|
||||||
// ToastUtil.show("商品金额过大,无法支付");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// for(int i=0;i<list.size();i++){
|
|
||||||
// String details = String.format(Locale.getDefault(),"%s , %s",
|
|
||||||
// list.get(i).getSku(),list.get(i).getPrice()
|
|
||||||
// );
|
|
||||||
// tempBuffer.append(details);
|
|
||||||
// if(i!=list.size()-1){
|
|
||||||
// tempBuffer.append("\n");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// googleBillingUtil.purchaseInApp(mActivity,"zs640");
|
|
||||||
|
|
||||||
googleBillingUtil.purchaseInApp(mActivity, googleBillingUtil.getInAppSkuByPosition(0));
|
|
||||||
|
|
||||||
// Log.d(TAG,tempBuffer.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPurchaseSuccess(@NonNull Purchase purchase, boolean isSelf) {
|
|
||||||
StringBuffer tempBuffer = new StringBuffer();
|
|
||||||
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
|
||||||
tempBuffer.append("购买成功:");
|
|
||||||
//通知自己服务器
|
|
||||||
if (mOrderid == null || purchase.getOrderId() == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
String allData = "";
|
|
||||||
allData = "OrderId=" + purchase.getOrderId() +
|
|
||||||
",PackageName=" + purchase.getPackageName() +
|
|
||||||
",Sku=" + "purchase.getSku()" +
|
|
||||||
",PurchaseTime=" + purchase.getPurchaseTime() +
|
|
||||||
",PurchaseToken=" + purchase.getPurchaseToken() +
|
|
||||||
",DeveloperPayload=" + purchase.getDeveloperPayload() +
|
|
||||||
",OriginalJson=" + purchase.getOriginalJson() +
|
|
||||||
",PurchaseState=" + purchase.getPurchaseState() +
|
|
||||||
",Signature=" + purchase.getSignature();
|
|
||||||
// CommonHttpUtil.notifyGoogle("1",mOrderid,purchase.getOrderId(),allData, new HttpCallback() {
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(int code, String msg, String[] info) {
|
|
||||||
// if(code==0){
|
|
||||||
// try {
|
|
||||||
// ToastUtil.show("购买成功!");
|
|
||||||
// }catch (Exception e){
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }else {
|
|
||||||
// ToastUtil.show("购买失败,请联系客服");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
tempBuffer.append("暂未支付:");
|
|
||||||
}
|
|
||||||
String details = String.format(Locale.getDefault(), "%s \n", " purchase.getSku()");
|
|
||||||
tempBuffer.append(details);
|
|
||||||
Log.d(TAG, tempBuffer.toString());
|
|
||||||
return true;//自动消耗(只有当isSelf为true,并且支付状态为PURCHASED时,该值才会生效)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onRecheck(@NonNull String skuType, @NonNull Purchase purchase, boolean isSelf) {
|
|
||||||
StringBuffer tempBuffer = new StringBuffer();
|
|
||||||
tempBuffer.append("检测到未处理的订单($skuType):${purchase.sku}()");
|
|
||||||
Log.d(TAG, tempBuffer.toString());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBillingServiceDisconnected() {
|
|
||||||
super.onBillingServiceDisconnected();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConsumeSuccess(@NonNull String purchaseToken, boolean isSelf) {
|
|
||||||
Log.d(TAG, "消耗商品成功:$purchaseToken");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAcknowledgePurchaseSuccess(boolean isSelf) {
|
|
||||||
Log.d(TAG, "确认购买商品成功");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFail(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, int responseCode, boolean isSelf) {
|
|
||||||
Log.d(TAG, "操作失败:tag=${" + tag.name() + "responseCode=" + responseCode);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, boolean isSelf) {
|
|
||||||
Log.d(TAG, "发生错误:tag=" + tag.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
private void checkSubs() {
|
private void checkSubs() {
|
||||||
int size = googleBillingUtil.getPurchasesSizeSubs(mActivity);
|
/*int size = googleBillingUtil.getPurchasesSizeSubs(mActivity);
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 0:
|
case 0:
|
||||||
//不具备有效订阅
|
//不具备有效订阅
|
||||||
@@ -502,18 +379,18 @@ public class PayPresenter {
|
|||||||
//具有有效订阅
|
//具有有效订阅
|
||||||
Log.d(TAG, "有效订阅数:$size(具备有效订阅)");
|
Log.d(TAG, "有效订阅数:$size(具备有效订阅)");
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void release() {
|
public void release() {
|
||||||
mActivity = null;
|
mActivity = null;
|
||||||
mPayCallback = null;
|
mPayCallback = null;
|
||||||
|
|
||||||
if (googleBillingUtil != null) {
|
/*if (googleBillingUtil != null) {
|
||||||
googleBillingUtil.onDestroy(mActivity);
|
googleBillingUtil.onDestroy(mActivity);
|
||||||
//退出程序的时候可以调用(实验性)
|
//退出程序的时候可以调用(实验性)
|
||||||
GoogleBillingUtil.endConnection();
|
GoogleBillingUtil.endConnection();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
62
common/src/main/java/com/yunbao/common/pay/hw/HwBuilder.java
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yunbao.common.pay.hw;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 华为支付
|
||||||
|
*/
|
||||||
|
public class HwBuilder {
|
||||||
|
|
||||||
|
private Activity mActivity;
|
||||||
|
|
||||||
|
public HwBuilder(Activity activity) {
|
||||||
|
mActivity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付
|
||||||
|
*/
|
||||||
|
public void pay(String changeid) {
|
||||||
|
try {
|
||||||
|
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_huawei.utils.HuaWeiPayManage");
|
||||||
|
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||||
|
invite.getClass().getMethod("pay", String.class).invoke(invite, changeid);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消耗所有商品
|
||||||
|
*/
|
||||||
|
public void consume() {
|
||||||
|
try {
|
||||||
|
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_huawei.utils.HuaWeiPayManage");
|
||||||
|
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||||
|
invite.getClass().getMethod("consume").invoke(invite);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取支付结果
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public JSONObject getPayResult(Intent intent) {
|
||||||
|
JSONObject object;
|
||||||
|
try {
|
||||||
|
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_huawei.utils.HuaWeiPayManage");
|
||||||
|
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||||
|
object = (JSONObject) invite.getClass().getMethod("getPayResult", Intent.class).invoke(invite, intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.yunbao.common.utils;
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,12 +18,13 @@ public class AndroidBug5497Workaround {
|
|||||||
// For more information, see https://issuetracker.google.com/issues/36911528
|
// For more information, see https://issuetracker.google.com/issues/36911528
|
||||||
// To use this class, simply invoke assistActivity() on an Activity that already has its content view set.
|
// To use this class, simply invoke assistActivity() on an Activity that already has its content view set.
|
||||||
|
|
||||||
public static void assistActivity (Activity activity) {
|
public static void assistActivity(Activity activity) {
|
||||||
new AndroidBug5497Workaround(activity);
|
new AndroidBug5497Workaround(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private View mChildOfContent;
|
private View mChildOfContent;
|
||||||
private int usableHeightPrevious;
|
private int usableHeightPrevious;
|
||||||
|
private int defHeight = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
private FrameLayout.LayoutParams frameLayoutParams;
|
private FrameLayout.LayoutParams frameLayoutParams;
|
||||||
|
|
||||||
private AndroidBug5497Workaround(Activity activity) {
|
private AndroidBug5497Workaround(Activity activity) {
|
||||||
@@ -29,8 +33,14 @@ public class AndroidBug5497Workaround {
|
|||||||
mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
possiblyResizeChildOfContent();
|
possiblyResizeChildOfContent();
|
||||||
|
int heightDiff = mChildOfContent.getRootView().getHeight() - mChildOfContent.getHeight();
|
||||||
|
if (heightDiff < 100) {
|
||||||
|
frameLayoutParams.height = defHeight;
|
||||||
|
mChildOfContent.requestLayout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();
|
frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +49,7 @@ public class AndroidBug5497Workaround {
|
|||||||
if (usableHeightNow != usableHeightPrevious) {
|
if (usableHeightNow != usableHeightPrevious) {
|
||||||
int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();
|
int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();
|
||||||
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
|
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
|
||||||
if (heightDifference > (usableHeightSansKeyboard/4)) {
|
if (heightDifference > (usableHeightSansKeyboard / 4)) {
|
||||||
// keyboard probably just became visible
|
// keyboard probably just became visible
|
||||||
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
|
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,926 +0,0 @@
|
|||||||
package com.yunbao.common.utils;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.android.billingclient.api.AcknowledgePurchaseParams;
|
|
||||||
import com.android.billingclient.api.AcknowledgePurchaseResponseListener;
|
|
||||||
import com.android.billingclient.api.BillingClient;
|
|
||||||
import com.android.billingclient.api.BillingClientStateListener;
|
|
||||||
import com.android.billingclient.api.BillingFlowParams;
|
|
||||||
import com.android.billingclient.api.BillingResult;
|
|
||||||
import com.android.billingclient.api.ConsumeParams;
|
|
||||||
import com.android.billingclient.api.ConsumeResponseListener;
|
|
||||||
import com.android.billingclient.api.Purchase;
|
|
||||||
import com.android.billingclient.api.PurchaseHistoryResponseListener;
|
|
||||||
import com.android.billingclient.api.PurchasesUpdatedListener;
|
|
||||||
import com.android.billingclient.api.SkuDetails;
|
|
||||||
import com.android.billingclient.api.SkuDetailsParams;
|
|
||||||
import com.android.billingclient.api.SkuDetailsResponseListener;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 作者:天镜baobao
|
|
||||||
* 时间:2019/1/5 15:16
|
|
||||||
* 说明:允许使用,但请遵循Apache License 2.0
|
|
||||||
* 使用:
|
|
||||||
* Copyright 2019 天镜baobao
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@SuppressWarnings({"WeakerAccess", "unused", "UnusedReturnValue"})
|
|
||||||
public class GoogleBillingUtil {
|
|
||||||
|
|
||||||
private static final String TAG = "GoogleBillingUtil";
|
|
||||||
private static boolean IS_DEBUG = false;
|
|
||||||
private static String[] inAppSKUS = new String[]{};//内购ID,必填,注意!如果用不着的请去掉多余的""
|
|
||||||
private static String[] subsSKUS = new String[]{};//订阅ID,必填,注意!如果用不着的请去掉多余的""
|
|
||||||
|
|
||||||
public static final String BILLING_TYPE_INAPP = BillingClient.SkuType.INAPP;//内购
|
|
||||||
public static final String BILLING_TYPE_SUBS = BillingClient.SkuType.SUBS;//订阅
|
|
||||||
|
|
||||||
private static BillingClient mBillingClient;
|
|
||||||
private static BillingClient.Builder builder ;
|
|
||||||
private static List<OnGoogleBillingListener> onGoogleBillingListenerList = new ArrayList<>();
|
|
||||||
private static Map<String,OnGoogleBillingListener> onGoogleBillingListenerMap = new HashMap<>();
|
|
||||||
private MyPurchasesUpdatedListener purchasesUpdatedListener = new MyPurchasesUpdatedListener();
|
|
||||||
|
|
||||||
private static boolean isAutoAcknowledgePurchase = true;
|
|
||||||
|
|
||||||
private static final GoogleBillingUtil mGoogleBillingUtil = new GoogleBillingUtil() ;
|
|
||||||
|
|
||||||
private GoogleBillingUtil()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//region===================================初始化google应用内购买服务=================================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置skus
|
|
||||||
* @param inAppSKUS 内购id
|
|
||||||
* @param subsSKUS 订阅id
|
|
||||||
*/
|
|
||||||
public static void setSkus(@Nullable String[] inAppSKUS, @Nullable String[] subsSKUS){
|
|
||||||
if(inAppSKUS!=null){
|
|
||||||
GoogleBillingUtil.inAppSKUS = Arrays.copyOf(inAppSKUS,inAppSKUS.length);
|
|
||||||
}
|
|
||||||
if(subsSKUS!=null){
|
|
||||||
GoogleBillingUtil.subsSKUS = Arrays.copyOf(subsSKUS,subsSKUS.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> void copyToArray(T[] base,T[] target){
|
|
||||||
System.arraycopy(base, 0, target, 0, base.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GoogleBillingUtil getInstance()
|
|
||||||
{
|
|
||||||
return mGoogleBillingUtil;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始建立内购连接
|
|
||||||
* @param activity activity
|
|
||||||
*/
|
|
||||||
public GoogleBillingUtil build(Activity activity)
|
|
||||||
{
|
|
||||||
purchasesUpdatedListener.tag = getTag(activity);
|
|
||||||
if(mBillingClient==null)
|
|
||||||
{
|
|
||||||
synchronized (mGoogleBillingUtil)
|
|
||||||
{
|
|
||||||
if(mBillingClient==null)
|
|
||||||
{
|
|
||||||
builder = BillingClient.newBuilder(activity);
|
|
||||||
mBillingClient = builder.setListener(purchasesUpdatedListener)
|
|
||||||
.enablePendingPurchases()
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
builder.setListener(purchasesUpdatedListener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
builder.setListener(purchasesUpdatedListener);
|
|
||||||
}
|
|
||||||
synchronized (mGoogleBillingUtil)
|
|
||||||
{
|
|
||||||
if(mGoogleBillingUtil.startConnection(activity))
|
|
||||||
{
|
|
||||||
mGoogleBillingUtil.queryInventoryInApp(getTag(activity));
|
|
||||||
mGoogleBillingUtil.queryInventorySubs(getTag(activity));
|
|
||||||
mGoogleBillingUtil.queryPurchasesInApp(getTag(activity));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mGoogleBillingUtil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean startConnection(Activity activity){
|
|
||||||
return startConnection(getTag(activity));
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean startConnection(String tag)
|
|
||||||
{
|
|
||||||
if(mBillingClient==null)
|
|
||||||
{
|
|
||||||
log("初始化失败:mBillingClient==null");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(!mBillingClient.isReady())
|
|
||||||
{
|
|
||||||
mBillingClient.startConnection(new BillingClientStateListener() {
|
|
||||||
@Override
|
|
||||||
public void onBillingSetupFinished(BillingResult billingResult) {
|
|
||||||
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onSetupSuccess(listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
queryInventoryInApp(tag);
|
|
||||||
queryInventorySubs(tag);
|
|
||||||
queryPurchasesInApp(tag);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log("初始化失败:onSetupFail:code="+billingResult.getResponseCode());
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onFail(GoogleBillingListenerTag.SETUP,billingResult.getResponseCode(), listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBillingServiceDisconnected() {
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onBillingServiceDisconnected();
|
|
||||||
}
|
|
||||||
log("初始化失败:onBillingServiceDisconnected");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region===================================查询商品=================================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询内购商品信息
|
|
||||||
*/
|
|
||||||
public void queryInventoryInApp(Activity activity)
|
|
||||||
{
|
|
||||||
queryInventoryInApp(getTag(activity));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void queryInventoryInApp(String tag)
|
|
||||||
{
|
|
||||||
queryInventory(tag, BillingClient.SkuType.INAPP);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询订阅商品信息
|
|
||||||
*/
|
|
||||||
public void queryInventorySubs(Activity activity)
|
|
||||||
{
|
|
||||||
queryInventory(getTag(activity), BillingClient.SkuType.SUBS);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void queryInventorySubs(String tag)
|
|
||||||
{
|
|
||||||
queryInventory(tag, BillingClient.SkuType.SUBS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void queryInventory(String tag,final String skuType) {
|
|
||||||
Runnable runnable=new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
if (mBillingClient == null)
|
|
||||||
{
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onError(GoogleBillingListenerTag.QUERY, listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
ArrayList<String> skuList = new ArrayList<>();
|
|
||||||
if(skuType.equals(BillingClient.SkuType.INAPP))
|
|
||||||
{
|
|
||||||
Collections.addAll(skuList, inAppSKUS);
|
|
||||||
}
|
|
||||||
else if(skuType.equals(BillingClient.SkuType.SUBS))
|
|
||||||
{
|
|
||||||
Collections.addAll(skuList, subsSKUS);
|
|
||||||
}
|
|
||||||
if(!skuList.isEmpty()){
|
|
||||||
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
|
|
||||||
params.setSkusList(skuList).setType(skuType);
|
|
||||||
mBillingClient.querySkuDetailsAsync(params.build(),new MySkuDetailsResponseListener(skuType,tag));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
executeServiceRequest(tag,runnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region===================================购买商品=================================
|
|
||||||
/**
|
|
||||||
* 发起内购
|
|
||||||
* @param skuId 内购商品id
|
|
||||||
*/
|
|
||||||
public void purchaseInApp(Activity activity, String skuId)
|
|
||||||
{
|
|
||||||
purchase(activity,skuId, BillingClient.SkuType.INAPP);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发起订阅
|
|
||||||
* @param skuId 订阅商品id
|
|
||||||
*/
|
|
||||||
public void purchaseSubs(Activity activity,String skuId)
|
|
||||||
{
|
|
||||||
purchase(activity,skuId, BillingClient.SkuType.SUBS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void purchase(Activity activity,final String skuId,final String skuType)
|
|
||||||
{
|
|
||||||
String tag = getTag(activity);
|
|
||||||
if(mBillingClient==null)
|
|
||||||
{
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onError(GoogleBillingListenerTag.PURCHASE, listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
if(startConnection(tag))
|
|
||||||
{
|
|
||||||
purchasesUpdatedListener.tag = tag;
|
|
||||||
builder.setListener(purchasesUpdatedListener);
|
|
||||||
List<String> skuList = new ArrayList<>();
|
|
||||||
skuList.add(skuId);
|
|
||||||
SkuDetailsParams skuDetailsParams = SkuDetailsParams.newBuilder()
|
|
||||||
.setSkusList(skuList)
|
|
||||||
.setType(skuType)
|
|
||||||
.build();
|
|
||||||
mBillingClient.querySkuDetailsAsync(skuDetailsParams, new SkuDetailsResponseListener() {
|
|
||||||
@Override
|
|
||||||
public void onSkuDetailsResponse(BillingResult billingResult, List<SkuDetails> skuDetailsList) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mBillingClient.querySkuDetailsAsync(skuDetailsParams, new SkuDetailsResponseListener() {
|
|
||||||
@Override
|
|
||||||
public void onSkuDetailsResponse(BillingResult billingResult, List<SkuDetails> skuDetailsList) {
|
|
||||||
if(skuDetailsList!=null&&!skuDetailsList.isEmpty()){
|
|
||||||
BillingFlowParams flowParams = BillingFlowParams.newBuilder()
|
|
||||||
.setSkuDetails(skuDetailsList.get(0))
|
|
||||||
.build();
|
|
||||||
mBillingClient.launchBillingFlow(activity,flowParams);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onError(GoogleBillingListenerTag.PURCHASE,listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region===================================消耗商品=================================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消耗商品
|
|
||||||
* @param purchaseToken {@link Purchase#getPurchaseToken()}
|
|
||||||
*/
|
|
||||||
public void consumeAsync(Activity activity,String purchaseToken)
|
|
||||||
{
|
|
||||||
consumeAsync(getTag(activity),purchaseToken,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void consumeAsync(Activity activity,String purchaseToken,@Nullable String developerPayload)
|
|
||||||
{
|
|
||||||
consumeAsync(getTag(activity),purchaseToken,developerPayload);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消耗商品
|
|
||||||
* @param purchaseToken {@link Purchase#getPurchaseToken()}
|
|
||||||
*/
|
|
||||||
private void consumeAsync(String tag,String purchaseToken){
|
|
||||||
consumeAsync(tag,purchaseToken,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void consumeAsync(String tag,String purchaseToken,@Nullable String developerPayload)
|
|
||||||
{
|
|
||||||
if(mBillingClient==null)
|
|
||||||
{
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
ConsumeParams consumeParams = ConsumeParams.newBuilder()
|
|
||||||
.setPurchaseToken(purchaseToken)
|
|
||||||
.build();
|
|
||||||
mBillingClient.consumeAsync(consumeParams,new MyConsumeResponseListener(tag));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消耗内购商品-通过sku数组
|
|
||||||
* @param sku sku
|
|
||||||
*/
|
|
||||||
public void consumeAsyncInApp(Activity activity,@NonNull String... sku)
|
|
||||||
{
|
|
||||||
if(mBillingClient==null) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
List<String> skuList = Arrays.asList(sku);
|
|
||||||
consumeAsyncInApp(activity,skuList,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消耗内购商品-通过sku数组
|
|
||||||
* @param skuList sku数组
|
|
||||||
*/
|
|
||||||
public void consumeAsyncInApp(Activity activity,@NonNull List<String> skuList,@Nullable List<String> developerPayloadList)
|
|
||||||
{
|
|
||||||
if(mBillingClient==null) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
List<Purchase> purchaseList = queryPurchasesInApp(activity);
|
|
||||||
if(purchaseList!=null){
|
|
||||||
for(Purchase purchase : purchaseList){
|
|
||||||
int index = skuList.indexOf("purchase.getSku()");
|
|
||||||
if(index!=-1){
|
|
||||||
if(developerPayloadList!=null&&index<developerPayloadList.size()){
|
|
||||||
consumeAsync(activity,purchase.getPurchaseToken(),developerPayloadList.get(index));
|
|
||||||
}else{
|
|
||||||
consumeAsync(activity,purchase.getPurchaseToken(),null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region===================================确认购买=================================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认购买
|
|
||||||
* @param activity activity
|
|
||||||
* @param purchaseToken token
|
|
||||||
*/
|
|
||||||
public void acknowledgePurchase(Activity activity,String purchaseToken){
|
|
||||||
acknowledgePurchase(activity,purchaseToken,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void acknowledgePurchase(Activity activity,String purchaseToken,@Nullable String developerPayload){
|
|
||||||
acknowledgePurchase(getTag(activity),purchaseToken,developerPayload);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void acknowledgePurchase(String tag,String purchaseToken){
|
|
||||||
acknowledgePurchase(tag,purchaseToken,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void acknowledgePurchase(String tag,String purchaseToken,@Nullable String developerPayload){
|
|
||||||
if(mBillingClient==null)
|
|
||||||
{
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
AcknowledgePurchaseParams params = AcknowledgePurchaseParams.newBuilder()
|
|
||||||
.setPurchaseToken(purchaseToken)
|
|
||||||
.build();
|
|
||||||
mBillingClient.acknowledgePurchase(params,new MyAcknowledgePurchaseResponseListener(tag));
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region===================================本地订单查询=================================
|
|
||||||
/**
|
|
||||||
* 获取已经内购的商品
|
|
||||||
* @return 商品列表
|
|
||||||
*/
|
|
||||||
public List<Purchase> queryPurchasesInApp(Activity activity)
|
|
||||||
{
|
|
||||||
return queryPurchases(getTag(activity), BillingClient.SkuType.INAPP);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Purchase> queryPurchasesInApp(String tag)
|
|
||||||
{
|
|
||||||
return queryPurchases(tag, BillingClient.SkuType.INAPP);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取已经订阅的商品
|
|
||||||
* @return 商品列表
|
|
||||||
*/
|
|
||||||
public List<Purchase> queryPurchasesSubs(Activity activity)
|
|
||||||
{
|
|
||||||
return queryPurchases(getTag(activity), BillingClient.SkuType.SUBS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Purchase> queryPurchases(String tag, String skuType)
|
|
||||||
{
|
|
||||||
// if(mBillingClient==null)
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// if(!mBillingClient.isReady())
|
|
||||||
// {
|
|
||||||
// startConnection(tag);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// Purchase.PurchasesResult purchasesResult = mBillingClient.queryPurchases(skuType);
|
|
||||||
// if(purchasesResult!=null)
|
|
||||||
// {
|
|
||||||
// if(purchasesResult.getResponseCode()== BillingClient.BillingResponseCode.OK)
|
|
||||||
// {
|
|
||||||
// List<Purchase> purchaseList = purchasesResult.getPurchasesList();
|
|
||||||
// if(purchaseList!=null&&!purchaseList.isEmpty())
|
|
||||||
// {
|
|
||||||
// for(Purchase purchase:purchaseList)
|
|
||||||
// {
|
|
||||||
// for(OnGoogleBillingListener listener : onGoogleBillingListenerList) {
|
|
||||||
// boolean isSelf = listener.tag.equals(tag);//是否是当前页面
|
|
||||||
// boolean isSuccess = listener.onRecheck(skuType, purchase, isSelf);//是否消耗或者确认
|
|
||||||
// if(isSelf){
|
|
||||||
// if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
|
||||||
// if(skuType.equals(BillingClient.SkuType.INAPP)) {
|
|
||||||
// if(isSuccess){
|
|
||||||
// consumeAsync(tag,purchase.getPurchaseToken());
|
|
||||||
// }else if(isAutoAcknowledgePurchase){
|
|
||||||
// if(!purchase.isAcknowledged()){
|
|
||||||
// acknowledgePurchase(tag,purchase.getPurchaseToken());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }else if(skuType.equals(BillingClient.SkuType.SUBS)){
|
|
||||||
// if(isAutoAcknowledgePurchase){
|
|
||||||
// if(!purchase.isAcknowledged()){
|
|
||||||
// acknowledgePurchase(tag,purchase.getPurchaseToken());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }else{
|
|
||||||
// log("未支付的订单:"+"purchase.getSku()");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return purchaseList;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region===================================在线订单查询=================================
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 异步联网查询所有的内购历史-无论是过期的、取消、等等的订单
|
|
||||||
* @param listener 监听器
|
|
||||||
* @return 返回false的时候说明网络出错
|
|
||||||
*/
|
|
||||||
public boolean queryPurchaseHistoryAsyncInApp(PurchaseHistoryResponseListener listener){
|
|
||||||
if(isReady()) {
|
|
||||||
mBillingClient.queryPurchaseHistoryAsync(BillingClient.SkuType.INAPP,listener);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 异步联网查询所有的订阅历史-无论是过期的、取消、等等的订单
|
|
||||||
* @param listener 监听器
|
|
||||||
* @return 返回false的时候说明网络出错
|
|
||||||
*/
|
|
||||||
public boolean queryPurchaseHistoryAsyncSubs(PurchaseHistoryResponseListener listener){
|
|
||||||
if(isReady()) {
|
|
||||||
mBillingClient.queryPurchaseHistoryAsync(BillingClient.SkuType.SUBS,listener);
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region===================================工具集合=================================
|
|
||||||
/**
|
|
||||||
* 获取有效订阅的数量
|
|
||||||
* @return -1查询失败,0没有有效订阅,>0具有有效的订阅
|
|
||||||
*/
|
|
||||||
public int getPurchasesSizeSubs(Activity activity)
|
|
||||||
{
|
|
||||||
List<Purchase> list = queryPurchasesSubs(activity);
|
|
||||||
if(list!=null)
|
|
||||||
{
|
|
||||||
return list.size();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过sku获取订阅商品序号
|
|
||||||
* @param sku sku
|
|
||||||
* @return 序号
|
|
||||||
*/
|
|
||||||
public int getSubsPositionBySku(String sku)
|
|
||||||
{
|
|
||||||
return getPositionBySku(sku, BillingClient.SkuType.SUBS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过sku获取内购商品序号
|
|
||||||
* @param sku sku
|
|
||||||
* @return 成功返回需要 失败返回-1
|
|
||||||
*/
|
|
||||||
public int getInAppPositionBySku(String sku)
|
|
||||||
{
|
|
||||||
return getPositionBySku(sku, BillingClient.SkuType.INAPP);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getPositionBySku(String sku,String skuType)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(skuType.equals(BillingClient.SkuType.INAPP))
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
for(String s:inAppSKUS)
|
|
||||||
{
|
|
||||||
if(s.equals(sku))
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(skuType.equals(BillingClient.SkuType.SUBS))
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
for(String s:subsSKUS)
|
|
||||||
{
|
|
||||||
if(s.equals(sku))
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过序号获取订阅sku
|
|
||||||
* @param position 序号
|
|
||||||
* @return sku
|
|
||||||
*/
|
|
||||||
public String getSubsSkuByPosition(int position)
|
|
||||||
{
|
|
||||||
if(position>=0&&position<subsSKUS.length)
|
|
||||||
{
|
|
||||||
return subsSKUS[position];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过序号获取内购sku
|
|
||||||
* @param position 序号
|
|
||||||
* @return sku
|
|
||||||
*/
|
|
||||||
public String getInAppSkuByPosition(int position)
|
|
||||||
{
|
|
||||||
if(position>=0&&position<inAppSKUS.length)
|
|
||||||
{
|
|
||||||
return inAppSKUS[position];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过sku获取商品类型(订阅获取内购)
|
|
||||||
* @param sku sku
|
|
||||||
* @return inapp内购,subs订阅
|
|
||||||
*/
|
|
||||||
public String getSkuType(String sku)
|
|
||||||
{
|
|
||||||
if(Arrays.asList(inAppSKUS).contains(sku))
|
|
||||||
{
|
|
||||||
return BillingClient.SkuType.INAPP;
|
|
||||||
}
|
|
||||||
else if(Arrays.asList(subsSKUS).contains(sku))
|
|
||||||
{
|
|
||||||
return BillingClient.SkuType.SUBS;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getTag(Activity activity){
|
|
||||||
if (activity==null){return "";}
|
|
||||||
return activity.getLocalClassName();
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region===================================其他方法=================================
|
|
||||||
|
|
||||||
private void executeServiceRequest(String tag,final Runnable runnable) {
|
|
||||||
if(startConnection(tag))
|
|
||||||
{
|
|
||||||
runnable.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* google内购服务是否已经准备好
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public static boolean isReady() {
|
|
||||||
return mBillingClient!=null&&mBillingClient.isReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置是否自动确认购买
|
|
||||||
* @param isAutoAcknowledgePurchase boolean
|
|
||||||
*/
|
|
||||||
public static void setIsAutoAcknowledgePurchase(boolean isAutoAcknowledgePurchase){
|
|
||||||
GoogleBillingUtil.isAutoAcknowledgePurchase = isAutoAcknowledgePurchase;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 断开连接google服务
|
|
||||||
* 注意!!!一般情况不建议调用该方法,让google保留连接是最好的选择。
|
|
||||||
*/
|
|
||||||
public static void endConnection()
|
|
||||||
{
|
|
||||||
//注意!!!一般情况不建议调用该方法,让google保留连接是最好的选择。
|
|
||||||
if(mBillingClient!=null)
|
|
||||||
{
|
|
||||||
if(mBillingClient.isReady())
|
|
||||||
{
|
|
||||||
mBillingClient.endConnection();
|
|
||||||
mBillingClient = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
public GoogleBillingUtil addOnGoogleBillingListener(Activity activity,OnGoogleBillingListener onGoogleBillingListener){
|
|
||||||
String tag = getTag(activity);
|
|
||||||
onGoogleBillingListener.tag = tag;
|
|
||||||
onGoogleBillingListenerMap.put(getTag(activity),onGoogleBillingListener);
|
|
||||||
for(int i=onGoogleBillingListenerList.size()-1;i>=0;i--){
|
|
||||||
OnGoogleBillingListener listener = onGoogleBillingListenerList.get(i);
|
|
||||||
if(listener.tag.equals(tag)){
|
|
||||||
onGoogleBillingListenerList.remove(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onGoogleBillingListenerList.add(onGoogleBillingListener);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeOnGoogleBillingListener(OnGoogleBillingListener onGoogleBillingListener){
|
|
||||||
onGoogleBillingListenerList.remove(onGoogleBillingListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeOnGoogleBillingListener(Activity activity){
|
|
||||||
String tag = getTag(activity);
|
|
||||||
for(int i=onGoogleBillingListenerList.size()-1;i>=0;i--){
|
|
||||||
OnGoogleBillingListener listener = onGoogleBillingListenerList.get(i);
|
|
||||||
if(listener.tag.equals(tag)){
|
|
||||||
removeOnGoogleBillingListener(listener);
|
|
||||||
onGoogleBillingListenerMap.remove(tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除内购监听器,防止内存泄漏-在Activity-onDestroy里面调用。
|
|
||||||
* 需要确保onDestroy和build方法在同一个线程。
|
|
||||||
*/
|
|
||||||
public void onDestroy(Activity activity){
|
|
||||||
if(builder!=null) {
|
|
||||||
builder.setListener(null);
|
|
||||||
}
|
|
||||||
if (activity != null)
|
|
||||||
removeOnGoogleBillingListener(activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Google购买商品回调接口(订阅和内购都走这个接口)
|
|
||||||
*/
|
|
||||||
private class MyPurchasesUpdatedListener implements PurchasesUpdatedListener
|
|
||||||
{
|
|
||||||
|
|
||||||
public String tag ;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchasesUpdated(BillingResult billingResult, @Nullable List<Purchase> list) {
|
|
||||||
if(billingResult.getResponseCode()== BillingClient.BillingResponseCode.OK&&list!=null)
|
|
||||||
{
|
|
||||||
for(Purchase purchase:list) {
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
boolean isSelf = listener.tag.equals(tag);//是否是当前页面
|
|
||||||
boolean isSuccess = listener.onPurchaseSuccess(purchase,isSelf);//是否自动消耗
|
|
||||||
if(isSelf&&purchase.getPurchaseState()== Purchase.PurchaseState.PURCHASED){
|
|
||||||
//是当前页面,并且商品状态为支付成功,才会进行消耗与确认的操作
|
|
||||||
String skuType = getSkuType("purchase.getSku()");
|
|
||||||
if(BillingClient.SkuType.INAPP.equals(skuType)){
|
|
||||||
if(isSuccess){
|
|
||||||
//进行消耗
|
|
||||||
consumeAsync(tag,purchase.getPurchaseToken());
|
|
||||||
}else if(isAutoAcknowledgePurchase){
|
|
||||||
//进行确认购买
|
|
||||||
if(!purchase.isAcknowledged()){
|
|
||||||
acknowledgePurchase(tag,purchase.getPurchaseToken());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if(BillingClient.SkuType.SUBS.equals(skuType)){
|
|
||||||
//进行确认购买
|
|
||||||
if(isAutoAcknowledgePurchase){
|
|
||||||
if(!purchase.isAcknowledged()){
|
|
||||||
acknowledgePurchase(tag,purchase.getPurchaseToken());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if(purchase.getPurchaseState()== Purchase.PurchaseState.PENDING){
|
|
||||||
log("待处理的订单:"+"purchase.getSku()");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(IS_DEBUG){
|
|
||||||
log("购买失败,responseCode:"+billingResult.getResponseCode()+",msg:"+billingResult.getDebugMessage());
|
|
||||||
}
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onFail(GoogleBillingListenerTag.PURCHASE,billingResult.getResponseCode(),listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Google查询商品信息回调接口
|
|
||||||
*/
|
|
||||||
private class MySkuDetailsResponseListener implements SkuDetailsResponseListener
|
|
||||||
{
|
|
||||||
private String skuType ;
|
|
||||||
private String tag;
|
|
||||||
|
|
||||||
public MySkuDetailsResponseListener(String skuType,String tag) {
|
|
||||||
this.skuType = skuType;
|
|
||||||
this.tag = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSkuDetailsResponse(BillingResult billingResult, List<SkuDetails> list) {
|
|
||||||
if(billingResult.getResponseCode()== BillingClient.BillingResponseCode.OK&&list!=null)
|
|
||||||
{
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onQuerySuccess(skuType,list,listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onFail(GoogleBillingListenerTag.QUERY,billingResult.getResponseCode(),listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
if(IS_DEBUG){
|
|
||||||
log("查询失败,responseCode:"+billingResult.getResponseCode()+",msg:"+billingResult.getDebugMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Googlg消耗商品回调
|
|
||||||
*/
|
|
||||||
private class MyConsumeResponseListener implements ConsumeResponseListener
|
|
||||||
{
|
|
||||||
private String tag ;
|
|
||||||
|
|
||||||
public MyConsumeResponseListener(String tag) {
|
|
||||||
this.tag = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConsumeResponse(BillingResult billingResult, String purchaseToken) {
|
|
||||||
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onConsumeSuccess(purchaseToken,listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onFail(GoogleBillingListenerTag.COMSUME,billingResult.getResponseCode(),listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
if(IS_DEBUG){
|
|
||||||
log("消耗失败,responseCode:"+billingResult.getResponseCode()+",msg:"+billingResult.getDebugMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Googlg消耗商品回调
|
|
||||||
*/
|
|
||||||
private class MyAcknowledgePurchaseResponseListener implements AcknowledgePurchaseResponseListener {
|
|
||||||
|
|
||||||
private String tag ;
|
|
||||||
|
|
||||||
public MyAcknowledgePurchaseResponseListener(String tag) {
|
|
||||||
this.tag = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAcknowledgePurchaseResponse(BillingResult billingResult) {
|
|
||||||
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onAcknowledgePurchaseSuccess(listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
for(OnGoogleBillingListener listener:onGoogleBillingListenerList){
|
|
||||||
listener.onFail(GoogleBillingListenerTag.AcKnowledgePurchase,billingResult.getResponseCode(),listener.tag.equals(tag));
|
|
||||||
}
|
|
||||||
if(IS_DEBUG){
|
|
||||||
log("确认购买失败,responseCode:"+billingResult.getResponseCode()+",msg:"+billingResult.getDebugMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum GoogleBillingListenerTag{
|
|
||||||
|
|
||||||
QUERY("query"),
|
|
||||||
PURCHASE("purchase"),
|
|
||||||
SETUP("setup"),
|
|
||||||
COMSUME("comsume"),
|
|
||||||
AcKnowledgePurchase("AcKnowledgePurchase"),
|
|
||||||
;
|
|
||||||
public String tag ;
|
|
||||||
GoogleBillingListenerTag(String tag){
|
|
||||||
this.tag = tag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void log(String msg)
|
|
||||||
{
|
|
||||||
if(IS_DEBUG)
|
|
||||||
{
|
|
||||||
Log.e(TAG,msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void isDebug(boolean isDebug){
|
|
||||||
GoogleBillingUtil.IS_DEBUG = isDebug;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
package com.yunbao.common.utils;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.android.billingclient.api.BillingClient;
|
|
||||||
import com.android.billingclient.api.BillingClientStateListener;
|
|
||||||
import com.android.billingclient.api.BillingFlowParams;
|
|
||||||
import com.android.billingclient.api.BillingResult;
|
|
||||||
import com.android.billingclient.api.ConsumeParams;
|
|
||||||
import com.android.billingclient.api.ConsumeResponseListener;
|
|
||||||
import com.android.billingclient.api.Purchase;
|
|
||||||
import com.android.billingclient.api.PurchasesResponseListener;
|
|
||||||
import com.android.billingclient.api.PurchasesUpdatedListener;
|
|
||||||
import com.android.billingclient.api.QueryPurchasesParams;
|
|
||||||
import com.android.billingclient.api.SkuDetails;
|
|
||||||
import com.android.billingclient.api.SkuDetailsParams;
|
|
||||||
import com.android.billingclient.api.SkuDetailsResponseListener;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新写Google内付工具类做简单的封装
|
|
||||||
* 支付流程:初始化Google支付服务-->查询商品-->购买-->支付成功回调-->消耗商品
|
|
||||||
*/
|
|
||||||
public class GoogleBillingUtilNew {
|
|
||||||
private BillingClient billingClient;
|
|
||||||
private Activity mContext;
|
|
||||||
private String TAG = "GoogleBillingUtilNew";
|
|
||||||
private static GoogleBillingUtilNew googleBillingUtilNew;
|
|
||||||
|
|
||||||
public static GoogleBillingUtilNew getInstance() {
|
|
||||||
if (googleBillingUtilNew == null) {
|
|
||||||
googleBillingUtilNew = new GoogleBillingUtilNew();
|
|
||||||
}
|
|
||||||
return googleBillingUtilNew;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initGooglePay(Activity mContext) {
|
|
||||||
this.mContext = mContext;
|
|
||||||
billingClient = BillingClient.newBuilder(mContext)
|
|
||||||
.setListener(purchasesUpdatedListener)
|
|
||||||
.enablePendingPurchases()
|
|
||||||
.build();
|
|
||||||
//请求连接到GooglePay
|
|
||||||
billingClient.startConnection(new BillingClientStateListener() {
|
|
||||||
@Override
|
|
||||||
public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
|
|
||||||
int code = billingResult.getResponseCode();
|
|
||||||
if (code != BillingClient.BillingResponseCode.OK) {
|
|
||||||
String msg = billingResult.getDebugMessage();
|
|
||||||
Log.e(TAG, "连接到GooglePay失败 code = " + code + " msg = " + msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.e(TAG, "连接到GooglePay成功");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//连接失败
|
|
||||||
@Override
|
|
||||||
public void onBillingServiceDisconnected() {
|
|
||||||
Log.e(TAG, "连接到GooglePay失败,请重试");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//查询商品
|
|
||||||
public void checkSku(String id) {
|
|
||||||
List<String> skuList = new ArrayList<>();
|
|
||||||
skuList.add(id);
|
|
||||||
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder()
|
|
||||||
.setSkusList(skuList)
|
|
||||||
.setType(BillingClient.SkuType.INAPP);
|
|
||||||
billingClient.querySkuDetailsAsync(params.build(), new SkuDetailsResponseListener() {
|
|
||||||
@Override
|
|
||||||
public void onSkuDetailsResponse(@NonNull BillingResult billingResult, @Nullable List<SkuDetails> list) {
|
|
||||||
int code = billingResult.getResponseCode();
|
|
||||||
if (code != BillingClient.BillingResponseCode.OK || list == null || list.isEmpty()) {
|
|
||||||
String msg = billingResult.getDebugMessage();
|
|
||||||
Log.e(TAG, "查询商品失败 code = " + code + " msg = " + msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.e(TAG, "查询商品成功");
|
|
||||||
buyIt(list.get(0));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//购买
|
|
||||||
private void buyIt(SkuDetails skuDetails) {
|
|
||||||
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
|
|
||||||
.setSkuDetails(skuDetails)
|
|
||||||
.build();
|
|
||||||
BillingResult billingResult = billingClient.launchBillingFlow(mContext, billingFlowParams);
|
|
||||||
int code = billingResult.getResponseCode();
|
|
||||||
if (code != BillingClient.BillingResponseCode.OK) {
|
|
||||||
String msg = billingResult.getDebugMessage();
|
|
||||||
Log.e(TAG, "购买商品失败 code = " + code + " msg = " + msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.e(TAG, "购买商品" + skuDetails.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private PurchasesUpdatedListener purchasesUpdatedListener = new PurchasesUpdatedListener() {
|
|
||||||
@Override
|
|
||||||
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> list) {
|
|
||||||
int code = billingResult.getResponseCode();
|
|
||||||
String msg = billingResult.getDebugMessage();
|
|
||||||
Log.e(TAG, "onPurchasesUpdated:code = " + code + " msg = " + msg);
|
|
||||||
if (list != null) {
|
|
||||||
for (Purchase purchase : list) {
|
|
||||||
Log.e(TAG, "onPurchasesUpdated:" + purchase.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (code == BillingClient.BillingResponseCode.OK && list != null) {
|
|
||||||
consume(list);
|
|
||||||
Log.e(TAG, "支付成功");
|
|
||||||
if (billingListener != null) {
|
|
||||||
billingListener.onPaySuccess(list);
|
|
||||||
}
|
|
||||||
} else if (code == BillingClient.BillingResponseCode.USER_CANCELED) {
|
|
||||||
Log.e(TAG, "支付取消");
|
|
||||||
if (billingListener != null) {
|
|
||||||
billingListener.onPayFailed(code, msg);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (billingListener != null) {
|
|
||||||
billingListener.onPayFailed(code, msg);
|
|
||||||
}
|
|
||||||
Log.e(TAG, "支付失败:code = " + code + " msg = " + msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//消耗商品
|
|
||||||
public void consume(List<Purchase> list) {
|
|
||||||
if (list == null || list.isEmpty() || billingClient == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (Purchase purchase : list) {
|
|
||||||
billingClient.consumeAsync(ConsumeParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build(), new ConsumeResponseListener() {
|
|
||||||
@Override
|
|
||||||
public void onConsumeResponse(BillingResult billingResult, String purchaseToken) {
|
|
||||||
Log.e(TAG, "onConsumeResponse code = " + billingResult.getResponseCode() + " , msg = " + billingResult.getDebugMessage() + " , purchaseToken = " + purchaseToken);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品订单
|
|
||||||
*/
|
|
||||||
public void queryPurchasesAsync(PurchasesResponseListener responseListener) {
|
|
||||||
if (billingClient == null) return;
|
|
||||||
//内购商品交易查询
|
|
||||||
//内购商品交易查询
|
|
||||||
QueryPurchasesParams inAppPurchasesQurey = QueryPurchasesParams.newBuilder()
|
|
||||||
.setProductType(BillingClient.ProductType.INAPP)
|
|
||||||
.build();
|
|
||||||
billingClient.queryPurchasesAsync(inAppPurchasesQurey, responseListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定义接口返回支付结果
|
|
||||||
*/
|
|
||||||
public interface GoogleBillingListener {
|
|
||||||
void onPaySuccess(List<Purchase> list);
|
|
||||||
|
|
||||||
void onPayFailed(int code, String msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private GoogleBillingListener billingListener;
|
|
||||||
|
|
||||||
public GoogleBillingUtilNew setBillingListener(GoogleBillingListener billingListener) {
|
|
||||||
this.billingListener = billingListener;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
|
public class GoogleCallBack {
|
||||||
|
public void processResponse() {
|
||||||
|
L.e("___GoogleCallBack___processResponse");
|
||||||
|
}
|
||||||
|
}
|
||||||
256
common/src/main/java/com/yunbao/common/utils/GoogleUtils.java
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谷歌工具类
|
||||||
|
*/
|
||||||
|
public class GoogleUtils {
|
||||||
|
|
||||||
|
Activity mActivity;
|
||||||
|
|
||||||
|
Context mContext;
|
||||||
|
|
||||||
|
Object googlePay;
|
||||||
|
|
||||||
|
public static GoogleUtils googleUtils;
|
||||||
|
|
||||||
|
public GoogleUtils(Activity activity) {
|
||||||
|
this.mActivity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GoogleUtils(Context mContext) {
|
||||||
|
this.mContext = mContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static GoogleUtils newInstance(Context mContext) {
|
||||||
|
if (googleUtils == null) {
|
||||||
|
googleUtils = new GoogleUtils(mContext);
|
||||||
|
}
|
||||||
|
return googleUtils;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static GoogleUtils newInstance(Activity mContext) {
|
||||||
|
if (googleUtils == null) {
|
||||||
|
googleUtils = new GoogleUtils(mContext);
|
||||||
|
}
|
||||||
|
return googleUtils;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录Intnet
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Intent getIntent() {
|
||||||
|
Intent intent;
|
||||||
|
try {
|
||||||
|
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleManage");
|
||||||
|
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||||
|
intent = (Intent) invite.getClass().getMethod("googleLogin").invoke(invite);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取支付结果
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public JSONObject getLoginResult(Intent intent) {
|
||||||
|
JSONObject object;
|
||||||
|
try {
|
||||||
|
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleManage");
|
||||||
|
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||||
|
object = (JSONObject) invite.getClass().getMethod("getLoginResult", Intent.class).invoke(invite, intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化谷歌支付
|
||||||
|
*/
|
||||||
|
public void initGooglePay() {
|
||||||
|
try {
|
||||||
|
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleBillingManage");
|
||||||
|
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||||
|
googlePay.getClass().getMethod("initGooglePay").invoke(googlePay);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getAdid() {
|
||||||
|
String adId;
|
||||||
|
try {
|
||||||
|
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleBillingManage");
|
||||||
|
Object invite = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||||
|
adId = (String) invite.getClass().getMethod("getAdid").invoke(googlePay);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return adId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买
|
||||||
|
*/
|
||||||
|
public void purchase(String skuId) {
|
||||||
|
try {
|
||||||
|
googlePay.getClass().getMethod("checkSku", String.class).invoke(googlePay, skuId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer timer;
|
||||||
|
|
||||||
|
public void setBillingListener(GoogleBillingListener billingListener) {
|
||||||
|
if (timer != null) {
|
||||||
|
timer.cancel();
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
googlePay.getClass().getMethod("initResultCode").invoke(googlePay);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
timer = new Timer();
|
||||||
|
TimerTask task = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
JSONObject resultCode = (JSONObject) googlePay.getClass().getMethod("getPayResult").invoke(googlePay);
|
||||||
|
int code = resultCode.getInt("resultCode");
|
||||||
|
String token = resultCode.getString("resultToken");
|
||||||
|
String orderId = resultCode.getString("resultOrderId");
|
||||||
|
if (code == 0) {
|
||||||
|
timer.cancel();
|
||||||
|
billingListener.onPaySuccess(token, orderId);
|
||||||
|
} else if (code == 1) {
|
||||||
|
timer.cancel();
|
||||||
|
billingListener.onPayFailed("支付取消");
|
||||||
|
} else if (code == 2) {
|
||||||
|
timer.cancel();
|
||||||
|
billingListener.onPayFailed("支付失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
timer.schedule(task, 1000, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initializeApp(Context context) {
|
||||||
|
try {
|
||||||
|
Class<?> clz = context.getClassLoader().loadClass("com.shayu.lib_google.utils.FirebaseManage");
|
||||||
|
Object invite = clz.getConstructor(Context.class).newInstance(context);
|
||||||
|
invite.getClass().getMethod("initializeApp").invoke(invite);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirebaseTokenListener(Activity activity, FirebaseTokenListener firebaseTokenListener) {
|
||||||
|
Timer timer = new Timer();
|
||||||
|
TimerTask task = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
Class<?> clz = activity.getClassLoader().loadClass("com.shayu.lib_google.utils.FirebaseManage");
|
||||||
|
googlePay = clz.getConstructor(Activity.class).newInstance(activity);
|
||||||
|
String token = (String) googlePay.getClass().getMethod("getToken").invoke(googlePay);
|
||||||
|
if (!StringUtil.isEmpty(token)) {
|
||||||
|
firebaseTokenListener.onResultToken(token);
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
timer.schedule(task, 1000, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initFireToken(Activity activity) {
|
||||||
|
try {
|
||||||
|
Class<?> clz = activity.getClassLoader().loadClass("com.shayu.lib_google.utils.FirebaseManage");
|
||||||
|
googlePay = clz.getConstructor(Activity.class).newInstance(activity);
|
||||||
|
googlePay.getClass().getMethod("initToken").invoke(googlePay);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void queryPurchasesAsync() {
|
||||||
|
try {
|
||||||
|
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleBillingManage");
|
||||||
|
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
|
||||||
|
googlePay.getClass().getMethod("consumeAll").invoke(googlePay);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQueryPurchaseListener(Activity activity, QueryPurchasesListener queryPurchasesListener) {
|
||||||
|
Timer timer = new Timer();
|
||||||
|
TimerTask task = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
JSONObject object = (JSONObject) googlePay.getClass().getMethod("getQuerySize").invoke(googlePay);
|
||||||
|
L.e("setQueryPurchaseListenersetQueryPurchaseListener__" + object.getInt("querySize"));
|
||||||
|
if (object.getInt("querySize") != -1) {
|
||||||
|
queryPurchasesListener.onResult(object);
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
timer.schedule(task, 1000, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义接口返回支付结果
|
||||||
|
*/
|
||||||
|
public interface GoogleBillingListener {
|
||||||
|
void onPaySuccess(String token, String orderId);
|
||||||
|
|
||||||
|
void onPayFailed(String msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface FirebaseTokenListener {
|
||||||
|
void onResultToken(String token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface QueryPurchasesListener {
|
||||||
|
void onResult(JSONObject obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -99,50 +99,41 @@ public class LogUtil {
|
|||||||
} else {
|
} else {
|
||||||
time = System.currentTimeMillis() + "";
|
time = System.currentTimeMillis() + "";
|
||||||
}
|
}
|
||||||
PostRequest<String> request = OkGo.<String>post("https://newht.yaoulive.com/index.php/api/error_log/report")
|
PostRequest<String> request = OkGo.<String>post("https://newht.yaoulive.com/index.php/api/error_log/report").params("log", err).params("uid", CommonAppConfig.getInstance().getUid()).params("time", time).params("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY).params("appVersion", CommonAppConfig.getInstance().getVersion()).tag("errorLog").converter(new StringCallback() {
|
||||||
.params("log", err)
|
String TAG = "异常上传";
|
||||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
|
||||||
.params("time", time)
|
|
||||||
.params("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY)
|
|
||||||
.params("appVersion", CommonAppConfig.getInstance().getVersion())
|
|
||||||
.tag("errorLog")
|
|
||||||
.converter(new StringCallback() {
|
|
||||||
String TAG = "异常上传";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Response<String> response) {
|
public void onSuccess(Response<String> response) {
|
||||||
Log.i(TAG, "onSuccess: " + response.message());
|
Log.i(TAG, "onSuccess: " + response.message());
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
UploadTask<String> task = OkUpload.request("errorLog", request)
|
UploadTask<String> task = OkUpload.request("errorLog", request).save().register(new UploadListener<String>("errorLog") {
|
||||||
.save()
|
|
||||||
.register(new UploadListener<String>("errorLog") {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart(Progress progress) {
|
public void onStart(Progress progress) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProgress(Progress progress) {
|
public void onProgress(Progress progress) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Progress progress) {
|
public void onError(Progress progress) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish(String s, Progress progress) {
|
public void onFinish(String s, Progress progress) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemove(Progress progress) {
|
public void onRemove(Progress progress) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
task.start();
|
task.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,12 +151,12 @@ public class LogUtil {
|
|||||||
public static void shareFile(Context context) {
|
public static void shareFile(Context context) {
|
||||||
try {
|
try {
|
||||||
IMLoginModel bean = IMLoginManager.get(context).getUserInfo();
|
IMLoginModel bean = IMLoginManager.get(context).getUserInfo();
|
||||||
boolean isAnchor=false;
|
boolean isAnchor = false;
|
||||||
if(bean!=null){
|
if (bean != null) {
|
||||||
isAnchor=bean.anchorUserType();
|
isAnchor = bean.anchorUserType();
|
||||||
}
|
}
|
||||||
//有debug文件或主播才允许
|
//有debug文件或主播才允许
|
||||||
if (!new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "pdlive.debug").exists()&&!isAnchor) {
|
if (!new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "pdlive.debug").exists() && !isAnchor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -225,7 +216,7 @@ public class LogUtil {
|
|||||||
share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
context.startActivity(Intent.createChooser(share, "分享文件"));
|
context.startActivity(Intent.createChooser(share, "分享文件"));
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !CommonAppConfig.IS_GOOGLE_PLAY) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && CommonAppConfig.IS_GOOGLE_PLAY == 0) {
|
||||||
if (!Environment.isExternalStorageManager()) {
|
if (!Environment.isExternalStorageManager()) {
|
||||||
Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
|
Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
@@ -244,17 +235,14 @@ public class LogUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static String TAG="Upload";
|
|
||||||
|
private static String TAG = "Upload";
|
||||||
|
|
||||||
private static void uploadLog(File log) {
|
private static void uploadLog(File log) {
|
||||||
|
|
||||||
JSONObject body = new JSONObject();
|
JSONObject body = new JSONObject();
|
||||||
|
|
||||||
MultipartBody requestBody = new MultipartBody.Builder()
|
MultipartBody requestBody = new MultipartBody.Builder().addFormDataPart("uid", CommonAppConfig.getInstance().getUid()).addFormDataPart("time", new SimpleDateFormat("yyyy-DD-mm HH:mm:ss", Locale.getDefault()).format(new Date())).addFormDataPart("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY + "").addFormDataPart("appVersion", CommonAppConfig.getInstance().getVersion()).addFormDataPart("file", "file", RequestBody.create(MediaType.parse("application/octet-stream"), log)) //上报日志文件
|
||||||
.addFormDataPart("uid", CommonAppConfig.getInstance().getUid())
|
|
||||||
.addFormDataPart("time", new SimpleDateFormat("yyyy-DD-mm HH:mm:ss", Locale.getDefault()).format(new Date()))
|
|
||||||
.addFormDataPart("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY+"")
|
|
||||||
.addFormDataPart("appVersion", CommonAppConfig.getInstance().getVersion())
|
|
||||||
.addFormDataPart("file","file", RequestBody.create(MediaType.parse("application/octet-stream"),log)) //上报日志文件
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
body.put("uid", CommonAppConfig.getInstance().getUid());
|
body.put("uid", CommonAppConfig.getInstance().getUid());
|
||||||
@@ -262,28 +250,23 @@ public class LogUtil {
|
|||||||
body.put("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY);
|
body.put("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY);
|
||||||
body.put("appVersion", CommonAppConfig.getInstance().getVersion());
|
body.put("appVersion", CommonAppConfig.getInstance().getVersion());
|
||||||
|
|
||||||
OkHttpClient client = new OkHttpClient.Builder()
|
OkHttpClient client = new OkHttpClient.Builder().connectTimeout(3, TimeUnit.SECONDS).build();
|
||||||
.connectTimeout(3, TimeUnit.SECONDS)
|
Request request = new Request.Builder().url("https://newht.yaoulive.com/index.php/api/error_log/report") //无法接受文件
|
||||||
.build();
|
.post(requestBody).build();
|
||||||
Request request = new Request.Builder()
|
client.newCall(request).enqueue(new Callback() {
|
||||||
.url("https://newht.yaoulive.com/index.php/api/error_log/report") //无法接受文件
|
@Override
|
||||||
.post(requestBody)
|
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
||||||
.build();
|
Log.e(TAG, "error", e);
|
||||||
client.newCall(request)
|
}
|
||||||
.enqueue(new Callback() {
|
|
||||||
@Override
|
|
||||||
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
|
||||||
Log.e(TAG, "error",e );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, okhttp3.Response response) throws IOException {
|
public void onResponse(Call call, okhttp3.Response response) throws IOException {
|
||||||
String body = response.body().string();
|
String body = response.body().string();
|
||||||
Log.i(TAG, "onResponse: "+body);
|
Log.i(TAG, "onResponse: " + body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,106 +0,0 @@
|
|||||||
package com.yunbao.common.utils;
|
|
||||||
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.android.billingclient.api.Purchase;
|
|
||||||
import com.android.billingclient.api.SkuDetails;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 作者:天镜baobao
|
|
||||||
* 时间:2019/6/2 13:51
|
|
||||||
* 说明:允许使用,但请遵循Apache License 2.0
|
|
||||||
* 使用:
|
|
||||||
* Copyright 2019 天镜baobao
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
public class OnGoogleBillingListener {
|
|
||||||
|
|
||||||
@SuppressWarnings("WeakerAccess")
|
|
||||||
public String tag = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询成功
|
|
||||||
* @param skuType 内购或者订阅
|
|
||||||
* @param list 商品列表
|
|
||||||
* @param isSelf 是否是当前页面的结果
|
|
||||||
*/
|
|
||||||
public void onQuerySuccess(@NonNull String skuType, @NonNull List<SkuDetails> list, boolean isSelf){}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 购买成功
|
|
||||||
* @param purchase 商品
|
|
||||||
* @param isSelf 是否是当前页面的结果
|
|
||||||
*
|
|
||||||
// * @return 是否消耗,只有当isSelf为true,并且支付状态为{@link com.android.billingclient.api.Purchase.PurchaseState.PURCHASED}时,该值才会生效。
|
|
||||||
*/
|
|
||||||
public boolean onPurchaseSuccess(@NonNull Purchase purchase, boolean isSelf){return true;}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化成功
|
|
||||||
* @param isSelf 是否是当前页面的结果
|
|
||||||
*/
|
|
||||||
public void onSetupSuccess(boolean isSelf){}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 每次启动重新检查订单,返回有效的订单
|
|
||||||
*
|
|
||||||
* @param skuType 内购或者订阅
|
|
||||||
* @param purchase 商品
|
|
||||||
* @param isSelf 是否是当前页面的结果
|
|
||||||
*
|
|
||||||
* @return 是否自动消耗,只有当isSelf为true,并且支付状态为{@link com.android.billingclient.api.Purchase.PurchaseState.PURCHASED}时,该值才会生效。
|
|
||||||
*/
|
|
||||||
public boolean onRecheck(@NonNull String skuType, @NonNull Purchase purchase, boolean isSelf) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接断开
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("WeakerAccess")
|
|
||||||
public void onBillingServiceDisconnected(){ }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消耗成功
|
|
||||||
* @param purchaseToken token
|
|
||||||
* @param isSelf 是否是当前页面的结果
|
|
||||||
*/
|
|
||||||
public void onConsumeSuccess(@NonNull String purchaseToken,boolean isSelf){}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认购买成功
|
|
||||||
* @param isSelf 是否是当前页面的结果
|
|
||||||
*/
|
|
||||||
public void onAcknowledgePurchaseSuccess(boolean isSelf){}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 失败回调
|
|
||||||
* @param tag {@link GoogleBillingUtil.GoogleBillingListenerTag}
|
|
||||||
* @param responseCode 返回码{https://developer.android.com/google/play/billing/billing_reference}
|
|
||||||
* @param isSelf 是否是当前页面的结果
|
|
||||||
*/
|
|
||||||
public void onFail(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, int responseCode, boolean isSelf){}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* google组件初始化失败等等。
|
|
||||||
* @param tag {@link GoogleBillingUtil.GoogleBillingListenerTag}
|
|
||||||
* @param isSelf 是否是当前页面的结果
|
|
||||||
*/
|
|
||||||
public void onError(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, boolean isSelf){}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -45,6 +45,7 @@ public class RouteUtil {
|
|||||||
public static final String PATH_RED_PACKET_INFO = "/main/RedPacketInfoActivity";
|
public static final String PATH_RED_PACKET_INFO = "/main/RedPacketInfoActivity";
|
||||||
public static final String PATH_RED_PACKET_USER = "/main/RedPacketUsersActivity";
|
public static final String PATH_RED_PACKET_USER = "/main/RedPacketUsersActivity";
|
||||||
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
|
public static final String PATH_SELECT_AVATAR="/main/UserAvatarSelectActivity";
|
||||||
|
public static final String PATH_BattlePassActivity="/main/BattlePassActivity";
|
||||||
|
|
||||||
public static void forwardFansActivity(String uid) {
|
public static void forwardFansActivity(String uid) {
|
||||||
ARouter.getInstance().build(PATH_FANSACTIVITY)
|
ARouter.getInstance().build(PATH_FANSACTIVITY)
|
||||||
@@ -315,4 +316,12 @@ public class RouteUtil {
|
|||||||
ARouter.getInstance().build(PATH_SELECT_AVATAR)
|
ARouter.getInstance().build(PATH_SELECT_AVATAR)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 战令
|
||||||
|
*/
|
||||||
|
public static void forwardBattlePass(){
|
||||||
|
ARouter.getInstance().build(PATH_BattlePassActivity)
|
||||||
|
.navigation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,11 +40,61 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//是否是谷歌版本
|
//是否是谷歌版本
|
||||||
public void showDialog(Activity context, ConfigBean configBean, String downloadUrl) {
|
public void showDialog(Activity context, ConfigBean configBean, String downloadUrl) {
|
||||||
//不是谷歌
|
//华为版本
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||||
|
//todo
|
||||||
|
//谷歌版本
|
||||||
|
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
|
//谷歌强制更新
|
||||||
|
if (configBean.getGoogle_isup().equals("1")) {
|
||||||
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
|
builder.setTitle(context.getString(R.string.version_update))
|
||||||
|
.setContent(configBean.getUpdateDes())
|
||||||
|
.setConfirmString(context.getString(R.string.version_immediate_use))
|
||||||
|
.setCancelString(context.getString(R.string.version_not_update))
|
||||||
|
.setCancelable(false)
|
||||||
|
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||||
|
public void onCancelClick() {
|
||||||
|
context.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
|
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||||
|
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||||
|
context.startActivity(i);
|
||||||
|
context.finish();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build()
|
||||||
|
.show();
|
||||||
|
//谷歌不强制
|
||||||
|
} else {
|
||||||
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
|
builder.setTitle(context.getString(R.string.version_update))
|
||||||
|
.setContent(configBean.getUpdateDes())
|
||||||
|
.setConfirmString(context.getString(R.string.version_immediate_use))
|
||||||
|
.setCancelString(context.getString(R.string.version_not_update))
|
||||||
|
.setCancelable(false)
|
||||||
|
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||||
|
public void onCancelClick() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
|
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||||
|
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||||
|
context.startActivity(i);
|
||||||
|
context.finish();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build()
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
//不强更
|
//不强更
|
||||||
if (configBean.getForceUpdate() != 1) {
|
if (configBean.getForceUpdate() != 1) {
|
||||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
@@ -103,55 +153,6 @@ public class VersionUtil {
|
|||||||
.build()
|
.build()
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
//谷歌版本
|
|
||||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
|
||||||
//谷歌强制更新
|
|
||||||
if (configBean.getGoogle_isup().equals("1")) {
|
|
||||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
|
||||||
builder.setTitle(context.getString(R.string.version_update))
|
|
||||||
.setContent(configBean.getUpdateDes())
|
|
||||||
.setConfirmString(context.getString(R.string.version_immediate_use))
|
|
||||||
.setCancelString(context.getString(R.string.version_not_update))
|
|
||||||
.setCancelable(false)
|
|
||||||
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
|
||||||
public void onCancelClick() {
|
|
||||||
context.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfirmClick(Dialog dialog, String content) {
|
|
||||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
|
||||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
|
||||||
context.startActivity(i);
|
|
||||||
context.finish();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build()
|
|
||||||
.show();
|
|
||||||
//谷歌不强制
|
|
||||||
} else {
|
|
||||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
|
||||||
builder.setTitle(context.getString(R.string.version_update))
|
|
||||||
.setContent(configBean.getUpdateDes())
|
|
||||||
.setConfirmString(context.getString(R.string.version_immediate_use))
|
|
||||||
.setCancelString(context.getString(R.string.version_not_update))
|
|
||||||
.setCancelable(false)
|
|
||||||
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
|
||||||
public void onCancelClick() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfirmClick(Dialog dialog, String content) {
|
|
||||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
|
||||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
|
||||||
context.startActivity(i);
|
|
||||||
context.finish();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build()
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ public class WordUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNewZh() {
|
public static boolean isNewZh() {
|
||||||
return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE;
|
return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE
|
||||||
|
|| IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.TRADITIONAL_CHINESE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getNewString(int res) {
|
public static String getNewString(int res) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.utils.TextUtils;
|
||||||
import com.lxj.xpopup.core.CenterPopupView;
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
@@ -69,10 +70,10 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
|||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
if (!mInside) {
|
if (!mInside) {
|
||||||
if (!CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getAPKGoogleIsUp() == 1) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 0 && APKManager.get().getAPKGoogleIsUp() == 1) {
|
||||||
findViewById(R.id.dialog_close).setVisibility(GONE);
|
findViewById(R.id.dialog_close).setVisibility(GONE);
|
||||||
}
|
}
|
||||||
if (!CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getAPKGoogleIsUp() == 1) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 0 && APKManager.get().getAPKGoogleIsUp() == 1) {
|
||||||
findViewById(R.id.dialog_close).setVisibility(GONE);
|
findViewById(R.id.dialog_close).setVisibility(GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,27 +85,37 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
|||||||
updateLine.setVisibility(GONE);
|
updateLine.setVisibility(GONE);
|
||||||
updateText.setText(APKManager.get().getAPKDes());
|
updateText.setText(APKManager.get().getAPKDes());
|
||||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dialog_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dialog_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
if (mInside){
|
if (mInside) {
|
||||||
dismiss();
|
dismiss();
|
||||||
}else {
|
} else {
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getAPKGoogleIsUp() != 1) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 && APKManager.get().getAPKGoogleIsUp() != 1) {
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
if (!CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getApkIsUp() != 1) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 2 && APKManager.get().getAPKGoogleIsUp() != 1) {
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
}
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 0 && APKManager.get().getApkIsUp() != 1) {
|
||||||
|
dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
}
|
||||||
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(versionImmediateUse, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(versionImmediateUse, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
//不是谷歌
|
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||||
if (!CommonAppConfig.IS_GOOGLE_PLAY) {
|
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||||
|
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||||
|
mContext.startActivity(i);
|
||||||
|
mContext.finish();
|
||||||
|
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||||
|
//华为
|
||||||
|
//todo
|
||||||
|
launchAppDetail(mContext, "com.pdlive.shayu", "com.pdlive.shayu");
|
||||||
|
} else {
|
||||||
versionImmediateUse.setVisibility(GONE);
|
versionImmediateUse.setVisibility(GONE);
|
||||||
updateLine.setVisibility(VISIBLE);
|
updateLine.setVisibility(VISIBLE);
|
||||||
downloadAPK(mContext, APKManager.get().getAPKUrl(), new APKDownloadUtil.OnUpdateListener() {
|
downloadAPK(mContext, APKManager.get().getAPKUrl(), new APKDownloadUtil.OnUpdateListener() {
|
||||||
@@ -113,24 +124,35 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
|||||||
ToastUtil.show(error);
|
ToastUtil.show(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
|
||||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
|
||||||
mContext.startActivity(i);
|
|
||||||
mContext.finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void launchAppDetail(Context mContext, String appPkg, String marketPkg) {
|
||||||
|
try {
|
||||||
|
if (TextUtils.isEmpty(appPkg)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uri uri = Uri.parse("market://details?id=" + appPkg);
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
|
if (!TextUtils.isEmpty(marketPkg)) {
|
||||||
|
intent.setPackage(marketPkg);
|
||||||
|
}
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void downloadAPK(Activity context, String url, APKDownloadUtil.OnUpdateListener listener) {
|
public void downloadAPK(Activity context, String url, APKDownloadUtil.OnUpdateListener listener) {
|
||||||
Request request = new Request.Builder().url(url)
|
Request request = new Request.Builder().url(url).addHeader("Accept-Encoding", "identity").build();
|
||||||
.addHeader("Accept-Encoding", "identity").build();
|
|
||||||
File downloadFile = new File(context.getCacheDir(), "update_app.apk");
|
File downloadFile = new File(context.getCacheDir(), "update_app.apk");
|
||||||
try {
|
try {
|
||||||
if (!downloadFile.exists()
|
if (!downloadFile.exists() && !downloadFile.createNewFile()) {
|
||||||
&& !downloadFile.createNewFile()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -153,8 +175,7 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
|||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
byte[] buf = new byte[2048];
|
byte[] buf = new byte[2048];
|
||||||
int len;
|
int len;
|
||||||
try (InputStream inputStream = response.body().byteStream();
|
try (InputStream inputStream = response.body().byteStream(); FileOutputStream outputStream = new FileOutputStream(downloadFile)) {
|
||||||
FileOutputStream outputStream = new FileOutputStream(downloadFile)) {
|
|
||||||
long total = response.body().contentLength();
|
long total = response.body().contentLength();
|
||||||
long sum = 0;
|
long sum = 0;
|
||||||
while ((len = inputStream.read(buf)) != -1) {
|
while ((len = inputStream.read(buf)) != -1) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class InteractionGamesChildViewHolder extends RecyclerView.ViewHolder {
|
|||||||
|
|
||||||
|
|
||||||
funGameName.setText(model.getTitle());
|
funGameName.setText(model.getTitle());
|
||||||
if (!TextUtils.isEmpty(model.getSudGameIsNew())||TextUtils.equals(model.getSudGameIsNew(),"1")){
|
if (!TextUtils.isEmpty(model.getSudGameIsNew())&&TextUtils.equals(model.getSudGameIsNew(),"1")){
|
||||||
itemView.findViewById(R.id.icon_new_game).setVisibility(View.VISIBLE);
|
itemView.findViewById(R.id.icon_new_game).setVisibility(View.VISIBLE);
|
||||||
}else {
|
}else {
|
||||||
itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE);
|
itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE);
|
||||||
|
|||||||
22
common/src/main/res/drawable/background_order_dialog.xml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<bitmap
|
||||||
|
android:gravity="fill_vertical|fill_horizontal"
|
||||||
|
android:src="@drawable/background_order_dialog_out_layout" />
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:bottom="3dp"
|
||||||
|
android:left="3dp"
|
||||||
|
android:right="4dp"
|
||||||
|
android:top="4dp">
|
||||||
|
<shape>
|
||||||
|
<solid android:color="#F5F5FF" />
|
||||||
|
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
<stroke
|
||||||
|
android:width="3dp"
|
||||||
|
android:color="#657FE4" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
After Width: | Height: | Size: 873 KiB |
21
common/src/main/res/drawable/order_level_progress_bg.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!--设置ProgressBar背景色-->
|
||||||
|
<item android:id="@android:id/background">
|
||||||
|
<shape>
|
||||||
|
<!--设置ProgressBar进度条圆角半径-->
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
<solid android:color="#B7AFCD" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!--设置ProgressBar进度条颜色-->
|
||||||
|
<item android:id="@android:id/progress">
|
||||||
|
<clip android:clipOrientation="horizontal">
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
<solid android:color="#CE2BFF" />
|
||||||
|
</shape>
|
||||||
|
</clip>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
176
common/src/main/res/layout/activate_elite_battle_order_popup.xml
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="17dp"
|
||||||
|
android:layout_marginEnd="17dp">
|
||||||
|
<ImageView
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:background="@drawable/background_order_dialog"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/war_order_close"
|
||||||
|
android:layout_width="19dp"
|
||||||
|
android:layout_height="19dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginTop="14dp"
|
||||||
|
android:layout_marginEnd="14dp"
|
||||||
|
android:src="@mipmap/icon_sud_rule_close" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/elites_image"
|
||||||
|
android:layout_width="211dp"
|
||||||
|
android:layout_height="27dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:src="@mipmap/icon_activate_the_elite_battle_order"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/enjoy_image"
|
||||||
|
android:layout_width="211dp"
|
||||||
|
android:layout_height="27dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:src="@mipmap/icon_enjoy_image"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginEnd="15dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:src="@mipmap/icon_war_order_diamond" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/gift_overvalue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/gift_overvalue"
|
||||||
|
android:textColor="#CE2BFF"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/gift_overvalue3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/gift_overvalue3"
|
||||||
|
android:textColor="#CE2BFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:src="@mipmap/icon_order_score" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="@string/more_integral"
|
||||||
|
android:textColor="#CE2BFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:src="@mipmap/icon_war_order_gift" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/gift3_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/unlock_more_gifts"
|
||||||
|
android:textColor="#CE2BFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:text="@string/has_reached_level_after_opening"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="13sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/button_war_order"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="@mipmap/button_war_order"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/button_war_order_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="123" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/diamond" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
40
common/src/main/res/layout/activity_end_popup.xml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="218dp"
|
||||||
|
android:layout_marginStart="22dp"
|
||||||
|
android:layout_marginEnd="22dp"
|
||||||
|
android:background="@drawable/background_order_dialog"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_marginTop="75dp"
|
||||||
|
android:layout_marginEnd="30dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/this_activity_is_over"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/confirm"
|
||||||
|
android:layout_width="116dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_gravity="center_horizontal|bottom"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="33dp"
|
||||||
|
android:background="@mipmap/button_buying_experience"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:text="@string/edit_one_4"
|
||||||
|
android:textColor="#E03600"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:scaleType="fitEnd"
|
android:scaleType="fitCenter"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/close"
|
app:layout_constraintBottom_toTopOf="@+id/close"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|||||||
68
common/src/main/res/layout/liberal_battle_pass_popup.xml
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="218dp"
|
||||||
|
android:layout_marginStart="22dp"
|
||||||
|
android:layout_marginEnd="22dp"
|
||||||
|
android:background="@drawable/background_order_dialog"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/liberal_battle_pass"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="73dp"
|
||||||
|
android:text="liberal_battle_pass2"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="57dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/cancel"
|
||||||
|
android:layout_width="116dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_marginStart="19dp"
|
||||||
|
android:background="@mipmap/button_liberal_battle_cancel"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:text="@string/cancel"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/liberal_battle_sure"
|
||||||
|
android:layout_width="116dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginEnd="19dp"
|
||||||
|
android:background="@mipmap/button_liberal_battle_sure"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:text="@string/confirm"
|
||||||
|
android:textColor="#E03600"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
182
common/src/main/res/layout/order_level_popup.xml
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="218dp"
|
||||||
|
android:layout_marginStart="17dp"
|
||||||
|
android:layout_marginEnd="17dp"
|
||||||
|
android:background="@drawable/background_order_dialog"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/war_order_close"
|
||||||
|
android:layout_width="19dp"
|
||||||
|
android:layout_height="19dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginTop="14dp"
|
||||||
|
android:layout_marginEnd="14dp"
|
||||||
|
android:src="@mipmap/icon_sud_rule_close" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:text="@string/order_level"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/current"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="46dp"
|
||||||
|
android:text="Lv7"
|
||||||
|
android:textColor="#CE2BFF"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="221dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="7dp">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="221dp"
|
||||||
|
android:layout_height="6dp"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="10"
|
||||||
|
android:progressDrawable="@drawable/order_level_progress_bg"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/exp_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textColor="#000"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="500/1000" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/buying_experience_point"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="90dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:background="@mipmap/backgroud_tickets_plus_minus">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/sub"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tickets_plus_minus"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:background="@null"
|
||||||
|
android:gravity="center"
|
||||||
|
android:imeOptions="actionSend"
|
||||||
|
android:inputType="number"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="12dp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/add"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/order_level_diamond"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:text="100"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="11sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:src="@mipmap/icon_diamond2" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/balance_diamond"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:text="100"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="11sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:src="@mipmap/icon_diamond2" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/buying_experience"
|
||||||
|
android:layout_width="116dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="@mipmap/button_buying_experience"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:text="@string/buying_experience"
|
||||||
|
android:textColor="#E03600"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
82
common/src/main/res/layout/promotion_elite_popup.xml
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="22dp"
|
||||||
|
android:layout_marginEnd="22dp"
|
||||||
|
android:background="@drawable/background_order_dialog"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/close"
|
||||||
|
android:layout_width="19dp"
|
||||||
|
android:layout_height="19dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginTop="14dp"
|
||||||
|
android:layout_marginEnd="14dp"
|
||||||
|
android:src="@mipmap/icon_sud_rule_close" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/upgrade_elite"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="23sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/upgrade_elite2"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_quintessence"
|
||||||
|
android:layout_width="116dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_marginStart="34dp"
|
||||||
|
android:background="@mipmap/bg_dialog_battlepass_btn"
|
||||||
|
android:text="@string/upgrade_elite_type1"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="#F36100"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_enjoy"
|
||||||
|
android:layout_width="116dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginEnd="34dp"
|
||||||
|
android:background="@mipmap/bg_dialog_battlepass_btn"
|
||||||
|
android:text="@string/upgrade_elite_type2"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="#F36100"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
56
common/src/main/res/layout/rule_of_war_popup.xml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_marginStart="17dp"
|
||||||
|
android:layout_marginEnd="17dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="380dp"
|
||||||
|
android:background="@drawable/background_order_dialog"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="111dp"
|
||||||
|
android:layout_height="62.5dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:src="@mipmap/icon_order_rule" />
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/rule"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="14dp"
|
||||||
|
android:layout_marginEnd="14dp"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
tools:text="1.戰令開啟時,完成戰令任務,提升戰令等級,可獲得大量等級獎勵。\n2.所有用戶免費解鎖普通版,戰令開啟時隨時可進階為精英版和尊享版,獲得豐厚額外專屬獎勵。\n3.三種戰令都會獎勵積分,可在兌換商城中兌換心儀的寶貝,部分寶貝兌換有戰令等級要求或兌換數量限制。\n4.每日任務0點刷新,未完成任務進度不再累計,每季任務將會在新一季戰令開啟時刷新。\n5.任務達成時需主動領取經驗,未领取經驗將會在任務刷新時過期。\n6.活動最終解釋權歸PDLIVE所有。"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/close"
|
||||||
|
android:layout_width="25dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:src="@mipmap/icon_order_rule_close" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
125
common/src/main/res/layout/war_order_exchange_details_popup.xml
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="282dp"
|
||||||
|
android:layout_marginStart="17dp"
|
||||||
|
android:layout_marginEnd="17dp"
|
||||||
|
android:background="@drawable/background_order_dialog"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/war_order_close"
|
||||||
|
android:layout_width="19dp"
|
||||||
|
android:layout_height="19dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="14dp"
|
||||||
|
android:src="@mipmap/icon_sud_rule_close" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/exchange_particulars"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
<LinearLayout
|
||||||
|
android:background="@mipmap/bg_dialog_battlepass_exchange"
|
||||||
|
android:layout_width="99dp"
|
||||||
|
android:layout_height="99dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="19dp">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/exchange_particulars"
|
||||||
|
android:layout_width="99dp"
|
||||||
|
android:layout_height="99dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/point_exchange_number"
|
||||||
|
android:textColor="#0D21B2"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="90dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:background="@mipmap/backgroud_tickets_plus_minus">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/sub"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tickets_plus_minus"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:background="@null"
|
||||||
|
android:gravity="center"
|
||||||
|
android:imeOptions="actionSend"
|
||||||
|
android:inputType="number"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="12dp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/add"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/point_exchange_linear"
|
||||||
|
android:layout_width="140dp"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="17dp"
|
||||||
|
android:background="@mipmap/button_buying_experience"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/point_exchange"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:textColor="#E03600"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:text="123" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="19dp"
|
||||||
|
android:layout_height="21dp"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:src="@mipmap/ic_integral" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:textColor="#E03600"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/point_exchange2" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
After Width: | Height: | Size: 38 KiB |
BIN
common/src/main/res/mipmap-b+en+us/icon_enjoy_image.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
common/src/main/res/mipmap-b+en+us/icon_order_rule.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/bg_dialog_battlepass_btn.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 71 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/button_buying_experience.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/button_enjoy.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 14 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/button_liberal_battle_sure.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/button_quintessence.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/button_war_order.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/ic_integral.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 32 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_enjoy_image.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_order_rule.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_order_rule_close.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_order_score.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_war_order_diamond.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_war_order_gift.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
@@ -411,7 +411,7 @@
|
|||||||
<string name="live_link_mic_cannot_link_2">Connecting wheat is currently in progress~</string>
|
<string name="live_link_mic_cannot_link_2">Connecting wheat is currently in progress~</string>
|
||||||
<string name="live_link_mic_cannot_pk">You are already in PK</string>
|
<string name="live_link_mic_cannot_pk">You are already in PK</string>
|
||||||
<string name="live_link_mic_pk_1">We</string>
|
<string name="live_link_mic_pk_1">We</string>
|
||||||
<string name="live_link_mic_pk_2">Other party</string>
|
<string name="live_link_mic_pk_2">Opponent</string>
|
||||||
<string name="live_coin_not_enough">The balance is insufficient. Do you want to recharge it?</string>
|
<string name="live_coin_not_enough">The balance is insufficient. Do you want to recharge it?</string>
|
||||||
<string name="live_online_anchor">Current online anchor</string>
|
<string name="live_online_anchor">Current online anchor</string>
|
||||||
<string name="link_mic_play_game">The other anchor is in the game</string>
|
<string name="link_mic_play_game">The other anchor is in the game</string>
|
||||||
@@ -1390,8 +1390,37 @@ Limited ride And limited avatar frame</string>
|
|||||||
<string name="conversion_quantity">Exchange quantity:</string>
|
<string name="conversion_quantity">Exchange quantity:</string>
|
||||||
<string name="conversion_quantity_need">Need %s</string>
|
<string name="conversion_quantity_need">Need %s</string>
|
||||||
<string name="conversion_quantity_need_of_use">Exchange&Usage Rules:</string>
|
<string name="conversion_quantity_need_of_use">Exchange&Usage Rules:</string>
|
||||||
<string name="conversion_quantity_need_of_use1">·One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string>
|
<string name="conversion_quantity_need_of_use1">1.One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string>
|
||||||
<string name="conversion_quantity_need_of_use2">·One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string>
|
<string name="conversion_quantity_need_of_use2">2.One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string>
|
||||||
<string name="conversion_quantity_need_of_use3">·Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string>
|
<string name="conversion_quantity_need_of_use3">3.Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string>
|
||||||
|
<string name="rule_of_war_hint1">1. When the BattlePass is activated, completing the BattlePass task and increasing the BattlePass level can earn a large amount of level rewards.\n</string>
|
||||||
|
<string name="rule_of_war_hint2">2. All users can unlock the regular version for free, and when the BattlePass is activated, they can upgrade to the elite version and the luxury version at any time, and receive rich additional exclusive rewards.\n</string>
|
||||||
|
|
||||||
|
|
||||||
|
<string name="upgrade_elite">Upgrade Elite/Luxury BattlePass</string>
|
||||||
|
<string name="upgrade_elite_type1">Upgrade Elite BattlePass</string>
|
||||||
|
<string name="upgrade_elite_type2">Upgrade Luxury BattlePass</string>
|
||||||
|
<string name="upgrade_elite2">You can receive a massive amount of points and exchange more rewards</string>
|
||||||
|
<string name="rule_of_war_hint3">3.三種戰令都會獎勵積分,可在兌換商城中兌換心 儀的寶貝,部分寶貝兌換有戰令等級要求或兌換數 量限制。</string>
|
||||||
|
<string name="rule_of_war_hint4">4.每日任務0點刷新,未完成任務進度不再累計, 每季任務將會在新一季戰令開啟時刷新。</string>
|
||||||
|
<string name="rule_of_war_hint5">5.任務達成時需主動領取經驗,未领取經驗將會在 任務刷新時自动领取。</string>
|
||||||
|
<string name="rule_of_war_hint6">6.活動最終解釋權歸PDLIVE所有。</string>
|
||||||
|
<string name="more_integral">More points</string>
|
||||||
|
<string name="gift_overvalue">Gifts worth over 200%</string>
|
||||||
|
<string name="gift_overvalue3">Gifts worth over 300%</string>
|
||||||
|
<string name="unlock_more_gifts">More Rare outfits</string>
|
||||||
|
<string name="unlock_more_gifts2">More Collectible outfits</string>
|
||||||
|
<string name="has_reached_level_after_opening">After opened,the rewards that have reached will be automatically unlocked!</string>
|
||||||
|
<string name="order_level">My level</string>
|
||||||
|
<string name="buying_experience_point">Purchase EXP value:</string>
|
||||||
|
<string name="buying_experience">Buy</string>
|
||||||
|
<string name="this_activity_is_over">This activity has ended. Please collect the unclaimed rewards as soon as possible.Points can be reserved for future use</string>
|
||||||
|
<string name="exchange_particulars">Exchange Details</string>
|
||||||
|
<string name="point_exchange">%s(points) exchange</string>
|
||||||
|
<string name="point_exchange2">exchange</string>
|
||||||
|
<string name="point_exchange_number">Quantity:</string>
|
||||||
|
<string name="battlepass_exchange_buy_integral">Insufficient points</string>
|
||||||
|
<string name="battlepass_exchange_buy_max">The quantity of goods exchanged has reached the upper limit</string>
|
||||||
|
<string name="battlepass_zl_get">Successfully opened</string>
|
||||||
|
<string name="battlepass_buy_max">You have purchased the BattlePass</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1387,7 +1387,36 @@
|
|||||||
<string name="conversion_quantity">兌換數量:</string>
|
<string name="conversion_quantity">兌換數量:</string>
|
||||||
<string name="conversion_quantity_need">需要 %s</string>
|
<string name="conversion_quantity_need">需要 %s</string>
|
||||||
<string name="conversion_quantity_need_of_use">兌換&使用規則:</string>
|
<string name="conversion_quantity_need_of_use">兌換&使用規則:</string>
|
||||||
<string name="conversion_quantity_need_of_use1">·1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
<string name="conversion_quantity_need_of_use1">1.1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
||||||
<string name="conversion_quantity_need_of_use2">·1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
<string name="conversion_quantity_need_of_use2">2.1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
||||||
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊。</string>
|
<string name="conversion_quantity_need_of_use3">3.觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
|
||||||
|
<string name="rule_of_war_hint1">1.戰令開啟時,完成戰令任務,提升戰令等級,可 獲得大量等級獎勵。</string>
|
||||||
|
<string name="rule_of_war_hint2">2.所有用戶免費解鎖普通版,戰令開啟時隨時可進 階為精英版和尊享版,獲得豐厚額外專屬獎勵。</string>
|
||||||
|
<string name="rule_of_war_hint3">3.三種戰令都會獎勵積分,可在兌換商城中兌換心 儀的寶貝,部分寶貝兌換有戰令等級要求或兌換數 量限制。</string>
|
||||||
|
<string name="rule_of_war_hint4">4.每日任務0點刷新,未完成任務進度不再累計, 每季任務將會在新一季戰令開啟時刷新。</string>
|
||||||
|
<string name="rule_of_war_hint5">5.任務達成時需主動領取經驗,未领取經驗將會在 任務刷新時自动领取。</string>
|
||||||
|
<string name="rule_of_war_hint6">6.活動最終解釋權歸PDLIVE所有。</string>
|
||||||
|
|
||||||
|
<string name="upgrade_elite">升級精英/尊享戰令</string>
|
||||||
|
<string name="upgrade_elite_type1">升級精英戰令</string>
|
||||||
|
<string name="upgrade_elite_type2">升級尊享戰令</string>
|
||||||
|
<string name="upgrade_elite2">可領取海量積分,兌換更多獎勵</string>
|
||||||
|
<string name="more_integral">更多積分</string>
|
||||||
|
<string name="gift_overvalue">禮物價值超 200%</string>
|
||||||
|
<string name="gift_overvalue3">禮物價值超 300%</string>
|
||||||
|
<string name="unlock_more_gifts">解鎖更多禮物 和全套珍稀裝扮</string>
|
||||||
|
<string name="unlock_more_gifts2">解鎖更多禮物 和全套典藏裝扮</string>
|
||||||
|
<string name="has_reached_level_after_opening">開通后已達到等級的獎勵將會自動解鎖!</string>
|
||||||
|
<string name="order_level">我的等級</string>
|
||||||
|
<string name="buying_experience_point">購買經驗值:</string>
|
||||||
|
<string name="buying_experience">購買</string>
|
||||||
|
<string name="this_activity_is_over">本期活動已結束,請儘快領取未領取的獎勵積分可保留下次使用</string>
|
||||||
|
<string name="exchange_particulars">兌換詳情</string>
|
||||||
|
<string name="point_exchange">%s(積分) 兌換</string>
|
||||||
|
<string name="point_exchange2">兌換</string>
|
||||||
|
<string name="point_exchange_number">數量:</string>
|
||||||
|
<string name="battlepass_exchange_buy_integral">積分不足</string>
|
||||||
|
<string name="battlepass_exchange_buy_max">商品兌換數量已達到上限</string>
|
||||||
|
<string name="battlepass_zl_get">開通成功</string>
|
||||||
|
<string name="battlepass_buy_max">您已購買該戰令</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1386,7 +1386,36 @@
|
|||||||
<string name="conversion_quantity">兌換數量:</string>
|
<string name="conversion_quantity">兌換數量:</string>
|
||||||
<string name="conversion_quantity_need">需要 %s</string>
|
<string name="conversion_quantity_need">需要 %s</string>
|
||||||
<string name="conversion_quantity_need_of_use">兌換&使用規則:</string>
|
<string name="conversion_quantity_need_of_use">兌換&使用規則:</string>
|
||||||
<string name="conversion_quantity_need_of_use1">·1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
<string name="conversion_quantity_need_of_use1">1.1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
||||||
<string name="conversion_quantity_need_of_use2">·1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
<string name="conversion_quantity_need_of_use2">2.1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
||||||
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊。</string>
|
<string name="conversion_quantity_need_of_use3">3.觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
|
||||||
|
<string name="rule_of_war_hint1">1.戰令開啟時,完成戰令任務,提升戰令等級,可 獲得大量等級獎勵。</string>
|
||||||
|
<string name="rule_of_war_hint2">2.所有用戶免費解鎖普通版,戰令開啟時隨時可進 階為精英版和尊享版,獲得豐厚額外專屬獎勵。</string>
|
||||||
|
<string name="rule_of_war_hint3">3.三種戰令都會獎勵積分,可在兌換商城中兌換心 儀的寶貝,部分寶貝兌換有戰令等級要求或兌換數 量限制。</string>
|
||||||
|
<string name="rule_of_war_hint4">4.每日任務0點刷新,未完成任務進度不再累計, 每季任務將會在新一季戰令開啟時刷新。</string>
|
||||||
|
<string name="rule_of_war_hint5">5.任務達成時需主動領取經驗,未领取經驗將會在 任務刷新時自动领取。</string>
|
||||||
|
<string name="rule_of_war_hint6">6.活動最終解釋權歸PDLIVE所有。</string>
|
||||||
|
|
||||||
|
<string name="upgrade_elite">升級精英/尊享戰令</string>
|
||||||
|
<string name="upgrade_elite_type1">升級精英戰令</string>
|
||||||
|
<string name="upgrade_elite_type2">升級尊享戰令</string>
|
||||||
|
<string name="upgrade_elite2">可領取海量積分,兌換更多獎勵</string>
|
||||||
|
<string name="more_integral">更多積分</string>
|
||||||
|
<string name="gift_overvalue">禮物價值超 200%</string>
|
||||||
|
<string name="gift_overvalue3">禮物價值超 300%</string>
|
||||||
|
<string name="unlock_more_gifts">解鎖更多禮物 和全套珍稀裝扮</string>
|
||||||
|
<string name="unlock_more_gifts2">解鎖更多禮物 和全套典藏裝扮</string>
|
||||||
|
<string name="has_reached_level_after_opening">開通后已達到等級的獎勵將會自動解鎖!</string>
|
||||||
|
<string name="order_level">我的等級</string>
|
||||||
|
<string name="buying_experience_point">購買經驗值:</string>
|
||||||
|
<string name="buying_experience">購買</string>
|
||||||
|
<string name="this_activity_is_over">本期活動已結束,請儘快領取未領取的獎勵積分可保留下次使用</string>
|
||||||
|
<string name="exchange_particulars">兌換詳情</string>
|
||||||
|
<string name="point_exchange">%s(積分) 兌換</string>
|
||||||
|
<string name="point_exchange2">兌換</string>
|
||||||
|
<string name="point_exchange_number">數量:</string>
|
||||||
|
<string name="battlepass_exchange_buy_integral">積分不足</string>
|
||||||
|
<string name="battlepass_exchange_buy_max">商品兌換數量已達到上限</string>
|
||||||
|
<string name="battlepass_zl_get">開通成功</string>
|
||||||
|
<string name="battlepass_buy_max">您已購買該戰令</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1386,8 +1386,36 @@
|
|||||||
<string name="conversion_quantity">兌換數量:</string>
|
<string name="conversion_quantity">兌換數量:</string>
|
||||||
<string name="conversion_quantity_need">需要 %s</string>
|
<string name="conversion_quantity_need">需要 %s</string>
|
||||||
<string name="conversion_quantity_need_of_use">兌換&使用規則:</string>
|
<string name="conversion_quantity_need_of_use">兌換&使用規則:</string>
|
||||||
<string name="conversion_quantity_need_of_use1">·1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
<string name="conversion_quantity_need_of_use1">1.1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
||||||
<string name="conversion_quantity_need_of_use2">·1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
<string name="conversion_quantity_need_of_use2">2.1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
||||||
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
|
<string name="conversion_quantity_need_of_use3">3.觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
|
||||||
|
<string name="rule_of_war_hint1">1.戰令開啟時,完成戰令任務,提升戰令等級,可 獲得大量等級獎勵。</string>
|
||||||
|
<string name="rule_of_war_hint2">2.所有用戶免費解鎖普通版,戰令開啟時隨時可進 階為精英版和尊享版,獲得豐厚額外專屬獎勵。</string>
|
||||||
|
<string name="rule_of_war_hint3">3.三種戰令都會獎勵積分,可在兌換商城中兌換心 儀的寶貝,部分寶貝兌換有戰令等級要求或兌換數 量限制。</string>
|
||||||
|
<string name="rule_of_war_hint4">4.每日任務0點刷新,未完成任務進度不再累計, 每季任務將會在新一季戰令開啟時刷新。</string>
|
||||||
|
<string name="rule_of_war_hint5">5.任務達成時需主動領取經驗,未领取經驗將會在 任務刷新時自动领取。</string>
|
||||||
|
<string name="rule_of_war_hint6">6.活動最終解釋權歸PDLIVE所有。</string>
|
||||||
|
|
||||||
|
<string name="upgrade_elite">升級精英/尊享戰令</string>
|
||||||
|
<string name="upgrade_elite_type1">升級精英戰令</string>
|
||||||
|
<string name="upgrade_elite_type2">升級尊享戰令</string>
|
||||||
|
<string name="upgrade_elite2">可領取海量積分,兌換更多獎勵</string>
|
||||||
|
<string name="more_integral">更多積分</string>
|
||||||
|
<string name="gift_overvalue">禮物價值超 200%</string>
|
||||||
|
<string name="gift_overvalue3">禮物價值超 300%</string>
|
||||||
|
<string name="unlock_more_gifts">解鎖更多禮物 和全套珍稀裝扮</string>
|
||||||
|
<string name="unlock_more_gifts2">解鎖更多禮物 和全套典藏裝扮</string>
|
||||||
|
<string name="has_reached_level_after_opening">開通后已達到等級的獎勵將會自動解鎖!</string>
|
||||||
|
<string name="order_level">我的等級</string>
|
||||||
|
<string name="buying_experience_point">購買經驗值:</string>
|
||||||
|
<string name="buying_experience">購買</string>
|
||||||
|
<string name="this_activity_is_over">本期活動已結束,請儘快領取未領取的獎勵積分可保留下次使用</string>
|
||||||
|
<string name="exchange_particulars">兌換詳情</string>
|
||||||
|
<string name="point_exchange">%s(積分) 兌換</string>
|
||||||
|
<string name="point_exchange2">兌換</string>
|
||||||
|
<string name="point_exchange_number">數量:</string>
|
||||||
|
<string name="battlepass_exchange_buy_integral">積分不足</string>
|
||||||
|
<string name="battlepass_exchange_buy_max">商品兌換數量已達到上限</string>
|
||||||
|
<string name="battlepass_zl_get">開通成功</string>
|
||||||
|
<string name="battlepass_buy_max">您已購買該戰令</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -411,7 +411,7 @@
|
|||||||
<string name="live_link_mic_cannot_link_2">Connecting wheat is currently in progress~</string>
|
<string name="live_link_mic_cannot_link_2">Connecting wheat is currently in progress~</string>
|
||||||
<string name="live_link_mic_cannot_pk">You are already in PK</string>
|
<string name="live_link_mic_cannot_pk">You are already in PK</string>
|
||||||
<string name="live_link_mic_pk_1">We</string>
|
<string name="live_link_mic_pk_1">We</string>
|
||||||
<string name="live_link_mic_pk_2">Other party</string>
|
<string name="live_link_mic_pk_2">Opponent</string>
|
||||||
<string name="live_coin_not_enough">The balance is insufficient. Do you want to recharge it?</string>
|
<string name="live_coin_not_enough">The balance is insufficient. Do you want to recharge it?</string>
|
||||||
<string name="live_online_anchor">Current online anchor</string>
|
<string name="live_online_anchor">Current online anchor</string>
|
||||||
<string name="link_mic_play_game">The other anchor is in the game</string>
|
<string name="link_mic_play_game">The other anchor is in the game</string>
|
||||||
@@ -1393,7 +1393,35 @@ Limited ride And limited avatar frame</string>
|
|||||||
<string name="conversion_quantity">Exchange quantity:</string>
|
<string name="conversion_quantity">Exchange quantity:</string>
|
||||||
<string name="conversion_quantity_need">Need %s</string>
|
<string name="conversion_quantity_need">Need %s</string>
|
||||||
<string name="conversion_quantity_need_of_use">Exchange&Usage Rules:</string>
|
<string name="conversion_quantity_need_of_use">Exchange&Usage Rules:</string>
|
||||||
<string name="conversion_quantity_need_of_use1">·One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string>
|
<string name="conversion_quantity_need_of_use1">1.One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string>
|
||||||
<string name="conversion_quantity_need_of_use2">·One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string>
|
<string name="conversion_quantity_need_of_use2">2.One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string>
|
||||||
<string name="conversion_quantity_need_of_use3">·Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string>
|
<string name="conversion_quantity_need_of_use3">3.Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string>
|
||||||
|
<string name="upgrade_elite">Upgrade Elite/Luxury BattlePass</string>
|
||||||
|
<string name="upgrade_elite_type1">Upgrade Elite BattlePass</string>
|
||||||
|
<string name="upgrade_elite_type2">Upgrade Luxury BattlePass</string>
|
||||||
|
<string name="upgrade_elite2">You can receive a massive amount of points and exchange more rewards</string>
|
||||||
|
<string name="rule_of_war_hint1">1. When the BattlePass is activated, completing the BattlePass task and increasing the BattlePass level can earn a large amount of level rewards.\n</string>
|
||||||
|
<string name="rule_of_war_hint2">2. All users can unlock the regular version for free, and when the BattlePass is activated, they can upgrade to the elite version and the luxury version at any time, and receive rich additional exclusive rewards.\n</string>
|
||||||
|
<string name="rule_of_war_hint3">3.三種戰令都會獎勵積分,可在兌換商城中兌換心 儀的寶貝,部分寶貝兌換有戰令等級要求或兌換數 量限制。</string>
|
||||||
|
<string name="rule_of_war_hint4">4.每日任務0點刷新,未完成任務進度不再累計, 每季任務將會在新一季戰令開啟時刷新。</string>
|
||||||
|
<string name="rule_of_war_hint5">5.任務達成時需主動領取經驗,未领取經驗將會在 任務刷新時自动领取。</string>
|
||||||
|
<string name="rule_of_war_hint6">6.活動最終解釋權歸PDLIVE所有。</string>
|
||||||
|
<string name="more_integral">More points</string>
|
||||||
|
<string name="gift_overvalue">Gifts worth over 200%</string>
|
||||||
|
<string name="gift_overvalue3">Gifts worth over 300%</string>
|
||||||
|
<string name="unlock_more_gifts">More Rare outfits</string>
|
||||||
|
<string name="unlock_more_gifts2">More Collectible outfits</string>
|
||||||
|
<string name="has_reached_level_after_opening">After opened,the rewards that have reached will be automatically unlocked!</string>
|
||||||
|
<string name="order_level">My level</string>
|
||||||
|
<string name="buying_experience_point">Purchase EXP value:</string>
|
||||||
|
<string name="buying_experience">Buy</string>
|
||||||
|
<string name="this_activity_is_over">This activity has ended. Please collect the unclaimed rewards as soon as possible.Points can be reserved for future use</string>
|
||||||
|
<string name="exchange_particulars">Exchange Details</string>
|
||||||
|
<string name="point_exchange">%s(points) exchange</string>
|
||||||
|
<string name="point_exchange2">exchange</string>
|
||||||
|
<string name="point_exchange_number">Quantity:</string>
|
||||||
|
<string name="battlepass_exchange_buy_integral">Insufficient points</string>
|
||||||
|
<string name="battlepass_exchange_buy_max">The quantity of goods exchanged has reached the upper limit</string>
|
||||||
|
<string name="battlepass_zl_get">Successfully opened</string>
|
||||||
|
<string name="battlepass_buy_max">You have purchased the BattlePass</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -4,28 +4,27 @@ ext {
|
|||||||
buildToolsVersion: "29.0.2",
|
buildToolsVersion: "29.0.2",
|
||||||
minSdkVersion : 21,
|
minSdkVersion : 21,
|
||||||
targetSdkVersion : 33,
|
targetSdkVersion : 33,
|
||||||
versionCode : 458,
|
versionCode : 459,
|
||||||
versionName : "6.6.3"
|
versionName : "6.6.3"
|
||||||
]
|
]
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
//正式、
|
//正式、
|
||||||
serverHost : "https://napi.yaoulive.com",
|
// serverHost : "https://napi.yaoulive.com",
|
||||||
// 测试
|
// 测试
|
||||||
// serverHost : " https://ceshi.yaoulive.com",
|
serverHost : " https://ceshi.yaoulive.com",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//百度语音识别
|
//百度语音识别
|
||||||
|
|
||||||
baiduAppId : "23774720",
|
baiduAppId : "23774720",
|
||||||
baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnR B",
|
baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB",
|
||||||
|
|
||||||
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
|
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
|
||||||
// true表示谷歌支付 false
|
|
||||||
isGooglePlay : false,
|
// true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包
|
||||||
|
isGooglePlay : 0,
|
||||||
//是否上报异常日志
|
//是否上报异常日志
|
||||||
isUploadLog : true,
|
isUploadLog : true,
|
||||||
//是否打包成插件包模式
|
//是否打包成插件包模式
|
||||||
isPluginModel : true,
|
isPluginModel : true,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ org.gradle.daemon=true
|
|||||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.configureondemand=true
|
org.gradle.configureondemand=true
|
||||||
|
|
||||||
|
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
minSdkVersion minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
targetSdkVersion targetSdkVersion
|
||||||
versionCode rootProject.ext.android.versionCode
|
versionCode versionCode
|
||||||
versionName rootProject.ext.android.versionName
|
versionName versionName
|
||||||
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
manifestPlaceholders = rootProject.ext.manifestPlaceholders
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|||||||
2
lib_country_code/proguard-rules.pro
vendored
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFiles
|
||||||
|
|||||||
1
lib_google/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
38
lib_google/build.gradle
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||||
|
buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion minSdkVersion
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
versionCode versionCode
|
||||||
|
versionName versionName
|
||||||
|
targetSdkVersion targetSdkVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation rootProject.ext.dependencies["appcompat-androidx"]
|
||||||
|
|
||||||
|
//谷歌内购
|
||||||
|
api 'com.android.billingclient:billing:5.0.0'
|
||||||
|
//谷歌登录
|
||||||
|
api 'com.google.android.gms:play-services-auth:15.0.0'
|
||||||
|
api 'com.google.android.gms:play-services-ads-identifier:15.0.1'
|
||||||
|
api 'com.google.firebase:firebase-messaging:23.0.6'
|
||||||
|
api 'cn.rongcloud.sdk:sight:5.2.5.4'
|
||||||
|
}
|
||||||
0
lib_google/consumer-rules.pro
Normal file
30
lib_google/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
|
-ignorewarnings
|
||||||
|
-keepattributes *Annotation*
|
||||||
|
-keepattributes Exceptions
|
||||||
|
-keepattributes InnerClasses
|
||||||
|
-keepattributes Signature
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
-keep class com.huawei.hianalytics.**{*;}
|
||||||
|
-keep class com.huawei.updatesdk.**{*;}
|
||||||
|
-keep class com.huawei.hms.**{*;}
|
||||||
5
lib_google/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.shayu.lib_google">
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.shayu.lib_google.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
|
import com.google.firebase.FirebaseApp;
|
||||||
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
|
|
||||||
|
import io.rong.push.PushManager;
|
||||||
|
import io.rong.push.PushType;
|
||||||
|
|
||||||
|
public class FirebaseManage {
|
||||||
|
private Activity mActivity;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public FirebaseManage(Activity activity) {
|
||||||
|
this.mActivity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FirebaseManage(Context mContext) {
|
||||||
|
this.mContext = mContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
String token = "";
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initToken() {
|
||||||
|
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener<String>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<String> task) {
|
||||||
|
if (!task.isSuccessful()) {
|
||||||
|
Log.w("TAG", "Fetching FCM registration token failed", task.getException());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Get new FCM registration token
|
||||||
|
token = task.getResult();
|
||||||
|
// Log and toast
|
||||||
|
Log.d("TAG", token);
|
||||||
|
|
||||||
|
PushManager.getInstance().onReceiveToken(mActivity, PushType.GOOGLE_FCM, token);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initializeApp() {
|
||||||
|
FirebaseApp.initializeApp(mContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,281 @@
|
|||||||
|
package com.shayu.lib_google.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.android.billingclient.api.BillingClient;
|
||||||
|
import com.android.billingclient.api.BillingClientStateListener;
|
||||||
|
import com.android.billingclient.api.BillingFlowParams;
|
||||||
|
import com.android.billingclient.api.BillingResult;
|
||||||
|
import com.android.billingclient.api.ConsumeParams;
|
||||||
|
import com.android.billingclient.api.ConsumeResponseListener;
|
||||||
|
import com.android.billingclient.api.Purchase;
|
||||||
|
import com.android.billingclient.api.PurchasesResponseListener;
|
||||||
|
import com.android.billingclient.api.PurchasesUpdatedListener;
|
||||||
|
import com.android.billingclient.api.QueryPurchasesParams;
|
||||||
|
import com.android.billingclient.api.SkuDetails;
|
||||||
|
import com.android.billingclient.api.SkuDetailsParams;
|
||||||
|
import com.android.billingclient.api.SkuDetailsResponseListener;
|
||||||
|
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
||||||
|
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
||||||
|
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新写Google内付工具类做简单的封装
|
||||||
|
* 支付流程:初始化Google支付服务-->查询商品-->购买-->支付成功回调-->消耗商品
|
||||||
|
*/
|
||||||
|
public class GoogleBillingManage implements PurchasesUpdatedListener {
|
||||||
|
private BillingClient billingClient;
|
||||||
|
private Activity mContext;
|
||||||
|
private String TAG = "GoogleBillingManage";
|
||||||
|
|
||||||
|
public GoogleBillingManage(Activity activity) {
|
||||||
|
this.mContext = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initGooglePay() {
|
||||||
|
billingClient = BillingClient.newBuilder(mContext).setListener(this).enablePendingPurchases().build();
|
||||||
|
//请求连接到GooglePay
|
||||||
|
billingClient.startConnection(new BillingClientStateListener() {
|
||||||
|
@Override
|
||||||
|
public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
|
||||||
|
int code = billingResult.getResponseCode();
|
||||||
|
if (code != BillingClient.BillingResponseCode.OK) {
|
||||||
|
String msg = billingResult.getDebugMessage();
|
||||||
|
Log.e(TAG, "连接到GooglePay失败 code = " + code + " msg = " + msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.e(TAG, "连接到GooglePay成功");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//连接失败
|
||||||
|
@Override
|
||||||
|
public void onBillingServiceDisconnected() {
|
||||||
|
Log.e(TAG, "连接到GooglePay失败,请重试");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询商品
|
||||||
|
public void checkSku(String id) {
|
||||||
|
List<String> skuList = new ArrayList<>();
|
||||||
|
skuList.add(id);
|
||||||
|
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder().setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
|
||||||
|
billingClient.querySkuDetailsAsync(params.build(), new SkuDetailsResponseListener() {
|
||||||
|
@Override
|
||||||
|
public void onSkuDetailsResponse(@NonNull BillingResult billingResult, @Nullable List<SkuDetails> list) {
|
||||||
|
int code = billingResult.getResponseCode();
|
||||||
|
if (code != BillingClient.BillingResponseCode.OK || list == null || list.isEmpty()) {
|
||||||
|
String msg = billingResult.getDebugMessage();
|
||||||
|
Log.e(TAG, "查询商品失败 code = " + code + " msg = " + msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.e(TAG, "查询商品成功");
|
||||||
|
buyIt(list.get(0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//购买
|
||||||
|
private void buyIt(SkuDetails skuDetails) {
|
||||||
|
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder().setSkuDetails(skuDetails).build();
|
||||||
|
BillingResult billingResult = billingClient.launchBillingFlow(mContext, billingFlowParams);
|
||||||
|
int code = billingResult.getResponseCode();
|
||||||
|
if (code != BillingClient.BillingResponseCode.OK) {
|
||||||
|
String msg = billingResult.getDebugMessage();
|
||||||
|
Log.e(TAG, "购买商品失败 code = " + code + " msg = " + msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.e(TAG, "购买商品" + skuDetails.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//消耗商品
|
||||||
|
public void consume(List<Purchase> list) {
|
||||||
|
if (list == null || list.isEmpty() || billingClient == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (Purchase purchase : list) {
|
||||||
|
billingClient.consumeAsync(ConsumeParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build(), new ConsumeResponseListener() {
|
||||||
|
@Override
|
||||||
|
public void onConsumeResponse(BillingResult billingResult, String purchaseToken) {
|
||||||
|
Log.e(TAG, "onConsumeResponse code = " + billingResult.getResponseCode() + " , msg = " + billingResult.getDebugMessage() + " , purchaseToken = " + purchaseToken);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int querySize = -1;
|
||||||
|
JSONArray tokenList = new JSONArray();
|
||||||
|
JSONArray orderList = new JSONArray();
|
||||||
|
String tradeNo = "";
|
||||||
|
|
||||||
|
public JSONObject getQuerySize() {
|
||||||
|
JSONObject object = new JSONObject();
|
||||||
|
try {
|
||||||
|
object.put("querySize", querySize);
|
||||||
|
object.put("tokenList", tokenList);
|
||||||
|
object.put("orderList", orderList);
|
||||||
|
object.put("tradeNo", tradeNo);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消耗所有商品
|
||||||
|
*/
|
||||||
|
public void consumeAll() {
|
||||||
|
queryPurchasesAsync(new PurchasesResponseListener() {
|
||||||
|
@Override
|
||||||
|
public void onQueryPurchasesResponse(@NonNull BillingResult billingResult, @NonNull List<Purchase> list) {
|
||||||
|
Log.e("TAG", "消耗所有商品消耗所有商品消耗所有商品消耗所有商品消耗所有商品消耗所有商品" + list.size());
|
||||||
|
querySize = list.size();
|
||||||
|
if (querySize > 0) {
|
||||||
|
tradeNo = list.get(0).getProducts().get(0);
|
||||||
|
for (Purchase purchase : list) {
|
||||||
|
tokenList.put(purchase.getPurchaseToken());
|
||||||
|
orderList.put(purchase.getOrderId());
|
||||||
|
}
|
||||||
|
consume(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品订单
|
||||||
|
*/
|
||||||
|
public void queryPurchasesAsync(PurchasesResponseListener responseListener) {
|
||||||
|
//内购商品交易查询
|
||||||
|
if (billingClient == null) {
|
||||||
|
billingClient = BillingClient.newBuilder(mContext).setListener(this).enablePendingPurchases().build();
|
||||||
|
//请求连接到GooglePay
|
||||||
|
billingClient.startConnection(new BillingClientStateListener() {
|
||||||
|
@Override
|
||||||
|
public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
|
||||||
|
int code = billingResult.getResponseCode();
|
||||||
|
if (code != BillingClient.BillingResponseCode.OK) {
|
||||||
|
String msg = billingResult.getDebugMessage();
|
||||||
|
Log.e(TAG, "连接到GooglePay失败 code = " + code + " msg = " + msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.e(TAG, "连接到GooglePay成功");
|
||||||
|
QueryPurchasesParams inAppPurchasesQurey = QueryPurchasesParams.newBuilder().setProductType(BillingClient.ProductType.INAPP).build();
|
||||||
|
billingClient.queryPurchasesAsync(inAppPurchasesQurey, responseListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
//连接失败
|
||||||
|
@Override
|
||||||
|
public void onBillingServiceDisconnected() {
|
||||||
|
Log.e(TAG, "连接到GooglePay失败,请重试");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAdid() {
|
||||||
|
try {
|
||||||
|
return AdvertisingIdClient.getAdvertisingIdInfo(mContext).getId();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (GooglePlayServicesNotAvailableException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (GooglePlayServicesRepairableException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int resultCode = -1;
|
||||||
|
String resultToken = "";
|
||||||
|
String resultOrderId = "";
|
||||||
|
|
||||||
|
|
||||||
|
public void initResultCode() {
|
||||||
|
resultCode = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getPayResult() {
|
||||||
|
JSONObject object = new JSONObject();
|
||||||
|
try {
|
||||||
|
object.put("resultCode", resultCode);
|
||||||
|
object.put("resultToken", resultToken);
|
||||||
|
object.put("resultOrderId", resultOrderId);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> list) {
|
||||||
|
int code = billingResult.getResponseCode();
|
||||||
|
String msg = billingResult.getDebugMessage();
|
||||||
|
|
||||||
|
Log.e(TAG, "onPurchasesUpdated:code = " + code + " msg = " + msg);
|
||||||
|
|
||||||
|
if (list != null) {
|
||||||
|
for (Purchase purchase : list) {
|
||||||
|
Log.e(TAG, "onPurchasesUpdated:" + purchase.toString());
|
||||||
|
}
|
||||||
|
if (list.get(0) != null) {
|
||||||
|
resultToken = list.get(0).getPurchaseToken();
|
||||||
|
resultOrderId = list.get(0).getOrderId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (code == BillingClient.BillingResponseCode.OK && list != null) {
|
||||||
|
consume(list);
|
||||||
|
resultCode = 0;
|
||||||
|
Log.e(TAG, "支付成功");
|
||||||
|
if (billingListener != null) {
|
||||||
|
billingListener.onPaySuccess(list);
|
||||||
|
}
|
||||||
|
} else if (code == BillingClient.BillingResponseCode.USER_CANCELED) {
|
||||||
|
Log.e(TAG, "支付取消");
|
||||||
|
resultCode = 1;
|
||||||
|
if (billingListener != null) {
|
||||||
|
billingListener.onPayFailed(code, msg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resultCode = 2;
|
||||||
|
if (billingListener != null) {
|
||||||
|
billingListener.onPayFailed(code, msg);
|
||||||
|
}
|
||||||
|
Log.e(TAG, "支付失败:code = " + code + " msg = " + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义接口返回支付结果
|
||||||
|
*/
|
||||||
|
public interface GoogleBillingListener {
|
||||||
|
void onPaySuccess(List<Purchase> list);
|
||||||
|
|
||||||
|
void onPayFailed(int code, String msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private GoogleBillingListener billingListener;
|
||||||
|
|
||||||
|
public GoogleBillingManage setBillingListener(GoogleBillingListener billingListener) {
|
||||||
|
this.billingListener = billingListener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.shayu.lib_google.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.google.android.gms.auth.api.signin.GoogleSignIn;
|
||||||
|
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
|
||||||
|
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
|
||||||
|
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
||||||
|
import com.google.android.gms.common.api.ApiException;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
public class GoogleManage {
|
||||||
|
|
||||||
|
Activity mActivity;
|
||||||
|
|
||||||
|
public GoogleManage(Activity mContext) {
|
||||||
|
this.mActivity = mContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谷歌登录
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Intent googleLogin() {
|
||||||
|
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build();
|
||||||
|
GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(mActivity, gso);
|
||||||
|
return mGoogleSignInClient.getSignInIntent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录回调
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public JSONObject getLoginResult(Intent data) {
|
||||||
|
JSONObject object = new JSONObject();
|
||||||
|
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
|
||||||
|
try {
|
||||||
|
GoogleSignInAccount account = task.getResult(ApiException.class);
|
||||||
|
//account里可以直接获取到ID,name,和头像
|
||||||
|
String idToken = account.getIdToken();
|
||||||
|
account.getFamilyName();
|
||||||
|
account.getGivenName();
|
||||||
|
|
||||||
|
object.put("displayName", account.getDisplayName());
|
||||||
|
object.put("openId", account.getId());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.i("Log", "ApiException = " + e);
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.shayu.lib_huawei;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
lib_huawei/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
32
lib_huawei/build.gradle
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||||
|
buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion minSdkVersion
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
versionCode versionCode
|
||||||
|
versionName versionName
|
||||||
|
targetSdkVersion targetSdkVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation rootProject.ext.dependencies["appcompat-androidx"]
|
||||||
|
|
||||||
|
api 'com.huawei.hms:iap:4.0.4.301'
|
||||||
|
}
|
||||||