导航菜单

页面标题

页面副标题

Petal Maps v4.7.0.310001 - NavFragment.java 源代码

正在查看: Petal Maps v4.7.0.310001 应用的 NavFragment.java JAVA 源代码文件

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


package com.huawei.maps.app.navigation.fragment;

import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.location.Location;
import android.os.Build;
import android.os.IBinder;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.Observer;
import com.huawei.hms.framework.common.NetworkUtil;
import com.huawei.hms.navi.navibase.model.FurnitureInfo;
import com.huawei.hms.navi.navibase.model.IntersectionNotice;
import com.huawei.hms.navi.navibase.model.LaneInfo;
import com.huawei.hms.navi.navibase.model.MapNaviLink;
import com.huawei.hms.navi.navibase.model.MapNaviPath;
import com.huawei.hms.navi.navibase.model.MapNaviStaticInfo;
import com.huawei.hms.navi.navibase.model.MapNaviTurnPoint;
import com.huawei.hms.navi.navibase.model.NaviInfo;
import com.huawei.hms.navi.navibase.model.SpeedInfo;
import com.huawei.hms.navi.navibase.model.locationstruct.NaviLatLng;
import com.huawei.hms.navi.navibase.model.locationstruct.NaviLocation;
import com.huawei.map.databus.MapDataBus;
import com.huawei.map.mapapi.HWMap;
import com.huawei.map.mapapi.model.CameraPosition;
import com.huawei.map.mapapi.model.LatLng;
import com.huawei.maps.app.R;
import com.huawei.maps.app.common.location.LocationHelper;
import com.huawei.maps.app.common.utils.BaseMapAppLifecycle;
import com.huawei.maps.app.common.utils.BaseMapApplication;
import com.huawei.maps.app.common.utils.task.TaskExecutor;
import com.huawei.maps.app.databinding.FragmentNavBinding;
import com.huawei.maps.app.databinding.LayoutQueryWearableCollaborEnableBinding;
import com.huawei.maps.app.databinding.MapStopNavDialogBinding;
import com.huawei.maps.app.databinding.PetalMapsChildViewBinding;
import com.huawei.maps.app.navigation.fragment.NavFragment;
import com.huawei.maps.app.navigation.helper.DriveNavHelper;
import com.huawei.maps.app.navigation.helper.WearableManager;
import com.huawei.maps.app.navigation.service.NavFloatingWindowService;
import com.huawei.maps.app.navigation.service.NavNotificationService;
import com.huawei.maps.app.navigation.utils.NavPopEventHelper;
import com.huawei.maps.app.navigation.viewmodel.NewRoadFeedbackViewModel;
import com.huawei.maps.app.petalmaps.IPatelMapsView;
import com.huawei.maps.app.petalmaps.PetalMapsActivity;
import com.huawei.maps.app.petalmaps.viewmode.ActivityViewModel;
import com.huawei.maps.app.routeplan.ui.bean.TicketErrorInfo;
import com.huawei.maps.app.routeplan.ui.fragment.RouteAddressEditFragment;
import com.huawei.maps.app.routeplan.util.RouteNavUtil;
import com.huawei.maps.app.routeplan.util.WorkerResult;
import com.huawei.maps.app.ugcrealtimedisplay.viewmodel.UGCRealTimeDisplayViewModel;
import com.huawei.maps.businessbase.applink.AppLinkHelper;
import com.huawei.maps.businessbase.bean.AchievementInfo;
import com.huawei.maps.businessbase.bean.NavCompleteInfo;
import com.huawei.maps.businessbase.database.commonaddress.bean.CommonAddressRecords;
import com.huawei.maps.businessbase.manager.FavoritesMakerHelper;
import com.huawei.maps.businessbase.manager.MapHelper;
import com.huawei.maps.businessbase.manager.tile.MapStyleSettingManager;
import com.huawei.maps.businessbase.model.Coordinate;
import com.huawei.maps.businessbase.model.DataBindingConfig;
import com.huawei.maps.businessbase.model.NaviCurRecord;
import com.huawei.maps.businessbase.model.Site;
import com.huawei.maps.businessbase.model.location.MapLocationStatus;
import com.huawei.maps.businessbase.model.navigation.MapDrivingInfo;
import com.huawei.maps.businessbase.network.NetworkConstant;
import com.huawei.maps.businessbase.report.CrashHandler;
import com.huawei.maps.businessbase.report.MapDevOpsReport;
import com.huawei.maps.businessbase.servicepermission.ServicePermission;
import com.huawei.maps.businessbase.servicepermission.helper.AppPermissionHelper;
import com.huawei.maps.businessbase.ui.BaseFragment;
import com.huawei.maps.businessbase.ui.DataBindingFragment;
import com.huawei.maps.businessbase.utils.PermissionsUtil;
import com.huawei.maps.businessbase.viewmodel.CommonActivityViewModel;
import com.huawei.maps.businessbase.viewmodel.CommonAddressRecordsViewModel;
import com.huawei.maps.commonui.model.ScreenDisplayStatus;
import com.huawei.maps.commonui.view.dialog.MapAlertDialog;
import com.huawei.maps.navi.listener.NavLocationChangeListener;
import com.huawei.maps.navi.listener.NaviArriveListener;
import com.huawei.maps.navi.listener.NaviCommonListener;
import com.huawei.maps.navi.service.NaviForegroundService;
import com.huawei.maps.navi.viewmodel.NaviViewModel;
import com.huawei.maps.poi.collect.data.QueryCommonAddressSiteTask;
import com.huawei.maps.poi.viewmodel.BottomViewModel;
import com.huawei.maps.poi.viewmodel.DetailViewModel;
import com.huawei.maps.privacy.agreement.AgreementRequestHelper;
import com.huawei.maps.route.viewmodel.RouteResultViewModel;
import com.huawei.secure.android.common.intent.SafeIntent;
import com.huawei.uikit.hwcheckbox.widget.HwCheckBox;
import defpackage.a06;
import defpackage.c31;
import defpackage.ep5;
import defpackage.gc0;
import defpackage.gm6;
import defpackage.gn4;
import defpackage.gp5;
import defpackage.hm6;
import defpackage.lk5;
import defpackage.lwa;
import defpackage.mwa;
import defpackage.n5;
import defpackage.ni4;
import defpackage.np6;
import defpackage.oa8;
import defpackage.ow6;
import defpackage.qp5;
import defpackage.qx7;
import defpackage.rp5;
import defpackage.rya;
import defpackage.sn7;
import defpackage.so4;
import defpackage.u04;
import defpackage.we;
import defpackage.xq5;
import defpackage.y64;
import defpackage.yta;
import defpackage.z09;
import defpackage.zb3;
import defpackage.zo5;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;

