jimu-decompiled/sources/com/ubt/jimu/blockly/view/JimuWebViewClient.java
2025-05-13 19:24:51 +02:00

127 lines
4.9 KiB
Java

package com.ubt.jimu.blockly.view;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Message;
import android.util.Log;
import android.webkit.ClientCertRequest;
import android.webkit.HttpAuthHandler;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.ubt.jimu.blockly.JimuRobot;
import com.ubt.jimu.blockly.command.BlocklyCommandController;
import com.ubt.jimu.blockly.command.JimuBlocklyCommand;
import com.ubtech.utils.FileHelper;
/* loaded from: classes.dex */
public class JimuWebViewClient extends WebViewClient {
private BlocklyCommandController command;
private Context context;
private DialogBlocklyWebView dialog;
private String tag = JimuWebViewClient.class.getSimpleName();
private boolean init = true;
public JimuWebViewClient(Context context, JimuBlocklyCommand jimuBlocklyCommand) {
this.context = context;
this.command = new BlocklyCommandController(jimuBlocklyCommand);
}
@Override // android.webkit.WebViewClient
public void doUpdateVisitedHistory(WebView webView, String str, boolean z) {
super.doUpdateVisitedHistory(webView, str, z);
}
@Override // android.webkit.WebViewClient
public void onFormResubmission(WebView webView, Message message, Message message2) {
super.onFormResubmission(webView, message, message2);
}
@Override // android.webkit.WebViewClient
public void onLoadResource(WebView webView, String str) {
super.onLoadResource(webView, str);
Log.i(this.tag, "onLoadResource:" + str);
}
@Override // android.webkit.WebViewClient
public void onPageCommitVisible(WebView webView, String str) {
super.onPageCommitVisible(webView, str);
}
@Override // android.webkit.WebViewClient
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
if (this.init) {
this.init = false;
this.dialog.hideWait();
JimuRobot jimuRobot = this.command.getJsInterface().getJimuRobot();
if ("0".equals(jimuRobot.getModelType())) {
FileHelper.a(jimuRobot.getSamplePath() + "loadFlags.file", "1", "");
}
}
Log.i(this.tag, "onPageFinished load url:" + str);
}
@Override // android.webkit.WebViewClient
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
super.onPageStarted(webView, str, bitmap);
Log.i(this.tag, "onPageStarted: " + str);
}
@Override // android.webkit.WebViewClient
public void onReceivedClientCertRequest(WebView webView, ClientCertRequest clientCertRequest) {
super.onReceivedClientCertRequest(webView, clientCertRequest);
}
@Override // android.webkit.WebViewClient
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
super.onReceivedError(webView, webResourceRequest, webResourceError);
}
@Override // android.webkit.WebViewClient
public void onReceivedHttpAuthRequest(WebView webView, HttpAuthHandler httpAuthHandler, String str, String str2) {
super.onReceivedHttpAuthRequest(webView, httpAuthHandler, str, str2);
Log.i(this.tag, "error:onReceivedHttpAuthRequest");
}
@Override // android.webkit.WebViewClient
public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
}
@Override // android.webkit.WebViewClient
public void onReceivedLoginRequest(WebView webView, String str, String str2, String str3) {
super.onReceivedLoginRequest(webView, str, str2, str3);
}
@Override // android.webkit.WebViewClient
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
super.onReceivedSslError(webView, sslErrorHandler, sslError);
Log.i(this.tag, "error:onReceivedSslError");
}
@Override // android.webkit.WebViewClient
public void onScaleChanged(WebView webView, float f, float f2) {
super.onScaleChanged(webView, f, f2);
}
public void setDialog(DialogBlocklyWebView dialogBlocklyWebView) {
this.dialog = dialogBlocklyWebView;
}
@Override // android.webkit.WebViewClient
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
return super.shouldInterceptRequest(webView, webResourceRequest);
}
@Override // android.webkit.WebViewClient
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
Log.i(this.tag, str);
return this.command.onBlocklyCommand(webView, str);
}
}