public void updateSpeedLimit(boolean isSpeedLimitExceeded, int speedLimit) { Preference speedLimits = ((DaoManager) DaoManager.getInstance()) .getPreferenceDao() .getPreference(Preference.ID_PREFERENCE_SPEED_LIMITS); isDisabled = speedLimits != null && speedLimits.getIntValue() == Preference.SPEED_LIMIT_OFF; int speedLimitFeature = FeaturesManager.getInstance().getStatus(FeaturesManager.FEATURE_CODE_NAV_SPEED_LIMIT); boolean isEnabled = speedLimitFeature == FeaturesManager.FE_ENABLED || speedLimitFeature == FeaturesManager.FE_PURCHASED; isDisabled = isDisabled || !isEnabled; int routeStyle = DaoManager.getInstance().getTripsDao().getIntValue(Preference.ID_PREFERENCE_ROUTETYPE); boolean isInPedestrian = routeStyle == Route.ROUTE_PEDESTRIAN ? true : false; isDisabled = isDisabled || isInPedestrian; if (isDisabled) { NavBottomStatusBarHelper.getInstance().setIsOverSpeedLimit(false); requestPaint(); return; } Preference preference = ((DaoManager) DaoManager.getInstance()) .getPreferenceDao() .getPreference(Preference.ID_PREFERENCE_DISTANCEUNIT); if (preference != null && preference.getIntValue() == Preference.UNIT_USCUSTOM) { // mph currentSpeedLimit = DataUtil.kmToMileInHighAccuracy(speedLimit); // currentUnit = "MPH"; currentUnit = ResourceManager.getInstance() .getCurrentBundle() .getString(IStringNav.RES_SPEED_LIMIT, IStringNav.FAMILY_NAV); } else { // kph currentSpeedLimit = speedLimit; // currentUnit = "KPH"; currentUnit = ResourceManager.getInstance() .getCurrentBundle() .getString(IStringNav.RES_SPEED_LIMIT, IStringNav.FAMILY_NAV); } if (speedLimit <= 0) { speedStr = "---"; unitStr = currentUnit; NavBottomStatusBarHelper.getInstance().setIsOverSpeedLimit(false); requestPaint(); return; } if (isSpeedLimitExceeded) { NavBottomStatusBarHelper.getInstance().setIsOverSpeedLimit(true); } else { NavBottomStatusBarHelper.getInstance().setIsOverSpeedLimit(false); } speedStr = currentSpeedLimit + ""; unitStr = currentUnit; requestPaint(); }
protected void doActionDelegate(int actionId) { switch (actionId) { case ACTION_INIT: { // initMapArrow(); MapVehiclePositionService.getInstance().resume(false); if (!NavRunningStatusProvider.getInstance().isNavRunning()) { DaoManager.getInstance().getTripsDao().initTripPreference(); } int multiRouteServerDrivenValue = FeaturesManager.getInstance() .getStatus(FeaturesManager.FEATURE_CODE_ROUTE_PLANNING_MULTI_ROUTE); boolean isMultiRouteEnabled = multiRouteServerDrivenValue == FeaturesManager.FE_ENABLED || multiRouteServerDrivenValue == FeaturesManager.FE_PURCHASED; boolean isIgnoreRoutePlanning = this.getBool(KEY_B_IS_IGNORE_ROUTE_PLANNING); boolean isCarConnectMode = this.getBool(KEY_B_IS_CAR_CONNECT_MODE); boolean isNavRunning = NavRunningStatusProvider.getInstance().isNavRunning(); int navRouteType = NavRunningStatusProvider.getInstance().getNavType(); if (isCarConnectMode) { postModelEvent(EVENT_MODEL_START_CAR_CONNECT_NAV); storeAddress(); } if ((isNavRunning && navRouteType == NavRunningStatusProvider.NAV_TYPE_DYNAMIC_ROUTE) || isIgnoreRoutePlanning) { postModelEvent(EVENT_MODEL_START_MOVING_MAP); storeAddress(); } else { if (isMultiRouteEnabled) { postModelEvent(EVENT_MODEL_START_ROUTE_PLANNING); storeAddress(); } else { postModelEvent(EVENT_MODEL_START_ROUTE_PLANNING_SETTING); } } break; } case ACTION_START_MOVING_MAP: case ACTION_START_TURN_MAP: { boolean isSearchAlongRoute = getBool(KEY_B_IS_FROM_SEARCH_ALONG); if (isSearchAlongRoute) { TripSummaryMisLog tripSummaryMisLog = (TripSummaryMisLog) MisLogManager.getInstance().getMisLog(IMisLogConstants.TYPE_TRIP_SUMMARY); if (tripSummaryMisLog != null) { tripSummaryMisLog.setIsEndedByDetour(true); } } postModelEvent(EVENT_MODEL_RELEASE_ALL_PREVIOUS_MODULES); break; } // Added for Ford Applink (CarConnect case ACTION_LAUNCH_CAR_CONNECT_NAV: { Address destination = (Address) get(KEY_O_ADDRESS_DEST); if (destination != null) { CarConnectHostManager.getInstance().requestNav(destination); // show toast message to inform user ((AbstractTnUiHelper) AbstractTnUiHelper.getInstance()) .runOnUiThread( new Runnable() { public void run() { Context ctx = AndroidPersistentContext.getInstance().getContext(); String text = ResourceManager.getInstance() .getCurrentBundle() .getString( IStringCarConnect.GETTING_ROUTE, IStringCarConnect.FAMILY_CARCONNECT); Toast.makeText(ctx, text, Toast.LENGTH_LONG).show(); } }); } break; } } }