Merge remote-tracking branch 'origin/master'

This commit is contained in:
18401019693 2022-08-09 17:25:28 +08:00
commit a3e647d74b
15 changed files with 92 additions and 384 deletions

View File

@ -118,6 +118,18 @@ public class InstructorOperationDialog extends AbsDialogFragment {
} }
}); });
AdjustEvent adjustEvent2 = new AdjustEvent("ykpmj8");
Adjust.trackEvent(adjustEvent2);
CommonHttpUtil.setAdvertisingChannels("ykpmj8", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_director_message_box", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_director_message_box");
}
}
});
EventBus.getDefault().post(new InstructorOperationEvent()); EventBus.getDefault().post(new InstructorOperationEvent());
dismiss(); dismiss();
} }

View File

@ -333,12 +333,14 @@ public class CommonHttpUtil {
.execute(callback); .execute(callback);
} }
public static void notifyGoogle(String purchaseToken, String orderNo, String tradeNo, String allData, 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("purchaseToken", purchaseToken)
.params("orderno", orderNo) .params("orderno", orderNo)
.params("trade_no", tradeNo) .params("trade_no", tradeNo)
.params("allData", allData) .params("allData", allData)
.params("gps_adid", gps_adid)
.execute(callback); .execute(callback);
} }

View File

@ -52,17 +52,7 @@ public class PDMessageInterceptor implements MessageInterceptor {
IMLoginModel userBean = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); IMLoginModel userBean = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
//新手指导员 //新手指导员
if (!TextUtils.isEmpty(userBean.getIsAdmin()) && TextUtils.equals(userBean.getIsAdmin(), "1")) { if (!TextUtils.isEmpty(userBean.getIsAdmin()) && TextUtils.equals(userBean.getIsAdmin(), "1")) {
AdjustEvent adjustEvent1 = new AdjustEvent("82nzkz"); //wow
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("82nzkz", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
FirebaseAnalytics.getInstance(CommonAppContext.sInstance.getApplicationContext()).logEvent("FS_director_enter", null);
AppEventsLogger.newLogger(CommonAppContext.sInstance.getApplicationContext()).logEvent("FB_director_enter");
}
}
});
} else {//非指导员 } else {//非指导员

View File

@ -417,20 +417,20 @@ public class PayPresenter {
",OriginalJson=" +purchase.getOriginalJson()+ ",OriginalJson=" +purchase.getOriginalJson()+
",PurchaseState=" +purchase.getPurchaseState()+ ",PurchaseState=" +purchase.getPurchaseState()+
",Signature="+purchase.getSignature(); ",Signature="+purchase.getSignature();
CommonHttpUtil.notifyGoogle("1",mOrderid,purchase.getOrderId(),allData, new HttpCallback() { // CommonHttpUtil.notifyGoogle("1",mOrderid,purchase.getOrderId(),allData, new HttpCallback() {
@Override // @Override
public void onSuccess(int code, String msg, String[] info) { // public void onSuccess(int code, String msg, String[] info) {
if(code==0){ // if(code==0){
try { // try {
ToastUtil.show("购买成功!"); // ToastUtil.show("购买成功!");
}catch (Exception e){ // }catch (Exception e){
e.printStackTrace(); // e.printStackTrace();
} // }
}else { // }else {
ToastUtil.show("购买失败,请联系客服"); // ToastUtil.show("购买失败,请联系客服");
} // }
} // }
}); // });
}else{ }else{

View File

@ -18,7 +18,6 @@ public class RouteUtil {
public static final String PATH_LOGIN_INVALID = "/main/LoginInvalidActivity"; public static final String PATH_LOGIN_INVALID = "/main/LoginInvalidActivity";
public static final String PATH_USER_HOME = "/main/UserHomeActivity"; public static final String PATH_USER_HOME = "/main/UserHomeActivity";
public static final String PATH_COIN = "/main/MyWalletActivity"; public static final String PATH_COIN = "/main/MyWalletActivity";
public static final String PATH_GOOGLE = "/main/GooglePayActivity";
public static final String PATH_REWARD = "/main/RewardActivity"; public static final String PATH_REWARD = "/main/RewardActivity";
public static final String PATH_EDITPROFILE = "/main/EditProfileActivity"; public static final String PATH_EDITPROFILE = "/main/EditProfileActivity";
public static final String PATH_LIVEREPORT = "/live/LiveReportActivity"; public static final String PATH_LIVEREPORT = "/live/LiveReportActivity";

View File

@ -24,6 +24,6 @@ ext {
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false // true表示谷歌支付 false
isGooglePlay : false isGooglePlay : true
] ]
} }