public class NavFragment extends DataBindingFragment<FragmentNavBinding> implements WearableManager.WearableListener {
    public static final String L = "NavFragment";
    public int A;
    public boolean D;
    public Timer F;
    public qp5 G;
    public NaviViewModel c;
    public SpeedReportViewModel d;
    public NewRoadFeedbackViewModel e;
    public UGCRealTimeDisplayViewModel f;
    public we g;
    public SafeIntent h;
    public NavFloatingWindowService i;
    public NavNotificationService.a j;
    public ServiceConnection k;
    public ServiceConnection l;
    public ServiceConnection m;
    public NaviForegroundService.a n;
    public MapAlertDialog o;
    public MapAlertDialog p;
    public MapAlertDialog q;
    public MapAlertDialog r;
    public int t;
    public zo5 w;
    public WearableManager x;
    public AchievementInfo y;
    public boolean z;
    public ScreenDisplayStatus s = ScreenDisplayStatus.NORMAL_AND_PORTRAIT;
    public boolean u = false;
    public boolean v = false;
    public volatile boolean B = true;
    public volatile boolean C = true;
    public final RouteAddressEditFragment.d E = new RouteAddressEditFragment.d(NaviCurRecord.getInstance());
    public long H = 0;
    public Observer<IntersectionNotice> I = new Observer() {
        public final void onChanged(Object obj) {
            NavFragment.G0((IntersectionNotice) obj);
        }
    };
    public Runnable J = new o();
    public Runnable K = new d();

