导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - SearchAutocompleteActivity.java 源代码

正在查看: Hopscotch v9.7.2 应用的 SearchAutocompleteActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package in.hopscotch.android.ui.autocomplete;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Editable;
import android.text.TextUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.internal.icing.v1;
import in.hopscotch.android.adapter.m0;
import in.hopscotch.android.application.a0;
import in.hopscotch.android.attribution.AttributionData;
import in.hopscotch.android.attribution.OrderAttributionHelper;
import in.hopscotch.android.common.helper.q;
import in.hopscotch.android.components.carousel.PageCarouselView;
import in.hopscotch.android.components.edittext.CustomEditBox;
import in.hopscotch.android.components.observers.o;
import in.hopscotch.android.components.util.x;
import in.hopscotch.android.databinding.t;
import in.hopscotch.android.domain.model.autocomplete.SearchSuggestion;
import in.hopscotch.android.domain.model.pagecarousel.PageCarousel;
import in.hopscotch.android.domain.model.search.SearchParameters;
import in.hopscotch.android.domain.model.tile.PageCarouselTile;
import in.hopscotch.android.util.a1;
import in.hopscotch.android.util.g0;
import in.hopscotch.android.util.s0;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.collections.h0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.FunctionAdapter;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.r;
import org.jetbrains.annotations.NotNull;

@Metadata
@SourceDebugExtension({"SMAP\nSearchAutocompleteActivity.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SearchAutocompleteActivity.kt\nin/hopscotch/android/ui/autocomplete/SearchAutocompleteActivity\n+ 2 Strings.kt\nkotlin/text/StringsKt__StringsKt\n+ 3 ArraysJVM.kt\nkotlin/collections/ArraysKt__ArraysJVMKt\n+ 4 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,578:1\n107#2:579\n79#2,22:580\n107#2:604\n79#2,22:605\n107#2:627\n79#2,22:628\n37#3,2:602\n1855#4,2:650\n*S KotlinDebug\n*F\n+ 1 SearchAutocompleteActivity.kt\nin/hopscotch/android/ui/autocomplete/SearchAutocompleteActivity\n*L\n219#1:579\n219#1:580,22\n364#1:604\n364#1:605,22\n398#1:627\n398#1:628,22\n346#1:602,2\n431#1:650,2\n*E\n"})
public final class SearchAutocompleteActivity extends in.hopscotch.android.ui.autocomplete.b {

    @NotNull
    public static final a k = new a(null);
    private t binding;
    private io.reactivex.disposables.b disposable;
    public in.hopscotch.android.core.util.d j;
    private AttributionData localAttributionData;
    private m searchSuggestionsAdapter;

    @NotNull
    private final in.hopscotch.android.components.carousel.j carouselRepository = new in.hopscotch.android.components.carousel.j();

    @NotNull
    private String searchQuery = "";
    private String fromScreen = "";
    private String fromLocation = "";
    private String placeHolder = "";

    public static final class a {
        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        @NotNull
        public static Intent a(@NotNull Context context, int i, String str, String str2, String str3) {
            Intrinsics.checkNotNullParameter(context, "context");
            Intent intent = new Intent(context, (Class<?>) SearchAutocompleteActivity.class);
            intent.putExtra("id", i);
            intent.putExtra("FROM_SCREEN", str);
            intent.putExtra("from_location", str2);
            intent.putExtra("placeHolder", str3);
            return intent;
        }

        private a() {
        }
    }

    public final class b implements l {
        public b() {
        }

        @Override
        public final void a(@NotNull SearchSuggestion searchSuggestion, int i) {
            Intrinsics.checkNotNullParameter(searchSuggestion, "searchSuggestion");
            SearchAutocompleteActivity.b1(SearchAutocompleteActivity.this, searchSuggestion, i);
        }
    }

    public class c {
        public static final int[] a;

