得物.apk(点击下载) / MapAddressPickerActivity.java


package com.shizhuang.duapp.modules.address;

import android.graphics.Point;
import android.os.Bundle;
import android.util.ArrayMap;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.Keep;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.OneShotPreDrawListener;
import androidx.lifecycle.ViewModelLazy;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import cd.l;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.knightboost.weaver.api.Scope;
import com.knightboost.weaver.api.annotations.Insert;
import com.knightboost.weaver.api.annotations.TargetClass;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.R;
import com.shizhuang.duapp.common.component.module.NormalModuleAdapter;
import com.shizhuang.duapp.common.extension.ViewExtensionKt;
import com.shizhuang.duapp.common.helper.locationsearch.GeoCoderResultListener;
import com.shizhuang.duapp.common.ui.BaseLeftBackActivity;
import com.shizhuang.duapp.common.widget.PlaceholderLayout;
import com.shizhuang.duapp.libs.bpm.BM;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.libs.duimageloaderview.options.DuScaleType;
import com.shizhuang.duapp.modules.du_mall_common.api.LoadResultKt;
import com.shizhuang.duapp.modules.du_mall_common.extension.LiveDataExtensionKt;
import com.shizhuang.duapp.modules.du_mall_common.utils.exposure.MallModuleExposureHelper;
import com.shizhuang.duapp.modules.du_mall_common.widget.DuLinearDividerDecoration;
import com.shizhuang.model.location.AddressComponentModel;
import com.shizhuang.model.location.GeoAddressResult;
import com.shizhuang.model.location.PoiInfoModel;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.TuplesKt;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt__IterablesKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Reflection;