    public class a implements ServiceConnection {
        public a() {
        }

        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            hm4.p(NavFragment.L, "floatingWindow bind");
            NavFragment.this.i = ((NavFloatingWindowService.b) iBinder).a();
            NavFragment.this.g.z(NavFragment.this.i);
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            hm4.p(NavFragment.L, "floatingWindow unbind");
        }
    }

    public class b implements ServiceConnection {
        public b() {
        }

        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            hm4.p(NavFragment.L, "FoldScreenService bind");
            NavFragment.this.j = (NavNotificationService.a) iBinder;
            NavFragment.this.j.c(ct3.Q());
            we unused = NavFragment.this.g;
            we.n().A(NavFragment.this.j);
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            hm4.p(NavFragment.L, "FoldScreenService unbind");
        }
    }

    public class c implements ServiceConnection {
        public c() {
        }

        public static void b(NaviForegroundService naviForegroundService) {
            if (naviForegroundService != null) {
                hm4.p(NavFragment.L, "ForegroundService is not null");
                naviForegroundService.a();
            }
        }

        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            hm4.p(NavFragment.L, "ForegroundService bind");
            NavFragment.this.n = (NaviForegroundService.a) iBinder;
            final NaviForegroundService a = NavFragment.this.n.a();
            try {
                if (Build.VERSION.SDK_INT >= 31) {
                    rya.a.b(new WorkerResult() {
                        @Override
                        public final void doWork() {
                            NavFragment.c.b(a);
                        }
                    });
                } else if (a != null) {
                    hm4.p(NavFragment.L, "ForegroundService is not null");
                    a.a();
                }
            } catch (Exception e) {
                o05.c(e, true);
                hm4.p(NavFragment.L, "nav onServiceConnected fail");
            }
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            hm4.p(NavFragment.L, "ForegroundService unbind");
        }
    }

    public class d implements Runnable {
        public d() {
        }

        @Override
        public void run() {
            gz4.h1().R2();
        }
    }

    public class e implements BaseMapAppLifecycle.AppRunSituationCallBack {
        public final BaseMapApplication a;

        public e(BaseMapApplication baseMapApplication) {
            this.a = baseMapApplication;
        }

        public void situation() {
            if (c06.b() && NavFragment.this.h == null && NavFragment.this.getActivity() != null) {
                BaseMapApplication baseMapApplication = this.a;
                if (baseMapApplication == null || baseMapApplication.isAppBackground()) {
                    NavFragment.this.l1();
                    NavFragment.this.Z0();
                }
            }
        }
    }

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

        static {
            int[] iArr = new int[ScreenDisplayStatus.values().length];
            a = iArr;
            try {
                iArr[ScreenDisplayStatus.NORMAL_AND_LANDSCAPE.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[ScreenDisplayStatus.MATAX_AND_TAHITI_AND_LANDSCAPE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
        }
    }

    public class g extends TimerTask {
        public g() {
        }

        @Override
        public void run() {
            hm4.p(NavFragment.L, "isPoiAddFinish = " + MapHelper.F2().c4());
            if (MapHelper.F2().c4()) {
                NavFragment.this.x0();
                if (ct3.Q()) {
                    NavFragment.this.v0();
                }
                hm4.p(NavFragment.L, "isDriveNav = " + k06.r());
                if (k06.r()) {
                    NavFragment.this.k1();
                }
                MapHelper.F2().G7(false);
                if (NavFragment.this.F != null) {
                    NavFragment.this.F.cancel();
                }
            }
        }
    }

    public class h implements Observer<List<FurnitureInfo>> {
        public h() {
        }

        public void onChanged(List<FurnitureInfo> list) {
            hm4.p(NavFragment.L, "serviceAreaInfos onChanged...");
            xq5.d().h(list);
        }
    }

    public class i implements Observer<MapNaviTurnPoint[]> {
        public i() {
        }

        public void onChanged(MapNaviTurnPoint[] mapNaviTurnPointArr) {
            gz4.h1().H1(mapNaviTurnPointArr);
        }
    }

    public class j implements Observer<LaneInfo> {
        public j() {
        }

        public void onChanged(LaneInfo laneInfo) {
            if (laneInfo == null) {
                DriveNavHelper.v().C();
            } else {
                DriveNavHelper.v().N0(laneInfo);
            }
        }
    }

    public class k implements NaviCommonListener {
        public k() {
        }

        public void onNaviInfoUpdate(NaviInfo naviInfo) {
            uk3.L().w(naviInfo);
            we.n().p(naviInfo);
        }

        public void onReCalculateRouteForYaw(String str) {
            DriveNavHelper.v().L0(true);
            if (com.huawei.maps.app.petalmaps.a.x1().isShowAlongCard()) {
                hm4.p(NavFragment.L, "onReCalculateRouteForYaw isShowAlongCard  hide it ");
                com.huawei.maps.app.petalmaps.a.x1().a2();
            }
            NavPopEventHelper.e().k(12);
            y64.h().l();
            xq5.d().b();
            if (k06.r()) {
                DriveNavHelper.v().O0(str);
                DriveNavHelper.v().H0(false);
                tp5.d().u((ArrayList) null);
                ep5.k().n();
            } else {
                yta.s().W(str);
                yta.s().P(false);
                yta.s().O(null);
            }
            we.n().q(str);
        }
    }

    public class l implements NaviArriveListener {
        public l() {
        }

        public void onArriveDestination(MapNaviStaticInfo mapNaviStaticInfo) {
            NavFragment.this.n0(mapNaviStaticInfo);
        }

        public void onArrivedWayPoint(int i) {
            NavFragment.this.o0(i);
        }
    }

    public class m implements NavLocationChangeListener {
        public m() {
        }

        public void handleLocationChange(NaviLocation naviLocation) {
            NaviLatLng coord = naviLocation.getCoord();
            double latitude = coord.getLatitude();
            double longitude = coord.getLongitude();
            im4.b(NavFragment.L, "NaviLocation latitude : " + latitude + "   longitude : " + longitude);
            MapHelper.F2().h1();
        }
    }

    public class n implements Observer<Boolean> {
        public n() {
        }

        public void onChanged(Boolean bool) {
            hm4.p(NavFragment.L, "onChanged: " + bool);
            if (bool.booleanValue()) {
                com.huawei.maps.app.petalmaps.a.x1().dismissPermissionDialog();
            } else {
                com.huawei.maps.app.petalmaps.a.x1().showLocationAlertDialog(0, NavFragment.this.getActivity());
            }
        }
    }

    public class o implements Runnable {
        public o() {
        }

        @Override
        public void run() {
            FragmentActivity activity = NavFragment.this.getActivity();
            if (activity == null) {
                hm4.h(NavFragment.L, "startNavForegroundService activity is null");
            } else {
                hm4.p(NavFragment.L, "startNavForegroundService SDK_INT > O");
                activity.startForegroundService(NavFragment.this.h);
            }
        }
    }

    public static class p implements Observer<Boolean> {
        public void onChanged(Boolean bool) {
            if (bool.booleanValue()) {
                return;
            }
            LocationHelper.v().setLocationStatus(MapLocationStatus.ERROR);
            cz9.p(o41.b().getResources().getString(Build.VERSION.SDK_INT >= 29 ? R.string.map_msg_location_closed_hms_always : R.string.map_nav_msg_location_closed_hms));
        }

        public p() {
        }
    }

    public static void G0(IntersectionNotice intersectionNotice) {
        if (1 == intersectionNotice.getType()) {
            y64.h().k(intersectionNotice);
        } else {
            y64.h().m(intersectionNotice);
        }
    }

    public static void J0(MapNaviStaticInfo mapNaviStaticInfo) {
        p79.i("sp_nav_driver_total_distance", mapNaviStaticInfo.getDrivenDist(), o41.c());
        p79.i("sp_nav_driver_partial_time", mapNaviStaticInfo.getRerouteTime(), o41.c());
        p79.i("sp_nav_driver_partial_distance", mapNaviStaticInfo.getDrivenDist(), o41.c());
    }

    public static void L0(DialogInterface dialogInterface) {
        if (c06.b()) {
            AppLinkHelper.p().M();
            AppLinkHelper.p().L();
        }
    }

    public static void O0(DialogInterface dialogInterface) {
        if (c06.b()) {
            AppLinkHelper.p().M();
        }
    }

    public static void R0(View view) {
        if (view instanceof HwCheckBox) {
            p79.g("IS_POPUP_WEARABLE", ((HwCheckBox) view).isChecked(), o41.c());
        }
    }

    public static void S0(LayoutQueryWearableCollaborEnableBinding layoutQueryWearableCollaborEnableBinding, View view) {
        if (layoutQueryWearableCollaborEnableBinding != null) {
            boolean isChecked = layoutQueryWearableCollaborEnableBinding.checkboxAskPrompt.isChecked();
            layoutQueryWearableCollaborEnableBinding.checkboxAskPrompt.setChecked(!isChecked);
            p79.g("IS_POPUP_WEARABLE", !isChecked, o41.c());
        }
    }

    public static void V0(LayoutQueryWearableCollaborEnableBinding layoutQueryWearableCollaborEnableBinding, DialogInterface dialogInterface) {
        if (layoutQueryWearableCollaborEnableBinding != null) {
            p79.g("IS_POPUP_WEARABLE", layoutQueryWearableCollaborEnableBinding.checkboxAskPrompt.isChecked(), o41.c());
        }
    }

    private void a1() {
        hm4.p(L, "removeObservers...");
        getActivityViewModel(CommonActivityViewModel.class).a().removeObservers(getViewLifecycleOwner());
        ((ActivityViewModel) getActivityViewModel(ActivityViewModel.class)).m().removeObservers(getViewLifecycleOwner());
        LocationHelper.v().getIsHMSLocationEnable().removeObservers(getViewLifecycleOwner());
        NaviViewModel naviViewModel = this.c;
        if (naviViewModel != null) {
            naviViewModel.p.s1().removeObservers(getViewLifecycleOwner());
            this.c.p.x1().removeObservers(getViewLifecycleOwner());
            this.c.k().removeObservers(getViewLifecycleOwner());
            this.c.p.b1().removeObservers(getViewLifecycleOwner());
            this.c.p.c1().removeObservers(getViewLifecycleOwner());
            this.c.p.r1().removeObservers(getViewLifecycleOwner());
            this.c.p.l1().removeObservers(getViewLifecycleOwner());
            this.c.p.i1().removeObserver(this.I);
        }
    }

    public void handleScreenDisplayStatusChange(ScreenDisplayStatus screenDisplayStatus) {
        hm4.p(L, "screenDisplayStatus in nav change to :" + screenDisplayStatus.name());
        ct3.h0(getActivity(), k06.r());
        ScreenDisplayStatus screenDisplayStatus2 = this.s;
        if (screenDisplayStatus2 != null && !screenDisplayStatus2.equals(screenDisplayStatus)) {
            b1(screenDisplayStatus);
        }
        this.s = screenDisplayStatus;
        this.w.d(screenDisplayStatus);
    }

    public void r0(NaviInfo naviInfo) {
        if (naviInfo == null) {
            hm4.h(L, "handleNaviInfoUpdate failed, navInfo is null .");
            return;
        }
        W();
        if (!this.u) {
            this.u = true;
            c31.h();
            c31.d();
        }
        this.g.p(naviInfo);
        X(naviInfo);
        X0(naviInfo);
    }

    private void u1() {
        t1();
        r1();
        s1();
    }

    private void y0() {
        getActivityViewModel(CommonActivityViewModel.class).a().observe(getViewLifecycleOwner(), new Observer() {
            public final void onChanged(Object obj) {
                NavFragment.this.handleScreenDisplayStatusChange((ScreenDisplayStatus) obj);
            }
        });
        this.c.p.s1().observe(getViewLifecycleOwner(), new Observer() {
            public final void onChanged(Object obj) {
                NavFragment.this.r0((NaviInfo) obj);
            }
        });
        this.c.p.x1().observe(getViewLifecycleOwner(), new h());
        this.c.k().observe(getViewLifecycleOwner(), new Observer() {
            public final void onChanged(Object obj) {
                NavFragment.this.q0(((Integer) obj).intValue());
            }
        });
        this.c.p.b1().observe(getViewLifecycleOwner(), new Observer() {
            public final void onChanged(Object obj) {
                NavFragment.this.p0((Boolean) obj);
            }
        });
        this.c.p.c1().observe(getViewLifecycleOwner(), new Observer() {
            public final void onChanged(Object obj) {
                NavFragment.this.F0((NaviLocation) obj);
            }
        });
        this.c.p.r1().observe(getViewLifecycleOwner(), new i());
        this.c.p.k1().observe(getViewLifecycleOwner(), new j());
        this.c.p.i1().observeForever(this.I);
        this.c.p.J2(new k());
        this.c.p.G2(new l());
        this.c.p.F2(new m());
    }

    public final boolean A0() {
        MapNaviPath naviPath = it3.x().getNaviPath();
        if (naviPath == null || !k06.r()) {
            return false;
        }
        List allLinks = naviPath.getAllLinks();
        if (tha.b(allLinks) || "N".equals(p19.F().f0())) {
            return false;
        }
        return "deu".equals(((MapNaviLink) allLinks.get(0)).getCountryCode()) || "deu".equals(((MapNaviLink) allLinks.get(allLinks.size() - 1)).getCountryCode());
    }

    public final void B0(CommonAddressRecords commonAddressRecords) {
        this.B = commonAddressRecords != null;
        hm4.p(L, "initCommuteAddress hasCompany:" + this.B);
    }

    public final void C0(CommonAddressRecords commonAddressRecords) {
        this.C = commonAddressRecords != null;
        hm4.p(L, "initCommuteAddress hasHome:" + this.C);
    }

    public final void D0(boolean z) {
        this.D = z;
        hm4.p(L, "showCommon:" + z);
    }

    public final void E0() {
        c0(true);
    }

    public final void F0(NaviLocation naviLocation) {
        this.c.p.G1(naviLocation);
        pa.e().k((MapHelper.F2().o2() >= 17.0f && cl3.r().C() && cl3.r().D()) ? false : true);
    }

    public final void H0() {
        j1(false);
    }

    public final void I0() {
        WearableManager wearableManager = this.x;
        if (wearableManager != null) {
            wearableManager.y(true);
        }
    }

    public final void M0(View view) {
        if (getActivity() == null) {
            return;
        }
        AppLinkHelper.p().S(true);
        o1();
        a0();
    }

    public final void N0(View view) {
        a0();
    }

    public final void P0(View view) {
        if (getActivity() == null) {
            return;
        }
        AppLinkHelper.p().S(false);
        o1();
        b0();
    }

    public final void Q0(View view) {
        b0();
    }

    public final void T0(LayoutQueryWearableCollaborEnableBinding layoutQueryWearableCollaborEnableBinding, View view) {
        if (layoutQueryWearableCollaborEnableBinding != null) {
            if (layoutQueryWearableCollaborEnableBinding.checkboxAskPrompt.isChecked()) {
                p19.F().J2("N");
            }
            this.x.j(false);
            pn5.A0(WearableManager.q(), "N");
            MapAlertDialog mapAlertDialog = this.r;
            if (mapAlertDialog != null) {
                mapAlertDialog.m();
            }
        }
    }

    public final boolean U() {
        int E = it3.x().E();
        int drivenDist = it3.x().y().getDrivenDist();
        hm4.p(L, "get Navi total dist: " + E + "  driveDis dist: " + drivenDist);
        if (E >= 10000 && drivenDist < 1000) {
            return true;
        }
        if (E < 1000 || E >= 10000 || drivenDist >= E * 0.1f) {
            return E < 1000 && !this.c.p.J1();
        }
        return true;
    }

    public final void U0(LayoutQueryWearableCollaborEnableBinding layoutQueryWearableCollaborEnableBinding, View view) {
        if (layoutQueryWearableCollaborEnableBinding != null) {
            if (layoutQueryWearableCollaborEnableBinding.checkboxAskPrompt.isChecked()) {
                p19.F().J2("Y");
            }
            this.x.j(true);
            pn5.A0(WearableManager.q(), "Y");
            MapAlertDialog mapAlertDialog = this.r;
            if (mapAlertDialog != null) {
                mapAlertDialog.m();
            }
        }
    }

    public final void V() {
        hm4.p(L, "back to route.");
        if (getActivity() == null || ((BaseFragment) this).mBinding == null) {
            return;
        }
        com.huawei.maps.app.petalmaps.a.x1().N4(k06.r());
        d0();
        p79.l("nav_curTime", o41.c());
        sn7.b().i(false);
        com.huawei.maps.app.petalmaps.a.x1().I0(getActivity());
        c06.m(false);
        NaviCurRecord.getInstance().initFromMyLoc();
        if (!it3.x().P()) {
            this.E.a();
        }
        RouteNavUtil.f(getActivity());
        RouteNavUtil.d(getActivity());
        this.z = true;
        com.huawei.maps.app.petalmaps.a.x1().k1(getActivity());
    }

    public final void W() {
        if (System.currentTimeMillis() - this.H < 60000) {
            hm4.f(L, "checkNavDarkMode too busy");
            return;
        }
        String O = p19.F().O();
        o9a.l(rp5.B());
        boolean i2 = o9a.i();
        if (!"Automatic".equals(O) || rp5.F(i2)) {
            return;
        }
        hm4.p(L, "naviDarkMode is:" + O + " , refresh modeData to isDark : " + i2);
        p19.F().Z1(i2 ? "Dark" : "Light");
    }

    public final void W0() {
        if (c06.b() && p19.F().U()) {
            if (!nf4.C(nf4.p())) {
                this.G.c(new hm6());
            } else {
                if (tg6.b().f().queryOfflineVoiceHasLoaded()) {
                    return;
                }
                this.G.c(new gm6());
            }
        }
    }

    public final void X(NaviInfo naviInfo) {
        SpeedInfo speedInfo;
        if (this.d == null || naviInfo == null || (speedInfo = naviInfo.getSpeedInfo()) == null) {
            return;
        }
        speedInfo.getSpeedValue();
        if (this.d.getShouldWaitThirtyMinutes()) {
            return;
        }
        if (naviInfo.getSpeedInfo().getSpeedValue() <= 15.0d) {
            if (this.d.getIsFiveMinutesTimerStarted()) {
                return;
            }
            this.d.i();
        } else if (this.d.getIsFiveMinutesTimerStarted()) {
            this.d.l();
        }
    }

    public final void X0(NaviInfo naviInfo) {
        final MapNaviStaticInfo y = it3.x().y();
        xr4.Q().k2(naviInfo.getPathRetainDistance());
        ln5.k().k0(y.getDrivenDist());
        ln5.k().l0(y.getDrivenTime());
        long currentTimeMillis = System.currentTimeMillis();
        if (currentTimeMillis - this.H > 60000) {
            com.huawei.maps.app.common.utils.task.a.b(TaskExecutor.NAVI).d(com.huawei.maps.app.common.utils.task.a.a(L, "recordNaviInfo", new Runnable() {
                @Override
                public final void run() {
                    NavFragment.J0(y);
                }
            }));
            this.H = currentTimeMillis;
        }
    }

    public final void Y() {
        NewRoadFeedbackViewModel newRoadFeedbackViewModel;
        if (c06.g() || (newRoadFeedbackViewModel = this.e) == null || newRoadFeedbackViewModel.w() == null) {
            return;
        }
        this.e.h();
    }

    public final void Y0() {
        Timer timer = this.F;
        if (timer != null) {
            timer.cancel();
            this.F = null;
        }
    }

    public void Z() {
        a0();
        b0();
    }

    public final void Z0() {
        o41.b().getMapAppLifeCycle().removeCallBack("callBackNavigation");
    }

    public final void a0() {
        MapAlertDialog mapAlertDialog = this.p;
        if (mapAlertDialog == null || !mapAlertDialog.v()) {
            return;
        }
        this.p.m();
    }

    public final void b0() {
        MapAlertDialog mapAlertDialog = this.o;
        if (mapAlertDialog == null || !mapAlertDialog.v()) {
            return;
        }
        this.o.m();
    }

    public final void b1(ScreenDisplayStatus screenDisplayStatus) {
        if (screenDisplayStatus == null) {
            return;
        }
        int i2 = f.a[screenDisplayStatus.ordinal()];
        if (i2 == 1 || i2 == 2) {
            pn5.S();
        }
    }

    public final void c0(boolean z) {
        String str = L;
        hm4.p(str, "exit navigation.");
        if (getActivity() == null || ((BaseFragment) this).mBinding == null || getContext() == null) {
            hm4.h(str, "exit navigation return.");
            return;
        }
        t0();
        cz9.f();
        com.huawei.maps.app.petalmaps.a.x1().m2(getActivity());
        np6.q((ActivityViewModel) getActivityViewModel(ActivityViewModel.class));
        MapAlertDialog mapAlertDialog = this.r;
        if (mapAlertDialog != null && mapAlertDialog.v()) {
            this.r.m();
        }
        this.y = n5.a();
        if (this.v) {
            c06.m(false);
            this.v = false;
        } else {
            if (U() && NaviCurRecord.getInstance().getStopNumsPassedDuringNavi() == 0 && !z) {
                if (this.c.p.P1()) {
                    NaviCurRecord.getInstance().setWayPointList(new ArrayList());
                }
                c06.h(true);
                V();
                FavoritesMakerHelper.n().y(false);
                return;
            }
            com.huawei.maps.app.petalmaps.a.x1().p5(jq5.t().v());
            if (!c06.g() && !z) {
                com.huawei.maps.app.petalmaps.a.x1().a5(false);
                c06.m(true);
            }
        }
        FavoritesMakerHelper.n().y(true);
        d0();
        p79.l("nav_curTime", o41.c());
        sn7.b().i(false);
        com.huawei.maps.app.petalmaps.a.x1().k1(getActivity());
        if (getActivity() instanceof PetalMapsActivity) {
            PetalMapsActivity activity = getActivity();
            if (activity == null) {
                return;
            }
            ow6.a.y(true);
            activity.setNavigation(IPatelMapsView.NavigationItem.EXPLORE);
        }
        pd0.g();
    }

    public final void c1() {
        xr4.Q().Y1(0);
        xr4.Q().Z1(0);
        xr4.Q().D1(0);
    }

    public final void d0() {
        hm4.p(L, "exitNaviCommon");
        if (com.huawei.maps.app.petalmaps.a.x1().isShowAlongCard()) {
            com.huawei.maps.app.petalmaps.a.x1().a2();
        }
        a1();
        k06.A(false);
        u04.a.G(true);
        gp5.a.a(requireActivity().getSupportFragmentManager());
        tg6.b().f().resumeThePauseOfflineVoice();
        PetalMapsActivity activity = getActivity();
        if (activity instanceof PetalMapsActivity) {
            activity.refreshDarkState();
        }
        MapStyleSettingManager.e().b(MapStyleSettingManager.l() ? 1 : 0, false);
        com.huawei.maps.app.petalmaps.a.x1().v4();
        u1();
        ni4.c().g();
        getActivity().getWindow().clearFlags(128);
        getActivity().getWindow().clearFlags(524288);
        getActivity().getWindow().clearFlags(4194304);
        this.c.p.U2();
        com.huawei.maps.app.petalmaps.a.x1().G4(o9a.d());
        getActivity().setNavigationBarColr(o9a.d());
        ef9.b(o9a.d(), getActivity());
        com.huawei.maps.app.petalmaps.a.x1().Y0();
        LocationHelper.v().setLocationMarkerVisibility(true);
        LocationHelper.v().D();
        MapHelper.F2().Y6(true);
        hm4.p("AutoZoom", "exitNaviCommon");
        MapHelper.F2().s6(false);
        MapHelper.F2().h6();
        com.huawei.maps.app.petalmaps.trafficevent.a.G();
        com.huawei.maps.app.petalmaps.a.x1().hideSlidingContainer();
        Y();
        com.huawei.maps.hicar.a.V().O0(0);
        gz4.h1().C2();
    }

    public final void d1() {
        if (getActivity() == null || getViewLifecycleOwner() == null) {
            return;
        }
        ((ActivityViewModel) getActivityViewModel(ActivityViewModel.class)).m().observe(getViewLifecycleOwner(), new n());
        LocationHelper.v().getIsHMSLocationEnable().observe(getViewLifecycleOwner(), new p());
    }

    public NewRoadFeedbackViewModel e0() {
        return this.e;
    }

    public final void e1(int i2) {
        this.w.f(i2, this.c);
    }

    public final Site f0() {
        Site site = (Site) getActivityViewModel(BottomViewModel.class).a.getValue();
        Site commuteSite = NaviCurRecord.getInstance().getCommuteSite();
        if (site == null) {
            return commuteSite;
        }
        site.setLocation(commuteSite.getLocation());
        return site;
    }

    public void f1() {
        if (this.w == null) {
            return;
        }
        e1(10);
        NavPopEventHelper.e().l(4, new NavPopEventHelper.OnHideListener() {
            @Override
            public final void onHide() {
                NavFragment.K0();
            }
        });
    }

    public final ServiceConnection g0() {
        return new b();
    }

    public void g1() {
        if (getActivity() != null) {
            MapAlertDialog.Builder builder = new MapAlertDialog.Builder(getActivity());
            View inflate = View.inflate(o41.c(), R.layout.map_stop_nav_dialog, null);
            MapStopNavDialogBinding mapStopNavDialogBinding = (MapStopNavDialogBinding) DataBindingUtil.bind(inflate);
            if (mapStopNavDialogBinding == null) {
                return;
            }
            mapStopNavDialogBinding.setIsDark(o9a.f());
            builder.D(inflate);
            MapAlertDialog F = builder.F();
            this.p = F;
            zb3.f(F, 24.0f);
            builder.s(new DialogInterface.OnDismissListener() {
                @Override
                public final void onDismiss(DialogInterface dialogInterface) {
                    NavFragment.L0(dialogInterface);
                }
            });
            mapStopNavDialogBinding.quitTextView.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    NavFragment.this.M0(view);
                }
            });
            mapStopNavDialogBinding.cancelTextView.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    NavFragment.this.N0(view);
                }
            });
        }
    }

    public DataBindingConfig getDataBindingConfig() {
        k06.A(true);
        u04.a.G(false);
        if (p19.F().U()) {
            tg6.b().f().pauseOfflineVoiceUpdate();
        }
        o9a.l(rp5.B());
        com.huawei.maps.app.petalmaps.a.x1().v4();
        return new DataBindingConfig(R.layout.fragment_nav);
    }

    public void goBack() {
        zo5 zo5Var = this.w;
        if (zo5Var == null) {
            return;
        }
        zo5Var.c();
    }

    public final ServiceConnection h0() {
        return new c();
    }

    public void h1() {
        if (getActivity() != null) {
            MapAlertDialog.Builder builder = new MapAlertDialog.Builder(getActivity());
            View inflate = View.inflate(o41.c(), R.layout.map_stop_nav_dialog, null);
            MapStopNavDialogBinding mapStopNavDialogBinding = (MapStopNavDialogBinding) DataBindingUtil.bind(inflate);
            if (mapStopNavDialogBinding == null) {
                return;
            }
            mapStopNavDialogBinding.setIsDark(o9a.f());
            builder.D(inflate);
            MapAlertDialog F = builder.F();
            this.o = F;
            zb3.f(F, 24.0f);
            builder.s(new DialogInterface.OnDismissListener() {
                @Override
                public final void onDismiss(DialogInterface dialogInterface) {
                    NavFragment.O0(dialogInterface);
                }
            });
            mapStopNavDialogBinding.quitTextView.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    NavFragment.this.P0(view);
                }
            });
            mapStopNavDialogBinding.cancelTextView.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    NavFragment.this.Q0(view);
                }
            });
        }
    }

    public NaviViewModel i0() {
        return this.c;
    }

    public final void i1() {
        if (this.G == null) {
            return;
        }
        if (A0()) {
            this.G.c(new oa8());
        }
        if (!p19.F().g().equals("noAudio") && rra.c()) {
            this.G.c(new lk5());
        } else if (rra.b()) {
            this.G.c(new so4());
        }
        W0();
        this.G.c(new lwa(this.x));
        this.G.c(new mwa(this.x));
        this.G.d();
    }

    public void initData() {
        hm4.p(L, " start nav init NavFrag data.");
        if (((BaseFragment) this).mBinding == null) {
            return;
        }
        u0();
        jh8.Y(false);
        yl7.w().P0(true);
        com.huawei.maps.businessbase.manager.location.a.N(false);
        com.huawei.maps.app.petalmaps.a.x1().o5(this.c);
        MapHelper.F2().X5(0);
        MapHelper.F2().X5(2);
        e1(c06.d());
        y0();
        this.x = new WearableManager(this);
        this.G = new qp5();
        n1();
        a06.h();
        a06.g();
        if (k06.x()) {
            a06.i();
        }
        d1();
        i1();
        s0();
        com.huawei.maps.hicar.a.V().O0(1);
    }

    public void initViewModel() {
        NaviCurRecord.getInstance().setStopNumsPassedDuringNavi(0);
        com.huawei.maps.app.petalmaps.a.x1().G5(false);
        this.c = getFragmentViewModel(NaviViewModel.class);
        this.d = (SpeedReportViewModel) getFragmentViewModel(SpeedReportViewModel.class);
        this.c.q();
        this.e = (NewRoadFeedbackViewModel) getActivityViewModel(NewRoadFeedbackViewModel.class);
        this.f = getActivityViewModel(UGCRealTimeDisplayViewModel.class);
        ar5.c().g();
        we n2 = we.n();
        this.g = n2;
        this.c.p.I2(n2);
        vs5.b().g(this.c);
    }

    public void initViews() {
        Window window;
        hm4.p(L, "navigation init view");
        if (getContext() == null || getActivity() == null) {
            return;
        }
        MapHelper.F2().S7(false);
        o9a.m(p19.F().O());
        if (ni4.c().e) {
            o9a.m(((BaseFragment) this).isDark ? "Dark" : "Light");
        }
        this.w = new zo5(this);
        c31.h().j(getActivity(), this.c);
        ct3.h0(getActivity(), k06.r());
        com.huawei.maps.app.petalmaps.a.x1().q2();
        if (k06.x()) {
            MapHelper.F2().K1();
        } else if (k06.r() && p19.F().U()) {
            MapHelper.F2().K1();
            q18.f();
        }
        FavoritesMakerHelper.n().y(false);
        if ("Automatic".equals(p19.F().O())) {
            ni4.c().e(o41.c());
        }
        FragmentActivity activity = getActivity();
        if (activity != null && (window = activity.getWindow()) != null) {
            window.addFlags(128);
            window.addFlags(524288);
            window.addFlags(4194304);
        }
        Y0();
        Timer timer = new Timer();
        this.F = timer;
        timer.schedule(new g(), 0L, 300L);
        getActivityViewModel(RouteResultViewModel.class).e(it3.x().getNaviPath().getStartPoint(), System.currentTimeMillis());
    }

    public final ServiceConnection j0() {
        return new a();
    }

    public final void j1(boolean z) {
        if (z) {
            MapAlertDialog mapAlertDialog = this.r;
            if (mapAlertDialog == null || !mapAlertDialog.v()) {
                return;
            }
            this.r.m();
            this.r = null;
        }
        FragmentActivity activity = getActivity();
        if (activity == null) {
            return;
        }
        MapAlertDialog mapAlertDialog2 = this.r;
        if (mapAlertDialog2 != null) {
            mapAlertDialog2.H();
            return;
        }
        final LayoutQueryWearableCollaborEnableBinding layoutQueryWearableCollaborEnableBinding = (LayoutQueryWearableCollaborEnableBinding) DataBindingUtil.inflate(LayoutInflater.from(activity), R.layout.layout_query_wearable_collabor_enable, (ViewGroup) null, false);
        if (layoutQueryWearableCollaborEnableBinding == null) {
            return;
        }
        layoutQueryWearableCollaborEnableBinding.checkboxAskPrompt.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NavFragment.R0(view);
            }
        });
        layoutQueryWearableCollaborEnableBinding.textAskPrompt.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NavFragment.S0(LayoutQueryWearableCollaborEnableBinding.this, view);
            }
        });
        layoutQueryWearableCollaborEnableBinding.textviewCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NavFragment.this.T0(layoutQueryWearableCollaborEnableBinding, view);
            }
        });
        layoutQueryWearableCollaborEnableBinding.textviewEnable.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NavFragment.this.U0(layoutQueryWearableCollaborEnableBinding, view);
            }
        });
        layoutQueryWearableCollaborEnableBinding.setIsDark(o9a.f());
        this.r = new MapAlertDialog.Builder(activity).s(new DialogInterface.OnDismissListener() {
            @Override
            public final void onDismiss(DialogInterface dialogInterface) {
                NavFragment.V0(LayoutQueryWearableCollaborEnableBinding.this, dialogInterface);
            }
        }).D(layoutQueryWearableCollaborEnableBinding.getRoot()).e(false).F();
    }

    public SpeedReportViewModel k0() {
        return this.d;
    }

    public final void k1() {
        FragmentActivity activity = getActivity();
        if (activity == null) {
            hm4.h(L, "fragmentActivity is null");
            return;
        }
        SafeIntent safeIntent = new SafeIntent(new Intent((Context) activity, (Class<?>) NavFloatingWindowService.class));
        if (this.k == null) {
            this.k = j0();
        }
        hm4.p(L, "startNavFloatingWindowService, mServiceConnection = " + this.k);
        activity.bindService(safeIntent, this.k, 1);
    }

    public final Site l0() {
        BottomViewModel activityViewModel = getActivityViewModel(BottomViewModel.class);
        return (Site) (activityViewModel.a.getValue() == null ? getActivityViewModel(DetailViewModel.class).n : activityViewModel.a).getValue();
    }

    public final void l1() {
        if (getActivity() == null) {
            hm4.h(L, "startNavForegroundService getActivity() is null");
            return;
        }
        String str = L;
        hm4.p(str, "start navigation foreground service : " + System.currentTimeMillis());
        if (this.h == null) {
            this.h = new SafeIntent(new Intent((Context) getActivity(), (Class<?>) NaviForegroundService.class));
        }
        if (getActivity() == null) {
            hm4.h(str, "startNavForegroundService activity is null");
        } else {
            w0();
        }
    }

    public UGCRealTimeDisplayViewModel m0() {
        return this.f;
    }

    public final void m1() {
        Locale locale = Locale.ENGLISH;
        String.format(locale, "%.2f", Double.valueOf(NaviCurRecord.getInstance().getFromLat()));
        String.format(locale, "%.2f", Double.valueOf(NaviCurRecord.getInstance().getFromLng()));
        String.format(locale, "%.2f", Double.valueOf(NaviCurRecord.getInstance().getToLat()));
        String.format(locale, "%.2f", Double.valueOf(NaviCurRecord.getInstance().getToLng()));
        MapDevOpsReport.b b2 = MapDevOpsReport.b("app_operation_flow");
        b2.U();
        b2.m1().e();
        p79.j("startTime", System.currentTimeMillis(), o41.c());
    }

    public final void n0(MapNaviStaticInfo mapNaviStaticInfo) {
        if (qc6.b(mapNaviStaticInfo)) {
            hm4.h(L, "handleArriveDestination failed ,staticInfo is null");
            return;
        }
        if (this.j != null) {
            hm4.p(L, "mFoldScreenBinder endNavi...");
            this.j.b();
        }
        if (k06.x()) {
            yta.s().w(null);
        }
        q1();
        if (o41.b().isAppBackground()) {
            hm4.p(L, "handleArriveDestination, isBackGround :true, stop service.");
            k06.A(false);
            u1();
            com.huawei.maps.app.petalmaps.a.x1().p5(mapNaviStaticInfo);
        }
    }

    public final void n1() {
        String str = L;
        hm4.p(str, "startNavi...");
        p19.F().W1(true);
        c1();
        m1();
        ln5.k().H();
        wq5.c().a();
        wq5.c().i();
        MapDataBus.get().post("tts_data_bus_set_default_bluetooth_channel", 0);
        this.c.p.N1();
        this.g.B(this.x);
        gc0.e().l();
        im4.c(str, (Location) null);
        this.c.p.S2(false, false);
        com.huawei.maps.app.petalmaps.a.x1().hideWeatherBadge();
        gn4.i().k();
        com.huawei.maps.app.petalmaps.a.x1().q5(false);
        WearableManager wearableManager = this.x;
        if (wearableManager != null) {
            wearableManager.g();
        }
        ViewDataBinding viewDataBinding = ((BaseFragment) this).mBinding;
        if (viewDataBinding != null) {
            ((FragmentNavBinding) viewDataBinding).navFragment.post(this.K);
        }
    }

    public void naviViewSwitch(boolean z) {
        DataBindingFragment b2 = this.w.b();
        if (b2 == null || !(b2 instanceof DriveNavFragment)) {
            return;
        }
        ((DriveNavFragment) b2).naviViewSwitch(z);
    }

    public final void o0(int i2) {
        hm4.p(L, "handleArrivedWayPoint ,arrived index : " + i2);
        DriveNavHelper.v().s0();
    }

    public final void o1() {
        this.v = true;
        MapDevOpsReport.b b2 = MapDevOpsReport.b("app_operation_flow");
        b2.T();
        b2.m1().e();
        p1();
    }

    public boolean onBackPressed() {
        return this.w.b().onBackPressed();
    }

    public void onDestroy() {
        String str = L;
        hm4.p(str, "navigation destroy");
        CrashHandler.d().u();
        ya9.b().h();
        NaviCurRecord.getInstance().setStopNumsPassedDuringNavi(0);
        if (c06.b() && getActivity() != null) {
            hm4.p(str, "navigation destroy exitNaviCommon");
            d0();
        }
        if (!this.z) {
            NaviCurRecord.getInstance().setWayPointList(new ArrayList());
            getActivityViewModel(RouteResultViewModel.class).d();
        }
        this.c.p.X2();
        com.huawei.maps.app.petalmaps.a.x1().a5(!c06.g());
        pn5.u(p19.F().m());
        gc0.e().n();
        com.huawei.maps.app.petalmaps.a.x1().o5(null);
        com.huawei.maps.app.petalmaps.a.x1().e1();
        qx7.e();
        Y0();
        this.G.g();
        com.huawei.maps.app.common.utils.task.a.h(this.J);
        com.huawei.maps.app.common.utils.task.a.h(this.K);
        this.K = null;
        super.onDestroy();
        ya9.b().d(com.huawei.maps.businessbase.manager.location.a.s());
    }

    public void onDestroyView() {
        String str = L;
        hm4.p(str, "navigation destroyView");
        Z();
        uk3.L().x();
        uk3.L().A();
        if (!c06.g()) {
            com.huawei.maps.app.petalmaps.a.x1().showRewardView(this.y);
        } else if (z0()) {
            this.e.k();
            PetalMapsChildViewBinding s1 = com.huawei.maps.app.petalmaps.a.x1().s1();
            if (s1 != null) {
                s1.setShowFragmentContainer(false);
            }
            com.huawei.maps.app.petalmaps.a.x1().G4(o9a.d());
            AgreementRequestHelper.E1(((DataBindingFragment) this).mActivity);
        } else {
            NavCompleteInfo navCompleteInfo = new NavCompleteInfo(this.y, f0(), this.A);
            Site l0 = l0();
            hm4.p(str, "site = " + l0);
            if (l0 == null) {
                l0 = NaviCurRecord.getInstance().getToSite();
            }
            if (((DataBindingFragment) this).mActivity != null) {
                CameraPosition n2 = MapHelper.F2().n2();
                Coordinate location = l0.getLocation();
                if (location != null) {
                    MapHelper.F2().T0(new CameraPosition(new LatLng(location.getLat(), location.getLng()), 15.0f, n2.tilt, n2.bearing), 800L, (HWMap.CancelableCallback) null);
                }
                com.huawei.maps.app.petalmaps.a.x1().t6(navCompleteInfo, ((DataBindingFragment) this).mActivity, l0);
            }
        }
        c31.h().v();
        vs5.b().f();
        com.huawei.maps.app.petalmaps.a.x1().P0(o9a.f());
        super.onDestroyView();
    }

    @Override
    public void onPopupConfirmDialog() {
        com.huawei.maps.app.common.utils.task.a.e(com.huawei.maps.app.common.utils.task.a.a(L, "onPopupConfirmDialog", new Runnable() {
            @Override
            public final void run() {
                NavFragment.this.H0();
            }
        }));
    }

    @Override
    public void onRequestBluetoothConnectPermission() {
        if (isAdded()) {
            PermissionsUtil.o(this, new PermissionsUtil.RequestCallback() {
                public final void success() {
                    NavFragment.this.I0();
                }
            });
        }
    }

    public void onRequestPermissionsResult(int i2, @NonNull String[] strArr, @NonNull int[] iArr) {
        WearableManager wearableManager;
        super/*androidx.fragment.app.Fragment*/.onRequestPermissionsResult(i2, strArr, iArr);
        if (i2 == 1026) {
            if (iArr.length == 0) {
                hm4.h(L, "request permissions fail");
            } else {
                if (iArr[0] != 0 || (wearableManager = this.x) == null) {
                    return;
                }
                wearableManager.y(true);
            }
        }
    }

    public void onResume() {
        super.onResume();
        MapHelper.F2().K7(true);
        c31.h().n((MapDrivingInfo) this.c.p.n1().getValue());
        j1(true);
    }

    public final void p0(Boolean bool) {
        if (bool.booleanValue()) {
            this.t = 0;
            hm4.p(L, " calculate route for yaw success, reset errorPlanCnt: " + this.t);
            MapAlertDialog mapAlertDialog = this.q;
            if (mapAlertDialog == null || !mapAlertDialog.v()) {
                return;
            }
            this.q.m();
            return;
        }
        if (!qk9.r()) {
            FragmentActivity activity = getActivity();
            MapAlertDialog mapAlertDialog2 = this.q;
            if ((mapAlertDialog2 == null || !mapAlertDialog2.v()) && activity != null) {
                this.q = sr4.l(activity);
                return;
            }
            return;
        }
        MapAlertDialog mapAlertDialog3 = this.q;
        if (mapAlertDialog3 != null && mapAlertDialog3.v()) {
            this.q.m();
        }
        this.t++;
        hm4.p(L, " calculate route for yaw, errorPlanCnt: " + this.t);
        if (this.t > 2) {
            cz9.o(R.string.navi_err_unavailable_route_wait_retry);
            NaviViewModel naviViewModel = this.c;
            if (naviViewModel != null) {
                naviViewModel.k().postValue(3);
            }
        }
    }

    public void p1() {
        NaviViewModel naviViewModel = this.c;
        if (naviViewModel != null) {
            naviViewModel.k().postValue(2);
        }
    }

    public final void q0(int i2) {
        hm4.p(L, "current nav page status change to : " + i2);
        if (((BaseFragment) this).mBinding == null) {
            return;
        }
        if (i2 == 2) {
            c0(false);
        } else {
            if (i2 != 3) {
                return;
            }
            V();
        }
    }

    public final void q1() {
        MapAlertDialog mapAlertDialog = this.p;
        boolean z = false;
        boolean z2 = mapAlertDialog != null && mapAlertDialog.v();
        MapAlertDialog mapAlertDialog2 = this.o;
        if (mapAlertDialog2 != null && mapAlertDialog2.v()) {
            z = true;
        }
        if (z2 || z) {
            AppLinkHelper.p().M();
            AppLinkHelper.p().L();
        }
    }

    public final void r1() {
        FragmentActivity activity = getActivity();
        if (this.i == null || activity == null) {
            return;
        }
        try {
            ServiceConnection serviceConnection = this.k;
            if (serviceConnection != null) {
                activity.unbindService(serviceConnection);
                this.k = null;
            }
        } catch (IllegalArgumentException e2) {
            hm4.h(L, "stopFloatingWindowService IllegalArgumentException" + e2.getMessage());
        }
        activity.stopService(new SafeIntent(new Intent((Context) getActivity(), (Class<?>) NavFloatingWindowService.class)));
    }

    public final void s0() {
        hm4.p(L, "initCommuteAddress start");
        CommonAddressRecordsViewModel fragmentViewModel = getFragmentViewModel(CommonAddressRecordsViewModel.class);
        fragmentViewModel.U().observe(getViewLifecycleOwner(), new Observer() {
            public final void onChanged(Object obj) {
                NavFragment.this.B0((CommonAddressRecords) obj);
            }
        });
        fragmentViewModel.V().observe(getViewLifecycleOwner(), new Observer() {
            public final void onChanged(Object obj) {
                NavFragment.this.C0((CommonAddressRecords) obj);
            }
        });
        new QueryCommonAddressSiteTask(new QueryCommonAddressSiteTask.QueryCommonAddressCallback() {
            public final void onResult(boolean z) {
                NavFragment.this.D0(z);
            }
        }).execute(TaskExecutor.COLLECT, new CommonAddressRecords[]{com.huawei.maps.businessbase.utils.a.I()});
    }

    public final void s1() {
        FragmentActivity activity = getActivity();
        if (this.j == null || activity == null) {
            return;
        }
        try {
            ServiceConnection serviceConnection = this.l;
            if (serviceConnection != null) {
                activity.unbindService(serviceConnection);
            }
        } catch (IllegalArgumentException e2) {
            hm4.h(L, "stopFoldScreenService IllegalArgumentException" + e2.getMessage());
        }
        activity.stopService(new SafeIntent(new Intent((Context) getActivity(), (Class<?>) NavNotificationService.class)));
    }

    public final void t0() {
        boolean m2 = k0a.k().m();
        boolean i2 = k.i2();
        if (m2 || !i2) {
            this.A = 0;
            hm4.p(L, "isIncognitoMode:" + m2 + "  agcSwitchOpen:" + i2);
            return;
        }
        if (l71.i() && !this.B) {
            this.A = 2;
            return;
        }
        if (l71.j() && !this.C) {
            this.A = 1;
        } else if (this.D) {
            this.A = 3;
        }
    }

    public final void t1() {
        Z0();
        if (this.h == null || getActivity() == null) {
            return;
        }
        hm4.p(L, "stop navigation foreground Service." + System.currentTimeMillis());
        ar5.c().k(true);
        if (ar5.c().h()) {
            ar5.c().j(false);
            if (this.m != null) {
                getActivity().unbindService(this.m);
            }
            getActivity().stopService(this.h);
        }
    }

    public final void u0() {
        CrashHandler.d().y(new CrashHandler.ActivityProtectCallBack() {
            public final void onCallBack() {
                NavFragment.this.E0();
            }
        });
    }

    public final void v0() {
        FragmentActivity activity = getActivity();
        if (activity == null) {
            return;
        }
        SafeIntent safeIntent = new SafeIntent(new Intent((Context) activity, (Class<?>) NavNotificationService.class));
        if (this.l == null) {
            this.l = g0();
        }
        activity.bindService(safeIntent, this.l, 1);
    }

    public final void w0() {
        FragmentActivity activity = getActivity();
        if (activity == null) {
            hm4.p(L, "initForService activity is null");
            return;
        }
        if (this.m == null) {
            hm4.p(L, "mForegroundConnection is null");
            this.m = h0();
        }
        activity.bindService(this.h, this.m, 1);
    }

    public final void x0() {
        if (q42.k() > 3) {
            l1();
            return;
        }
        hm4.p(L, "init notification observer.");
        BaseMapApplication b2 = o41.b();
        b2.getMapAppLifeCycle().setCallBack("callBackNavigation", new e(b2));
    }

    public final boolean z0() {
        if (!AppPermissionHelper.isChinaOperationType() && k06.s() && z09.f() && TextUtils.equals(z09.d(), TicketErrorInfo.TICKET_ERROR_TYPE_NO_DATA) && !k0a.k().m() && ServicePermission.getOperationType() == NetworkConstant.OperationType.ASPIEGEL.ordinal() && NetworkUtil.getNetworkType(o41.c()) != -1) {
            return !e4.a().isChildren();
        }
        return false;
    }

    public static void K0() {
    }
}