View File

@ -333,6 +333,7 @@ public class LiveAudienceActivity extends LiveActivity {
NewUserDialog fragment1 = new NewUserDialog(); NewUserDialog fragment1 = new NewUserDialog();
fragment1.show(((LiveActivity) mContext).getSupportFragmentManager(), "NewUserDialog"); fragment1.show(((LiveActivity) mContext).getSupportFragmentManager(), "NewUserDialog");
} }
if (timeIndex == CommonAppConfig.getInstance().alert_time) { if (timeIndex == CommonAppConfig.getInstance().alert_time) {
if (mLiveRoomViewHolder.isAttention == 0) { if (mLiveRoomViewHolder.isAttention == 0) {
BlowkissDialog fragment1 = new BlowkissDialog(); BlowkissDialog fragment1 = new BlowkissDialog();
@ -478,7 +479,20 @@ public class LiveAudienceActivity extends LiveActivity {
mFirebaseAnalytics.logEvent("FS_enterroom", null); mFirebaseAnalytics.logEvent("FS_enterroom", null);
logger.logEvent("FB_enterroom"); logger.logEvent("FB_enterroom");
//观看十分钟并且有充值优质用户 //观看1分钟
if (obj.getIntValue("see_time") >= 60){
AdjustEvent good_user = new AdjustEvent("7zxuxz");
Adjust.trackEvent(good_user);
CommonHttpUtil.setAdvertisingChannels("7zxuxz", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
mFirebaseAnalytics.logEvent("FS_enter_app_1min", null);
logger.logEvent("FB_enter_app_1min", null);
}
}
});
}
if (obj.getIntValue("see_time") >= 600 && obj.getIntValue("un_charge") == 1) { if (obj.getIntValue("see_time") >= 600 && obj.getIntValue("un_charge") == 1) {
AdjustEvent good_user = new AdjustEvent("val8lv"); AdjustEvent good_user = new AdjustEvent("val8lv");
Adjust.trackEvent(good_user); Adjust.trackEvent(good_user);

View File

@ -31,12 +31,15 @@ import com.alibaba.android.arouter.launcher.ARouter;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.LiveGiftBean2; import com.yunbao.common.bean.LiveGiftBean2;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;

View File

@ -32,7 +32,6 @@ import com.yunbao.live.activity.LiveAudienceActivity;
import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN; import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
import static com.yunbao.common.utils.RouteUtil.PATH_GOOGLE;
public class LiveHDDialogFragment extends AbsDialogFragment { public class LiveHDDialogFragment extends AbsDialogFragment {
@ -133,14 +132,9 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
public class JsInteration { public class JsInteration {
@JavascriptInterface @JavascriptInterface
public void androidGoTopUp() { public void androidGoTopUp() {
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
//谷歌的
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlePaycoin&first_page=1&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
ARouter.getInstance().build(PATH_GOOGLE).withString("url", url).navigation();
} else {
//我们的
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).withString("tag", "&first_page=1").navigation(); ARouter.getInstance().build(PATH_COIN).withInt("p", 0).withString("tag", "&first_page=1").navigation();
}
dismiss(); dismiss();
} }

View File

@ -141,17 +141,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
if ("showBanner".equals(str)) { if ("showBanner".equals(str)) {
showBanner3(); showBanner3();
} else if ("stop_svga_new_user_double".equals(str) && mBannerList3.size() > 2) { } else if ("stop_svga_new_user_double".equals(str) && mBannerList3.size() > 2) {
AdjustEvent adjustEvent1 = new AdjustEvent("80lzdi");
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("80lzdi", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_3", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_mission_3");
}
}
});
mBannerList3.get(2).setLink("1"); mBannerList3.get(2).setLink("1");
mBanner3.update(mBannerList3); mBanner3.update(mBannerList3);
if (mBannerList3.get(0).getLink().equals("1")) { if (mBannerList3.get(0).getLink().equals("1")) {
@ -163,17 +153,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
} }
} else if ("stop_svga_new_user_follow".equals(str)&& mBannerList3.size() > 1) { } else if ("stop_svga_new_user_follow".equals(str)&& mBannerList3.size() > 1) {
mBannerList3.get(1).setLink("1"); mBannerList3.get(1).setLink("1");
AdjustEvent adjustEvent1 = new AdjustEvent("f084wh");
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("f084wh", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_2", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_mission_2");
}
}
});
mBanner3.update(mBannerList3); mBanner3.update(mBannerList3);
if (mBannerList3.get(0).getLink().equals("1")) { if (mBannerList3.get(0).getLink().equals("1")) {
if (mBannerList3.get(1).getLink().equals("1")) { if (mBannerList3.get(1).getLink().equals("1")) {
@ -183,17 +163,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
} }
} }
} else if ("stop_new_user_gif".equals(str)&& mBannerList3.size() > 0) { } else if ("stop_new_user_gif".equals(str)&& mBannerList3.size() > 0) {
AdjustEvent adjustEvent1 = new AdjustEvent("aqqz70");
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("aqqz70", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_1", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_mission_1");
}
}
});
IMLoginManager.get(mContext).setNewUserGif(false); IMLoginManager.get(mContext).setNewUserGif(false);
mBannerList3.get(0).setLink("1"); mBannerList3.get(0).setLink("1");
mBanner3.update(mBannerList3); mBanner3.update(mBannerList3);
@ -205,10 +174,43 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
} }
} }
} else if ("stop_svga_new_user_double1".equals(str)) { } else if ("stop_svga_new_user_double1".equals(str)) {
AdjustEvent adjustEvent1 = new AdjustEvent("80lzdi");
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("80lzdi", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_3", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_mission_3");
}
}
});
publicToast(mContext); publicToast(mContext);
} else if ("stop_svga_new_user_follow1".equals(str)) { } else if ("stop_svga_new_user_follow1".equals(str)) {
AdjustEvent adjustEvent1 = new AdjustEvent("f084wh");
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("f084wh", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_2", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_mission_2");
}
}
});
publicToast(mContext); publicToast(mContext);
} else if ("stop_new_user_gif1".equals(str)) { } else if ("stop_new_user_gif1".equals(str)) {
AdjustEvent adjustEvent1 = new AdjustEvent("aqqz70");
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("aqqz70", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_1", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_mission_1");
}
}
});
publicToast(mContext); publicToast(mContext);
} }
} }