@Route(path = "/order/MapAddressPickerPage")
@Metadata(bv = {}, d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0007\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lcom/shizhuang/duapp/modules/address/MapAddressPickerActivity;", "Lcom/shizhuang/duapp/common/ui/BaseLeftBackActivity;", "<init>", "()V", "du_order_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: MapAddressPickerActivity.kt */
public final class MapAddressPickerActivity extends BaseLeftBackActivity {
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: c  reason: collision with root package name */
    public final Lazy f10657c = new ViewModelLazy(Reflection.getOrCreateKotlinClass(MapAddressViewModel.class), new MapAddressPickerActivity$$special$$inlined$viewModels$2(this), new MapAddressPickerActivity$$special$$inlined$viewModels$1(this));
    public final NormalModuleAdapter d = new NormalModuleAdapter(false, 1);
    public final List<bv.b> e = new ArrayList();
    public AddressComponentModel f;

    /* renamed from: g  reason: collision with root package name */
    public final Lazy f10658g = LazyKt__LazyJVMKt.lazy(new MapAddressPickerActivity$listExposureHelper$2(this));

    /* renamed from: h  reason: collision with root package name */
    public HashMap f10659h;

    public class _boostWeave {
        public static ChangeQuickRedirect changeQuickRedirect;

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.appcompat.app.AppCompatActivity")
        @Insert(mayCreateSuper = true, value = "onCreate")
        @Keep
        public static void ActivityMethodWeaver_onCreate(@Nullable MapAddressPickerActivity mapAddressPickerActivity, Bundle bundle) {
            if (!PatchProxy.proxy(new Object[]{mapAddressPickerActivity, bundle}, null, changeQuickRedirect, true, 58887, new Class[]{MapAddressPickerActivity.class, Bundle.class}, Void.TYPE).isSupported) {
                jn.b bVar = jn.b.f34396a;
                if (!bVar.b()) {
                    bVar.d(true);
                }
                long currentTimeMillis = System.currentTimeMillis();
                MapAddressPickerActivity.e(mapAddressPickerActivity, bundle);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (mapAddressPickerActivity.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.address.MapAddressPickerActivity")) {
                    bVar.activityOnCreateMethod(mapAddressPickerActivity, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.appcompat.app.AppCompatActivity")
        @Insert(mayCreateSuper = true, value = "onResume")
        @Keep
        public static void ActivityMethodWeaver_onResume(MapAddressPickerActivity mapAddressPickerActivity) {
            if (!PatchProxy.proxy(new Object[]{mapAddressPickerActivity}, null, changeQuickRedirect, true, 58886, new Class[]{MapAddressPickerActivity.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                MapAddressPickerActivity.d(mapAddressPickerActivity);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (mapAddressPickerActivity.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.address.MapAddressPickerActivity")) {
                    jn.b.f34396a.activityOnResumeMethod(mapAddressPickerActivity, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.appcompat.app.AppCompatActivity")
        @Insert(mayCreateSuper = true, value = "onStart")
        @Keep
        public static void ActivityMethodWeaver_onStart(MapAddressPickerActivity mapAddressPickerActivity) {
            if (!PatchProxy.proxy(new Object[]{mapAddressPickerActivity}, null, changeQuickRedirect, true, 58888, new Class[]{MapAddressPickerActivity.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                MapAddressPickerActivity.f(mapAddressPickerActivity);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (mapAddressPickerActivity.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.address.MapAddressPickerActivity")) {
                    jn.b.f34396a.activityOnStartMethod(mapAddressPickerActivity, currentTimeMillis, currentTimeMillis2);
                }
            }
        }
    }

    /* compiled from: View.kt */
    public static final class a implements Runnable {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final /* synthetic */ View b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ MapAddressPickerActivity f10660c;

        public a(View view, MapAddressPickerActivity mapAddressPickerActivity) {
            this.b = view;
            this.f10660c = mapAddressPickerActivity;
        }

        public final void run() {
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 58894, new Class[0], Void.TYPE).isSupported) {
                this.f10660c.g().d().setValue(Integer.valueOf(this.b.getMeasuredHeight()));
            }
        }
    }

    /* compiled from: MapAddressPickerActivity.kt */
    public static final class b implements GeoCoderResultListener {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ MapAddressPickerActivity f10661a;

        /* JADX WARN: Incorrect args count in method signature: ()V */
        public b(MapAddressPickerActivity mapAddressPickerActivity) {
            this.f10661a = mapAddressPickerActivity;
        }

        @Override // com.shizhuang.duapp.common.helper.locationsearch.GeoCoderResultListener
        public void onFailure(int i, @org.jetbrains.annotations.Nullable String str, @org.jetbrains.annotations.Nullable Throwable th2) {
            if (!PatchProxy.proxy(new Object[]{new Integer(i), str, th2}, this, changeQuickRedirect, false, 58898, new Class[]{Integer.TYPE, String.class, Throwable.class}, Void.TYPE).isSupported && l.a(this.f10661a)) {
                BM.b mall = BM.mall();
                Pair[] pairArr = new Pair[2];
                pairArr[0] = TuplesKt.to("errorCode", String.valueOf(i));
                if (str == null) {
                    str = "";
                }
                pairArr[1] = TuplesKt.to("errorMsg", str);
                mall.c("order_map_poi_list_error", MapsKt__MapsKt.mapOf(pairArr));
                this.f10661a.showErrorView();
            }
        }

        @Override // com.shizhuang.duapp.common.helper.locationsearch.GeoCoderResultListener
        public void onSuccess(int i, @org.jetbrains.annotations.Nullable GeoAddressResult geoAddressResult) {
            if (!PatchProxy.proxy(new Object[]{new Integer(i), geoAddressResult}, this, changeQuickRedirect, false, 58897, new Class[]{Integer.TYPE, GeoAddressResult.class}, Void.TYPE).isSupported && l.a(this.f10661a)) {
                MapAddressPickerActivity mapAddressPickerActivity = this.f10661a;
                List<PoiInfoModel> list = null;
                mapAddressPickerActivity.f = geoAddressResult != null ? geoAddressResult.addressComponent : null;
                mapAddressPickerActivity.e.clear();
                List<bv.b> list2 = this.f10661a.e;
                if (geoAddressResult != null) {
                    list = geoAddressResult.pois;
                }
                if (list == null) {
                    list = CollectionsKt__CollectionsKt.emptyList();
                }
                ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(list, 10));
                Iterator<T> it2 = list.iterator();
                while (it2.hasNext()) {
                    arrayList.add(new bv.b(it2.next(), false, 2));
                }
                list2.addAll(arrayList);
                bv.b bVar = (bv.b) CollectionsKt___CollectionsKt.firstOrNull((List) this.f10661a.e);
                if (bVar != null) {
                    bVar.b(true);
                }
                MapAddressPickerActivity mapAddressPickerActivity2 = this.f10661a;
                mapAddressPickerActivity2.d.setItems(mapAddressPickerActivity2.e);
                ((RecyclerView) this.f10661a._$_findCachedViewById(R.id.rvPoi)).scrollToPosition(0);
                MapAddressPickerActivity mapAddressPickerActivity3 = this.f10661a;
                PatchProxyResult proxy = PatchProxy.proxy(new Object[0], mapAddressPickerActivity3, MapAddressPickerActivity.changeQuickRedirect, false, 58867, new Class[0], MallModuleExposureHelper.class);
                ((MallModuleExposureHelper) (proxy.isSupported ? proxy.result : mapAddressPickerActivity3.f10658g.getValue())).startAttachExposure(true);
                if (this.f10661a.e.isEmpty()) {
                    this.f10661a.showEmptyView();
                } else {
                    this.f10661a.showDataView();
                }
            }
        }
    }

    public static void d(MapAddressPickerActivity mapAddressPickerActivity) {
        if (!PatchProxy.proxy(new Object[0], mapAddressPickerActivity, changeQuickRedirect, false, 58874, new Class[0], Void.TYPE).isSupported) {
            super.onResume();
            i60.a aVar = i60.a.f33292a;
            Integer valueOf = Integer.valueOf(mapAddressPickerActivity.g().getPageType());
            if (!PatchProxy.proxy(new Object[]{valueOf}, aVar, i60.a.changeQuickRedirect, false, 124368, new Class[]{Object.class}, Void.TYPE).isSupported) {
                i60.b bVar = i60.b.f33293a;
                ArrayMap arrayMap = new ArrayMap(8);
                arrayMap.put("page_type", valueOf);
                bVar.b("trade_address_pageview", "1727", "", arrayMap);
            }
        }
    }

    public static void e(MapAddressPickerActivity mapAddressPickerActivity, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, mapAddressPickerActivity, changeQuickRedirect, false, 58881, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            super.onCreate(bundle);
        }
    }

    public static void f(MapAddressPickerActivity mapAddressPickerActivity) {
        if (!PatchProxy.proxy(new Object[0], mapAddressPickerActivity, changeQuickRedirect, false, 58883, new Class[0], Void.TYPE).isSupported) {
            super.onStart();
        }
    }

    public View _$_findCachedViewById(int i) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 58878, new Class[]{Integer.TYPE}, View.class);
        if (proxy.isSupported) {
            return (View) proxy.result;
        }
        if (this.f10659h == null) {
            this.f10659h = new HashMap();
        }
        View view = (View) this.f10659h.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.f10659h.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    public final MapAddressViewModel g() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 58866, new Class[0], MapAddressViewModel.class);
        return (MapAddressViewModel) (proxy.isSupported ? proxy.result : this.f10657c.getValue());
    }

    @Override // com.shizhuang.duapp.common.ui.BaseActivity, com.shizhuang.duapp.common.base.inter.IViewController
    public int getLayout() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 58868, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.activity_map_address_picker;
    }

    public final void h(boolean z) {
        Object[] objArr = {new Byte(z ? (byte) 1 : 0)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Boolean.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 58876, new Class[]{cls}, Void.TYPE).isSupported) {
            if (g().e() || z) {
                showLoadingView();
                if (g().e()) {
                    MapAddressViewModel g3 = g();
                    if (!PatchProxy.proxy(new Object[]{new Byte((byte) 0)}, g3, MapAddressViewModel.changeQuickRedirect, false, 58905, new Class[]{cls}, Void.TYPE).isSupported) {
                        g3.e = false;
                    }
                }
            }
            LatLng value = g().c().getValue();
            if (value != null) {
                new qd.b(getContext()).a(value.latitude, value.longitude, new b(this));
            }
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseActivity, com.shizhuang.duapp.common.base.inter.IViewController
    public void initData() {
        boolean z = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 58872, new Class[0], Void.TYPE).isSupported;
    }

    @Override // com.shizhuang.duapp.common.ui.BaseLeftBackActivity, com.shizhuang.duapp.common.ui.BaseActivity, com.shizhuang.duapp.common.base.inter.IViewController
    public void initView(@org.jetbrains.annotations.Nullable Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 58869, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            super.initView(bundle);
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 58870, new Class[0], Void.TYPE).isSupported) {
                NormalModuleAdapter normalModuleAdapter = this.d;
                normalModuleAdapter.getDelegate().C(bv.b.class, 1, null, -1, true, null, null, new MapAddressPickerActivity$initPoiRv$1(this));
                ((RecyclerView) _$_findCachedViewById(R.id.rvPoi)).setLayoutManager(new LinearLayoutManager(getContext()));
                float f12 = (float) 20;
                ((RecyclerView) _$_findCachedViewById(R.id.rvPoi)).addItemDecoration(new DuLinearDividerDecoration(getContext(), 0, null, (int) 4294046197L, 0, new Point(fi.b.b(f12), fi.b.b(f12)), false, false, 214));
                ((RecyclerView) _$_findCachedViewById(R.id.rvPoi)).setAdapter(this.d);
            }
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 58871, new Class[0], Void.TYPE).isSupported) {
                LiveDataExtensionKt.b(g().c(), this, new MapAddressPickerActivity$initObserver$1(this));
                LoadResultKt.h(g().b(), this, new MapAddressPickerActivity$initObserver$2(this), new MapAddressPickerActivity$initObserver$3(this));
            }
            showLoadingView();
            ViewExtensionKt.j((ImageView) _$_findCachedViewById(R.id.ivMyLocation), 0, new MapAddressPickerActivity$initView$1(this), 1);
            ((PlaceholderLayout) _$_findCachedViewById(R.id.placeholderLayout)).setEmptyContent("暂无相关数据");
            Toolbar toolbar = this.toolbar;
            OneShotPreDrawListener.add(toolbar, new a(toolbar, this));
            ((DuImageLoaderView) _$_findCachedViewById(R.id.bgMapPlaceHolder)).i("https://cdn.poizon.com/node-common/c7e46a72-c054-5eb3-4e5d-92b9dae1e82a-1125-846.png").p0(DuScaleType.CENTER_CROP).x();
        }
    }

    @Override // androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.shizhuang.duapp.common.ui.BaseLeftBackActivity, com.shizhuang.duapp.common.ui.BaseActivity
    public void onCreate(Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 58880, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            _boostWeave.ActivityMethodWeaver_onCreate(this, bundle);
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseActivity, com.shizhuang.duapp.common.base.inter.IViewController
    public void onNetErrorRetryClick() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 58875, new Class[0], Void.TYPE).isSupported) {
            super.onNetErrorRetryClick();
            if (g().c().getValue() != null) {
                h(true);
            }
        }
    }

    @Override // androidx.fragment.app.FragmentActivity, com.shizhuang.duapp.common.ui.BaseLeftBackActivity, com.shizhuang.duapp.common.ui.BaseActivity
    public void onResume() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 58873, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.ActivityMethodWeaver_onResume(this);
        }
    }

    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.shizhuang.duapp.common.ui.BaseLeftBackActivity, com.shizhuang.duapp.common.ui.BaseActivity
    public void onStart() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 58882, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.ActivityMethodWeaver_onStart(this);
        }
    }
}