|
@@ -201,7 +201,8 @@ public class KFZSJs {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
@JavascriptInterface
|
|
|
- public void captureQRCode(){
|
|
|
|
|
|
|
+ public void captureQRCode() {
|
|
|
|
|
+ if (!CameraUtil.checkCameraPermission(activity)) return;
|
|
|
Intent intent = new Intent(activity, CaptureActivity.class);
|
|
Intent intent = new Intent(activity, CaptureActivity.class);
|
|
|
activity.startActivityForResult(intent, Constant.INTENT_CAPTURE_QRCODE);
|
|
activity.startActivityForResult(intent, Constant.INTENT_CAPTURE_QRCODE);
|
|
|
}
|
|
}
|
|
@@ -378,31 +379,46 @@ public class KFZSJs {
|
|
|
activity.runOnUiThread(() -> iWeb.setH5Type(h5Type));
|
|
activity.runOnUiThread(() -> iWeb.setH5Type(h5Type));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private long lastClickTime = 0l;
|
|
|
|
|
+
|
|
|
|
|
+ private boolean checkFastClick() {
|
|
|
|
|
+ long currentTime = System.currentTimeMillis();
|
|
|
|
|
+ if (currentTime - lastClickTime > 2000) {
|
|
|
|
|
+ lastClickTime = currentTime;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@JavascriptInterface
|
|
@JavascriptInterface
|
|
|
public void alipay(String payInfo, boolean b) {
|
|
public void alipay(String payInfo, boolean b) {
|
|
|
- CommonUtil.getInstance().alipay(activity, payInfo, b, new AbsObserver<String>() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onNext(String result) {
|
|
|
|
|
- iWeb.loadJs(String.format(Locale.CHINA, "onAlipayResult('%s')", result));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (checkFastClick()) {
|
|
|
|
|
+ CommonUtil.getInstance().alipay(activity, payInfo, b, new AbsObserver<String>() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(String result) {
|
|
|
|
|
+ iWeb.loadJs(String.format(Locale.CHINA, "onAlipayResult('%s')", result));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onError(Throwable e) {
|
|
|
|
|
- iWeb.loadJs(String.format(Locale.CHINA, "onAlipayResult('%s')", e.getMessage()));
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(Throwable e) {
|
|
|
|
|
+ iWeb.loadJs(String.format(Locale.CHINA, "onAlipayResult('%s')", e.getMessage()));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
@JavascriptInterface
|
|
|
public void wxpay(String payInfo) {
|
|
public void wxpay(String payInfo) {
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(payInfo);
|
|
|
|
|
- LogUtil.println("KFZSJs", "wxpay", payInfo);
|
|
|
|
|
- if (jsonObject == null) {
|
|
|
|
|
- G.showToast(R.string.please_contact_customer_service);
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ if (checkFastClick()) {
|
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(payInfo);
|
|
|
|
|
+ LogUtil.println("KFZSJs", "wxpay", payInfo);
|
|
|
|
|
+ if (jsonObject == null) {
|
|
|
|
|
+ G.showToast(R.string.please_contact_customer_service);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ String attach = jsonObject.getString("attach").split("_")[1];
|
|
|
|
|
+ CommonUtil.getInstance().wxpay(SheepApp.getInstance().getWxApi(activity, attach), jsonObject);
|
|
|
}
|
|
}
|
|
|
- String attach = jsonObject.getString("attach").split("_")[1];
|
|
|
|
|
- CommonUtil.getInstance().wxpay(SheepApp.getInstance().getWxApi(activity, attach), jsonObject);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@JavascriptInterface
|
|
@JavascriptInterface
|