        static {
            int[] iArr = new int[SearchParameters.TYPE.values().length];
            try {
                iArr[SearchParameters.TYPE.KEYWORDS.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[SearchParameters.TYPE.PRODUCT.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                iArr[SearchParameters.TYPE.PRODUCT_TYPE_ID.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                iArr[SearchParameters.TYPE.CATEGORIES.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                iArr[SearchParameters.TYPE.SUBCATEGORIES.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                iArr[SearchParameters.TYPE.BROWSE_CATEGORIES.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                iArr[SearchParameters.TYPE.BRANDS.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                iArr[SearchParameters.TYPE.PROFILES.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                iArr[SearchParameters.TYPE.APP_LINK.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                iArr[SearchParameters.TYPE.RECENT_SEARCH.ordinal()] = 10;
            } catch (NoSuchFieldError unused10) {
            }
            a = iArr;
        }
    }

    public static final class d implements Observer, FunctionAdapter {
        private final Function1 function;

        public d(Function1 function) {
            Intrinsics.checkNotNullParameter(function, "function");
            this.function = function;
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof Observer) && (obj instanceof FunctionAdapter)) {
                return Intrinsics.areEqual(this.function, ((FunctionAdapter) obj).getFunctionDelegate());
            }
            return false;
        }

        @Override
        @NotNull
        public final kotlin.h<?> getFunctionDelegate() {
            return this.function;
        }

        public final int hashCode() {
            return this.function.hashCode();
        }

        public final void onChanged(Object obj) {
            this.function.invoke(obj);
        }
    }

    public static void W0(SearchAutocompleteActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        t tVar = this$0.binding;
        t tVar2 = null;
        if (tVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar = null;
        }
        Editable text = tVar.g.getText();
        if (text != null) {
            text.clear();
        }
        t tVar3 = this$0.binding;
        if (tVar3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
        } else {
            tVar2 = tVar3;
        }
        ImageView clearText = tVar2.b;
        Intrinsics.checkNotNullExpressionValue(clearText, "clearText");
        in.hopscotch.android.core.util.j.b(clearText);
    }

    public static void X0(SearchAutocompleteActivity this$0, PageCarousel pageCarousel, PageCarousel pageCarousel2, PageCarouselTile pageCarouselTile) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(pageCarousel, "$pageCarousel");
        Intrinsics.checkNotNullParameter(pageCarousel2, "<anonymous parameter 0>");
        Intrinsics.checkNotNullParameter(pageCarouselTile, "pageCarouselTile");
        Integer carouselId = pageCarousel.getCarouselId();
        Integer id = pageCarouselTile.getId();
        this$0.getClass();
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        in.hopscotch.android.common.helper.n.g(linkedHashMap, "carousel_id", carouselId);
        in.hopscotch.android.common.helper.n.g(linkedHashMap, "tile_id", id);
        in.hopscotch.android.common.helper.n.g(linkedHashMap, "from_screen", this$0.fromScreen);
        v1.g("search_carousel_tile_clicked", linkedHashMap, true, true, o.a());
        s0.f(this$0, pageCarouselTile.getActionUrl(), "", null, null, "Search", "Search Page Carousel", null, 0, pageCarouselTile.getId(), null);
    }

    public static void Y0(SearchAutocompleteActivity this$0) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        try {
            t tVar = this$0.binding;
            t tVar2 = null;
            if (tVar == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
                tVar = null;
            }
            tVar.g.requestFocus();
            Object systemService = this$0.getSystemService("input_method");
            Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.view.inputmethod.InputMethodManager");
            InputMethodManager inputMethodManager = (InputMethodManager) systemService;
            if (Build.VERSION.SDK_INT < 30) {
                inputMethodManager.toggleSoftInput(2, 1);
                return;
            }
            t tVar3 = this$0.binding;
            if (tVar3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
            } else {
                tVar2 = tVar3;
            }
            inputMethodManager.showSoftInput(tVar2.g, 0);
        } catch (Exception e) {
            this$0.g1().d(e);
        }
    }

    public static void Z0(SearchAutocompleteActivity this$0, SearchParameters searchParameters, int i) {
        String str;
        String str2;
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        Intrinsics.checkNotNullParameter(searchParameters, "$searchParameters");
        String string = this$0.getString(2132017244);
        Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
        String string2 = this$0.getString(2132019007);
        String str3 = this$0.searchQuery;
        if (!a1.d(this$0)) {
            g0.a(this$0);
            return;
        }
        Intent c2 = a0.c(this$0, false);
        Intrinsics.checkNotNullExpressionValue(c2, "createProductListIntent(...)");
        c2.putExtra("SEARCH_PARAM", searchParameters);
        c2.putExtra("IS_FROM_SEARCH", true);
        if (r.g(string, this$0.getString(2132017244), true)) {
            c2.putExtra("FROM_RECENT_SEARCH", true);
        }
        String name = searchParameters.name;
        Intrinsics.checkNotNullExpressionValue(name, "name");
        int length = name.length() - 1;
        int i2 = 0;
        boolean z = false;
        while (i2 <= length) {
            boolean z2 = Intrinsics.compare((int) name.charAt(!z ? i2 : length), 32) <= 0;
            if (z) {
                if (!z2) {
                    break;
                } else {
                    length--;
                }
            } else if (z2) {
                i2++;
            } else {
                z = true;
            }
        }
        c2.putExtra("PLP_ON_SEARCH_TITLE", name.subSequence(i2, length + 1).toString());
        q.a = string;
        q.f(string2);
        if (!TextUtils.isEmpty(searchParameters.displayName)) {
            name = searchParameters.displayName;
        }
        String str4 = name;
        x.b().getClass();
        x.a(searchParameters);
        SearchParameters.TYPE type = searchParameters.type;
        switch (type == null ? -1 : c.a[type.ordinal()]) {
            case 1:
                str = "Keyword";
                break;
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
                str = "CategorySuggestion";
                break;
            case 7:
                str = "BrandSuggestion";
                break;
            case 8:
                str = "ProfileSuggestion";
                break;
            default:
                str = "";
                break;
        }
        String str5 = str;
        if (searchParameters.isRecentSearch) {
            c2.putExtra("SEARCH_QUERY", searchParameters.name);
            str5 = "RecentSearch";
            str2 = "RecentSearch";
        } else {
            c2.putExtra("SEARCH_QUERY", str3);
            str2 = str;
        }
        c2.putExtra("SUGGESTION_INDEX", i + 1);
        in.hopscotch.android.analytics.a.d().a("Client autocomplete");
        String str6 = this$0.fromScreen;
        OrderAttributionHelper.getInstance().addAttributionData((String) null, str4, 0, (str6 == null || str6.equals("Discover")) ? str5 : "NS", (String) null, str2, (String) null, (String) null, (String) null, (String) null);
        this$0.startActivity(c2);
    }

    public static final void a1(SearchAutocompleteActivity searchAutocompleteActivity, String str) {
        searchAutocompleteActivity.getClass();
        t tVar = null;
        if (!r.i(str) && str.length() != 0) {
            t tVar2 = searchAutocompleteActivity.binding;
            if (tVar2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
            } else {
                tVar = tVar2;
            }
            ImageView clearText = tVar.b;
            Intrinsics.checkNotNullExpressionValue(clearText, "clearText");
            in.hopscotch.android.core.util.j.f(clearText);
            return;
        }
        m mVar = searchAutocompleteActivity.searchSuggestionsAdapter;
        if (mVar != null) {
            mVar.N(h0.a);
        }
        t tVar3 = searchAutocompleteActivity.binding;
        if (tVar3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar3 = null;
        }
        RecyclerView searchItemsList = tVar3.h;
        Intrinsics.checkNotNullExpressionValue(searchItemsList, "searchItemsList");
        in.hopscotch.android.core.util.j.b(searchItemsList);
        t tVar4 = searchAutocompleteActivity.binding;
        if (tVar4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
        } else {
            tVar = tVar4;
        }
        ImageView clearText2 = tVar.b;
        Intrinsics.checkNotNullExpressionValue(clearText2, "clearText");
        in.hopscotch.android.core.util.j.b(clearText2);
    }

    public static final void b1(in.hopscotch.android.ui.autocomplete.SearchAutocompleteActivity r20, in.hopscotch.android.domain.model.autocomplete.SearchSuggestion r21, int r22) {
        throw new UnsupportedOperationException("Method not decompiled: in.hopscotch.android.ui.autocomplete.SearchAutocompleteActivity.b1(in.hopscotch.android.ui.autocomplete.SearchAutocompleteActivity, in.hopscotch.android.domain.model.autocomplete.SearchSuggestion, int):void");
    }

    public static final void c1(SearchAutocompleteActivity searchAutocompleteActivity, in.hopscotch.android.util.autocomplete.a aVar) {
        List<SearchSuggestion> b2;
        if (aVar == null) {
            searchAutocompleteActivity.g1().d(new Exception("Params cannot be null or empty."));
            return;
        }
        searchAutocompleteActivity.getClass();
        if (aVar.c()) {
            Throwable b3 = aVar.b();
            if (b3 != null) {
                searchAutocompleteActivity.g1().d(new Exception(b3));
                return;
            }
            return;
        }
        in.hopscotch.android.domain.response.autcomplete.a a2 = aVar.a();
        if (a2 == null || (b2 = a2.b()) == null) {
            return;
        }
        t tVar = searchAutocompleteActivity.binding;
        if (tVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar = null;
        }
        RecyclerView searchItemsList = tVar.h;
        Intrinsics.checkNotNullExpressionValue(searchItemsList, "searchItemsList");
        in.hopscotch.android.core.util.j.f(searchItemsList);
        Iterator<T> it = b2.iterator();
        while (it.hasNext()) {
            ((SearchSuggestion) it.next()).setQuery(aVar.d());
        }
        String str = searchAutocompleteActivity.searchQuery;
        synchronized (searchAutocompleteActivity) {
            try {
                if (str.length() != 0 && !r.i(str)) {
                    m mVar = searchAutocompleteActivity.searchSuggestionsAdapter;
                    if (mVar != null) {
                        mVar.N(b2);
                    }
                }
                m mVar2 = searchAutocompleteActivity.searchSuggestionsAdapter;
                if (mVar2 != null) {
                    mVar2.N(h0.a);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public static final void d1(in.hopscotch.android.ui.autocomplete.SearchAutocompleteActivity r29, java.lang.String r30) {
        throw new UnsupportedOperationException("Method not decompiled: in.hopscotch.android.ui.autocomplete.SearchAutocompleteActivity.d1(in.hopscotch.android.ui.autocomplete.SearchAutocompleteActivity, java.lang.String):void");
    }

    public static final void f1(SearchAutocompleteActivity searchAutocompleteActivity, PageCarousel pageCarousel) {
        searchAutocompleteActivity.getClass();
        List<PageCarouselTile> tiles = pageCarousel.getTiles();
        t tVar = null;
        if ((tiles == null || tiles.isEmpty()) && pageCarousel.getTitleImage() == null) {
            t tVar2 = searchAutocompleteActivity.binding;
            if (tVar2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
            } else {
                tVar = tVar2;
            }
            PageCarouselView searchPageCarousel = tVar.i;
            Intrinsics.checkNotNullExpressionValue(searchPageCarousel, "searchPageCarousel");
            in.hopscotch.android.core.util.j.b(searchPageCarousel);
            return;
        }
        t tVar3 = searchAutocompleteActivity.binding;
        if (tVar3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar3 = null;
        }
        PageCarouselView searchPageCarousel2 = tVar3.i;
        Intrinsics.checkNotNullExpressionValue(searchPageCarousel2, "searchPageCarousel");
        in.hopscotch.android.core.util.j.f(searchPageCarousel2);
        t tVar4 = searchAutocompleteActivity.binding;
        if (tVar4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar4 = null;
        }
        tVar4.i.o(pageCarousel, (Integer) null, (in.hopscotch.android.analytics.g) null, PageCarouselView.a.SEARCH, (Bundle) null);
        Integer carouselId = pageCarousel.getCarouselId();
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        in.hopscotch.android.common.helper.n.g(linkedHashMap, "carousel_id", carouselId);
        in.hopscotch.android.common.helper.n.g(linkedHashMap, "from_screen", searchAutocompleteActivity.fromScreen);
        v1.g("search_carousel_viewed", linkedHashMap, true, true, o.a());
        t tVar5 = searchAutocompleteActivity.binding;
        if (tVar5 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
        } else {
            tVar = tVar5;
        }
        tVar.i.setPageCarouselClickListener(new androidx.media3.exoplayer.analytics.g(searchAutocompleteActivity, pageCarousel));
    }

    @Override
    public final void B0() {
    }

    @Override
    public final void b0() {
        t tVar = this.binding;
        if (tVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar = null;
        }
        ConstraintLayout searchAutocompleteContainer = tVar.e;
        Intrinsics.checkNotNullExpressionValue(searchAutocompleteContainer, "searchAutocompleteContainer");
        showOffLineSnackBar(searchAutocompleteContainer);
    }

    @NotNull
    public final in.hopscotch.android.core.util.d g1() {
        in.hopscotch.android.core.util.d dVar = this.j;
        if (dVar != null) {
            return dVar;
        }
        Intrinsics.throwUninitializedPropertyAccessException("logger");
        return null;
    }

    public final void h1() {
        Object systemService = getSystemService("input_method");
        Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.view.inputmethod.InputMethodManager");
        InputMethodManager inputMethodManager = (InputMethodManager) systemService;
        t tVar = this.binding;
        if (tVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar = null;
        }
        inputMethodManager.hideSoftInputFromWindow(tVar.g.getWindowToken(), 0);
    }

    @Override
    public final void onCreate(Bundle bundle) {
        ArrayList arrayList;
        int i = 2;
        int i2 = 3;
        super.onCreate(bundle);
        t b2 = t.b(getLayoutInflater());
        Intrinsics.checkNotNullExpressionValue(b2, "inflate(...)");
        this.binding = b2;
        setContentView(b2.a());
        this.carouselRepository.g().observe(this, new d(new in.hopscotch.android.ui.autocomplete.d(this)));
        t tVar = null;
        this.carouselRepository.e((Integer) null, kotlin.collections.s0.g(new Pair("carouselType", "SearchCarousel")));
        this.localAttributionData = OrderAttributionHelper.getInstance().getCurrentAttributionData();
        this.fromScreen = getIntent().getStringExtra("FROM_SCREEN");
        this.fromLocation = getIntent().getStringExtra("from_location");
        this.placeHolder = getIntent().getStringExtra("placeHolder");
        t tVar2 = this.binding;
        if (tVar2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar2 = null;
        }
        tVar2.a.setOnClickListener(new com.google.android.material.datepicker.m(this, 25));
        t tVar3 = this.binding;
        if (tVar3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar3 = null;
        }
        tVar3.h.setLayoutManager(new LinearLayoutManager(this, 1, false));
        this.searchSuggestionsAdapter = new m(h0.a, new b());
        t tVar4 = this.binding;
        if (tVar4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar4 = null;
        }
        tVar4.h.setAdapter(this.searchSuggestionsAdapter);
        t tVar5 = this.binding;
        if (tVar5 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar5 = null;
        }
        tVar5.b.setOnClickListener(new in.hopscotch.android.hsplp.ui.xltile.d(this, i));
        t tVar6 = this.binding;
        if (tVar6 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar6 = null;
        }
        tVar6.g.setHint(this.placeHolder);
        t tVar7 = this.binding;
        if (tVar7 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar7 = null;
        }
        CustomEditBox textChanges = tVar7.g;
        Intrinsics.checkNotNullExpressionValue(textChanges, "searchEditText");
        Intrinsics.checkParameterIsNotNull(textChanges, "$this$textChanges");
        this.disposable = new com.jakewharton.rxbinding3.widget.a(textChanges).map(new in.hopscotch.android.components.carousel.i(new e(this), 3)).filter(new in.hopscotch.android.application.observers.c(4, f.h)).debounce(300L, TimeUnit.MILLISECONDS).distinctUntilChanged().switchMap(new in.hopscotch.android.data.impl.department.a(new g(this), 3)).subscribeOn(io.reactivex.schedulers.a.b).observeOn(io.reactivex.android.schedulers.a.a()).subscribe(new in.hopscotch.android.data.impl.exchange.a(new h(this), 2), new in.hopscotch.android.components.carousel.i(new i(this), 4));
        t tVar8 = this.binding;
        if (tVar8 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            tVar8 = null;
        }
        CustomEditBox searchEditText = tVar8.g;
        Intrinsics.checkNotNullExpressionValue(searchEditText, "searchEditText");
        j onDone = new j(this);
        Intrinsics.checkNotNullParameter(searchEditText, "<this>");
        Intrinsics.checkNotNullParameter(onDone, "onDone");
        searchEditText.setOnEditorActionListener(new in.hopscotch.android.adapter.s0(onDone, 1));
        x.b().getClass();
        String A = in.hopscotch.android.common.util.j.A();
        if (TextUtils.isEmpty(A)) {
            arrayList = new ArrayList();
        } else {
            List<SearchParameters> list = (List) x.c(A).get(in.hopscotch.android.common.util.j.E());
            ArrayList arrayList2 = new ArrayList();
            if (list != null) {
                for (SearchParameters searchParameters : list) {
                    if (searchParameters != null) {
                        searchParameters.isRecentSearch = true;
                        searchParameters.displayName = !TextUtils.isEmpty(searchParameters.displayName) ? searchParameters.displayName : searchParameters.name;
                    }
                    arrayList2.add(searchParameters);
                }
                Collections.reverse(arrayList2);
                arrayList = arrayList2;
            } else {
                arrayList = new ArrayList();
            }
        }
        if (arrayList.isEmpty()) {
            t tVar9 = this.binding;
            if (tVar9 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
            } else {
                tVar = tVar9;
            }
            Group recentSearchesGroup = tVar.d;
            Intrinsics.checkNotNullExpressionValue(recentSearchesGroup, "recentSearchesGroup");
            in.hopscotch.android.core.util.j.b(recentSearchesGroup);
        } else {
            t tVar10 = this.binding;
            if (tVar10 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
                tVar10 = null;
            }
            Group recentSearchesGroup2 = tVar10.d;
            Intrinsics.checkNotNullExpressionValue(recentSearchesGroup2, "recentSearchesGroup");
            in.hopscotch.android.core.util.j.f(recentSearchesGroup2);
            int size = arrayList.size();
            for (int i3 = 0; i3 < size; i3++) {
                FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
                int c2 = in.hopscotch.android.core.util.j.c(8);
                layoutParams.setMargins(0, c2, c2, in.hopscotch.android.core.util.j.c(2));
                layoutParams.gravity = 17;
                CardView cardView = new CardView(this);
                cardView.setLayoutParams(layoutParams);
                cardView.setRadius(in.hopscotch.android.core.util.j.c(16));
                FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2);
                TextView textView = new TextView(cardView.getContext());
                textView.setTextSize(2, 12.0f);
                textView.setBackgroundResource(2131232384);
                textView.setTextColor(androidx.core.content.a.b(cardView.getContext(), 2131100826));
                textView.setSingleLine();
                textView.setEllipsize(TextUtils.TruncateAt.END);
                textView.setGravity(17);
                textView.setLayoutParams(layoutParams2);
                textView.setText(((SearchParameters) arrayList.get(i3)).name);
                cardView.addView(textView);
                cardView.setOnClickListener(new m0(this, (SearchParameters) arrayList.get(i3), i3, 3));
                t tVar11 = this.binding;
                if (tVar11 == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("binding");
                    tVar11 = null;
                }
                tVar11.c.addView(cardView);
            }
        }
        new Handler(Looper.getMainLooper()).postDelayed(new in.hopscotch.android.hspdp.helper.k(this, i2), 100L);
    }

    @Override
    public final void onDestroy() {
        super.onDestroy();
        io.reactivex.disposables.b bVar = this.disposable;
        if (bVar != null) {
            bVar.dispose();
        }
        h1();
    }

    @Override
    public final void onPause() {
        super.onPause();
        h1();
    }

    public final void onResume() {
        OrderAttributionHelper.getInstance().setCurrentOrderAttributionData(this.localAttributionData);
        super/*androidx.fragment.app.n*/.onResume();
    }
}