package com.linksure.browser.activity; import android.content.Context; import android.content.Intent; import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewStub; import android.webkit.URLUtil; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; import butterknife.Bind; import com.lantern.core.constant.EventConstant; import com.lantern.core.utils.AppUtil; import com.linksure.a.e; import com.linksure.api.a.a; import com.linksure.api.utils.j; import com.linksure.browser.BrowserApp; import com.linksure.browser.activity.fragment.WebFragment; import com.linksure.browser.activity.privacy.PrivacyActivity; import com.linksure.browser.activity.tab.TabManager; import com.linksure.browser.activity.user.FeedLoginActivity; import com.linksure.browser.activity.user.messagebox.UserMessageBoxActivity; import com.linksure.browser.analytics.b; import com.linksure.browser.b.c; import com.linksure.browser.base.BaseActivity; import com.linksure.browser.bean.BookmarkItem; import com.linksure.browser.bean.EventInfo; import com.linksure.browser.config.f; import com.linksure.browser.constant.EventConstants; import com.linksure.browser.service.MsgService; import com.linksure.browser.utils.CommonUtils; import com.linksure.browser.utils.g; import com.linksure.browser.utils.r; import com.linksure.browser.utils.v; import com.linksure.browser.view.dialog.CustomDialog; import com.linksure.browser.view.home.CompositorLayout; import com.linksure.browser.view.home.HomePageInterceptor; import com.linksure.browser.view.home.SearchBar; import com.linksure.browser.webcore.h; import com.linksure.framework.a.l; import com.linksure.framework.a.n; import com.wifi.link.wfys.R; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Timer; import java.util.TimerTask; public class BrowserActivity extends BaseActivity { /* renamed from: b reason: collision with root package name */ public static BrowserActivity f5990b; /* renamed from: a reason: collision with root package name */ h f5991a; private com.linksure.browser.activity.settings.a c; private Timer d = null; private TimerTask e = null; private PopupWindow f = null; @Bind({R.id.fragment_web_container}) FrameLayout fragment_web_container; private Intent g = null; @Bind({R.id.root_layout}) CompositorLayout mCompositorLayout; @Bind({R.id.view_arrow_back}) View mViewArrowBack; @Bind({R.id.view_arrow_forward}) View mViewArrowForward; @Bind({R.id.set_default_browser_stub}) ViewStub set_default_browser_stub; @Override // com.linksure.browser.base.BaseActivity public int getLayoutID() { return R.layout.activity_browser; } @Override // com.linksure.browser.base.BaseActivity public void onNightMode() { } @Override // com.linksure.browser.base.BaseActivity public void initView(View view) { this.f5991a = new h(this); this.c = new com.linksure.browser.activity.settings.a(this, this.set_default_browser_stub); } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ @Override // com.linksure.browser.base.BaseActivity public void onEvent(EventInfo eventInfo) { super.onEvent(eventInfo); switch (eventInfo.getId()) { case EventConstants.EVT_FUNCTION_TAB_SWITCH /*{ENCODED_INT: 2009}*/: Intent intent = this.g; if (intent != null) { this.f5991a.a(intent); this.g = null; return; } return; case EventConstants.EVT_FUNCTION_ADD_TAB /*{ENCODED_INT: 2010}*/: case EventConstants.EVT_HOME_SHOW_HOME /*{ENCODED_INT: 5010}*/: this.f5991a.a(TabManager.HomeState.DEFAULT); return; case EventConstants.EVT_FUNCTION_IMAGELOAD_CHANGE /*{ENCODED_INT: 2012}*/: case EventConstants.EVT_FUNCTION_REMOTING_DEBUG_CHANGE /*{ENCODED_INT: 2025}*/: this.f5991a.j(); return; case EventConstants.EVT_FUNCTION_INCOGNITO /*{ENCODED_INT: 2015}*/: this.f5991a.h(); return; case EventConstants.EVT_FUNCTION_FULLSCREEN /*{ENCODED_INT: 2019}*/: boolean z = true; if (eventInfo.getObj() != null && (eventInfo.getObj() instanceof Boolean) && !((Boolean) eventInfo.getObj()).booleanValue()) { z = false; } if (!com.linksure.browser.preference.a.a().k() || !z) { ((FrameLayout.LayoutParams) this.fragment_web_container.getLayoutParams()).bottomMargin = j.a().getDimensionPixelOffset(R.dimen.bottom_bar_height); } else { ((FrameLayout.LayoutParams) this.fragment_web_container.getLayoutParams()).bottomMargin = 0; } this.fragment_web_container.requestLayout(); return; case EventConstants.EVT_FUNCTION_CHANGE_UA /*{ENCODED_INT: 2041}*/: this.f5991a.k(); return; case EventConstants.EVT_FUNCTION_USER_CENTER_LOGIN_OUT /*{ENCODED_INT: 2044}*/: a(); synchronized (this) { l.b(new Runnable() { /* class com.linksure.browser.activity.BrowserActivity.AnonymousClass3 */ public final void run() { List<BookmarkItem> e = c.a().e(); if (e != null && e.size() > 0) { for (int i = 0; i < e.size(); i++) { c.a().c(e.get(i)); } } } }); } return; case EventConstants.EVT_FUNCTION_USER_CENTER_LOGINED /*{ENCODED_INT: 2045}*/: if (com.linksure.browser.activity.user.a.a() && this.d == null && this.e == null) { this.d = new Timer(); this.e = new TimerTask() { /* class com.linksure.browser.activity.BrowserActivity.AnonymousClass4 */ public final void run() { BrowserActivity browserActivity; if (com.linksure.browser.activity.user.a.a() && FeedLoginActivity.a(BrowserActivity.this).intValue() == 1 && (browserActivity = BrowserActivity.this) != null && !browserActivity.isFinishing() && com.linksure.browser.activity.user.a.a()) { BrowserActivity browserActivity2 = BrowserActivity.this; browserActivity2.runOnUiThread(new a(browserActivity2, (byte) 0)); } } }; this.d.schedule(this.e, 0, 7200000); } synchronized (this) { com.linksure.api.a.a.a().a(new a.AbstractC0220a<Object>(this) { /* class com.linksure.browser.h.b.AnonymousClass2 */ /* renamed from: a reason: collision with root package name */ final /* synthetic */ Context f7256a; { this.f7256a = r1; } @Override // com.linksure.api.a.a.AbstractC0220a public final Object doInBackground() { HashMap hashMap = new HashMap(); List<BookmarkItem> g = c.a().g(); if (g.size() > 0) { List<e.a> a2 = c.a(g); if (a2 != null) { for (int i = 0; i < a2.size(); i++) { e.a aVar = a2.get(i); int i2 = 0; while (true) { if (i2 >= g.size()) { break; } BookmarkItem bookmarkItem = g.get(i); if (!TextUtils.isEmpty(bookmarkItem.getTitle()) && bookmarkItem.getTitle().equals(aVar.f5915a)) { g.get(i).setDirId((long) aVar.f5916b); break; } i2++; } } } for (int i3 = 0; i3 < g.size(); i3++) { BookmarkItem bookmarkItem2 = g.get(i3); hashMap.put(bookmarkItem2, c.a().a(bookmarkItem2.getUuid())); } for (Map.Entry entry : hashMap.entrySet()) { c.a((BookmarkItem) entry.getKey(), (List) entry.getValue()); } BookmarkItem d = c.a().d(); if (d != null) { List<BookmarkItem> a3 = c.a().a(d.getUuid()); d.setDirId(0); c.a(d, a3); } } b.a(this.f7256a); return null; } }); } return; case 3003: com.linksure.browser.preference.a.a(); this.f5991a.g(); return; case EventConstants.EVT_GLOBAL_SWITCH_PRIVACY /*{ENCODED_INT: 3004}*/: n.a(this, com.linksure.browser.config.e.a() ? R.string.msg_privacy_open : R.string.msg_privacy_close); Bundle b2 = eventInfo.getB(); if (b2 != null && b2.getBoolean("isFirst")) { BrowserApp.e().postDelayed(new Runnable() { /* class com.linksure.browser.webcore.h.AnonymousClass4 */ public final void run() { if (h.this.f7441a != null && !h.this.f7441a.isFinishing()) { b.a("lsbr_privatesafecd_pop"); new CustomDialog.Builder(h.this.f7441a).setView(j.e(R.layout.dialog_privacy_set_secret)).setConfirmButton(R.string.base_ok, new CustomDialog.OnDialogConfirmClickListener() { /* class com.linksure.browser.webcore.h.AnonymousClass4.AnonymousClass2 */ @Override // com.linksure.browser.view.dialog.CustomDialog.OnDialogConfirmClickListener public final void confirm(CustomDialog customDialog) { customDialog.dismiss(); Intent intent = new Intent(h.this.f7441a, PrivacyActivity.class); intent.putExtra("status", PrivacyActivity.Status.SET); h.this.f7441a.startActivity(intent); b.a("lsbr_newprivate_safecd", "from", "1"); } }).setCancleButton(R.string.base_skip, new CustomDialog.OnDialogCancelClickListener() { /* class com.linksure.browser.webcore.h.AnonymousClass4.AnonymousClass1 */ @Override // com.linksure.browser.view.dialog.CustomDialog.OnDialogCancelClickListener public final void cancle(CustomDialog customDialog) { customDialog.dismiss(); b.a("lsbr_passsafecd_prompt"); } }).setGravity(17).setCanceledOnTouchOutside(false).create().show(); } } }, 1000); break; } case EventConstants.EVT_GLOBAL_EXIT_PRIVACY /*{ENCODED_INT: 3005}*/: new CustomDialog.Builder(this).setTitle(R.string.home_privacy_mode).setMessage(R.string.home_privacy_dialog_exit_dec).setConfirmButtonColor(android.support.v4.content.b.c(com.linksure.api.a.a().f5950a, R.color.base_theme_color)).setConfirmButton(R.string.base_exit, new CustomDialog.OnDialogConfirmClickListener() { /* class com.linksure.browser.activity.BrowserActivity.AnonymousClass2 */ @Override // com.linksure.browser.view.dialog.CustomDialog.OnDialogConfirmClickListener public final void confirm(CustomDialog customDialog) { customDialog.dismiss(); com.linksure.browser.config.e.c(); } }).setCancleButton(R.string.base_cancel, new CustomDialog.OnDialogCancelClickListener() { /* class com.linksure.browser.activity.BrowserActivity.AnonymousClass1 */ @Override // com.linksure.browser.view.dialog.CustomDialog.OnDialogCancelClickListener public final void cancle(CustomDialog customDialog) { customDialog.dismiss(); } }).setGravity(17).create().show(); return; case EventConstants.EVT_GLOBAL_CHANGE_LANGUAGE /*{ENCODED_INT: 3006}*/: CommonUtils.c(); return; case EventConstants.EVT_MAIN_HOME_INIT /*{ENCODED_INT: 4001}*/: this.f5991a.b(); return; case EventConstants.EVT_HOME_STYLE_CHANGED /*{ENCODED_INT: 5001}*/: break; case EventConstants.EVT_HOME_SHOW_VIDEO /*{ENCODED_INT: 5007}*/: this.f5991a.a(TabManager.HomeState.VIDEO); return; case EventConstants.EVT_HOME_SHOW_FEED_LIST /*{ENCODED_INT: 5008}*/: this.f5991a.a(TabManager.HomeState.FEEDS); return; case EventConstants.EVT_HOME_VIEW_CHANGED /*{ENCODED_INT: 5011}*/: if (eventInfo.getObj() instanceof TabManager.HomeState) { this.f5991a.a((TabManager.HomeState) eventInfo.getObj()); return; } return; case EventConstants.EVT_HOME_WIFI_ANIM_FEED_VIDEO /*{ENCODED_INT: 5012}*/: this.f5991a.d(); return; default: return; } this.f5991a.c(); } @Override // android.support.v4.app.SupportActivity, android.support.v4.app.FragmentActivity, com.linksure.browser.base.BaseActivity public void onCreate(Bundle bundle) { super.onCreate(bundle); this.g = getIntent(); f5990b = this; MsgService.a(this); b.a(EventConstant.EVENTS.APPOPEN); BrowserApp.i(); if (getIntent() != null) { if (TextUtils.isEmpty(getIntent().getAction())) { b.a("lsbr_app_open", "openstyle", "1"); } else if (Objects.equals(getIntent().getAction(), "android.intent.action.VIEW")) { b.a("lsbr_app_open", "openstyle", "2"); } } this.mCompositorLayout.setInterceptor(new HomePageInterceptor(this, this.f5991a, this.mViewArrowBack, this.mViewArrowForward)); Log.i("xxfigo", "channel: " + AppUtil.getChannelName(getApplicationContext()) + "versionname: " + com.linksure.api.utils.a.c() + " code: " + com.linksure.api.utils.a.b()); } @Override // android.support.v4.app.FragmentActivity, com.linksure.browser.base.BaseActivity public void onActivityResult(int i, int i2, Intent intent) { String str; super.onActivityResult(i, i2, intent); if (i == 100) { com.linksure.browser.webcore.b.a(this, i2, intent); } else if (i == SearchBar.Companion.getREQUEST_CODE_SCAN() && i2 == -1 && intent != null) { String stringExtra = intent.getStringExtra("decodeString"); if (v.d(stringExtra)) { str = URLUtil.composeSearchUrl(stringExtra, r.a(), "%s"); } else { str = URLUtil.guessUrl(stringExtra); } g.a(1001, str, null, null); } } class a implements Runnable { private a() { } /* synthetic */ a(BrowserActivity browserActivity, byte b2) { this(); } public final void run() { com.linksure.browser.activity.user.b.a(); BrowserActivity browserActivity = BrowserActivity.this; int b2 = com.linksure.browser.activity.user.b.b(browserActivity, "1") + com.linksure.browser.activity.user.b.b(browserActivity, "2"); if ((BrowserActivity.this.f == null || !BrowserActivity.this.f.isShowing()) && b2 > 0) { View inflate = LayoutInflater.from(BrowserActivity.this).inflate(R.layout.user_message_pop, (ViewGroup) null, false); LinearLayout linearLayout = new LinearLayout(BrowserActivity.this); final PopupWindow popupWindow = new PopupWindow(inflate, -2, -2); BrowserActivity.this.f = popupWindow; popupWindow.setTouchable(true); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.showAtLocation(linearLayout, 17, 0, 0); ((TextView) inflate.findViewById(R.id.user_receive_message_text)).setText(String.format(BrowserActivity.this.getString(R.string.user_center_message_count_tips), String.valueOf(b2))); inflate.findViewById(R.id.user_message_pop_window).setOnClickListener(new View.OnClickListener() { /* class com.linksure.browser.activity.BrowserActivity.a.AnonymousClass1 */ public final void onClick(View view) { b.a("lsbr_mesremind_click"); popupWindow.dismiss(); BrowserActivity.this.f.dismiss(); BrowserActivity.this.startActivity(new Intent(BrowserActivity.this, UserMessageBoxActivity.class)); } }); b.a("lsbr_message_remind"); } } } private void a() { Timer timer = this.d; if (timer != null) { timer.cancel(); this.d = null; } TimerTask timerTask = this.e; if (timerTask != null) { timerTask.cancel(); this.e = null; } } @Override // android.support.v4.app.FragmentActivity public void onNewIntent(Intent intent) { if (intent == null) { return; } if (TextUtils.equals(intent.getStringExtra("from"), "connSDK")) { g.a(1001, "https://www.wifi.com/", null, null); } else { this.f5991a.a(intent); } } @Override // android.support.v4.app.FragmentActivity public void onBackPressed() { this.f5991a.e(); } @Override // android.support.v4.app.FragmentActivity, com.linksure.browser.base.BaseActivity public void onDestroy() { super.onDestroy(); this.f5991a.f(); com.linksure.browser.activity.settings.a aVar = this.c; if (aVar.f6864b != null) { aVar.f6864b.removeCallbacksAndMessages(null); aVar.f6864b = null; } a(); } @Override // android.support.v4.app.FragmentActivity, com.linksure.browser.base.BaseActivity public void onResume() { super.onResume(); this.f5991a.h(); com.linksure.browser.activity.settings.a aVar = this.c; if (aVar.d) { aVar.c = false; aVar.a(); } try { f.a(); if (f.b().equals("0")) { b.a("lsbr_firebase_funa"); } else { b.a("lsbr_firebase_funb"); } } catch (Exception unused) { } } @Override // android.support.v4.app.FragmentActivity public void onPause() { super.onPause(); this.f5991a.i(); this.c.c = true; } @Override // com.linksure.browser.base.BaseActivity public boolean dispatchTouchEvent(MotionEvent motionEvent) { return super.dispatchTouchEvent(motionEvent); } public boolean onKeyDown(int i, KeyEvent keyEvent) { com.linksure.browser.activity.tab.a b2 = TabManager.a(this).b(); if (b2 != null && b2.d()) { return super.onKeyDown(i, keyEvent); } if (i == 25 || i == 24) { keyEvent.startTracking(); if (keyEvent.getRepeatCount() == 0) { h hVar = this.f5991a; if (hVar.d == null || hVar.d.isHidden()) { return false; } WebFragment webFragment = hVar.d; if (webFragment.f6441a == null || !webFragment.f6441a.isShown() || !webFragment.mPreferences.f()) { return false; } switch (i) { case 24: webFragment.f6441a.b(false); return true; case 25: webFragment.f6441a.a(false); return true; default: return true; } } } return super.onKeyDown(i, keyEvent); } public boolean onKeyLongPress(int i, KeyEvent keyEvent) { com.linksure.browser.activity.tab.a b2 = TabManager.a(this).b(); if (b2 != null && b2.d()) { return super.onKeyDown(i, keyEvent); } if (i == 25 || i == 24) { h hVar = this.f5991a; boolean z = false; if (hVar.d != null && !hVar.d.isHidden()) { WebFragment webFragment = hVar.d; if (webFragment.f6441a != null && webFragment.f6441a.isShown() && webFragment.mPreferences.f()) { if (i == 25) { webFragment.f6441a.a(true); } else if (i == 24) { webFragment.f6441a.b(true); } z = true; } } if (z) { return true; } } return super.onKeyLongPress(i, keyEvent); } }