示例#1
0
 protected void storeAddress() {
   Address originAddress = (Address) get(KEY_O_ADDRESS_ORI);
   Address destAddress = (Address) get(KEY_O_ADDRESS_DEST);
   NavRunningStatusProvider.getInstance().setDestination(destAddress);
   DaoManager.getInstance().getAddressDao().addToRecent(originAddress);
   DaoManager.getInstance().getAddressDao().addToRecent(destAddress);
 }
  protected void load() {
    cellTowerMappingInfos =
        ((DaoManager) DaoManager.getInstance()).getLocationCacheDao().getCellTowerCache();
    lastCellLocation =
        ((DaoManager) DaoManager.getInstance()).getLocationCacheDao().getLastCellLocation();
    lastGpsLocation =
        ((DaoManager) DaoManager.getInstance()).getLocationCacheDao().getLastGpsLocation();

    if (cellTowerMappingInfos == null) cellTowerMappingInfos = new Vector();
  }
  public void save() {
    ((DaoManager) DaoManager.getInstance())
        .getLocationCacheDao()
        .setLastCellLocation(lastCellLocation);
    ((DaoManager) DaoManager.getInstance())
        .getLocationCacheDao()
        .setLastGpsLocation(lastGpsLocation);

    synchronized (mutex) {
      ((DaoManager) DaoManager.getInstance())
          .getLocationCacheDao()
          .setCellTowerCache(cellTowerMappingInfos);
    }

    ((DaoManager) DaoManager.getInstance()).getLocationCacheDao().store();
  }
示例#4
0
  protected void initMapArrow() {
    PreferenceDao preferenceDao = ((DaoManager) DaoManager.getInstance()).getPreferenceDao();
    String currentCarValue = preferenceDao.getStrValue(Preference.ID_PREFERENCE_CAR_MODEL);
    if (currentCarValue == null || currentCarValue.length() == 0) {
      currentCarValue = "arrow";
    }

    MapContainer.getInstance().addCarModel(null, currentCarValue + ".mod");
  }
  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();
  }
示例#6
0
  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;
        }
    }
  }