lib_google
lib_huawei
This commit is contained in:
@@ -110,7 +110,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
private ImageView btn_phone, btn_line, btn_twitter;
|
||||
private TextView btn_tip, btn_tip1, tv_customer;
|
||||
private TwitterLoginButton tt_login_button;
|
||||
private LinearLayout btn_google;
|
||||
private LinearLayout btn_google, googleLayout;
|
||||
public static Activity activity;
|
||||
private static String mLoginType = Constants.MOB_PHONE;//登录方式
|
||||
public String mPromoCode = "", UserID = "";//推广码
|
||||
@@ -169,6 +169,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -184,6 +185,12 @@ public class EntryActivity extends AppCompatActivity {
|
||||
activity = this;
|
||||
Contexts = this;
|
||||
setStatusBar();
|
||||
googleLayout = findViewById(R.id.googleLayout);
|
||||
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
googleLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
lt_btn_facebook = findViewById(R.id.lt_btn_facebook);
|
||||
lt_btn_twitter = findViewById(R.id.lt_btn_twitter);
|
||||
btn_tip = findViewById(R.id.btn_tip);
|
||||
|
||||
@@ -38,9 +38,6 @@ import androidx.viewpager.widget.ViewPager;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.jakewharton.rxbinding3.view.RxView;
|
||||
@@ -751,10 +748,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
} else {
|
||||
ToastUtil.show("正在初始化,請稍等....");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查版本更新
|
||||
*/
|
||||
|
||||
@@ -18,10 +18,6 @@ import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.android.billingclient.api.BillingResult;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.android.billingclient.api.PurchasesResponseListener;
|
||||
import com.google.gson.Gson;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
@@ -30,7 +26,7 @@ import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.pay.hw.HwBuilder;
|
||||
import com.yunbao.common.utils.GoogleBillingUtilNew;
|
||||
import com.yunbao.common.utils.GoogleUtils;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.main.R;
|
||||
@@ -47,9 +43,11 @@ import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTit
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -62,7 +60,7 @@ public class MyWalletActivity extends AbsActivity {
|
||||
public static String orderId;
|
||||
|
||||
HwBuilder hwBuilder;
|
||||
|
||||
GoogleUtils googleUtils;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -76,7 +74,10 @@ public class MyWalletActivity extends AbsActivity {
|
||||
mw = MyWalletActivity.this;
|
||||
setTitle(mContext.getString(R.string.wallet));
|
||||
|
||||
GoogleBillingUtilNew.getInstance().initGooglePay(mContext);
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
googleUtils = new GoogleUtils(mContext);
|
||||
googleUtils.initGooglePay();
|
||||
}
|
||||
|
||||
hwBuilder = new HwBuilder(MyWalletActivity.this);
|
||||
|
||||
@@ -92,37 +93,49 @@ public class MyWalletActivity extends AbsActivity {
|
||||
loadingDialog.setShowText(getString(R.string.order_query));
|
||||
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
|
||||
GoogleBillingUtilNew.getInstance().queryPurchasesAsync(new PurchasesResponseListener() {
|
||||
@Override
|
||||
public void onQueryPurchasesResponse(@NonNull BillingResult billingResult, @NonNull List<Purchase> list) {
|
||||
if (list.size() == 0) {
|
||||
loadingDialog.setShowText(getString(R.string.order_query_success));
|
||||
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000);
|
||||
} else {
|
||||
loadingDialog.setShowText(getString(R.string.order_query));
|
||||
//消费订单
|
||||
GoogleBillingUtilNew.getInstance().consume(list);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
int finalI = i;
|
||||
payHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//谷歌掉单处理
|
||||
CommonHttpUtil.Google_sec_pay(list.get(finalI).getPurchaseToken(), list.get(finalI).getOrderId(), list.get(finalI).getProducts().get(0), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (finalI == list.size() - 1) {
|
||||
loadingDialog.setShowText(getString(R.string.order_query_success));
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
ToastUtil.show("充值已到账");
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
googleUtils.queryPurchasesAsync();
|
||||
googleUtils.setQueryPurchaseListener(mContext, new GoogleUtils.QueryPurchasesListener() {
|
||||
@Override
|
||||
public void onResult(JSONObject obj) {
|
||||
try {
|
||||
int code = obj.getInt("querySize");
|
||||
if (code == 0) {
|
||||
loadingDialog.setShowText(getString(R.string.order_query_success));
|
||||
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000);
|
||||
} else {
|
||||
|
||||
JSONArray tokenList = obj.getJSONArray("tokenList");
|
||||
JSONArray orderList = obj.getJSONArray("orderList");
|
||||
String tradeNo = obj.getString("tradeNo");
|
||||
|
||||
for (int i = 0; i < tokenList.length(); i++) {
|
||||
int finalI = i;
|
||||
payHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//谷歌掉单处理
|
||||
try {
|
||||
CommonHttpUtil.Google_sec_pay(tokenList.getString(finalI), orderList.getString(finalI), tradeNo, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (finalI == tokenList.length() - 1) {
|
||||
loadingDialog.setShowText(getString(R.string.order_query_success));
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
ToastUtil.show("充值已到账");
|
||||
finish();
|
||||
}
|
||||
});
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/googleLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@@ -132,7 +133,6 @@
|
||||
<!-- </RelativeLayout>-->
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_login_other"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user