MD5 校验值:c2b7e78b3eaf112acc5fe1ecf912743d
SearchResultsActivity.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.drewapps.searches.simple.view.searchResults; import android.app.Dialog; import android.content.ClipData; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.webkit.ValueCallback; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; import androidx.appcompat.widget.AppCompatCheckBox; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.FragmentManager; import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.ViewPager; import com.drewapps.searches.simple.R; import com.drewapps.searches.simple.app.AppConstants; import com.drewapps.searches.simple.app.MyApplication; import com.drewapps.searches.simple.model.category.Category; import com.drewapps.searches.simple.model.history.HistoryNew; import com.drewapps.searches.simple.model.site.Site; import com.drewapps.searches.simple.model.site.SiteHelper; import com.drewapps.searches.simple.model.siteData.SiteData; import com.drewapps.searches.simple.shared.extensions.ActivityKt; import com.drewapps.searches.simple.shared.extensions.ContextKt; import com.drewapps.searches.simple.shared.extensions.MenuKt; import com.drewapps.searches.simple.shared.preferences.Prefs; import com.drewapps.searches.simple.view.about.AboutActivity; import com.drewapps.searches.simple.view.base.BaseActivity; import com.drewapps.searches.simple.view.base.BaseFragment; import com.drewapps.searches.simple.view.customView.MyViewPager; import com.drewapps.searches.simple.view.customView.webview.MyWebView; import com.drewapps.searches.simple.view.history.HistoryActivity; import com.drewapps.searches.simple.view.manageSites.ManageSitesDragDropActivity; import com.drewapps.searches.simple.view.search.SearchActivity; import com.drewapps.searches.simple.view.searchResults.searchThePage.SearchThePageHelper; import com.drewapps.searches.simple.view.searchResults.sites.SiteContextMenuHelper; import com.drewapps.searches.simple.view.searchResults.sites.SitesFragment; import com.drewapps.searches.simple.view.searchResults.webview.WebViewFragment; import com.drewapps.searches.simple.view.settings.SettingsActivity; import com.drewapps.searches.simple.view.textZoom.TextZoomDialogHelper; import com.drewapps.searches.simple.view.widget.MyAlertDialog; import com.drewapps.searches.simple.view.widget.Permission; import com.google.android.gms.actions.SearchIntents; import com.google.android.gms.common.internal.ImagesContract; import com.google.android.material.tabs.TabLayout; import com.google.firebase.analytics.FirebaseAnalytics; import java.util.ArrayList; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.Objects; import java.util.Stack; import kotlin.Metadata; import kotlin.collections.CollectionsKt; import kotlin.comparisons.ComparisonsKt; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.Ref; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u009c\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0015\n\u0002\b\u001d\u0018\u0000 h2\u00020\u00012\u00020\u00022\u00020\u0003:\u0001hB\u0005¢\u0006\u0002\u0010\u0004J\u0010\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0011H\u0002J\b\u0010\u0015\u001a\u00020\u0013H\u0002J\u0010\u0010\u0016\u001a\u00020\u00132\u0006\u0010\u0017\u001a\u00020\u0011H\u0002J\b\u0010\u0018\u001a\u00020\u0013H\u0002J\b\u0010\u0019\u001a\u00020\u0013H\u0002J\u000e\u0010\u001a\u001a\u00020\u00132\u0006\u0010\u001b\u001a\u00020\u001cJ\b\u0010\u001d\u001a\u00020\u0013H\u0002J\u0010\u0010\u001e\u001a\u00020\u00132\u0006\u0010\u001f\u001a\u00020 H\u0002J\b\u0010!\u001a\u00020\u0013H\u0002J\b\u0010\"\u001a\u00020\u0013H\u0002J\b\u0010#\u001a\u00020\u0013H\u0002J\b\u0010$\u001a\u00020\u0013H\u0002J\b\u0010%\u001a\u00020\u0013H\u0002J\b\u0010&\u001a\u00020\u0013H\u0002J\"\u0010'\u001a\u00020\u00132\u0006\u0010(\u001a\u00020\u00112\u0006\u0010)\u001a\u00020\u00112\b\u0010*\u001a\u0004\u0018\u00010 H\u0014J\b\u0010+\u001a\u00020\u0013H\u0016J\u0010\u0010,\u001a\u00020\u00132\u0006\u0010-\u001a\u00020.H\u0016J\u0010\u0010/\u001a\u0002002\u0006\u00101\u001a\u000202H\u0016J\u0010\u00103\u001a\u00020\u00132\u0006\u00104\u001a\u00020\u001cH\u0016J\u0010\u00105\u001a\u00020\u00132\u0006\u00104\u001a\u00020\u001cH\u0016J\u0010\u00106\u001a\u00020\u00132\u0006\u00104\u001a\u00020\u001cH\u0016J\u0012\u00107\u001a\u00020\u00132\b\u00108\u001a\u0004\u0018\u000109H\u0014J\"\u0010:\u001a\u00020\u00132\u0006\u0010;\u001a\u00020<2\u0006\u0010=\u001a\u00020>2\b\u0010?\u001a\u0004\u0018\u00010@H\u0016J\u0012\u0010A\u001a\u0002002\b\u0010;\u001a\u0004\u0018\u00010BH\u0016J\b\u0010C\u001a\u00020\u0013H\u0016J\u0010\u0010D\u001a\u00020\u00132\u0006\u0010\u001f\u001a\u00020 H\u0014J\u0012\u0010E\u001a\u0002002\b\u00101\u001a\u0004\u0018\u000102H\u0016J\u0012\u0010F\u001a\u0002002\b\u0010;\u001a\u0004\u0018\u00010BH\u0016J-\u0010G\u001a\u00020\u00132\u0006\u0010(\u001a\u00020\u00112\u000e\u0010H\u001a\n\u0012\u0006\b\u0001\u0012\u00020J0I2\u0006\u0010K\u001a\u00020LH\u0016¢\u0006\u0002\u0010MJ\b\u0010N\u001a\u00020\u0013H\u0014J\b\u0010O\u001a\u00020\u0013H\u0002J\b\u0010P\u001a\u00020\u0013H\u0002J\b\u0010Q\u001a\u00020\u0013H\u0002J\u0012\u0010R\u001a\u00020\u00132\b\u0010S\u001a\u0004\u0018\u00010JH\u0002J\u0006\u0010T\u001a\u00020\u0013J\b\u0010U\u001a\u00020\u0013H\u0002J\b\u0010V\u001a\u00020\u0013H\u0002J\u0016\u0010W\u001a\u00020\u00132\u0006\u0010X\u001a\u00020\u001c2\u0006\u0010Y\u001a\u000200J\b\u0010Z\u001a\u00020\u0013H\u0002J\u000e\u0010[\u001a\u00020\u00132\u0006\u0010\u001b\u001a\u00020\u001cJ\b\u0010\\\u001a\u00020\u0013H\u0002J\u000e\u0010]\u001a\u00020\u00132\u0006\u0010^\u001a\u000200J\b\u0010_\u001a\u00020\u0013H\u0002J\b\u0010`\u001a\u00020\u0013H\u0002J\b\u0010a\u001a\u00020\u0013H\u0002J\u0016\u0010b\u001a\u00020\u00132\u0006\u0010c\u001a\u00020J2\u0006\u0010S\u001a\u00020JJ\b\u0010d\u001a\u00020\u0013H\u0002J\u0006\u0010e\u001a\u00020\u0013J\u0006\u0010f\u001a\u00020\u0013J\b\u0010g\u001a\u00020\u0013H\u0002R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0007\u001a\u0004\u0018\u00010\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\fX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082.¢\u0006\u0002\n\u0000R\u0014\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u00110\u0010X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006i"}, d2 = {"Lcom/drewapps/searches/simple/view/searchResults/SearchResultsActivity;", "Lcom/drewapps/searches/simple/view/base/BaseActivity;", "Lcom/drewapps/searches/simple/view/textZoom/TextZoomDialogHelper$Listener;", "Lcom/drewapps/searches/simple/view/searchResults/sites/SiteContextMenuHelper$Listener;", "()V", "handlerAfterPageSelected", "Landroid/os/Handler;", "runnableAfterPageSelected", "Ljava/lang/Runnable;", "searchResultsPagerAdapter", "Lcom/drewapps/searches/simple/view/searchResults/SearchResultsPagerAdapter;", "searchThePageHelper", "Lcom/drewapps/searches/simple/view/searchResults/searchThePage/SearchThePageHelper;", "siteContextMenuHelper", "Lcom/drewapps/searches/simple/view/searchResults/sites/SiteContextMenuHelper;", "stackTabIndex", "Ljava/util/Stack;", "", "behaviorForOrientation", "", "orientation", "changeTabAccordingToStack", "changeViewPagerPadding", "value", "clearViewPager", "closeAllSites", "closeSite", "siteToClose", "Lcom/drewapps/searches/simple/model/site/Site;", "getArgs", "handleIntent", "intent", "Landroid/content/Intent;", "initData", "initEverything", "initFirst", "initUi", "leaveSearchResultsActivity", "loadSites", "onActivityResult", "requestCode", "resultCode", "data", "onBackPressed", "onConfigurationChanged", "newConfig", "Landroid/content/res/Configuration;", "onContextItemSelected", "", "item", "Landroid/view/MenuItem;", "onContextMenuSiteClose", "site", "onContextMenuSiteOpen", "onContextMenuSiteOpenInNewTab", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onCreateContextMenu", "menu", "Landroid/view/ContextMenu;", "v", "Landroid/view/View;", "menuInfo", "Landroid/view/ContextMenu$ContextMenuInfo;", "onCreateOptionsMenu", "Landroid/view/Menu;", "onDialogDismiss", "onNewIntent", "onOptionsItemSelected", "onPrepareOptionsMenu", "onRequestPermissionsResult", "permissions", "", "", "grantResults", "", "(I[Ljava/lang/String;[I)V", "onResume", "openAbout", "openDefaultSearchEngineForCategory", "openHistory", "openInBrowser", ImagesContract.URL, "openManageSitesActivity", "openSearchActivity", "openSettings", "openSite", "siteToOpen", "changeTab", "performCloseAllSites", "performCloseSite", "saveHistory", "setViewPagerStatus", "b", "setupViewPager", FirebaseAnalytics.Event.SHARE, "showCategoryIcon", "showOpenOnlyInBrowserDialog", "siteName", "showTextZoomDialog", "sitesFragmentNotifyDataSetChanged", "smoothTransition", "updateViewPager", "Companion", "app_release"}, k = 1, mv = {1, 4, 0}) public final class SearchResultsActivity extends BaseActivity implements TextZoomDialogHelper.Listener, SiteContextMenuHelper.Listener { private static String mCameraPhotoPath; private static Uri mCapturedImageURI; private static ValueCallback<Uri[]> mFilePathCallback; private static ValueCallback<Uri> mUploadMessage; private static boolean reopenManageSitesActivity; private static boolean sitesHaveChanged; private HashMap _$_findViewCache; private Runnable runnableAfterPageSelected; private SearchResultsPagerAdapter searchResultsPagerAdapter; private SearchThePageHelper searchThePageHelper; private SiteContextMenuHelper siteContextMenuHelper; public static final Companion INSTANCE = new Companion(null); private static final String ARG_FROM_HISTORY = "from_history"; private Handler handlerAfterPageSelected = new Handler(); private Stack<Integer> stackTabIndex = new Stack<>(); private final void behaviorForOrientation(int orientation) { } private final void getArgs() { } @Override public void _$_clearFindViewByIdCache() { HashMap hashMap = this._$_findViewCache; if (hashMap != null) { hashMap.clear(); } } @Override public View _$_findCachedViewById(int i) { if (this._$_findViewCache == null) { this._$_findViewCache = new HashMap(); } View view = (View) this._$_findViewCache.get(Integer.valueOf(i)); if (view != null) { return view; } View findViewById = findViewById(i); this._$_findViewCache.put(Integer.valueOf(i), findViewById); return findViewById; } @Override public void onDialogDismiss() { } @Metadata(bv = {1, 0, 3}, d1 = {"\u0000<\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0010\u0011\n\u0002\b\b\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010$\u001a\u00020%2\u0006\u0010&\u001a\u00020'R\u0014\u0010\u0003\u001a\u00020\u0004X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006R\u001c\u0010\u0007\u001a\u0004\u0018\u00010\u0004X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\b\u0010\u0006\"\u0004\b\t\u0010\nR\u001c\u0010\u000b\u001a\u0004\u0018\u00010\fX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0010R(\u0010\u0011\u001a\u0010\u0012\n\u0012\b\u0012\u0004\u0012\u00020\f0\u0013\u0018\u00010\u0012X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0015\"\u0004\b\u0016\u0010\u0017R\"\u0010\u0018\u001a\n\u0012\u0004\u0012\u00020\f\u0018\u00010\u0012X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0019\u0010\u0015\"\u0004\b\u001a\u0010\u0017R\u001a\u0010\u001b\u001a\u00020\u001cX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001d\u0010\u001e\"\u0004\b\u001f\u0010 R\u001a\u0010!\u001a\u00020\u001cX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\"\u0010\u001e\"\u0004\b#\u0010 ¨\u0006("}, d2 = {"Lcom/drewapps/searches/simple/view/searchResults/SearchResultsActivity$Companion;", "", "()V", "ARG_FROM_HISTORY", "", "getARG_FROM_HISTORY", "()Ljava/lang/String;", "mCameraPhotoPath", "getMCameraPhotoPath", "setMCameraPhotoPath", "(Ljava/lang/String;)V", "mCapturedImageURI", "Landroid/net/Uri;", "getMCapturedImageURI", "()Landroid/net/Uri;", "setMCapturedImageURI", "(Landroid/net/Uri;)V", "mFilePathCallback", "Landroid/webkit/ValueCallback;", "", "getMFilePathCallback", "()Landroid/webkit/ValueCallback;", "setMFilePathCallback", "(Landroid/webkit/ValueCallback;)V", "mUploadMessage", "getMUploadMessage", "setMUploadMessage", "reopenManageSitesActivity", "", "getReopenManageSitesActivity", "()Z", "setReopenManageSitesActivity", "(Z)V", "sitesHaveChanged", "getSitesHaveChanged", "setSitesHaveChanged", "openManageSitesActivity", "", "context", "Landroid/content/Context;", "app_release"}, k = 1, mv = {1, 4, 0}) public static final class Companion { private Companion() { } public Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public final String getARG_FROM_HISTORY() { return SearchResultsActivity.ARG_FROM_HISTORY; } public final ValueCallback<Uri> getMUploadMessage() { return SearchResultsActivity.mUploadMessage; } public final void setMUploadMessage(ValueCallback<Uri> valueCallback) { SearchResultsActivity.mUploadMessage = valueCallback; } public final ValueCallback<Uri[]> getMFilePathCallback() { return SearchResultsActivity.mFilePathCallback; } public final void setMFilePathCallback(ValueCallback<Uri[]> valueCallback) { SearchResultsActivity.mFilePathCallback = valueCallback; } public final Uri getMCapturedImageURI() { return SearchResultsActivity.mCapturedImageURI; } public final void setMCapturedImageURI(Uri uri) { SearchResultsActivity.mCapturedImageURI = uri; } public final String getMCameraPhotoPath() { return SearchResultsActivity.mCameraPhotoPath; } public final void setMCameraPhotoPath(String str) { SearchResultsActivity.mCameraPhotoPath = str; } public final boolean getSitesHaveChanged() { return SearchResultsActivity.sitesHaveChanged; } public final void setSitesHaveChanged(boolean z) { SearchResultsActivity.sitesHaveChanged = z; } public final boolean getReopenManageSitesActivity() { return SearchResultsActivity.reopenManageSitesActivity; } public final void setReopenManageSitesActivity(boolean z) { SearchResultsActivity.reopenManageSitesActivity = z; } public final void openManageSitesActivity(Context context) { Intrinsics.checkNotNullParameter(context, "context"); context.startActivity(new Intent(context, (Class<?>) ManageSitesDragDropActivity.class)); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search_results); initEverything(); } private final void initEverything() { initFirst(); Intent intent = getIntent(); Intrinsics.checkNotNullExpressionValue(intent, "intent"); handleIntent(intent); getArgs(); initData(); initUi(); openDefaultSearchEngineForCategory(); } private final void initFirst() { SearchResultsActivity searchResultsActivity = this; this.siteContextMenuHelper = new SiteContextMenuHelper(searchResultsActivity, this); MyViewPager view_pager_main = (MyViewPager) _$_findCachedViewById(R.id.view_pager_main); Intrinsics.checkNotNullExpressionValue(view_pager_main, "view_pager_main"); TabLayout tab_layout_main = (TabLayout) _$_findCachedViewById(R.id.tab_layout_main); Intrinsics.checkNotNullExpressionValue(tab_layout_main, "tab_layout_main"); LinearLayout layout_search_the_page = (LinearLayout) _$_findCachedViewById(R.id.layout_search_the_page); Intrinsics.checkNotNullExpressionValue(layout_search_the_page, "layout_search_the_page"); EditText edittext_search_the_page = (EditText) _$_findCachedViewById(R.id.edittext_search_the_page); Intrinsics.checkNotNullExpressionValue(edittext_search_the_page, "edittext_search_the_page"); TextView textview_search_the_page_count = (TextView) _$_findCachedViewById(R.id.textview_search_the_page_count); Intrinsics.checkNotNullExpressionValue(textview_search_the_page_count, "textview_search_the_page_count"); ImageButton button_search_the_page_previous = (ImageButton) _$_findCachedViewById(R.id.button_search_the_page_previous); Intrinsics.checkNotNullExpressionValue(button_search_the_page_previous, "button_search_the_page_previous"); ImageButton button_search_the_page_next = (ImageButton) _$_findCachedViewById(R.id.button_search_the_page_next); Intrinsics.checkNotNullExpressionValue(button_search_the_page_next, "button_search_the_page_next"); ImageButton button_search_the_page_close = (ImageButton) _$_findCachedViewById(R.id.button_search_the_page_close); Intrinsics.checkNotNullExpressionValue(button_search_the_page_close, "button_search_the_page_close"); this.searchThePageHelper = new SearchThePageHelper(searchResultsActivity, view_pager_main, tab_layout_main, layout_search_the_page, edittext_search_the_page, textview_search_the_page_count, button_search_the_page_previous, button_search_the_page_next, button_search_the_page_close); } private final void initUi() { setupToolbarBackButton(true); setTitle(getMyApplication().getSearchContentDisplay()); Category categorySelected = getMyApplication().getCategorySelected(); Intrinsics.checkNotNull(categorySelected); setSubTitle(getString(R.string.search_for_subtitle, new Object[]{categorySelected.getName()})); SearchThePageHelper searchThePageHelper = this.searchThePageHelper; if (searchThePageHelper == null) { Intrinsics.throwUninitializedPropertyAccessException("searchThePageHelper"); } searchThePageHelper.setupViews(); setupViewPager(); Resources resources = getResources(); Intrinsics.checkNotNullExpressionValue(resources, "this.resources"); behaviorForOrientation(resources.getConfiguration().orientation); } private final void initData() { loadSites(); getMyApplication().getArrOpenedSite().clear(); } private final void loadSites() { SiteHelper siteHelper = SiteHelper.INSTANCE; Category categorySelected = getMyApplication().getCategorySelected(); Intrinsics.checkNotNull(categorySelected); ArrayList<Site> createArrSite = siteHelper.createArrSite(categorySelected.getId()); HashMap<Integer, ArrayList<SiteData>> mapSiteData = Prefs.INSTANCE.getMapSiteData(this); Category categorySelected2 = getMyApplication().getCategorySelected(); Intrinsics.checkNotNull(categorySelected2); ArrayList<SiteData> arrayList = mapSiteData.get(Integer.valueOf(categorySelected2.getId())); MyApplication.Companion companion = MyApplication.INSTANCE; Intrinsics.checkNotNull(arrayList); companion.putSiteDataIn(arrayList, createArrSite); getMyApplication().getArrSite().clear(); ArrayList<Site> arrSite = getMyApplication().getArrSite(); ArrayList arrayList2 = new ArrayList(); for (Object obj : createArrSite) { if (((Site) obj).getIsVisible()) { arrayList2.add(obj); } } arrSite.addAll(arrayList2); ArrayList<Site> arrSite2 = getMyApplication().getArrSite(); if (arrSite2.size() > 1) { CollectionsKt.sortWith(arrSite2, new Comparator<T>() { @Override public final int compare(T t, T t2) { return ComparisonsKt.compareValues(Integer.valueOf(((Site) t).getPosition()), Integer.valueOf(((Site) t2).getPosition())); } }); } } @Override public void onNewIntent(Intent intent) { Intrinsics.checkNotNullParameter(intent, "intent"); super.onNewIntent(intent); initEverything(); } private final void handleIntent(Intent intent) { String stringExtra; if (!Intrinsics.areEqual("android.intent.action.SEARCH", intent.getAction()) || (stringExtra = intent.getStringExtra(SearchIntents.EXTRA_QUERY)) == null) { return; } getMyApplication().setSearchContentDisplay(stringExtra); Prefs.INSTANCE.insertSearchContentDisplay(this, getMyApplication().getSearchContentDisplay()); saveHistory(); } private final void saveHistory() { if (getMyApplication().getSearchHistorySave()) { SearchResultsActivity searchResultsActivity = this; ArrayList<HistoryNew> arrHistoryNew = Prefs.INSTANCE.getArrHistoryNew(searchResultsActivity); String searchContentDisplay = getMyApplication().getSearchContentDisplay(); Category categorySelected = getMyApplication().getCategorySelected(); Intrinsics.checkNotNull(categorySelected); arrHistoryNew.add(0, new HistoryNew(searchContentDisplay, categorySelected.getId(), new Date())); ArrayList<HistoryNew> arrayList = new ArrayList<>(); if (arrHistoryNew.size() > AppConstants.INSTANCE.getSEARCH_HISTORY_COUNT()) { arrayList.addAll(arrHistoryNew.subList(0, AppConstants.INSTANCE.getSEARCH_HISTORY_COUNT())); } else { arrayList.addAll(arrHistoryNew); } Prefs.INSTANCE.insertArrHistoryNew(searchResultsActivity, arrayList); } } @Override protected void onResume() { super.onResume(); if (reopenManageSitesActivity) { reopenManageSitesActivity = false; openManageSitesActivity(); } if (sitesHaveChanged) { sitesHaveChanged = false; loadSites(); SearchResultsPagerAdapter searchResultsPagerAdapter = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } BaseFragment baseFragment = searchResultsPagerAdapter.getArrFragments().get(0); Objects.requireNonNull(baseFragment, "null cannot be cast to non-null type com.drewapps.searches.simple.view.searchResults.sites.SitesFragment"); ((SitesFragment) baseFragment).initData(); } } public final void openManageSitesActivity() { startActivity(new Intent(this, (Class<?>) ManageSitesDragDropActivity.class)); } public final void smoothTransition() { CoordinatorLayout layout_main_parent = (CoordinatorLayout) _$_findCachedViewById(R.id.layout_main_parent); Intrinsics.checkNotNullExpressionValue(layout_main_parent, "layout_main_parent"); ActivityKt.smoothTransition(this, layout_main_parent); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); Toolbar toolbar = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar, "toolbar"); menuInflater.inflate(R.menu.menu_search_results, toolbar.getMenu()); Toolbar toolbar2 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar2, "toolbar"); Menu menu2 = toolbar2.getMenu(); Intrinsics.checkNotNullExpressionValue(menu2, "toolbar.menu"); MenuKt.makeMenuIconsVisible(menu2); Toolbar toolbar3 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar3, "toolbar"); Menu menu3 = toolbar3.getMenu(); Intrinsics.checkNotNullExpressionValue(menu3, "toolbar.menu"); MenuKt.setGroupDivider(menu3, true); return true; } @Override public boolean onPrepareOptionsMenu(Menu menu) { Object[] objArr = new Object[1]; Site currentSite = getMyApplication().getCurrentSite(); objArr[0] = currentSite != null ? currentSite.getName() : null; String string = getString(R.string.menu_search_results_close, objArr); Intrinsics.checkNotNullExpressionValue(string, "getString(\n R…rrentSite?.name\n )"); Toolbar toolbar = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar, "toolbar"); MenuItem findItem = toolbar.getMenu().findItem(R.id.menu_search_results_close); if (findItem != null) { findItem.setTitle(string); } Toolbar toolbar2 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar2, "toolbar"); MenuItem findItem2 = toolbar2.getMenu().findItem(R.id.menu_search_results_close_all); Intrinsics.checkNotNullExpressionValue(findItem2, "toolbar.menu.findItem(R.…search_results_close_all)"); findItem2.setVisible(false); MyViewPager view_pager_main = (MyViewPager) _$_findCachedViewById(R.id.view_pager_main); Intrinsics.checkNotNullExpressionValue(view_pager_main, "view_pager_main"); if (view_pager_main.getCurrentItem() == 0) { Toolbar toolbar3 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar3, "toolbar"); MenuItem findItem3 = toolbar3.getMenu().findItem(R.id.menu_search_results_share); Intrinsics.checkNotNullExpressionValue(findItem3, "toolbar.menu.findItem(R.…enu_search_results_share)"); findItem3.setVisible(false); Toolbar toolbar4 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar4, "toolbar"); MenuItem findItem4 = toolbar4.getMenu().findItem(R.id.menu_search_results_open_in_browser); Intrinsics.checkNotNullExpressionValue(findItem4, "toolbar.menu.findItem(R.…_results_open_in_browser)"); findItem4.setVisible(false); Toolbar toolbar5 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar5, "toolbar"); MenuItem findItem5 = toolbar5.getMenu().findItem(R.id.menu_search_results_search_the_page); Intrinsics.checkNotNullExpressionValue(findItem5, "toolbar.menu.findItem(R.…_results_search_the_page)"); findItem5.setVisible(false); Toolbar toolbar6 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar6, "toolbar"); MenuItem findItem6 = toolbar6.getMenu().findItem(R.id.menu_search_results_text_zoom); Intrinsics.checkNotNullExpressionValue(findItem6, "toolbar.menu.findItem(R.…search_results_text_zoom)"); findItem6.setVisible(false); Toolbar toolbar7 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar7, "toolbar"); MenuItem findItem7 = toolbar7.getMenu().findItem(R.id.menu_search_results_close); Intrinsics.checkNotNullExpressionValue(findItem7, "toolbar.menu.findItem(R.…enu_search_results_close)"); findItem7.setVisible(false); } else { Toolbar toolbar8 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar8, "toolbar"); MenuItem findItem8 = toolbar8.getMenu().findItem(R.id.menu_search_results_share); Intrinsics.checkNotNullExpressionValue(findItem8, "toolbar.menu.findItem(R.…enu_search_results_share)"); findItem8.setVisible(true); Toolbar toolbar9 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar9, "toolbar"); MenuItem findItem9 = toolbar9.getMenu().findItem(R.id.menu_search_results_open_in_browser); Intrinsics.checkNotNullExpressionValue(findItem9, "toolbar.menu.findItem(R.…_results_open_in_browser)"); findItem9.setVisible(true); Toolbar toolbar10 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar10, "toolbar"); MenuItem findItem10 = toolbar10.getMenu().findItem(R.id.menu_search_results_search_the_page); Intrinsics.checkNotNullExpressionValue(findItem10, "toolbar.menu.findItem(R.…_results_search_the_page)"); findItem10.setVisible(true); Toolbar toolbar11 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar11, "toolbar"); MenuItem findItem11 = toolbar11.getMenu().findItem(R.id.menu_search_results_text_zoom); Intrinsics.checkNotNullExpressionValue(findItem11, "toolbar.menu.findItem(R.…search_results_text_zoom)"); findItem11.setVisible(true); Toolbar toolbar12 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar12, "toolbar"); MenuItem findItem12 = toolbar12.getMenu().findItem(R.id.menu_search_results_text_zoom); Intrinsics.checkNotNullExpressionValue(findItem12, "toolbar.menu.findItem(R.…search_results_text_zoom)"); findItem12.setTitle(getString(R.string.menu_search_results_text_zoom, new Object[]{String.valueOf(getMyApplication().getTextZoom()) + "%"})); Toolbar toolbar13 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar13, "toolbar"); MenuItem findItem13 = toolbar13.getMenu().findItem(R.id.menu_search_results_close); Intrinsics.checkNotNullExpressionValue(findItem13, "toolbar.menu.findItem(R.…enu_search_results_close)"); findItem13.setVisible(true); } if (getMyApplication().getArrOpenedSite().size() > 0) { Toolbar toolbar14 = (Toolbar) _$_findCachedViewById(R.id.toolbar); Intrinsics.checkNotNullExpressionValue(toolbar14, "toolbar"); MenuItem findItem14 = toolbar14.getMenu().findItem(R.id.menu_search_results_close_all); Intrinsics.checkNotNullExpressionValue(findItem14, "toolbar.menu.findItem(R.…search_results_close_all)"); findItem14.setVisible(true); } return super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { Integer valueOf = item != null ? Integer.valueOf(item.getItemId()) : null; if (valueOf != null && valueOf.intValue() == 16908332) { leaveSearchResultsActivity(); return true; } if (valueOf != null && valueOf.intValue() == R.id.menu_search_results_open_in_browser) { MyWebView currentWebView = getMyApplication().getCurrentWebView(); openInBrowser(currentWebView != null ? currentWebView.getUrl() : null); return true; } if (valueOf != null && valueOf.intValue() == R.id.menu_search_results_share) { share(); return true; } if (valueOf != null && valueOf.intValue() == R.id.menu_search_results_search_the_page) { SearchThePageHelper searchThePageHelper = this.searchThePageHelper; if (searchThePageHelper == null) { Intrinsics.throwUninitializedPropertyAccessException("searchThePageHelper"); } if (searchThePageHelper.getLayoutParent().getVisibility() == 8) { SearchThePageHelper searchThePageHelper2 = this.searchThePageHelper; if (searchThePageHelper2 == null) { Intrinsics.throwUninitializedPropertyAccessException("searchThePageHelper"); } searchThePageHelper2.show(); } else { SearchThePageHelper searchThePageHelper3 = this.searchThePageHelper; if (searchThePageHelper3 == null) { Intrinsics.throwUninitializedPropertyAccessException("searchThePageHelper"); } searchThePageHelper3.close(); } return true; } if (valueOf != null && valueOf.intValue() == R.id.menu_search_results_text_zoom) { showTextZoomDialog(); return true; } if (valueOf != null && valueOf.intValue() == R.id.menu_search_results_close) { Site currentSite = getMyApplication().getCurrentSite(); Intrinsics.checkNotNull(currentSite); closeSite(currentSite); return true; } if (valueOf != null && valueOf.intValue() == R.id.menu_search_results_close_all) { closeAllSites(); return true; } if (valueOf != null && valueOf.intValue() == R.id.menu_search_results_history) { openHistory(); return true; } if (valueOf != null && valueOf.intValue() == R.id.menu_search_results_settings) { openSettings(); return true; } if (valueOf != null && valueOf.intValue() == R.id.menu_search_results_about) { openAbout(); return true; } return super.onOptionsItemSelected(item); } private final void showTextZoomDialog() { new TextZoomDialogHelper(this, this).showDialog(); } private final void openHistory() { startActivity(new Intent(this, (Class<?>) HistoryActivity.class)); } private final void openSettings() { startActivity(new Intent(this, (Class<?>) SettingsActivity.class)); } private final void openAbout() { startActivity(new Intent(this, (Class<?>) AboutActivity.class)); } private final void share() { StringBuilder append = new StringBuilder().append(getString(R.string.app_name)).append(" - "); Site currentSite = getMyApplication().getCurrentSite(); Intrinsics.checkNotNull(currentSite); String sb = append.append(currentSite.getName()).toString(); MyWebView currentWebView = getMyApplication().getCurrentWebView(); Intrinsics.checkNotNull(currentWebView); String url = currentWebView.getUrl(); Intent intent = new Intent("android.intent.action.SEND"); intent.setType("text/plain"); intent.putExtra("android.intent.extra.SUBJECT", sb); intent.putExtra("android.intent.extra.TEXT", url); startActivity(Intent.createChooser(intent, getString(R.string.title_share_via))); } public final void openInBrowser(String url) { if (url == null) { return; } if (!ContextKt.hasActivityToResolveIntent(this, url)) { MyAlertDialog.INSTANCE.createNoBrowserErrorMessage(this).show(); } else { startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url))); } } private final void clearViewPager() { MyViewPager view_pager_main = (MyViewPager) _$_findCachedViewById(R.id.view_pager_main); Intrinsics.checkNotNullExpressionValue(view_pager_main, "view_pager_main"); if (view_pager_main.getAdapter() != null) { MyViewPager view_pager_main2 = (MyViewPager) _$_findCachedViewById(R.id.view_pager_main); Intrinsics.checkNotNullExpressionValue(view_pager_main2, "view_pager_main"); PagerAdapter adapter = view_pager_main2.getAdapter(); Objects.requireNonNull(adapter, "null cannot be cast to non-null type com.drewapps.searches.simple.view.searchResults.SearchResultsPagerAdapter"); ((SearchResultsPagerAdapter) adapter).getArrFragments().clear(); MyViewPager view_pager_main3 = (MyViewPager) _$_findCachedViewById(R.id.view_pager_main); Intrinsics.checkNotNullExpressionValue(view_pager_main3, "view_pager_main"); PagerAdapter adapter2 = view_pager_main3.getAdapter(); if (adapter2 != null) { ((SearchResultsPagerAdapter) adapter2).notifyDataSetChanged(); } MyViewPager view_pager_main4 = (MyViewPager) _$_findCachedViewById(R.id.view_pager_main); Intrinsics.checkNotNullExpressionValue(view_pager_main4, "view_pager_main"); view_pager_main4.setAdapter((PagerAdapter) null); ((MyViewPager) _$_findCachedViewById(R.id.view_pager_main)).clearOnPageChangeListeners(); } } private final void setupViewPager() { ArrayList arrayList = new ArrayList(); arrayList.add(SitesFragment.INSTANCE.getInstance()); FragmentManager supportFragmentManager = getSupportFragmentManager(); Intrinsics.checkNotNullExpressionValue(supportFragmentManager, "supportFragmentManager"); this.searchResultsPagerAdapter = new SearchResultsPagerAdapter(this, arrayList, supportFragmentManager); clearViewPager(); MyViewPager view_pager_main = (MyViewPager) _$_findCachedViewById(R.id.view_pager_main); Intrinsics.checkNotNullExpressionValue(view_pager_main, "view_pager_main"); view_pager_main.setOffscreenPageLimit(3); MyViewPager view_pager_main2 = (MyViewPager) _$_findCachedViewById(R.id.view_pager_main); Intrinsics.checkNotNullExpressionValue(view_pager_main2, "view_pager_main"); SearchResultsPagerAdapter searchResultsPagerAdapter = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } view_pager_main2.setAdapter(searchResultsPagerAdapter); ((TabLayout) _$_findCachedViewById(R.id.tab_layout_main)).setupWithViewPager((MyViewPager) _$_findCachedViewById(R.id.view_pager_main)); ((MyViewPager) _$_findCachedViewById(R.id.view_pager_main)).addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { Stack stack; Stack stack2; stack = SearchResultsActivity.this.stackTabIndex; Integer num = (Integer) stack.lastElement(); if (num == null || num.intValue() != position) { stack2 = SearchResultsActivity.this.stackTabIndex; stack2.push(Integer.valueOf(position)); } SearchResultsActivity.this.showCategoryIcon(); ActivityKt.hideKeyboard$default(SearchResultsActivity.this, null, 1, null); } }); this.stackTabIndex.clear(); this.stackTabIndex.push(0); showCategoryIcon(); } public final void showCategoryIcon() { TabLayout.Tab tabAt = ((TabLayout) _$_findCachedViewById(R.id.tab_layout_main)).getTabAt(0); if (tabAt != null) { Category categorySelected = getMyApplication().getCategorySelected(); Intrinsics.checkNotNull(categorySelected); tabAt.setIcon(categorySelected.getImageWhiteResourceId()); } TabLayout.Tab tabAt2 = ((TabLayout) _$_findCachedViewById(R.id.tab_layout_main)).getTabAt(0); if (tabAt2 != null) { tabAt2.setContentDescription(R.string.search_results_first_tab); } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Bundle extras; if (Build.VERSION.SDK_INT >= 21) { if (requestCode != 1 || mFilePathCallback == null) { super.onActivityResult(requestCode, resultCode, data); return; } Uri[] uriArr = (Uri[]) null; if (resultCode == -1) { if (data != null && (extras = data.getExtras()) != null) { extras.get("data"); } String dataString = data != null ? data.getDataString() : null; ClipData clipData = data != null ? data.getClipData() : null; String.valueOf(data != null ? data.getClipData() : null); if (clipData != null) { ArrayList arrayList = new ArrayList(); int itemCount = clipData.getItemCount() - 1; if (itemCount >= 0) { int i = 0; while (true) { ClipData.Item itemAt = clipData.getItemAt(i); Intrinsics.checkNotNullExpressionValue(itemAt, "clipData.getItemAt(i)"); arrayList.add(itemAt.getUri()); if (i == itemCount) { break; } else { i++; } } } uriArr = (Uri[]) arrayList.toArray(new Uri[0]); } else if (dataString != null) { Uri parse = Uri.parse(dataString); Intrinsics.checkNotNullExpressionValue(parse, "Uri.parse(dataString)"); uriArr = new Uri[]{parse}; } else { String str = mCameraPhotoPath; if (str != null) { Uri parse2 = Uri.parse(str); Intrinsics.checkNotNullExpressionValue(parse2, "Uri.parse(mCameraPhotoPath)"); uriArr = new Uri[]{parse2}; mCameraPhotoPath = (String) null; } } } ValueCallback<Uri[]> valueCallback = mFilePathCallback; if (valueCallback != null) { valueCallback.onReceiveValue(uriArr); } mFilePathCallback = (ValueCallback) null; return; } if (Build.VERSION.SDK_INT <= 19) { if (requestCode != 1) { super.onActivityResult(requestCode, resultCode, data); return; } if (resultCode != -1 || mUploadMessage == null) { return; } Uri uri = (Uri) null; if ((data != null ? data.getData() : null) != null) { uri = data.getData(); } else { if ((data != null ? data.getDataString() : null) != null) { uri = Uri.parse(data.getDataString()); } else { Uri uri2 = mCapturedImageURI; if (uri2 != null) { uri = uri2; } } } ValueCallback<Uri> valueCallback2 = mUploadMessage; if (valueCallback2 != null) { valueCallback2.onReceiveValue(uri); } mUploadMessage = (ValueCallback) null; } } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { Intrinsics.checkNotNullParameter(permissions, "permissions"); Intrinsics.checkNotNullParameter(grantResults, "grantResults"); super.onRequestPermissionsResult(requestCode, permissions, grantResults); Permission.INSTANCE.executeContinueMethod(grantResults); } @Override public void onConfigurationChanged(Configuration newConfig) { Intrinsics.checkNotNullParameter(newConfig, "newConfig"); behaviorForOrientation(newConfig.orientation); super.onConfigurationChanged(newConfig); } private final void changeViewPagerPadding(int value) { ((MyViewPager) _$_findCachedViewById(R.id.view_pager_main)).setPadding(0, 0, 0, value); } @Override public void onBackPressed() { Integer lastElement; Integer lastElement2; if (getMyApplication().getCurrentWebView() == null) { if (this.stackTabIndex.size() >= 2 && ((lastElement2 = this.stackTabIndex.lastElement()) == null || lastElement2.intValue() != 0)) { changeTabAccordingToStack(); return; } else { leaveSearchResultsActivity(); return; } } MyWebView currentWebView = getMyApplication().getCurrentWebView(); Intrinsics.checkNotNull(currentWebView); if (currentWebView.canGoBack()) { MyWebView currentWebView2 = getMyApplication().getCurrentWebView(); Intrinsics.checkNotNull(currentWebView2); currentWebView2.goBack(); } else if (this.stackTabIndex.size() >= 2 && ((lastElement = this.stackTabIndex.lastElement()) == null || lastElement.intValue() != 0)) { changeTabAccordingToStack(); } else { leaveSearchResultsActivity(); } } public final void openSearchActivity() { Intent intent = new Intent(this, (Class<?>) SearchActivity.class); intent.setFlags(268468224); startActivity(intent); } private final void leaveSearchResultsActivity() { getMyApplication().getConfirmationOnBack(); getParent(); getParentActivityIntent(); if (!getMyApplication().getConfirmationOnBack() || (getMyApplication().getConfirmationOnBack() && getMyApplication().getArrOpenedSite().size() == 0)) { openSearchActivity(); return; } DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { @Override public final void onClick(DialogInterface dialogInterface, int i) { SearchResultsActivity.this.openSearchActivity(); } }; String string = getString(R.string.app_name); Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.app_name)"); MyAlertDialog.create$default(MyAlertDialog.INSTANCE, this, false, string, null, 0, getString(R.string.search_results_leave_confirmation_message), null, 0, getString(R.string.yes), null, R.color.colorPrimary, onClickListener, getString(R.string.no), null, R.color.colorAccent, null, null, null, 0, null, null, 2073306, null).show(); } private final void changeTabAccordingToStack() { this.stackTabIndex.pop(); MyViewPager myViewPager = (MyViewPager) _$_findCachedViewById(R.id.view_pager_main); Integer lastElement = this.stackTabIndex.lastElement(); Intrinsics.checkNotNullExpressionValue(lastElement, "stackTabIndex.lastElement()"); myViewPager.setCurrentItem(lastElement.intValue(), true); } public final void showOpenOnlyInBrowserDialog(String siteName, final String url) { Intrinsics.checkNotNullParameter(siteName, "siteName"); Intrinsics.checkNotNullParameter(url, "url"); SearchResultsActivity searchResultsActivity = this; if (!Prefs.INSTANCE.getShowOpenOnlyInBrowserDialog(searchResultsActivity)) { openInBrowser(url); return; } final Ref.ObjectRef objectRef = new Ref.ObjectRef(); objectRef.element = (Dialog) 0; final View view = getLayoutInflater().inflate(R.layout.dialog_only_in_browser, (ViewGroup) null); DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { @Override public final void onClick(DialogInterface dialogInterface, int i) { SearchResultsActivity.this.openInBrowser(url); Dialog dialog = (Dialog) objectRef.element; if (dialog != null) { dialog.dismiss(); } } }; Intrinsics.checkNotNullExpressionValue(view, "view"); TextView textView = (TextView) view.findViewById(R.id.textview_only_in_browser_message); Intrinsics.checkNotNullExpressionValue(textView, "view.textview_only_in_browser_message"); textView.setText(getString(R.string.search_results_only_in_browser_message, new Object[]{siteName})); MyAlertDialog myAlertDialog = MyAlertDialog.INSTANCE; String string = getString(R.string.app_name); Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.app_name)"); objectRef.element = MyAlertDialog.create$default(myAlertDialog, searchResultsActivity, true, string, null, 0, null, null, 0, getString(R.string.ok), null, R.color.dark_blue, onClickListener, null, null, 0, null, null, null, 0, null, view, 1045240, null); Dialog dialog = (Dialog) objectRef.element; if (dialog != null) { dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public final void onDismiss(DialogInterface dialogInterface) { MyApplication myApplication; MyApplication myApplication2; View view2 = view; Intrinsics.checkNotNullExpressionValue(view2, "view"); AppCompatCheckBox appCompatCheckBox = (AppCompatCheckBox) view2.findViewById(R.id.checkbox_only_in_brwoser_do_not_show); Intrinsics.checkNotNullExpressionValue(appCompatCheckBox, "view.checkbox_only_in_brwoser_do_not_show"); if (appCompatCheckBox.isChecked()) { myApplication = SearchResultsActivity.this.getMyApplication(); myApplication.setShowOpenOnlyInBrowserDialog(false); Prefs prefs = Prefs.INSTANCE; SearchResultsActivity searchResultsActivity2 = SearchResultsActivity.this; SearchResultsActivity searchResultsActivity3 = searchResultsActivity2; myApplication2 = searchResultsActivity2.getMyApplication(); prefs.insertShowOpenOnlyInBrowserDialog(searchResultsActivity3, myApplication2.getShowOpenOnlyInBrowserDialog()); } } }); } ((Dialog) objectRef.element).show(); } public final void openSite(Site siteToOpen, boolean changeTab) { int i; Intrinsics.checkNotNullParameter(siteToOpen, "siteToOpen"); if (siteToOpen.getOpenInBrowser()) { Category categorySelected = getMyApplication().getCategorySelected(); Intrinsics.checkNotNull(categorySelected); showOpenOnlyInBrowserDialog(siteToOpen.getName(), Site.mountUrl$default(siteToOpen, this, categorySelected.getId(), getMyApplication().getSearchContentDisplay(), false, 8, null)); return; } int i2 = 0; int lastIndex = CollectionsKt.getLastIndex(getMyApplication().getArrOpenedSite()); if (lastIndex >= 0) { while (true) { Site site = getMyApplication().getArrOpenedSite().get(i2); Intrinsics.checkNotNullExpressionValue(site, "myApplication.arrOpenedSite.get(i)"); if (site.getId() == siteToOpen.getId()) { break; } else if (i2 == lastIndex) { break; } else { i2++; } } } i2 = -1; if (i2 == -1) { getMyApplication().getArrOpenedSite().add(siteToOpen); SearchResultsPagerAdapter searchResultsPagerAdapter = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } i = CollectionsKt.getLastIndex(searchResultsPagerAdapter.getArrFragments()) + 1; SearchResultsPagerAdapter searchResultsPagerAdapter2 = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter2 == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } ArrayList<BaseFragment> arrFragments = searchResultsPagerAdapter2.getArrFragments(); WebViewFragment.Companion companion = WebViewFragment.INSTANCE; String searchContentDisplay = getMyApplication().getSearchContentDisplay(); Category categorySelected2 = getMyApplication().getCategorySelected(); Intrinsics.checkNotNull(categorySelected2); arrFragments.add(companion.newInstance(i, siteToOpen, searchContentDisplay, categorySelected2)); SearchResultsPagerAdapter searchResultsPagerAdapter3 = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter3 == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } searchResultsPagerAdapter3.notifyDataSetChanged(); sitesFragmentNotifyDataSetChanged(); } else { i = i2 + 1; } if (changeTab) { ((MyViewPager) _$_findCachedViewById(R.id.view_pager_main)).setCurrentItem(i, true); } else { showCategoryIcon(); } } private final void closeAllSites() { if (!getMyApplication().getConfirmationOnClosingAllSites()) { performCloseAllSites(); return; } DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { @Override public final void onClick(DialogInterface dialogInterface, int i) { SearchResultsActivity.this.performCloseAllSites(); } }; String string = getString(R.string.app_name); Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.app_name)"); MyAlertDialog.create$default(MyAlertDialog.INSTANCE, this, false, string, null, 0, getString(R.string.search_results_close_all_sites_confirmation_message), null, 0, getString(R.string.yes), null, R.color.colorPrimary, onClickListener, getString(R.string.no), null, R.color.colorAccent, null, null, null, 0, null, null, 2073306, null).show(); } public final void performCloseAllSites() { getMyApplication().getArrOpenedSite().clear(); ArrayList arrayList = new ArrayList(); SearchResultsPagerAdapter searchResultsPagerAdapter = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } int lastIndex = CollectionsKt.getLastIndex(searchResultsPagerAdapter.getArrFragments()); int i = 1; if (1 <= lastIndex) { while (true) { SearchResultsPagerAdapter searchResultsPagerAdapter2 = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter2 == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } arrayList.add(searchResultsPagerAdapter2.getArrFragments().get(i)); if (i == lastIndex) { break; } else { i++; } } } SearchResultsPagerAdapter searchResultsPagerAdapter3 = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter3 == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } searchResultsPagerAdapter3.getArrFragments().removeAll(arrayList); updateViewPager(); } public final void closeSite(final Site siteToClose) { Intrinsics.checkNotNullParameter(siteToClose, "siteToClose"); if (!getMyApplication().getConfirmationOnClosingAsite()) { performCloseSite(siteToClose); return; } DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { @Override public final void onClick(DialogInterface dialogInterface, int i) { SearchResultsActivity.this.performCloseSite(siteToClose); } }; String string = getString(R.string.app_name); Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.app_name)"); MyAlertDialog.create$default(MyAlertDialog.INSTANCE, this, false, string, null, 0, getString(R.string.search_results_close_site_confirmation_message, new Object[]{siteToClose.getName()}), null, 0, getString(R.string.yes), null, R.color.colorPrimary, onClickListener, getString(R.string.no), null, R.color.colorAccent, null, null, null, 0, null, null, 2073306, null).show(); } public final void performCloseSite(Site siteToClose) { int i; Intrinsics.checkNotNullParameter(siteToClose, "siteToClose"); int lastIndex = CollectionsKt.getLastIndex(getMyApplication().getArrOpenedSite()); if (lastIndex >= 0) { i = 0; while (true) { Site site = getMyApplication().getArrOpenedSite().get(i); Intrinsics.checkNotNullExpressionValue(site, "myApplication.arrOpenedSite.get(i)"); if (site.getId() == siteToClose.getId()) { break; } else if (i == lastIndex) { break; } else { i++; } } } i = -1; if (i == -1) { return; } getMyApplication().getArrOpenedSite().remove(i); SearchResultsPagerAdapter searchResultsPagerAdapter = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } searchResultsPagerAdapter.getArrFragments().remove(i + 1); updateViewPager(); } private final void updateViewPager() { SearchResultsPagerAdapter searchResultsPagerAdapter = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } searchResultsPagerAdapter.notifyDataSetChanged(); sitesFragmentNotifyDataSetChanged(); ((MyViewPager) _$_findCachedViewById(R.id.view_pager_main)).setCurrentItem(0, true); showCategoryIcon(); } public final void sitesFragmentNotifyDataSetChanged() { SearchResultsPagerAdapter searchResultsPagerAdapter = this.searchResultsPagerAdapter; if (searchResultsPagerAdapter == null) { Intrinsics.throwUninitializedPropertyAccessException("searchResultsPagerAdapter"); } BaseFragment baseFragment = searchResultsPagerAdapter.getArrFragments().get(0); Objects.requireNonNull(baseFragment, "null cannot be cast to non-null type com.drewapps.searches.simple.view.searchResults.sites.SitesFragment"); ((SitesFragment) baseFragment).notifiyDataSetChanged(); } public final void setViewPagerStatus(boolean b) { ((MyViewPager) _$_findCachedViewById(R.id.view_pager_main)).setPagingEnabled(b); } private final void openDefaultSearchEngineForCategory() { ArrayList<Site> arrSite = getMyApplication().getArrSite(); ArrayList<Site> arrayList = new ArrayList(); for (Object obj : arrSite) { if (((Site) obj).getIsDefault()) { arrayList.add(obj); } } int i = -1; boolean z = true; for (Site site : arrayList) { i++; if (!site.getOpenInBrowser() || (site.getOpenInBrowser() && i == 0)) { openSite(site, z); } z = false; } } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { Intrinsics.checkNotNullParameter(menu, "menu"); Intrinsics.checkNotNullParameter(v, "v"); super.onCreateContextMenu(menu, v, menuInfo); SiteContextMenuHelper siteContextMenuHelper = this.siteContextMenuHelper; if (siteContextMenuHelper == null) { Intrinsics.throwUninitializedPropertyAccessException("siteContextMenuHelper"); } siteContextMenuHelper.onCreateContextMenu(menu, v, menuInfo); } @Override public boolean onContextItemSelected(MenuItem item) { Intrinsics.checkNotNullParameter(item, "item"); SiteContextMenuHelper siteContextMenuHelper = this.siteContextMenuHelper; if (siteContextMenuHelper == null) { Intrinsics.throwUninitializedPropertyAccessException("siteContextMenuHelper"); } siteContextMenuHelper.onContextItemSelected(item); return super.onContextItemSelected(item); } @Override public void onContextMenuSiteOpen(Site site) { Intrinsics.checkNotNullParameter(site, "site"); openSite(site, true); } @Override public void onContextMenuSiteOpenInNewTab(Site site) { Intrinsics.checkNotNullParameter(site, "site"); openSite(site, false); } @Override public void onContextMenuSiteClose(Site site) { Intrinsics.checkNotNullParameter(site, "site"); closeSite(site); } }