View File

@ -27,9 +27,6 @@
<activity <activity
android:name=".activity.MyWalletActivity" android:name=".activity.MyWalletActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".activity.GooglePayActivity"
android:screenOrientation="portrait" />
<activity <activity
android:name=".activity.ZhuangBanActivity" android:name=".activity.ZhuangBanActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />

View File

@ -199,7 +199,7 @@ public class GoogleFragment extends Fragment {
// return false; // return false;
// } // }
// googleBillingUtil.consumeAsync(GooglePayActivity.this,purchase.getPurchaseToken()); // googleBillingUtil.consumeAsync(GooglePayActivity.this,purchase.getPurchaseToken());
CommonHttpUtil.notifyGoogle(purchase.getPurchaseToken(),purchase.getOrderId(),mProductId,mOrderid, new HttpCallback() { CommonHttpUtil.notifyGoogle(purchase.getPurchaseToken(),purchase.getOrderId(),mProductId,mOrderid, adid,new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if(code==0){ if(code==0){
@ -212,8 +212,6 @@ public class GoogleFragment extends Fragment {
logger.logEvent("FB_iap_Play", params); logger.logEvent("FB_iap_Play", params);
logger.logEvent("FB_iap_events", params);
Bundle fb_params = new Bundle(); Bundle fb_params = new Bundle();
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD"); fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID,mProductId); fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID,mProductId);
@ -232,15 +230,8 @@ public class GoogleFragment extends Fragment {
google_params.putString("price",MoneyUsds); google_params.putString("price",MoneyUsds);
google_params.putString("quantity","1"); google_params.putString("quantity","1");
mFirebaseAnalytics.logEvent("FS_iap_Play", google_params); mFirebaseAnalytics.logEvent("FS_iap_Play", google_params);
mFirebaseAnalytics.logEvent("FS_iap_events", google_params);
//AD官方通知充值
AdjustEvent adjustEvent = new AdjustEvent("z8v726");
adjustEvent.setRevenue(Double.parseDouble(MoneyUsds),"HKD");
// adjustEvent.setOrderId(mOrderid);
Adjust.trackEvent(adjustEvent);
AdjustEvent adjustEvent1 = new AdjustEvent("cgssol"); AdjustEvent adjustEvent1 = new AdjustEvent("cgssol");
Adjust.trackEvent(adjustEvent1); Adjust.trackEvent(adjustEvent1);
@ -256,13 +247,10 @@ public class GoogleFragment extends Fragment {
AdjustEvent adjustEvent2 = new AdjustEvent("tr8lb9"); AdjustEvent adjustEvent2 = new AdjustEvent("tr8lb9");
adjustEvent2.setRevenue(Double.parseDouble(MoneyUsds),"HKD"); adjustEvent2.setRevenue(Double.parseDouble(MoneyUsds),"HKD");
adjustEvent.addCallbackParameter("GOrderid",purchase.getOrderId()); adjustEvent2.addCallbackParameter("GOrderid",purchase.getOrderId());
adjustEvent.addCallbackParameter("POrderid",mOrderid); adjustEvent2.addCallbackParameter("POrderid",mOrderid);
adjustEvent.addCallbackParameter("Uid",CommonAppConfig.getInstance().getUid()); adjustEvent2.addCallbackParameter("Uid",CommonAppConfig.getInstance().getUid());
// String adid = AdvertisingIdClient.getAdvertisingIdInfo(getActivity()).getId(); adjustEvent2.addCallbackParameter("GADid",adid);
// ToastUtil.show(adid);
// adjustEvent.addCallbackParameter("GADid",adid);
adjustEvent2.setOrderId(mOrderid); adjustEvent2.setOrderId(mOrderid);
Adjust.trackEvent(adjustEvent2); Adjust.trackEvent(adjustEvent2);
@ -294,8 +282,6 @@ public class GoogleFragment extends Fragment {
return true ;//自动消耗(只有当isSelf为true,并且支付状态为PURCHASED时该值才会生效) return true ;//自动消耗(只有当isSelf为true,并且支付状态为PURCHASED时该值才会生效)
} }
@Override @Override
public boolean onRecheck(@NonNull String skuType, @NonNull Purchase purchase, boolean isSelf) { public boolean onRecheck(@NonNull String skuType, @NonNull Purchase purchase, boolean isSelf) {
StringBuffer tempBuffer =new StringBuffer(); StringBuffer tempBuffer =new StringBuffer();

View File

@ -1,280 +0,0 @@
package com.yunbao.main.activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.Color;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.android.billingclient.api.Purchase;
import com.android.billingclient.api.SkuDetails;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.GoogleBillingUtil;
import com.yunbao.common.utils.OnGoogleBillingListener;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R;
import com.yunbao.main.utils.HXLinePagerIndicator;
import com.yunbao.main.views.TestWebViewClient;
import net.lucode.hackware.magicindicator.MagicIndicator;
import net.lucode.hackware.magicindicator.buildins.UIUtil;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
import java.util.List;
import java.util.Locale;
import static android.util.Log.i;
@Route(path = RouteUtil.PATH_GOOGLE)
public class GooglePayActivity extends AbsActivity {
String TAG = "GooglePay";
//我们自己的订单号
private String mOrderid,mProductId;
ProgressDialog progressDialog;
private WebView rlWebview;
// private String [] arrPro = {"1"};
private void initGooglePay() {
// arrPro[0]="2";
GoogleBillingUtil.isDebug(true);
// GoogleBillingUtil.setSkus(arrPro,null);
GoogleBillingUtil.setIsAutoAcknowledgePurchase(true);//设置自动确认购买
googleBillingUtil = GoogleBillingUtil.getInstance()
.addOnGoogleBillingListener(GooglePayActivity.this, mOnMyGoogleBillingListener)
.build(GooglePayActivity.this);
}
private OnGoogleBillingListener mOnMyGoogleBillingListener=new OnGoogleBillingListener(){
@Override
public void onSetupSuccess(boolean isSelf) {
super.onSetupSuccess(isSelf);
Log.d(TAG,"内购服务初始化完成");
}
@Override
public void onQuerySuccess(@NonNull String skuType, @NonNull List<SkuDetails> list, boolean isSelf) {
googleBillingUtil.purchaseInApp(GooglePayActivity.this,mProductId);
}
@Override
public boolean onPurchaseSuccess(@NonNull Purchase purchase, boolean isSelf) {
StringBuffer tempBuffer =new StringBuffer();
if(progressDialog.isShowing()){
progressDialog.dismiss();
}
if(purchase.getPurchaseState()==Purchase.PurchaseState.PURCHASED){
tempBuffer.append("购买成功:");
//通知自己服务器
if (mOrderid == null || purchase.getOrderId() == null){
return false;
}
// googleBillingUtil.consumeAsync(GooglePayActivity.this,purchase.getPurchaseToken());
CommonHttpUtil.notifyGoogle(purchase.getPurchaseToken(),purchase.getOrderId(),mProductId,mOrderid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if(code==0){
try {
String r_url = CommonAppConfig.HOST +"?g=Appapi&m=Mall&a=paysuss&status=1";
rlWebview.loadUrl(r_url);
}catch (Exception e){
e.printStackTrace();
}
}else {
String r_url = CommonAppConfig.HOST +"?g=Appapi&m=Mall&a=paysuss&status=0";
rlWebview.loadUrl(r_url);
ToastUtil.show("购买失败,请联系客服");
}
}
});
}else{
progressDialog.setTitle("正在處理");
progressDialog.setMessage("系統檢測到您的卡是慢速卡,正在處理您的訂單,大概需要一分鐘,請勿離開,若因離開此頁面導致支付失敗,請聯系在線客服");
progressDialog.setCancelable(false);
progressDialog.show();
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);
String r_url = CommonAppConfig.HOST +"?g=Appapi&m=Mall&a=paysuss&status=0";
rlWebview.loadUrl(r_url);
}
@Override
public void onError(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, boolean isSelf) {
Log.d(TAG,"发生错误:tag="+tag.name());
String r_url = CommonAppConfig.HOST +"?g=Appapi&m=Mall&a=paysuss&status=0";
rlWebview.loadUrl(r_url);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initGooglePay();
initView();
rlWebview.loadUrl(getIntent().getStringExtra("url"));
i("tag", getIntent().getStringExtra("url"));
WebSettings webSettings = rlWebview.getSettings();
webSettings.setDomStorageEnabled(true);
webSettings.setTextZoom(100);
webSettings.setUseWideViewPort(true);
webSettings.setJavaScriptEnabled(true); // 是否开启JS支持
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");
TestWebViewClient testWebViewClient = new TestWebViewClient(this, rlWebview);
rlWebview.setWebViewClient(testWebViewClient);
}
private GoogleBillingUtil googleBillingUtil;
//js调用原生
public class JsInteration {
@JavascriptInterface
public void androidGoToGooglePay(String ProductId, String OrderNumber) {
Log.e(TAG,"ProductId"+ProductId+"OrderNumber"+OrderNumber);
mProductId = ProductId;
mOrderid = OrderNumber;
googleBillingUtil.purchaseInApp(GooglePayActivity.this,mProductId);
}
@JavascriptInterface
public void androidMethodBack() {
GooglePayActivity.this.finish();
}
@JavascriptInterface
public void androidGoBack() {
GooglePayActivity.this.finish();
}
}
@Override
protected int getLayoutId() {
return R.layout.activity_google_pay;
}
private void initView() {
rlWebview = (WebView) findViewById(R.id.rlWebview);
final String[] titles = {WordUtil.getString(R.string.diamond), WordUtil.getString(R.string.coins),WordUtil.getString(R.string.golden_beans)};
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator);
CommonNavigator commonNavigator = new CommonNavigator(this);
commonNavigator.setAdjustMode(true);
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
@Override
public int getCount() {
return titles == null ? 0 : titles.length;
}
@Override
public IPagerTitleView getTitleView(Context context, final int index) {
ColorTransitionPagerTitleView colorTransitionPagerTitleView = new ColorTransitionPagerTitleView(context);
colorTransitionPagerTitleView.setNormalColor(Color.GRAY);
colorTransitionPagerTitleView.setSelectedColor(Color.BLACK);
colorTransitionPagerTitleView.setTextAppearance(GooglePayActivity.this,R.style.TabLayoutTextStyle);
colorTransitionPagerTitleView.setText(titles[index]);
colorTransitionPagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
return colorTransitionPagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
HXLinePagerIndicator indicator = new HXLinePagerIndicator(context);
indicator.setMode(LinePagerIndicator.MODE_EXACTLY);
indicator.setLineHeight(UIUtil.dip2px(context, 4));
indicator.setLineWidth(UIUtil.dip2px(context, 20));
indicator.setRoundRadius(UIUtil.dip2px(context, 3));
indicator.setStartInterpolator(new AccelerateInterpolator());
indicator.setEndInterpolator(new DecelerateInterpolator(2.0f));
return indicator;
}
});
magicIndicator.setNavigator(commonNavigator);
progressDialog=new ProgressDialog(GooglePayActivity.this);
magicIndicator.onPageSelected(0);
}
public void release() {
if (googleBillingUtil != null){
googleBillingUtil.onDestroy(GooglePayActivity.this);
//退出程序的时候可以调用(实验性)
GoogleBillingUtil.endConnection();
}
}
}

View File

@ -88,17 +88,7 @@ public class PDLiveConversationListActivity extends AbsActivity {
container = findViewById(R.id.container); container = findViewById(R.id.container);
redPoint = findViewById(R.id.v_table_redpoint); redPoint = findViewById(R.id.v_table_redpoint);
redpointMe = findViewById(R.id.v_table_redpoint_me); redpointMe = findViewById(R.id.v_table_redpoint_me);
AdjustEvent adjustEvent2 = new AdjustEvent("ykpmj8");
Adjust.trackEvent(adjustEvent2);
CommonHttpUtil.setAdvertisingChannels("ykpmj8", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
FirebaseAnalytics.getInstance(PDLiveConversationListActivity.this).logEvent("FS_director_message_box", null);
AppEventsLogger.newLogger(PDLiveConversationListActivity.this).logEvent("FB_director_message_box");
}
}
});
mTabButtonGroup.setCurPosition(2); mTabButtonGroup.setCurPosition(2);
findViewById(R.id.btn_start).setOnClickListener(v -> { findViewById(R.id.btn_start).setOnClickListener(v -> {
//防止重新加载多个 //防止重新加载多个

View File

@ -27,7 +27,6 @@ import com.yunbao.live.dialog.LiveFansFragment;
import com.yunbao.live.views.LiveRoomViewHolder; import com.yunbao.live.views.LiveRoomViewHolder;
import com.yunbao.main.R; import com.yunbao.main.R;
import static com.yunbao.common.utils.RouteUtil.PATH_GOOGLE;
import static com.yunbao.common.utils.RouteUtil.PATH_REWARD; import static com.yunbao.common.utils.RouteUtil.PATH_REWARD;
public class SigninDialog extends AbsDialogFragment { public class SigninDialog extends AbsDialogFragment {