TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c
以下内容为反编译后的 AbsBaseWebViewActivity.java 源代码,内容仅作参考
package com.tencent.biz.webviewbase;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tencent.biz.AuthorizeConfig;
import com.tencent.biz.common.util.FileChooserHelper;
import com.tencent.biz.common.util.ImageUtil;
import com.tencent.biz.common.util.Util;
import com.tencent.biz.pubaccount.CustomWebChromeClient;
import com.tencent.biz.pubaccount.CustomWebView;
import com.tencent.biz.ui.TouchWebView;
import com.tencent.common.app.AppInterface;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.magnifiersdk.memory.ActivityLeakSolution;
import com.tencent.mobileqq.activity.QQBrowserActivity;
import com.tencent.mobileqq.activity.aio.AIOOpenWebMonitor;
import com.tencent.mobileqq.app.AppConstants;
import com.tencent.mobileqq.app.IphoneTitleBarActivity;
import com.tencent.mobileqq.app.ThreadExcutor;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.config.ResourcePluginListener;
import com.tencent.mobileqq.log.VipWebViewReportLog;
import com.tencent.mobileqq.pluginsdk.ActivityLifecycle;
import com.tencent.mobileqq.theme.ThemeUtil;
import com.tencent.mobileqq.util.Utils;
import com.tencent.mobileqq.vaswebviewplugin.BuscardJsPlugin;
import com.tencent.mobileqq.webprocess.WebAccelerateHelper;
import com.tencent.mobileqq.webview.sonic.SonicClientImpl;
import com.tencent.mobileqq.webview.swift.JsBridgeListener;
import com.tencent.mobileqq.webview.swift.SwiftIphoneTitleBarUI;
import com.tencent.mobileqq.webview.swift.SwiftReuseTouchWebView;
import com.tencent.mobileqq.webview.swift.WebViewFragment;
import com.tencent.mobileqq.webview.swift.WebViewPlugin;
import com.tencent.mobileqq.webview.swift.WebViewPluginContainer;
import com.tencent.mobileqq.webview.swift.WebViewPluginEngine;
import com.tencent.mobileqq.webview.swift.WebviewPluginEventConfig;
import com.tencent.mobileqq.webview.swift.component.SwiftBrowserComponentsProvider;
import com.tencent.mobileqq.webview.swift.component.SwiftBrowserSetting;
import com.tencent.mobileqq.webview.swift.component.SwiftBrowserStatistics;
import com.tencent.mobileqq.webview.swift.component.SwiftBrowserUIStyleHandler;
import com.tencent.mobileqq.webview.swift.utils.SwiftWebAccelerator;
import com.tencent.mobileqq.webview.swift.utils.SwiftWebViewUtils;
import com.tencent.mobileqq.webview.webso.WebSoUtils;
import com.tencent.mobileqq.widget.QQToast;
import com.tencent.qphone.base.util.QLog;
import com.tencent.smtt.sdk.CookieSyncManager;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;
import com.tencent.smtt.sdk.stat.MttLoader;
import com.tencent.sonic.sdk.SonicSession;
import com.tencent.sonic.sdk.SonicSessionConfig;
import com.tencent.tim.R;
import com.tencent.widget.immersive.ImmersiveUtils;
import cooperation.buscard.BuscardHelper;
import cooperation.pluginbridge.BridgeHelper;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import mqq.app.AppRuntime;
import mqq.app.MobileQQ;
import org.json.JSONObject;
public abstract class AbsBaseWebViewActivity extends IphoneTitleBarActivity implements View.OnClickListener, View.OnTouchListener, WebViewPluginContainer, SwiftBrowserComponentsProvider.SwiftBrowserComponentProviderContext, SwiftBrowserComponentsProvider.SwiftBrowserComponentProviderSupporter {
public static final HashSet f83370a = new HashSet();
public static final int f83371b = 0;
public static final String h = "keyAction";
public static final String i = "actionSelectPicture";
public static final String j = "Web_SetUserAgent";
public static final String k = "Web_AdjustSettings";
static final String n = "WebViewBase";
public static final String p = "Web_qqbrowser_init_only_webview";
private Drawable f6616a;
private ImageView f6617a;
public AuthorizeConfig f6618a;
public FileChooserHelper f6619a;
private CustomWebChromeClient f6620a;
private TouchWebView f6621a;
private WebAIOController f6622a;
public volatile AppInterface f6623a;
public SonicClientImpl f6624a;
protected JsBridgeListener f6625a;
public SwiftIphoneTitleBarUI f6626a;
public volatile WebViewPluginEngine f6627a;
private WebViewClient f6633a;
private boolean f6635a;
public FrameLayout f6637b;
private Object f6638b;
protected boolean f6639b;
public boolean f6640c;
protected volatile boolean f6641d;
public long e;
public boolean f6642e;
public long f;
protected boolean f6643f;
private boolean g;
private boolean f6644h;
protected String m;
public String o;
public long f83372c = 51539607556L;
public long d = 5;
public String l = "";
public final Handler f6636b = new Handler(Looper.getMainLooper());
public final Object f6634a = new Object();
public final SwiftBrowserComponentsProvider f6628a = m1799a();
public final SwiftBrowserUIStyleHandler f6632a = (SwiftBrowserUIStyleHandler) this.f6628a.a(2);
public final SwiftBrowserUIStyleHandler.SwiftBrowserUIStyle f6631a = this.f6632a.f34966a;
protected final SwiftBrowserSetting f6629a = (SwiftBrowserSetting) this.f6628a.a(-1);
public final SwiftBrowserStatistics f6630a = (SwiftBrowserStatistics) this.f6628a.a(-2);
static {
f83370a.add("Meizu_M040");
f83370a.add("YuLong_Coolpad8720Q");
f83370a.add("YuLong_Coolpad 7269");
f83370a.add("samsung_SM-G9006W");
}
public SwiftBrowserComponentsProvider m1799a() {
return new SwiftBrowserComponentsProvider(this, 63, null);
}
@Override
public SwiftBrowserComponentsProvider mo9621b() {
return this.f6628a;
}
@Override
public WebView mo1800a() {
throw new UnsupportedOperationException("must override this method getHostWebView()!");
}
@Override
public WebViewFragment mo1798a() {
return null;
}
@Override
public Activity mo1807c() {
return this;
}
public final void m1802a() {
if (this.f6627a == null && WebViewPluginEngine.f95030a != null) {
if (QLog.isColorLevel()) {
QLog.d("AbsBaseWebViewActivity", 2, "-->web engine and plugin initialized at process preload!");
}
this.f6627a = WebViewPluginEngine.f95030a;
WebViewPluginEngine.f95030a = null;
WebAccelerateHelper.getInstance().onPluginRuntimeReady(this.f6627a, this.f6623a, this);
} else if (this.f6627a == null) {
synchronized (this.f6634a) {
if (this.f6627a == null) {
this.f6627a = WebAccelerateHelper.getInstance().createWebViewPluginEngine(this.f6623a, this, null, null);
WebAccelerateHelper.getInstance().onPluginRuntimeReady(this.f6627a, this.f6623a, this);
}
}
}
}
public final TouchWebView a(ViewGroup viewGroup) {
TouchWebView touchWebView;
WebSettings settings;
PackageManager packageManager;
boolean z;
String processName;
String str;
int lastIndexOf;
Util.m945a("Web_qqbrowser_init_only_webview");
Intent intent = getIntent();
long currentTimeMillis = System.currentTimeMillis();
try {
if (0 != (this.e & 64)) {
touchWebView = SwiftReuseTouchWebView.a(this);
} else {
touchWebView = new TouchWebView(this);
}
if (touchWebView instanceof SwiftReuseTouchWebView) {
this.f6630a.f34911o = 1 == ((SwiftReuseTouchWebView) touchWebView).f95019c;
}
if (QLog.isColorLevel()) {
QLog.d("webviewinit", 2, "TouchWebView cost = " + (System.currentTimeMillis() - currentTimeMillis));
}
touchWebView.setIntent(intent);
Util.m947b("Web_qqbrowser_init_only_webview");
if (this.f6623a == null && QLog.isColorLevel()) {
QLog.w(n, 2, "Caution! AppRuntime is null!");
}
this.f6627a.a(touchWebView);
touchWebView.setPluginEngine(this.f6627a);
if (this.f6624a != null) {
this.f6624a.a(touchWebView);
}
System.currentTimeMillis();
if (this.f6620a == null) {
this.f6620a = new hwp(this);
}
touchWebView.setWebChromeClient(this.f6620a);
if (this.f6633a == null) {
if (Build.VERSION.SDK_INT >= 21) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "API Level >= 23");
}
this.f6633a = new hwq(this);
} else {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "API level < 23");
}
this.f6633a = new hwr(this);
}
}
touchWebView.setWebViewClient(this.f6633a);
touchWebView.setScrollBarStyle(0);
if (BaseApplicationImpl.a().getSharedPreferences(AppConstants.f17367Y, 4).getBoolean("enableWebviewDebug", false) && Build.VERSION.SDK_INT >= 19) {
WebView.setWebContentsDebuggingEnabled(true);
}
Util.m945a("Web_AdjustSettings");
settings = touchWebView.getSettings();
Util.m945a("Web_SetUserAgent");
settings.setUserAgentString(SwiftWebViewUtils.a(settings.getUserAgentString(), m1805b(), touchWebView.getX5WebViewExtension() != null));
Util.m947b("Web_SetUserAgent");
settings.setSavePassword(false);
settings.setSaveFormData(false);
settings.setBuiltInZoomControls(true);
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
settings.setPluginState(WebSettings.PluginState.ON);
packageManager = getPackageManager();
try {
} catch (RuntimeException e) {
z = false;
}
} catch (Exception e2) {
QLog.i(n, 1, "createWebView error : " + e2.toString() + ", " + e2.getMessage());
touchWebView = null;
if (!isFinishing()) {
QQToast.a(BaseApplicationImpl.a(), BaseApplicationImpl.a().getResources().getString(R.string.f66752name_res_0x7f0a20a4), 1).m9833a();
finish();
}
Utils.a(getAppRuntime());
}
if (!packageManager.hasSystemFeature("android.hardware.touchscreen.multitouch")) {
if (!packageManager.hasSystemFeature("android.hardware.faketouch.multitouch.distinct")) {
z = false;
settings.setDisplayZoomControls(z);
settings.setPluginsEnabled(true);
settings.setJavaScriptEnabled(true);
settings.setAllowContentAccess(true);
settings.setDatabaseEnabled(true);
settings.setDomStorageEnabled(true);
settings.setAppCacheEnabled(true);
processName = MobileQQ.getMobileQQ().getProcessName();
str = "";
if (processName != null && (lastIndexOf = processName.lastIndexOf(58)) > -1) {
str = "_" + processName.substring(lastIndexOf + 1);
}
settings.setDatabasePath(getApplicationContext().getDir("database" + str, 0).getPath());
settings.setAppCachePath(getApplicationContext().getDir("appcache" + str, 0).getPath());
settings.setMediaPlaybackRequiresUserGesture(false);
if (Build.VERSION.SDK_INT >= 11) {
touchWebView.removeJavascriptInterface("searchBoxJavaBridge_");
}
touchWebView.requestFocus();
touchWebView.setFocusableInTouchMode(true);
touchWebView.setDownloadListener(new hws(this, touchWebView));
CookieSyncManager.createInstance(getApplicationContext());
if (touchWebView.getX5WebViewExtension() == null) {
this.f6644h = true;
touchWebView.getX5WebViewExtension().setWebViewClientExtension(new hwx(this, touchWebView));
AIOOpenWebMonitor.b(getIntent(), AIOOpenWebMonitor.f12204p, "1");
} else {
AIOOpenWebMonitor.b(getIntent(), AIOOpenWebMonitor.f12204p, "2");
}
touchWebView.getView().setOnTouchListener(this);
if (this.f6643f) {
touchWebView.setMask(true);
}
Util.m947b("Web_AdjustSettings");
if (viewGroup != null) {
viewGroup.addView(touchWebView);
}
return touchWebView;
}
}
z = true;
settings.setDisplayZoomControls(z);
settings.setPluginsEnabled(true);
settings.setJavaScriptEnabled(true);
settings.setAllowContentAccess(true);
settings.setDatabaseEnabled(true);
settings.setDomStorageEnabled(true);
settings.setAppCacheEnabled(true);
processName = MobileQQ.getMobileQQ().getProcessName();
str = "";
if (processName != null) {
str = "_" + processName.substring(lastIndexOf + 1);
}
settings.setDatabasePath(getApplicationContext().getDir("database" + str, 0).getPath());
settings.setAppCachePath(getApplicationContext().getDir("appcache" + str, 0).getPath());
settings.setMediaPlaybackRequiresUserGesture(false);
if (Build.VERSION.SDK_INT >= 11) {
}
touchWebView.requestFocus();
touchWebView.setFocusableInTouchMode(true);
touchWebView.setDownloadListener(new hws(this, touchWebView));
CookieSyncManager.createInstance(getApplicationContext());
if (touchWebView.getX5WebViewExtension() == null) {
}
touchWebView.getView().setOnTouchListener(this);
if (this.f6643f) {
}
Util.m947b("Web_AdjustSettings");
if (viewGroup != null) {
}
return touchWebView;
}
public final TouchWebView b(ViewGroup viewGroup) {
if (this.f6621a != null) {
return this.f6621a;
}
this.f6621a = a(viewGroup);
return this.f6621a;
}
private void a(String str) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "initSonicSession url = :" + str);
}
SonicSession createSession = WebAccelerateHelper.getSonicEngine().createSession(str, new SonicSessionConfig());
if (createSession != null) {
this.f6624a = new SonicClientImpl();
createSession.bindClient(this.f6624a);
return;
}
QLog.d(n, 1, "initSonicSession sonicSession = null, url = " + str);
}
private void c() {
if (this.f6627a == null) {
if (this.f6627a == null && WebViewPluginEngine.f95030a != null) {
this.f6627a = WebViewPluginEngine.f95030a;
WebViewPluginEngine.f95030a = null;
WebAccelerateHelper.getInstance().onPluginRuntimeReady(this.f6627a, this.f6623a, this);
return;
}
ThreadManager.a((Runnable) new hwt(this), (ThreadExcutor.IThreadListener) null, false);
}
}
@Override
public final int pluginStartActivityForResult(WebViewPlugin webViewPlugin, Intent intent, byte b2) {
int switchRequestCode = switchRequestCode(webViewPlugin, b2);
if (switchRequestCode == -1) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "pluginStartActivityForResult not handled");
}
} else {
startActivityForResult(intent, switchRequestCode);
}
return switchRequestCode;
}
@Override
public final int switchRequestCode(WebViewPlugin webViewPlugin, byte b2) {
CustomWebView m9631a = webViewPlugin.mRuntime.m9631a();
if (m9631a == null || m9631a.m1031a() == null) {
return -1;
}
int a2 = WebViewPluginEngine.a(webViewPlugin);
if (a2 == -1) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "switchRequestCode failed: webview index=0, pluginIndex=" + a2);
return -1;
}
return -1;
}
return ((a2 << 8) & 65280) | 0 | (b2 & ResourcePluginListener.f88784c);
}
public void onClick(View view) {
if (view == this.rightViewImg || view == this.rightHighLView || view == this.rightViewText) {
m1803a();
}
}
@Override
public boolean showPreview() {
setImmersiveStatus();
if (this.mSystemBarComp != null) {
this.mSystemBarComp.init();
}
overridePendingTransition(0, 0);
setContentViewNoTitle(R.layout.f56463name_res_0x7f030076);
((TextView) findViewById(R.id.f48289name_res_0x7f0904bd)).setText(R.string.f60653name_res_0x7f0a08c9);
return true;
}
protected String m1801a() {
Intent intent = getIntent();
String stringExtra = intent.getStringExtra("url");
if (stringExtra == null) {
String stringExtra2 = intent.getStringExtra("key_params_qq");
if (stringExtra2 == null) {
return "";
}
return stringExtra2;
}
return stringExtra;
}
@Override
public void onCreate(Bundle bundle) {
d();
SwiftWebAccelerator.a().m9687a();
String a2 = SwiftWebViewUtils.a(getIntent());
WebAccelerateHelper.getInstance().preGetKey(a2, getIntent(), this.f6623a);
WebAccelerateHelper.getInstance().preCheckOffline(a2);
WebAccelerateHelper.getInstance().preFetchResource(a2, null);
this.f6632a.c();
this.f6626a = this.f6632a.f34963a;
boolean z = WebAccelerateHelper.isWebViewCache;
a(a2);
ThreadManager.m4810a().post(new hwu(this, z));
super.onCreate(bundle);
if (QLog.isColorLevel()) {
QLog.d(n, 2, "onCreate cache:" + z);
}
this.f6623a = (AppInterface) MobileQQ.sMobileQQ.waitAppRuntime(null);
if (this.f6623a != null) {
if (!z && !VipWebViewReportLog.m6824a()) {
VipWebViewReportLog.a(this, this.f6623a);
}
c();
}
String str = Build.MANUFACTURER + "_" + Build.MODEL;
if (Build.VERSION.SDK_INT > 10 && !f83370a.contains(str)) {
getWindow().addFlags(16777216);
}
getWindow().setFormat(-3);
}
@Override
public boolean doOnCreate(Bundle bundle) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "doOnCreate");
}
super.doOnCreate(bundle);
AppRuntime appRuntime = getAppRuntime();
if (appRuntime instanceof AppInterface) {
this.f6623a = (AppInterface) appRuntime;
}
if (!VipWebViewReportLog.m6824a()) {
VipWebViewReportLog.a(this, this.f6623a);
}
QQBrowserActivity.H++;
this.f6643f = ThemeUtil.THEME_ID_NIGHTMODE.equals(ThemeUtil.getCurrentThemeInfo().getString("themeId"));
setTheme(R.style.f67878name_res_0x7f0d02a2);
this.f6618a = AuthorizeConfig.a();
WebAccelerateHelper.isWebViewCache = true;
SwiftBrowserStatistics swiftBrowserStatistics = this.f6630a;
this.f6640c = false;
swiftBrowserStatistics.f34897g = false;
this.o = this.f6623a.getAccount();
d();
m1802a();
return true;
}
private void d() {
if (!this.f6641d) {
this.f6641d = true;
String stringExtra = getIntent().getStringExtra("url");
if (WebSoUtils.m9718b(stringExtra)) {
ThreadManager.a((Runnable) new hwv(this, stringExtra), (ThreadExcutor.IThreadListener) null, false);
}
}
}
public boolean a(long j2, Map map) {
if (this.f6621a != null) {
this.f6621a.onResume();
WebViewPluginEngine a2 = this.f6621a.a();
if (a2 != null) {
return a2.a(this.f6621a.getUrl(), j2, map);
}
}
return false;
}
@Override
public void doOnResume() {
e();
super.doOnResume();
if (QLog.isColorLevel()) {
QLog.d(n, 2, "onResume");
}
Intent intent = new Intent("com.tencent.tim.notify.foreground");
intent.putExtra("selfuin", this.o);
intent.putExtra("AccountInfoSync", AppConstants.dn);
intent.putExtra("classname", getClass().getName());
sendBroadcast(intent, "com.tencent.tim.msg.permission.pushnotify");
a(2L, (Map) null);
String a2 = BridgeHelper.a(getActivity(), this.o).a("buscard_registerNFC");
if (TextUtils.isEmpty(a2) || "true".equals(a2)) {
ActivityLifecycle.onResume(getActivity());
}
}
@Override
public void doOnPause() {
super.doOnPause();
if (QLog.isColorLevel()) {
QLog.d(n, 2, "onPause");
}
if (this.f6620a != null && this.f6642e) {
this.f6620a.onHideCustomView();
}
a(WebviewPluginEventConfig.q, (Map) null);
String a2 = BridgeHelper.a(getActivity(), this.o).a("buscard_registerNFC");
if (TextUtils.isEmpty(a2) || "true".equals(a2)) {
ActivityLifecycle.onPause(getActivity());
}
}
@Override
public void doOnStop() {
super.doOnStop();
if ((this.f83372c & 33554432) != 0) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "close on hide by wv param");
}
finish();
}
}
@Override
public void doOnDestroy() {
super.doOnDestroy();
if (QLog.isColorLevel()) {
QLog.d(n, 2, "onDestroy");
}
QQBrowserActivity.H--;
if (this.f6622a != null) {
this.f6622a.a(QQBrowserActivity.H <= 0);
}
SwiftBrowserStatistics swiftBrowserStatistics = this.f6630a;
this.f6640c = true;
swiftBrowserStatistics.f34897g = true;
if (this.f6620a != null) {
this.f6620a.a();
}
if (this.f6621a != null) {
WebViewPluginEngine a2 = this.f6621a.a();
if (a2 != null) {
a2.b();
}
if (this.f6621a.getParent() != null) {
try {
((ViewGroup) this.f6621a.getParent()).removeView(this.f6621a);
} catch (Exception e) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "remove webview error");
}
}
}
try {
this.f6621a.stopLoading();
} catch (Exception e2) {
}
this.f6621a.a("about:blank");
this.f6621a.clearView();
this.f6621a.destroy();
this.f6621a = null;
}
this.f6623a = null;
ActivityLeakSolution.fixInputMethodManagerLeak(this);
ActivityLeakSolution.fixAudioManagerLeak(this);
}
@Override
public void doOnActivityResult(int i2, int i3, Intent intent) {
WebViewPluginEngine a2;
if (QLog.isColorLevel()) {
QLog.d(n, 2, "onActivityResult, requestCode=" + i2 + ", resultCode=" + i3);
}
HashMap hashMap = new HashMap();
hashMap.put("requestCode", Integer.valueOf(i2));
hashMap.put("resultCode", Integer.valueOf(i3));
hashMap.put("data", intent);
if (!a(WebviewPluginEventConfig.t, hashMap)) {
int i4 = i2 & 255;
int i5 = (i2 >> 8) & 255;
int i6 = (i2 >> 16) & 255;
if (i5 > 0) {
if (this.f6621a != null && (a2 = this.f6621a.a()) != null) {
if (intent != null && intent.hasExtra(MttLoader.ENTRY_ID) && a2.m9636a("card") == null) {
a2.a(new String[]{"card"});
}
WebViewPlugin a3 = a2.a(i5, true);
if (a3 != null) {
a3.onActivityResult(intent, (byte) i4, i3);
return;
}
}
if (QLog.isColorLevel()) {
QLog.w(n, 2, "Caution! activity result not handled!");
}
} else if (this.f6619a != null && this.f6619a.a(i2, i3, intent)) {
if (QLog.isColorLevel()) {
QLog.w(n, 2, "Activity result handled by FileChooserHelper.");
}
} else if (i3 == -1 && this.f6621a != null) {
switch (i2) {
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
if (intent != null) {
String stringExtra = intent.getStringExtra("callbackSn");
String stringExtra2 = intent.getStringExtra("result");
this.f6621a.loadUrl("javascript:window.JsBridge&&JsBridge.callback('" + stringExtra + "',{'r':0,'result':" + stringExtra2 + "});");
try {
this.f6639b = new JSONObject(stringExtra2).getInt("resultCode") == 0;
if (QLog.isColorLevel()) {
QLog.d(n, 2, "onActivityResult: mPayActionSucc=" + this.f6639b);
return;
}
return;
} catch (Exception e) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "onActivityResult: mPayActionException=" + e.getMessage());
return;
}
return;
}
}
return;
default:
return;
}
} else if (i3 == 4660) {
setResult(4660);
finish();
}
}
}
@Override
public void doOnNewIntent(Intent intent) {
WebViewPluginEngine a2;
WebViewPlugin a3;
WebViewPluginEngine a4;
WebViewPlugin a5;
boolean z = false;
if ("actionSelectPicture".equals(intent.getStringExtra("keyAction"))) {
int intExtra = intent.getIntExtra("requestCode", -1);
int i2 = intExtra & 255;
int i3 = (intExtra >> 8) & 255;
int i4 = (intExtra >> 16) & 255;
if (i3 > 0) {
if (this.f6621a != null && (a4 = this.f6621a.a()) != null && (a5 = a4.a(i3, true)) != null) {
a5.onActivityResult(intent, (byte) i2, intent.hasExtra("PhotoConst.PHOTO_PATHS") ? -1 : 0);
return;
} else if (QLog.isColorLevel()) {
QLog.w(n, 2, "Caution! activity result not handled!");
}
}
}
this.o = this.f6623a.getAccount();
if ("android.nfc.action.TECH_DISCOVERED".equals(intent.getAction())) {
if (this.f6621a != null && (a2 = this.f6621a.a()) != null && (a3 = a2.a(120, true)) != null && (a3 instanceof BuscardJsPlugin)) {
a3.onActivityResult(intent, (byte) 120, 0);
z = true;
}
if (!z) {
BuscardHelper.a(this.o, getActivity(), intent);
}
}
}
@Override
public boolean onBackEvent() {
if (this.f6620a != null && this.f6642e) {
this.f6620a.onHideCustomView();
} else {
if (this.f6624a != null) {
this.f6624a.clearHistory();
this.f6624a.m9596a();
this.f6624a = null;
}
HashMap hashMap = new HashMap(1);
hashMap.put("target", 3);
if (!a(WebviewPluginEventConfig.u, hashMap)) {
if ((this.f83372c & 4) == 0 && this.f6621a != null && this.f6621a.canGoBack()) {
this.f6621a.stopLoading();
this.f6621a.goBack();
WebViewPluginEngine a2 = this.f6621a.a();
if (a2 != null) {
a2.a(this.f6621a.getUrl(), WebviewPluginEventConfig.J, hashMap);
}
} else {
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService("input_method");
if (inputMethodManager != null && getCurrentFocus() != null) {
inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}
if (this.f6620a != null && this.f6642e) {
this.f6620a.onHideCustomView();
} else {
finish();
}
}
}
}
return true;
}
@Override
public void finish() {
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService("input_method");
if (inputMethodManager != null && getCurrentFocus() != null) {
inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}
super.finish();
if (getIntent().getBooleanExtra(QQBrowserActivity.K, false)) {
overridePendingTransition(0, R.anim.f37540name_res_0x7f04000a);
}
}
@Override
public boolean doOnKeyDown(int i2, KeyEvent keyEvent) {
switch (i2) {
case 24:
a(WebviewPluginEventConfig.C, (Map) null);
break;
case 25:
a(WebviewPluginEventConfig.B, (Map) null);
break;
case 82:
a(WebviewPluginEventConfig.A, (Map) null);
break;
}
return super.doOnKeyDown(i2, keyEvent);
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if ((motionEvent.getAction() & 255) == 0) {
this.f = System.currentTimeMillis();
return false;
}
return false;
}
public void a(Intent intent) {
init(intent);
}
public View a() {
return this.mContentView;
}
@Override
public void init(Intent intent) {
super.init(intent);
if (this.vg != null) {
this.vg.setOnTouchListener(new hww(this));
}
removeWebViewLayerType();
this.f6626a.f34599a = this.leftView;
this.f6626a.f34611b = this.centerView;
this.f6626a.f34615c = this.rightViewText;
this.f6626a.f34597a = this.rightViewImg;
this.f6626a.f34595a = this.vg;
}
@Override
public void onPostThemeChanged() {
if (this.f6623a != null) {
this.f6643f = ThemeUtil.isInNightMode(this.f6623a);
a(WebviewPluginEventConfig.x, (Map) null);
}
if (this.mSystemBarComp != null && !this.f6631a.h) {
int color = getResources().getColor(R.color.f39367skin_color_title_immersive_bar);
if (ImmersiveUtils.a(getWindow(), true)) {
color = getResources().getColor(R.color.f38784name_res_0x7f0b017f);
}
this.mSystemBarComp.a(color);
this.mSystemBarComp.b(color);
}
}
@Override
public Object getSystemService(String str) {
AuthorizeConfig authorizeConfig;
if ("audio".equals(str)) {
if (this.f6638b == null) {
if (!this.f6644h && 14 <= Build.VERSION.SDK_INT && Build.VERSION.SDK_INT <= 18) {
if (this.f6618a == null) {
authorizeConfig = AuthorizeConfig.a();
this.f6618a = authorizeConfig;
} else {
authorizeConfig = this.f6618a;
}
if (authorizeConfig.a("enable_custom_am", (Boolean) false).booleanValue()) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "using custom AudioManager");
}
synchronized (AbsBaseWebViewActivity.class) {
if (this.f6638b == null) {
this.f6638b = new hwy(getApplicationContext());
}
}
}
}
if (QLog.isColorLevel()) {
QLog.d(n, 2, "using system AudioManager");
}
this.f6638b = super.getSystemService("audio");
}
return this.f6638b;
}
return super.getSystemService(str);
}
public void a(boolean z) {
if (z) {
this.f6631a.f35002d = true;
if (this.rightViewText != null) {
this.rightViewText.setVisibility(8);
}
if (this.rightViewImg != null) {
this.rightViewImg.setVisibility(8);
}
if (this.f6617a != null) {
this.f6617a.setVisibility(8);
return;
}
return;
}
if (this.rightViewText != null && !TextUtils.isEmpty(this.rightViewText.getText())) {
this.rightViewText.setVisibility(0);
}
if (this.rightViewImg != null) {
this.rightViewImg.setVisibility(0);
}
if (this.f6617a != null) {
this.f6617a.setVisibility(0);
}
}
public void a(String str, String str2, String str3, boolean z, int i2, int i3, JsBridgeListener jsBridgeListener, View.OnClickListener onClickListener) {
boolean z2 = jsBridgeListener != null && jsBridgeListener.f34580a;
if (z) {
this.f6631a.f35002d = true;
this.rightViewText.setVisibility(8);
this.rightViewImg.setVisibility(8);
if (this.f6617a != null) {
this.f6617a.setVisibility(8);
return;
}
return;
}
if (i2 == 0) {
if (!TextUtils.isEmpty(str2)) {
this.rightViewText.setText(str2);
this.rightViewText.setVisibility(0);
this.rightViewText.bringToFront();
this.rightViewImg.setImageResource(0);
this.rightViewImg.setBackgroundColor(0);
this.rightViewImg.setVisibility(8);
}
if (str3 != null) {
int i4 = 0;
if (str3.length() > 0) {
try {
i4 = Color.parseColor(str3);
} catch (Exception e) {
i4 = 0;
}
}
this.rightViewImg.setBackgroundColor(i4);
}
if (str != null && !z2) {
this.rightViewImg.setOnClickListener(this);
this.rightViewText.setOnClickListener(this);
this.m = str.trim();
} else {
this.f6625a = jsBridgeListener;
this.m = null;
}
} else {
this.rightViewText.setVisibility(8);
this.rightViewImg.setVisibility(0);
this.f6631a.f35002d = i2 != 4;
switch (i2) {
case 1:
this.f6632a.a((View) this.rightViewImg, false, R.drawable.f43772name_res_0x7f020a8c, R.drawable.f43772name_res_0x7f020a8c);
this.rightViewImg.setContentDescription(getResources().getString(R.string.f64195name_res_0x7f0a16a2));
break;
case 2:
this.f6632a.a((View) this.rightViewImg, false, R.drawable.f43771name_res_0x7f020a8b, R.drawable.f43771name_res_0x7f020a8b);
this.rightViewImg.setContentDescription(getResources().getString(R.string.f64192name_res_0x7f0a169f));
break;
case 3:
this.f6632a.a((View) this.rightViewImg, false, R.drawable.f42292name_res_0x7f0204bf, R.drawable.f42288name_res_0x7f0204bb);
this.rightViewImg.setContentDescription(getResources().getString(R.string.f64189name_res_0x7f0a169c));
break;
case 4:
this.f6632a.a((View) this.rightViewImg, false, R.drawable.f41918name_res_0x7f020349, R.drawable.f41910name_res_0x7f020341);
this.rightViewText.setText(getResources().getString(R.string.f64190name_res_0x7f0a169d));
break;
case 5:
this.rightViewImg.setImageResource(R.drawable.f43822name_res_0x7f020abe);
this.rightViewImg.setContentDescription(getResources().getString(R.string.f64193name_res_0x7f0a16a0));
((AnimationDrawable) this.rightViewImg.getDrawable()).start();
break;
case 6:
default:
this.rightViewImg.setVisibility(8);
break;
case 7:
this.f6632a.a((View) this.rightViewImg, false, R.drawable.f42280name_res_0x7f0204b3, R.drawable.f42280name_res_0x7f0204b3);
this.rightViewImg.setContentDescription(getResources().getString(R.string.f64194name_res_0x7f0a16a1));
break;
case 8:
case 11:
this.f6632a.a((View) this.rightViewImg, false, R.drawable.f46581skin_header_icon_single, R.drawable.f46583name_res_0x7f021587);
this.rightViewImg.setContentDescription(getResources().getString(R.string.f64194name_res_0x7f0a16a1));
break;
case 9:
this.f6632a.a((View) this.rightViewImg, false, R.drawable.f41595name_res_0x7f020206, R.drawable.f41595name_res_0x7f020206);
this.rightViewImg.setContentDescription(getResources().getString(R.string.f64191name_res_0x7f0a169e));
break;
case 10:
this.f6632a.a((View) this.rightViewImg, false, R.drawable.f46625name_res_0x7f0215b1, R.drawable.f46625name_res_0x7f0215b1);
this.rightViewImg.setContentDescription(getResources().getString(R.string.f64191name_res_0x7f0a169e));
break;
}
if (i3 != 0) {
if (this.f6617a == null) {
this.f6617a = new ImageView(this);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
layoutParams.addRule(7, R.id.f48300ivTitleBtnRightImage);
layoutParams.addRule(6, R.id.f48300ivTitleBtnRightImage);
layoutParams.setMargins(0, 0, 0, 0);
this.f6617a.setLayoutParams(layoutParams);
((RelativeLayout) findViewById(R.id.f47678name_res_0x7f09025a)).addView(this.f6617a);
}
this.f6617a.setVisibility(0);
switch (i3) {
case 6:
this.f6617a.setImageResource(R.drawable.f43669name_res_0x7f020a25);
break;
default:
this.f6617a.setVisibility(8);
break;
}
} else if (this.f6617a != null) {
this.f6617a.setVisibility(8);
}
if (!TextUtils.isEmpty(str2)) {
this.rightViewImg.setContentDescription(str2);
}
if (onClickListener != null) {
this.rightViewImg.setOnClickListener(onClickListener);
} else if (str != null && !z2) {
this.rightViewImg.setOnClickListener(this);
this.rightViewText.setOnClickListener(this);
this.m = str.trim();
} else {
this.m = null;
this.f6625a = jsBridgeListener;
}
this.f6635a = false;
this.g = false;
}
if (this.f6631a.f34995a != null && this.f6631a.f34995a.has("txtclr")) {
String optString = this.f6631a.f34995a.optString("txtclr", "");
if (!TextUtils.isEmpty(optString)) {
if (!optString.startsWith("#")) {
optString = "#" + optString;
}
try {
int parseColor = Color.parseColor(optString);
Drawable a2 = ImageUtil.a(this.rightViewImg.getDrawable(), parseColor);
if (a2 != null) {
this.rightViewImg.setImageDrawable(a2);
}
this.rightViewText.setTextColor(parseColor);
} catch (Exception e2) {
QLog.e(n, 1, e2, new Object[0]);
}
}
}
}
public void a(int i2) {
this.centerView.setTextColor(i2);
}
public void b(int i2) {
this.leftView.setTextColor(i2);
this.rightViewText.setTextColor(i2);
Drawable background = this.leftView.getBackground();
Drawable drawable = this.rightViewImg.getDrawable();
if (background != null) {
if (!this.f6635a) {
this.f6616a = background;
this.f6635a = true;
}
Drawable a2 = ImageUtil.a(background, i2);
if (a2 != null) {
this.leftView.setBackgroundDrawable(a2);
}
}
if (drawable != null) {
if (!this.g) {
this.g = true;
}
Drawable a3 = ImageUtil.a(drawable, i2);
if (a3 != null) {
this.rightViewImg.setImageDrawable(a3);
}
}
}
public void m1806b() {
this.leftView.setTextColor(getResources().getColorStateList(R.color.f39327name_res_0x7f0b039e));
this.leftView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.f46936name_res_0x7f0216e8), (Drawable) null, (Drawable) null, (Drawable) null);
this.rightViewText.setTextColor(getResources().getColorStateList(R.color.f39327name_res_0x7f0b039e));
this.centerView.setTextColor(getResources().getColor(R.color.f39331name_res_0x7f0b03a2));
if (this.rightViewImg != null) {
Drawable drawable = this.rightViewImg.getDrawable();
if (drawable != null) {
drawable.clearColorFilter();
drawable.invalidateSelf();
}
this.rightViewImg.setImageDrawable(drawable);
}
this.leftView.setBackgroundDrawable(this.f6616a);
}
public void a(WebViewPlugin webViewPlugin, Intent intent, byte b2) {
int switchRequestCode = switchRequestCode(webViewPlugin, b2);
intent.putExtra("keyAction", "actionSelectPicture");
intent.putExtra("requestCode", switchRequestCode);
startActivity(intent);
}
public void a(WebView webView, int i2) {
}
public void a(WebView webView, String str) {
}
public void a(WebView webView, String str, Bitmap bitmap) {
}
public void b(WebView webView, String str) {
}
public void a(WebView webView, int i2, String str, String str2) {
}
public boolean m1804a(WebView webView, String str) {
return false;
}
public void a(String str, String str2) {
}
protected String m1805b() {
return null;
}
public static int a(WebViewPlugin webViewPlugin, byte b2) {
CustomWebView m9631a = webViewPlugin.mRuntime.m9631a();
if (m9631a == null || m9631a.m1031a() == null) {
return -1;
}
int a2 = WebViewPluginEngine.a(webViewPlugin);
if (a2 == -1) {
if (QLog.isColorLevel()) {
QLog.d(n, 2, "switchRequestCode failed: webview index=0, pluginIndex=" + a2);
return -1;
}
return -1;
}
return ((a2 << 8) & 65280) | 0 | (b2 & ResourcePluginListener.f88784c);
}
protected boolean m1803a() {
if (this.f6621a != null) {
if (this.f6625a != null && this.f6625a.f34580a) {
this.f6621a.a(this.f6625a, 0, "");
return true;
} else if (!TextUtils.isEmpty(this.m)) {
this.f6621a.a(this.m, "");
return true;
}
}
return false;
}
protected WebAIOController m1797a() {
return null;
}
public void b(WebView webView, String str, Bitmap bitmap) {
}
private void e() {
if (this.f6622a == null) {
this.f6622a = m1797a();
}
if (this.f6622a != null) {
this.f6622a.a(WebAIOController.f, new Object[0]);
}
}
}