调研通 v3.0.3版本的 MD5 值为:fe075d21227d488bdb9f6aa09d3b3f35
以下内容为反编译后的 X5WebViewActivity.java 源代码,内容仅作参考
package com.yyt.common.acticity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import c.o.a.a.b;
import com.stx.xhb.commontitlebar.CustomTitleBar;
import com.tencent.smtt.export.external.interfaces.WebResourceRequest;
import com.tencent.smtt.export.external.interfaces.WebResourceResponse;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;
import com.yyt.common.m.b;
import com.yyt.common.o.n;
import java.io.File;
import java.io.FileInputStream;
public class X5WebViewActivity extends AppCompatActivity {
private static final String f10869c = "X5WebViewActivity";
private WebView f10870a;
private View f10871b;
public class a extends WebViewClient {
a() {
}
@Override
public void onPageFinished(WebView webView, String str) {
Log.i(X5WebViewActivity.f10869c, "onPageFinished, view:" + webView + ", url:" + str);
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
Log.i(X5WebViewActivity.f10869c, "onPageStarted, view:" + webView + ", url:" + str);
}
@Override
public void onReceivedError(WebView webView, int i, String str, String str2) {
Log.e(X5WebViewActivity.f10869c, "onReceivedError: " + i + ", description: " + str + ", url: " + str2);
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
if (webResourceRequest.getUrl().toString().contains("debugdebug")) {
FileInputStream fileInputStream = null;
Log.i("AterDebug", "shouldInterceptRequest");
try {
fileInputStream = new FileInputStream(new File("/sdcard/1.png"));
} catch (Exception unused) {
}
return new WebResourceResponse("image/*", "utf-8", fileInputStream);
}
return super.shouldInterceptRequest(webView, webResourceRequest);
}
}
private void H() {
this.f10870a.setWebViewClient(new a());
}
public void J(View view) {
finish();
}
public void L(View view, b.c cVar) {
if (cVar.f11110a) {
for (Rect rect : cVar.f11111b) {
if (view != null) {
if (view.getLayoutParams() instanceof LinearLayout.LayoutParams) {
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) view.getLayoutParams();
layoutParams.height += rect.bottom;
view.setLayoutParams(layoutParams);
}
if (view.getLayoutParams() instanceof FrameLayout.LayoutParams) {
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) view.getLayoutParams();
layoutParams2.height += rect.bottom;
view.setLayoutParams(layoutParams2);
}
if (view.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) view.getLayoutParams();
layoutParams3.height += rect.bottom;
view.setLayoutParams(layoutParams3);
}
}
C(rect.bottom);
}
return;
}
getWindow().setStatusBarColor(Color.parseColor(n.d(this)));
}
public void C(int i) {
if (this.f10870a.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.f10870a.getLayoutParams();
layoutParams.topMargin += i;
this.f10870a.setLayoutParams(layoutParams);
}
if (this.f10870a.getLayoutParams() instanceof FrameLayout.LayoutParams) {
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.f10870a.getLayoutParams();
layoutParams2.topMargin += i;
this.f10870a.setLayoutParams(layoutParams2);
}
}
public void D() {
RelativeLayout relativeLayout = new RelativeLayout(this);
G();
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
layoutParams.topMargin = com.stx.xhb.commontitlebar.c.d.c(this, b.d.titlebar_height);
relativeLayout.addView(this.f10870a, layoutParams);
setContentView(relativeLayout);
}
public View E() {
if (this.f10871b == null) {
View inflate = LayoutInflater.from(this).inflate(b.l.header_view, (ViewGroup) null);
this.f10871b = inflate;
com.stx.xhb.commontitlebar.c.e.f(inflate, Color.parseColor(n.d(this)));
com.stx.xhb.commontitlebar.c.e.f(this.f10871b.findViewById(b.i.titlebar), Color.parseColor("#00000000"));
this.f10871b.setLayoutParams(new LinearLayout.LayoutParams(-1, com.stx.xhb.commontitlebar.c.d.c(this, b.d.titlebar_height)));
}
return this.f10871b;
}
public void F(CustomTitleBar customTitleBar) {
com.stx.xhb.commontitlebar.d.a b2 = customTitleBar.b(b.h.icon_back, b.i.topbar_left_button);
b2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
X5WebViewActivity.this.J(view);
}
});
if (b2.getTag() != null) {
getResources().getDrawable(((Integer) b2.getTag()).intValue()).setColorFilter(Color.parseColor(n.e(this)), PorterDuff.Mode.SRC_ATOP);
}
}
protected void G() {
WebView.setWebContentsDebuggingEnabled(true);
WebView webView = new WebView(this);
this.f10870a = webView;
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setAllowFileAccess(true);
settings.setSupportZoom(true);
settings.setDatabaseEnabled(true);
settings.setAllowFileAccess(true);
settings.setDomStorageEnabled(true);
H();
this.f10870a.loadUrl("http://debugtbs.qq.com");
}
@Override
public void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
requestWindowFeature(1);
com.yyt.common.m.c.a().e(this);
D();
final View E = E();
if (E != null) {
addContentView(E, E.getLayoutParams());
F((CustomTitleBar) E.findViewById(b.i.titlebar));
}
com.yyt.common.m.c.a().b(this, new b.InterfaceC0203b() {
@Override
public final void a(b.c cVar) {
X5WebViewActivity.this.L(E, cVar);
}
});
}
}