|
|
@@ -2,6 +2,7 @@ package com.sheep.gamegroup.view.activity;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
import android.app.Activity;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.net.Uri;
|
|
|
import android.os.Build;
|
|
|
@@ -9,6 +10,7 @@ import android.os.Bundle;
|
|
|
import android.os.Environment;
|
|
|
import android.provider.MediaStore;
|
|
|
import android.support.annotation.RequiresApi;
|
|
|
+import android.support.v7.app.AlertDialog;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import com.tencent.smtt.sdk.DownloadListener;
|
|
|
@@ -230,23 +232,38 @@ public class ActWeb extends BaseCompatActivity {
|
|
|
mWebView.setWebViewClient(new WebViewClient() {
|
|
|
@Override
|
|
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
- try {
|
|
|
- //微信H5支付核心代码
|
|
|
- if (url.startsWith("weixin://wap/pay?")) {
|
|
|
- Intent intent = new Intent();
|
|
|
- intent.setAction(Intent.ACTION_VIEW);
|
|
|
- intent.setData(Uri.parse(url));
|
|
|
- startActivity(intent);
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- Map<String, String> extraHeaders = new HashMap<>();
|
|
|
- extraHeaders.put("Referer", "http://17xmy.com");
|
|
|
- view.loadUrl(url, extraHeaders);
|
|
|
+ //微信H5支付核心代码
|
|
|
+ if (url.startsWith("weixin://wap/pay?")) {
|
|
|
+ try {
|
|
|
+ Intent intent = new Intent();
|
|
|
+ intent.setAction(Intent.ACTION_VIEW);
|
|
|
+ intent.setData(Uri.parse(url));
|
|
|
+ startActivity(intent);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } else if(url.startsWith("alipays:") || url.startsWith("alipay")) {
|
|
|
+ try {
|
|
|
+ startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url)));
|
|
|
+ } catch (Exception e) {
|
|
|
+ new AlertDialog.Builder(ActWeb.this)
|
|
|
+ .setMessage("未检测到支付宝客户端,请安装后重试。")
|
|
|
+ .setPositiveButton("立即安装", new DialogInterface.OnClickListener() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ Uri alipayUrl = Uri.parse("https://d.alipay.com");
|
|
|
+ startActivity(new Intent("android.intent.action.VIEW", alipayUrl));
|
|
|
+ }
|
|
|
+ }).setNegativeButton("取消", null).show();
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ Map<String, String> extraHeaders = new HashMap<>();
|
|
|
+ extraHeaders.put("Referer", "http://17xmy.com");
|
|
|
+ view.loadUrl(url, extraHeaders);
|
|
|
}
|
|
|
-
|
|
|
return true;
|
|
|
}
|
|
|
|