lib_google
lib_huawei
This commit is contained in:
@@ -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.immomo.cosmos.mediax:beautyutils:2.2.1_01071700"
|
||||
api files('libs/liteavsdk.jar')
|
||||
@@ -180,8 +184,7 @@ dependencies {
|
||||
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
|
||||
//loading样式库
|
||||
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'
|
||||
implementation 'com.github.tajchert:WaitingDots:0.6.1'
|
||||
//悬浮窗
|
||||
@@ -206,4 +209,11 @@ dependencies {
|
||||
|
||||
// 多语言语音识别扩展库(可选)
|
||||
api 'tech.sud.mgp:SudASR:1.3.3.1158'
|
||||
|
||||
//华为支付插件包
|
||||
api project(':lib_huawei')
|
||||
|
||||
//google插件包
|
||||
api project(':lib_google')
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CommonAppConfig {
|
||||
//域名
|
||||
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");
|
||||
//是否为插件包模式
|
||||
@@ -470,6 +470,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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 个人中心功能列表
|
||||
*/
|
||||
|
||||
@@ -173,106 +173,97 @@ public class CommonHttpUtil {
|
||||
}
|
||||
Log.i("来了", lang);
|
||||
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
|
||||
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG)
|
||||
.params("langue", lang)
|
||||
.params("version", "" + VersionUtil.getVersion())
|
||||
.params("from", "android")
|
||||
.params("appType", "1")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
try {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class);
|
||||
CommonAppConfig.getInstance().setConfig(bean);
|
||||
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() {
|
||||
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG).params("langue", lang).params("version", "" + VersionUtil.getVersion()).params("from", "android").params("appType", "1").execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
try {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class);
|
||||
CommonAppConfig.getInstance().setConfig(bean);
|
||||
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(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 +271,18 @@ public class CommonHttpUtil {
|
||||
* QQ登录的时候 获取unionID 与PC端互通的时候用
|
||||
*/
|
||||
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")
|
||||
.tag(CommonHttpConsts.GET_QQ_LOGIN_UNION_ID)
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(Response<String> response) {
|
||||
if (commonCallback != null) {
|
||||
String data = response.body();
|
||||
data = data.substring(data.indexOf("{"), data.lastIndexOf("}") + 1);
|
||||
L.e("getQQLoginUnionID------>" + data);
|
||||
JSONObject obj = JSON.parseObject(data);
|
||||
commonCallback.callback(obj.getString("unionid"));
|
||||
}
|
||||
}
|
||||
});
|
||||
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() {
|
||||
@Override
|
||||
public void onSuccess(Response<String> response) {
|
||||
if (commonCallback != null) {
|
||||
String data = response.body();
|
||||
data = data.substring(data.indexOf("{"), data.lastIndexOf("}") + 1);
|
||||
L.e("getQQLoginUnionID------>" + data);
|
||||
JSONObject obj = JSON.parseObject(data);
|
||||
commonCallback.callback(obj.getString("unionid"));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -312,13 +301,11 @@ public class CommonHttpUtil {
|
||||
ToastUtil.show(WordUtil.getString(R.string.cannot_follow_self));
|
||||
return;
|
||||
}
|
||||
HttpClient.getInstance().get("User.setAttents", tag)
|
||||
.params("touid", touid)
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0 || code == 1001) {
|
||||
int isAttention = JSON.parseObject(info[0]).getIntValue("isattent");//1是 关注 0是未关注
|
||||
HttpClient.getInstance().get("User.setAttents", tag).params("touid", touid).execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0 || code == 1001) {
|
||||
int isAttention = JSON.parseObject(info[0]).getIntValue("isattent");//1是 关注 0是未关注
|
||||
/* if (code == 1001) {
|
||||
if (WordUtil.isNewZh()) {
|
||||
ToastUtil.show("粉絲團等級已清零,待領取獎勵已自動領取至【個性裝扮】");
|
||||
@@ -326,13 +313,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]");
|
||||
}
|
||||
}*/
|
||||
EventBus.getDefault().post(new FollowEvent(touid, isAttention));
|
||||
if (callback != null) {
|
||||
callback.callback(isAttention);
|
||||
}
|
||||
}
|
||||
EventBus.getDefault().post(new FollowEvent(touid, isAttention));
|
||||
if (callback != null) {
|
||||
callback.callback(isAttention);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,15 +327,14 @@ public class CommonHttpUtil {
|
||||
*/
|
||||
public static void getBalance(HttpCallback callback) {
|
||||
String isGoogle;
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
isGoogle = "1";
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
isGoogle = "2";
|
||||
} else {
|
||||
isGoogle = "-1";
|
||||
}
|
||||
HttpClient.getInstance().get("User.getBalance", CommonHttpConsts.GET_BALANCE)
|
||||
.params("type", 0)
|
||||
.params("isGooglePay", isGoogle)
|
||||
.execute(callback);
|
||||
HttpClient.getInstance().get("User.getBalance", CommonHttpConsts.GET_BALANCE).params("type", 0).params("isGooglePay", isGoogle).execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,8 +343,7 @@ public class CommonHttpUtil {
|
||||
* @param callback
|
||||
*/
|
||||
public static void getAliOrder(String parmas, HttpCallback callback) {
|
||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_ALI_ORDER)
|
||||
.execute(callback);
|
||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_ALI_ORDER).execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -367,8 +352,7 @@ public class CommonHttpUtil {
|
||||
* @param callback
|
||||
*/
|
||||
public static void getWxOrder(String parmas, HttpCallback callback) {
|
||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_ORDER)
|
||||
.execute(callback);
|
||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_ORDER).execute(callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -379,8 +363,7 @@ public class CommonHttpUtil {
|
||||
*/
|
||||
|
||||
public static void getCashierOrder(String parmas, HttpCallback callback) {
|
||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_CASHIER_ORDER)
|
||||
.execute(callback);
|
||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_CASHIER_ORDER).execute(callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -392,8 +375,7 @@ public class CommonHttpUtil {
|
||||
|
||||
|
||||
public static void getWxH5Order(String parmas, HttpCallback callback) {
|
||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_H5ORDER)
|
||||
.execute(callback);
|
||||
HttpClient.getInstance().get(parmas, CommonHttpConsts.GET_WX_H5ORDER).execute(callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -401,8 +383,7 @@ public class CommonHttpUtil {
|
||||
* 检查token是否失效
|
||||
*/
|
||||
public static void checkTokenInvalid() {
|
||||
HttpClient.getInstance().get("User.ifToken", CommonHttpConsts.CHECK_TOKEN_INVALID)
|
||||
.execute(NO_CALLBACK);
|
||||
HttpClient.getInstance().get("User.ifToken", CommonHttpConsts.CHECK_TOKEN_INVALID).execute(NO_CALLBACK);
|
||||
}
|
||||
|
||||
|
||||
@@ -410,32 +391,15 @@ public class CommonHttpUtil {
|
||||
* 谷歌支付成功后,通知自己服务器
|
||||
*/
|
||||
public static void notifyMeGoogle(String purchaseToken, String productId, String orderno, HttpCallback callback) {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
.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);
|
||||
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);
|
||||
}
|
||||
|
||||
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")
|
||||
.params("purchaseToken", purchaseToken)
|
||||
.params("orderno", orderNo)
|
||||
.params("trade_no", tradeNo)
|
||||
.params("package_name", "com.pdlive.shayu")
|
||||
.execute(callback);
|
||||
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);
|
||||
}
|
||||
|
||||
//不做任何操作的HttpCallback
|
||||
@@ -452,20 +416,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) {
|
||||
PostRequest<JsonBean> request;
|
||||
if ("2".equals(community_type)) {
|
||||
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);
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
if (file1 != null) {
|
||||
request.params("file1", file1);
|
||||
@@ -483,9 +436,7 @@ public class CommonHttpUtil {
|
||||
* 用户个人主页信息
|
||||
*/
|
||||
public static void getUserBaseinfo(String touid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO)
|
||||
.params("touid", touid)
|
||||
.execute(callback);
|
||||
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO).params("touid", touid).execute(callback);
|
||||
}
|
||||
//
|
||||
// //埋点唯一性
|
||||
|
||||
62
common/src/main/java/com/yunbao/common/pay/hw/HwBuilder.java
Normal file
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;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,6 @@ public class GoogleBillingUtilNew {
|
||||
Log.e(TAG, "支付失败:code = " + code + " msg = " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
public class GoogleCallBack {
|
||||
public void processResponse() {
|
||||
L.e("___GoogleCallBack___processResponse");
|
||||
}
|
||||
}
|
||||
212
common/src/main/java/com/yunbao/common/utils/GoogleUtils.java
Normal file
212
common/src/main/java/com/yunbao/common/utils/GoogleUtils.java
Normal file
@@ -0,0 +1,212 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
||||
import com.shayu.lib_google.utils.GoogleBillingManage;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBillingListener(GoogleBillingListener billingListener) {
|
||||
Timer 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) {
|
||||
billingListener.onPaySuccess(token, orderId);
|
||||
timer.cancel();
|
||||
} else if (code == 1 || code == 2) {
|
||||
billingListener.onPayFailed("支付失败");
|
||||
timer.cancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
timer.scheduleAtFixedRate(task, 60000, 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, 10000, 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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定义接口返回支付结果
|
||||
*/
|
||||
public interface GoogleBillingListener {
|
||||
void onPaySuccess(String token, String orderId);
|
||||
|
||||
void onPayFailed(String msg);
|
||||
}
|
||||
|
||||
public interface FirebaseTokenListener {
|
||||
void onResultToken(String token);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,50 +99,41 @@ public class LogUtil {
|
||||
} else {
|
||||
time = System.currentTimeMillis() + "";
|
||||
}
|
||||
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() {
|
||||
String TAG = "异常上传";
|
||||
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() {
|
||||
String TAG = "异常上传";
|
||||
|
||||
@Override
|
||||
public void onSuccess(Response<String> response) {
|
||||
Log.i(TAG, "onSuccess: " + response.message());
|
||||
file.delete();
|
||||
}
|
||||
});
|
||||
UploadTask<String> task = OkUpload.request("errorLog", request)
|
||||
.save()
|
||||
.register(new UploadListener<String>("errorLog") {
|
||||
@Override
|
||||
public void onSuccess(Response<String> response) {
|
||||
Log.i(TAG, "onSuccess: " + response.message());
|
||||
file.delete();
|
||||
}
|
||||
});
|
||||
UploadTask<String> task = OkUpload.request("errorLog", request).save().register(new UploadListener<String>("errorLog") {
|
||||
|
||||
@Override
|
||||
public void onStart(Progress progress) {
|
||||
@Override
|
||||
public void onStart(Progress progress) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(Progress progress) {
|
||||
@Override
|
||||
public void onProgress(Progress progress) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Progress progress) {
|
||||
}
|
||||
@Override
|
||||
public void onError(Progress progress) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(String s, Progress progress) {
|
||||
file.delete();
|
||||
}
|
||||
@Override
|
||||
public void onFinish(String s, Progress progress) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemove(Progress progress) {
|
||||
@Override
|
||||
public void onRemove(Progress progress) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
task.start();
|
||||
}
|
||||
}
|
||||
@@ -160,12 +151,12 @@ public class LogUtil {
|
||||
public static void shareFile(Context context) {
|
||||
try {
|
||||
IMLoginModel bean = IMLoginManager.get(context).getUserInfo();
|
||||
boolean isAnchor=false;
|
||||
if(bean!=null){
|
||||
isAnchor=bean.anchorUserType();
|
||||
boolean isAnchor = false;
|
||||
if (bean != null) {
|
||||
isAnchor = bean.anchorUserType();
|
||||
}
|
||||
//有debug文件或主播才允许
|
||||
if (!new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "pdlive.debug").exists()&&!isAnchor) {
|
||||
if (!new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "pdlive.debug").exists() && !isAnchor) {
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -225,7 +216,7 @@ public class LogUtil {
|
||||
share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
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()) {
|
||||
Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
|
||||
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) {
|
||||
|
||||
JSONObject body = new JSONObject();
|
||||
|
||||
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)) //上报日志文件
|
||||
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)) //上报日志文件
|
||||
.build();
|
||||
|
||||
body.put("uid", CommonAppConfig.getInstance().getUid());
|
||||
@@ -262,28 +250,23 @@ public class LogUtil {
|
||||
body.put("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY);
|
||||
body.put("appVersion", CommonAppConfig.getInstance().getVersion());
|
||||
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
.connectTimeout(3, TimeUnit.SECONDS)
|
||||
.build();
|
||||
Request request = new Request.Builder()
|
||||
.url("https://newht.yaoulive.com/index.php/api/error_log/report") //无法接受文件
|
||||
.post(requestBody)
|
||||
.build();
|
||||
client.newCall(request)
|
||||
.enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
||||
Log.e(TAG, "error",e );
|
||||
}
|
||||
OkHttpClient client = new OkHttpClient.Builder().connectTimeout(3, TimeUnit.SECONDS).build();
|
||||
Request request = new Request.Builder().url("https://newht.yaoulive.com/index.php/api/error_log/report") //无法接受文件
|
||||
.post(requestBody).build();
|
||||
client.newCall(request).enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
||||
Log.e(TAG, "error", e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, okhttp3.Response response) throws IOException {
|
||||
String body = response.body().string();
|
||||
Log.i(TAG, "onResponse: "+body);
|
||||
}
|
||||
@Override
|
||||
public void onResponse(Call call, okhttp3.Response response) throws IOException {
|
||||
String body = response.body().string();
|
||||
Log.i(TAG, "onResponse: " + body);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,11 +40,61 @@ public class VersionUtil {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//是否是谷歌版本
|
||||
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) {
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
@@ -103,55 +153,6 @@ public class VersionUtil {
|
||||
.build()
|
||||
.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,10 +69,10 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
|
||||
private void initView() {
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -86,13 +86,16 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.dialog_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (mInside){
|
||||
if (mInside) {
|
||||
dismiss();
|
||||
}else {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getAPKGoogleIsUp() != 1) {
|
||||
} else {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 && APKManager.get().getAPKGoogleIsUp() != 1) {
|
||||
dismiss();
|
||||
}
|
||||
if (!CommonAppConfig.IS_GOOGLE_PLAY && APKManager.get().getApkIsUp() != 1) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 2 && APKManager.get().getAPKGoogleIsUp() != 1) {
|
||||
dismiss();
|
||||
}
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 0 && APKManager.get().getApkIsUp() != 1) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
@@ -103,8 +106,16 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
ViewClicksAntiShake.clicksAntiShake(versionImmediateUse, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
//不是谷歌
|
||||
if (!CommonAppConfig.IS_GOOGLE_PLAY) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
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
|
||||
|
||||
} else {
|
||||
versionImmediateUse.setVisibility(GONE);
|
||||
updateLine.setVisibility(VISIBLE);
|
||||
downloadAPK(mContext, APKManager.get().getAPKUrl(), new APKDownloadUtil.OnUpdateListener() {
|
||||
@@ -113,13 +124,7 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user