WebView兼容和平精英的跳转
This commit is contained in:
@@ -16,6 +16,7 @@ import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebBackForwardList;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
@@ -42,6 +43,7 @@ import com.yizhuan.erban.ui.webview.event.TaroPayResultEvent;
|
||||
import com.yizhuan.erban.ui.widget.ShareDialog;
|
||||
import com.yizhuan.erban.utils.WebViewUtils;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.certification.event.CertificationResultEvent;
|
||||
import com.yizhuan.xchat_android_core.share.ShareModel;
|
||||
import com.yizhuan.xchat_android_core.web.bean.WebJsBeanInfo;
|
||||
@@ -254,6 +256,31 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
//删除直接拨打电话的功能
|
||||
return true;
|
||||
}
|
||||
if (url.startsWith("pubgmhd1106467070://")) {
|
||||
// 跳转和平精英
|
||||
Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
if (in.resolveActivity(getPackageManager()) == null) {
|
||||
toast("您尚未安装游戏,跳转失败。");
|
||||
} else {
|
||||
in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
startActivity(in);
|
||||
}
|
||||
// 跳转成功或失败与否,都重新回到最后打开的App内非第三方网页
|
||||
view.post(() -> {
|
||||
WebBackForwardList list = view.copyBackForwardList();
|
||||
final int length = list.getSize();
|
||||
int steps = 1;
|
||||
for (int i = length - 1; i >=0 ; i--) {
|
||||
String lastUrl = list.getItemAtIndex(i).getUrl();
|
||||
steps--;
|
||||
if (lastUrl != null && lastUrl.startsWith(UriProvider.JAVA_WEB_URL)) {
|
||||
view.goBackOrForward(steps);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
// ------- 处理结束 -------
|
||||
|
||||
if (!(url.startsWith("http") || url.startsWith("https"))) {
|
||||
|
Reference in New Issue
Block a user