QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 SkinWebDetailView.java 源代码,内容仅作参考
package com.tencent.mtt.external.setting.skin;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.webkit.WebResourceResponse;
import android.widget.FrameLayout;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.MttFunctionwindowProxy;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.webview.QBWebView;
import com.tencent.mtt.base.webview.WebViewUtils;
import com.tencent.mtt.base.webview.common.QBWebSettings;
import com.tencent.mtt.base.webview.common.QBWebViewClient;
import com.tencent.mtt.browser.WebEngine;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.setting.manager.UserSettingManager;
import com.tencent.mtt.browser.setting.skin.MttSkinInstallListener;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.external.setting.base.RotateScreenManager;
import com.tencent.mtt.external.setting.facade.ForwardListener;
import com.tencent.mtt.external.setting.facade.ViewState;
import com.tencent.mtt.external.setting.manager.SkinWebCacheManager;
import kotlin.text.Typography;
public final class SkinWebDetailView extends FrameLayout implements WebEngine.WebCoreStateObserver, SkinManager.SkinWebpageCallback, MttSkinInstallListener, ViewState {
QBWebView f59806a;
MttFunctionwindowProxy f59807b;
public int f59808c;
long f59809d;
Handler e;
private boolean f;
private SkinManager g;
private Bundle h;
private ForwardListener i;
private boolean j;
private String k;
class AnonymousClass5 extends Handler {
final SkinWebDetailView f59818a;
@Override
public void handleMessage(Message message) {
int h;
Object obj = message.obj;
if (message.what == 327681 && obj != null && (obj instanceof String) && (h = SkinManager.s().h((String) obj)) != -1 && h == this.f59818a.f59808c) {
this.f59818a.f59807b.e();
}
}
}
public class CardWebViewClient extends QBWebViewClient {
public CardWebViewClient() {
}
@Override
public WebResourceResponse shouldInterceptRequest(QBWebView qBWebView, String str) {
WebResourceResponse a2 = SkinWebCacheManager.a().a(str);
return a2 != null ? a2 : super.shouldInterceptRequest(qBWebView, str);
}
@Override
public boolean shouldOverrideUrlLoading(QBWebView qBWebView, String str) {
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - SkinWebDetailView.this.f59809d > 500) {
SkinWebDetailView.this.f59809d = currentTimeMillis;
if (!TextUtils.isEmpty(str)) {
if (str.contains("isnewpage=true") && !TextUtils.equals(str, qBWebView.getUrl())) {
Bundle bundle = new Bundle();
bundle.putString("card_store_url", str);
if (str.contains("titlename=")) {
String decode = UrlUtils.decode(UrlUtils.getValueByKey(str, str.toLowerCase(), "titlename=", Typography.amp));
if (!TextUtils.isEmpty(decode)) {
bundle.putString("card_store_name", decode);
}
}
SkinWebDetailView.this.a(35, bundle);
return true;
}
if (str.contains("openinmainwindow=true")) {
new UrlParams(str).b(1).c(13).e();
return true;
}
}
}
return super.shouldOverrideUrlLoading(qBWebView, str);
}
}
private void f() {
h();
addView(this.f59806a, new FrameLayout.LayoutParams(-1, -1));
QBWebView qBWebView = this.f59806a;
if (qBWebView == null || qBWebView.getView() == null) {
return;
}
this.f59806a.getView().setFocusableInTouchMode(true);
this.f59806a.getView().setBackgroundColor(MttResources.c(R.color.theme_home_color_bkg));
}
private void h() {
if (this.f59806a == null) {
this.f59806a = new QBWebView(ContextHolder.getAppContext());
i();
WebViewUtils.a(this.f59806a, (String) null);
this.f59806a.addDefaultJavaScriptInterface();
this.f59806a.setQBWebViewClient(new CardWebViewClient());
this.f59806a.getQBSettings().m(true);
this.f59806a.getQBSettings().n(false);
}
}
private void i() {
QBWebView qBWebView = this.f59806a;
if (qBWebView != null) {
QBWebSettings qBSettings = qBWebView.getQBSettings();
qBSettings.p(true);
qBSettings.q(true);
qBSettings.o(true);
UserSettingManager b2 = UserSettingManager.b();
if (b2 == null || this.f59806a.getSettingsExtension() == null) {
return;
}
this.f59806a.getSettingsExtension().f(b2.getBoolean("Key4FitScreen", false));
}
}
private void j() {
String str;
if (!this.f || this.f59806a == null) {
return;
}
this.f = false;
str = "";
Bundle bundle = this.h;
if (bundle != null) {
str = bundle.containsKey("card_store_url") ? this.h.getString("card_store_url") : "";
if (this.h.containsKey("cache_flag")) {
this.j = true;
}
}
this.f59806a.loadUrl(str);
this.g.a((SkinManager.SkinWebpageCallback) this);
}
@Override
public void a(int i) {
if (i == 1) {
this.e.removeMessages(327681);
Handler handler = this.e;
handler.sendMessageDelayed(handler.obtainMessage(327681, this.k), 1000L);
}
}
void a(int i, Bundle bundle) {
ForwardListener forwardListener = this.i;
if (forwardListener != null) {
forwardListener.a(i, bundle);
}
}
@Override
public void a(int i, final String str) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (SkinWebDetailView.this.f59806a != null) {
SkinWebDetailView.this.f59806a.loadUrl("javascript:x5onSkinUnzip(\"" + str + "\");");
}
}
});
}
@Override
public void a(String str) {
}
@Override
public void b() {
RotateScreenManager.a().a((Activity) null, 3, 1);
j();
}
@Override
public void b(int i, final String str) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (SkinWebDetailView.this.f59806a != null) {
SkinWebDetailView.this.f59806a.loadUrl("javascript:x5onSkinDelete (\"" + str + "\");");
}
}
});
}
@Override
public void b(final String str) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (SkinWebDetailView.this.f59806a != null) {
SkinWebDetailView.this.f59806a.loadUrl("javascript:x5onSkinSwitch(\"" + str + "\");");
}
}
});
this.k = str;
}
@Override
public void c() {
this.e.removeMessages(327681);
RotateScreenManager.a().b(null, 3, 1);
}
@Override
public void c(int i, final String str) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (SkinWebDetailView.this.f59806a != null) {
SkinWebDetailView.this.f59806a.loadUrl("javascript:x5onSkinUnzip(\"" + str + "\");");
}
}
});
}
@Override
public void cd_() {
}
@Override
public boolean ce_() {
this.e.removeMessages(327681);
return false;
}
@Override
public void d() {
}
@Override
public void d(int i, String str) {
}
@Override
public void e(int i, String str) {
}
@Override
public boolean e() {
return false;
}
@Override
public void f(int i, String str) {
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.g.b(this);
this.g.a((SkinManager.SkinWebpageCallback) null);
QBWebView qBWebView = this.f59806a;
if (qBWebView != null) {
removeView(qBWebView);
this.f59806a.destroy();
}
}
@Override
public void onWebCorePrepared() {
f();
j();
}
public void setForwardListener(ForwardListener forwardListener) {
this.i = forwardListener;
}
}