com.mapbox.core.utils.TextUtils Java Examples

The following examples show how to use com.mapbox.core.utils.TextUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapboxOptimization.java    From mapbox-java with MIT License 6 votes vote down vote up
/**
 * This uses the provided parameters set using the {@link Builder} and first checks that all
 * values are valid, formats the values as strings for easier consumption by the API, and lastly
 * creates a new {@link MapboxOptimization} object with the values provided.
 *
 * @return a new instance of Mapbox Optimization
 * @since 2.1.0
 */
public MapboxOptimization build() {
  if (coordinates == null || coordinates.size() < 2) {
    throw new ServicesException("At least two coordinates must be provided with your API"
      + "request.");
  } else if (coordinates.size() > 12) {
    throw new ServicesException("Maximum of 12 coordinates are allowed for this API.");
  }

  coordinates(formatCoordinates(coordinates));
  bearings(FormatUtils.formatBearings(bearings));
  annotations(TextUtils.join(",", annotations));
  radiuses(TextUtils.formatRadiuses(radiuses));
  distributions(FormatUtils.formatDistributions(distributions));

  // Generate build so that we can check that values are valid.
  MapboxOptimization optimization = autoBuild();

  if (!MapboxUtils.isAccessTokenValid(optimization.accessToken())) {
    throw new ServicesException("Using Mapbox Services requires setting a valid access token.");
  }
  return optimization;
}
 
Example #2
Source File: MapboxGeocoding.java    From mapbox-java with MIT License 5 votes vote down vote up
/**
 * Limit the results to a defined bounding box. Unlike {@link #proximity()}, this will strictly
 * limit results to within the bounding box only. If simple biasing is desired rather than a
 * strict region, use proximity instead.
 *
 * @param minX the minX of bounding box when maps facing north
 * @param minY the minY of bounding box when maps facing north
 * @param maxX the maxX of bounding box when maps facing north
 * @param maxY the maxY of bounding box when maps facing north
 * @return this builder for chaining options together
 * @since 1.0.0
 */
public Builder bbox(@FloatRange(from = -180, to = 180) double minX,
                    @FloatRange(from = -90, to = 90) double minY,
                    @FloatRange(from = -180, to = 180) double maxX,
                    @FloatRange(from = -90, to = 90) double maxY) {
  bbox(String.format(Locale.US, "%s,%s,%s,%s",
    TextUtils.formatCoordinate(minX),
    TextUtils.formatCoordinate(minY),
    TextUtils.formatCoordinate(maxX),
    TextUtils.formatCoordinate(maxY))
  );
  return this;
}
 
Example #3
Source File: NavigationTelemetry.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private void validateAccessToken(String accessToken) {
  if (TextUtils.isEmpty(accessToken) || (!accessToken.toLowerCase(Locale.US).startsWith("pk.")
    && !accessToken.toLowerCase(Locale.US).startsWith("sk."))) {
    throw new NavigationException("A valid access token must be passed in when first initializing"
      + " MapboxNavigation");
  }
}
 
Example #4
Source File: MapboxStaticMapTest.java    From mapbox-java with MIT License 5 votes vote down vote up
@Test
public void sanity() throws Exception {
  MapboxStaticMap staticMap = MapboxStaticMap.builder()
    .accessToken(ACCESS_TOKEN)
    .build();
  assertNotNull(staticMap);
  assertTrue(!TextUtils.isEmpty(staticMap.url().toString()));
}
 
Example #5
Source File: MapboxStaticMap.java    From mapbox-java with MIT License 5 votes vote down vote up
private String generateLocationPathSegment() {
  if (precision() > 0) {
    List<String> geoInfo = new ArrayList<>();
    geoInfo.add(TextUtils.formatCoordinate(cameraPoint().longitude(), precision()));
    geoInfo.add(TextUtils.formatCoordinate(cameraPoint().latitude(), precision()));
    geoInfo.add(TextUtils.formatCoordinate(cameraZoom(), precision()));
    geoInfo.add(TextUtils.formatCoordinate(cameraBearing(), precision()));
    geoInfo.add(TextUtils.formatCoordinate(cameraPitch(), precision()));
    return TextUtils.join(",", geoInfo.toArray());
  } else {
    return String.format(Locale.US, "%f,%f,%f,%f,%f", cameraPoint().longitude(),
      cameraPoint().latitude(), cameraZoom(), cameraBearing(), cameraPitch());
  }
}
 
Example #6
Source File: PlaceOptions.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Build a new instance of the {@link PlaceOptions} class using the characteristics set in this
 * {@link Builder}.
 *
 * @param mode pass in which mode you'd like the view to be in when displayed to the user; Can
 *             be either {@link #MODE_FULLSCREEN} or {@link #MODE_CARDS}
 * @return a new instance of the {@link PlaceOptions} class
 * @since 0.1.0
 */
public PlaceOptions build(@IntRange(from = 1, to = 2) int mode) {

  if (!countries.isEmpty()) {
    country(TextUtils.join(",", countries.toArray()));
  }

  injectedPlaces(injectedPlaces);
  viewMode(mode);

  return autoBuild();
}
 
Example #7
Source File: MapboxSpeech.java    From mapbox-java with MIT License 5 votes vote down vote up
/**
 * This uses the provided parameters set using the {@link Builder} and first checks that all
 * values are valid, formats the values as strings for easier consumption by the API, and lastly
 * creates a new {@link MapboxSpeech} object with the values provided.
 *
 * @return a new instance of Mapbox Speech
 * @throws ServicesException when a provided parameter is detected to be incorrect
 * @since 3.0.0
 */
public MapboxSpeech build() {
  MapboxSpeech mapboxSpeech = autoBuild();

  if (TextUtils.isEmpty(mapboxSpeech.instruction())) {
    throw new ServicesException("Non-null, non-empty instruction text is required.");
  }

  return mapboxSpeech;
}
 
Example #8
Source File: MapboxOptimization.java    From mapbox-java with MIT License 5 votes vote down vote up
private static String formatCoordinates(List<Point> coordinates) {
  List<String> coordinatesFormatted = new ArrayList<>();
  for (Point point : coordinates) {
    coordinatesFormatted.add(String.format(Locale.US, "%s,%s",
      FormatUtils.formatCoordinate(point.longitude()),
      FormatUtils.formatCoordinate(point.latitude())));
  }

  return TextUtils.join(";", coordinatesFormatted.toArray());
}
 
Example #9
Source File: MapboxMapMatching.java    From mapbox-java with MIT License 5 votes vote down vote up
private static String formatCoordinates(List<Point> coordinates) {
  List<String> coordinatesFormatted = new ArrayList<>();
  for (Point point : coordinates) {
    coordinatesFormatted.add(String.format(Locale.US, "%s,%s",
      FormatUtils.formatCoordinate(point.longitude()),
      FormatUtils.formatCoordinate(point.latitude())));
  }

  return TextUtils.join(";", coordinatesFormatted.toArray());
}
 
Example #10
Source File: MapboxTilequery.java    From mapbox-java with MIT License 5 votes vote down vote up
/**
 * The longitude and latitude to be queried.
 *
 * @param point query point
 * @return this builder for chaining options together
 * @since 3.5.0
 */
public Builder query(@NonNull Point point) {
  query(String.format(Locale.US, "%s,%s",
    TextUtils.formatCoordinate(point.longitude()),
    TextUtils.formatCoordinate(point.latitude())));

  String str = String.format(Locale.US, "%s,%s",
    TextUtils.formatCoordinate(point.longitude()),
    TextUtils.formatCoordinate(point.latitude()));
  return this;
}
 
Example #11
Source File: MapboxMatrix.java    From mapbox-java with MIT License 5 votes vote down vote up
private static String formatCoordinates(List<Point> coordinates) {
  List<String> coordinatesFormatted = new ArrayList<>();
  for (Point point : coordinates) {
    coordinatesFormatted.add(String.format(Locale.US, "%s,%s",
      FormatUtils.formatCoordinate(point.longitude()),
      FormatUtils.formatCoordinate(point.latitude())));
  }
  return TextUtils.join(";", coordinatesFormatted.toArray());
}
 
Example #12
Source File: MapboxMatrix.java    From mapbox-java with MIT License 5 votes vote down vote up
/**
 * This uses the provided parameters set using the {@link Builder} and first checks that all
 * values are valid, formats the values as strings for easier consumption by the API, and lastly
 * creates a new {@link MapboxMatrix} object with the values provided.
 *
 * @return a new instance of Mapbox Matrix
 * @since 2.1.0
 */
public MapboxMatrix build() {
  if (coordinates == null || coordinates.size() < 2) {
    throw new ServicesException("At least two coordinates must be provided with your API"
      + " request.");
  } else if (coordinateListSizeLimit != null && coordinateListSizeLimit < 0) {
    throw new ServicesException("If you're going to use the coordinateListSizeLimit() method, "
      + "please pass through a number that's greater than zero.");
  } else if (coordinateListSizeLimit == null && coordinates.size() > 25) {
    throw new ServicesException("A maximum of 25 coordinates is the default "
      + " allowed for this API. If your Mapbox account has been enabled by the"
      + " Mapbox team to make a request with more than 25 coordinates, please use"
      + " the builder's coordinateListSizeLimit() method and pass through your account"
      + "-specific maximum.");
  } else if (coordinateListSizeLimit != null && coordinateListSizeLimit < coordinates.size()) {
    throw new ServicesException("If you're going to use the coordinateListSizeLimit() method,"
      + " please pass through a number that's equal to or greater than the size of"
      + " your coordinate list.");
  }

  coordinates(formatCoordinates(coordinates));

  sources(TextUtils.join(";", sources));
  destinations(TextUtils.join(";", destinations));
  annotations(TextUtils.join(",", annotations));
  approaches(TextUtils.join(";", approaches));

  // Generate build so that we can check that values are valid.
  MapboxMatrix matrix = autoBuild();

  if (!MapboxUtils.isAccessTokenValid(matrix.accessToken())) {
    throw new ServicesException("Using Mapbox Services requires setting a valid access token.");
  }
  return matrix;
}
 
Example #13
Source File: MapboxGeocoding.java    From mapbox-java with MIT License 4 votes vote down vote up
/**
 * Build a new {@link MapboxGeocoding} object.
 *
 * @return a new {@link MapboxGeocoding} using the provided values in this builder
 * @since 3.0.0
 */
public MapboxGeocoding build() {

  if (!countries.isEmpty()) {
    country(TextUtils.join(",", countries.toArray()));
  }

  if (intersectionStreets.size() == 2) {
    query(TextUtils.join(" and ", intersectionStreets.toArray()));
    geocodingTypes(GeocodingCriteria.TYPE_ADDRESS);
  }

  // Generate build so that we can check that values are valid.
  MapboxGeocoding geocoding = autoBuild();

  if (!MapboxUtils.isAccessTokenValid(geocoding.accessToken())) {
    throw new ServicesException("Using Mapbox Services requires setting a valid access token.");
  }
  if (geocoding.query().isEmpty()) {
    throw new ServicesException("A query with at least one character or digit is required.");
  }

  if (geocoding.reverseMode() != null
    && geocoding.limit() != null && !geocoding.limit().equals("1")) {
    throw new ServicesException("Limit must be combined with a single type parameter");
  }

  if (intersectionStreets.size() == 2) {
    if (!(geocoding.mode().equals(GeocodingCriteria.MODE_PLACES)
            || geocoding.mode().equals(GeocodingCriteria.MODE_PLACES_PERMANENT))) {
      throw new ServicesException("Geocoding mode must be GeocodingCriteria.MODE_PLACES "
              + "or GeocodingCriteria.MODE_PLACES_PERMANENT for intersection search.");
    }
    if (TextUtils.isEmpty(geocoding.geocodingTypes())
            || !geocoding.geocodingTypes().equals(GeocodingCriteria.TYPE_ADDRESS)) {
      throw new ServicesException("Geocoding type must be set to Geocoding "
              + "Criteria.TYPE_ADDRESS for intersection search.");
    }
    if (TextUtils.isEmpty(geocoding.proximity())) {
      throw new ServicesException("Geocoding proximity must be set for intersection search.");
    }
  }
  return geocoding;
}
 
Example #14
Source File: TurnLaneView.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);

  if (isInEditMode()) {
    LanesStyleKit.drawLaneStraight(canvas, primaryColor, size);
    return;
  }

  if (drawData == null || TextUtils.isEmpty(drawData.getDrawMethod())) {
    return;
  }

  switch (drawData.getDrawMethod()) {
    case DRAW_LANE_STRAIGHT:
      LanesStyleKit.drawLaneStraight(canvas, primaryColor, size);
      break;
    case DRAW_LANE_UTURN:
      LanesStyleKit.drawLaneUturn(canvas, primaryColor, size);
      break;
    case DRAW_LANE_RIGHT:
      LanesStyleKit.drawLaneRight(canvas, primaryColor, size);
      break;
    case DRAW_LANE_SLIGHT_RIGHT:
      LanesStyleKit.drawLaneSlightRight(canvas, primaryColor, size);
      break;
    case DRAW_LANE_RIGHT_ONLY:
      LanesStyleKit.drawLaneRightOnly(canvas, primaryColor, secondaryColor, size);
      break;
    case DRAW_LANE_STRAIGHT_RIGHT:
      LanesStyleKit.drawLaneStraightRight(canvas, primaryColor, size);
      break;
    case DRAW_LANE_STRAIGHT_ONLY:
      LanesStyleKit.drawLaneStraightOnly(canvas, primaryColor, secondaryColor, size);
      break;
    default:
      LanesStyleKit.drawLaneStraight(canvas, primaryColor, size);
      break;
  }

  // Set alpha based on validity
  setAlpha(!isValid ? 0.4f : 1.0f);

  // Flip if needed
  setScaleX(drawData.shouldBeFlipped() ? -1 : 1);
}
 
Example #15
Source File: MapboxStaticMap.java    From mapbox-java with MIT License 4 votes vote down vote up
/**
 * Returns the formatted URL string meant to be passed to your Http client for retrieval of the
 * actual Mapbox Static Image.
 *
 * @return a {@link HttpUrl} which can be used for making the request for the image
 * @since 3.0.0
 */
public HttpUrl url() {
  HttpUrl.Builder urlBuilder = HttpUrl.parse(baseUrl()).newBuilder()
    .addPathSegment("styles")
    .addPathSegment("v1")
    .addPathSegment(user())
    .addPathSegment(styleId())
    .addPathSegment("static")
    .addQueryParameter("access_token", accessToken());

  List<String> annotations = new ArrayList<>();
  if (staticMarkerAnnotations() != null) {
    List<String> markerStrings = new ArrayList<>(staticMarkerAnnotations().size());
    for (StaticMarkerAnnotation marker : staticMarkerAnnotations()) {
      markerStrings.add(marker.url());
    }
    annotations.addAll(markerStrings);
  }

  if (staticPolylineAnnotations() != null) {
    String[] polylineStringArray = new String[staticPolylineAnnotations().size()];
    for (StaticPolylineAnnotation polyline : staticPolylineAnnotations()) {
      polylineStringArray[staticPolylineAnnotations().indexOf(polyline)] = polyline.url();
    }
    annotations.addAll(Arrays.asList(polylineStringArray));
  }

  if (geoJson() != null) {
    annotations.add(String.format(Locale.US, "geojson(%s)", geoJson().toJson()));
  }

  if (!annotations.isEmpty()) {
    urlBuilder.addPathSegment(TextUtils.join(",", annotations.toArray()));
  }

  urlBuilder.addPathSegment(cameraAuto() ? CAMERA_AUTO
    : generateLocationPathSegment());

  if (beforeLayer() != null) {
    urlBuilder.addQueryParameter(BEFORE_LAYER, beforeLayer());
  }
  if (!attribution()) {
    urlBuilder.addQueryParameter("attribution", "false");
  }
  if (!logo()) {
    urlBuilder.addQueryParameter("logo", "false");
  }

  // Has to be last segment in URL
  urlBuilder.addPathSegment(generateSizePathSegment());
  return urlBuilder.build();

}
 
Example #16
Source File: MapboxIsochrone.java    From mapbox-java with MIT License 4 votes vote down vote up
/**
 * Build a new {@link MapboxIsochrone} object.
 *
 * @return this builder for chaining options together
 * @since 4.6.0
 */
public MapboxIsochrone build() {

  if (contoursMinutes != null) {
    if (contoursMinutes.length < 1) {
      throw new ServicesException("A query with at least one specified "
        + "minute amount is required.");
    }

    if (contoursMinutes.length >= 2) {
      for (int x = 0; x < contoursMinutes.length - 1; x++) {
        if (contoursMinutes[x] > contoursMinutes[x + 1]) {
          throw new ServicesException("The minutes must be listed"
            + " in order from the lowest number to the highest number.");
        }
      }
    }
    contoursMinutes(TextUtils.join(",", contoursMinutes));
  }

  if (contoursColors != null) {
    contoursColors(TextUtils.join(",", contoursColors));
  }

  if (contoursColors != null
    && contoursMinutes != null
    && contoursColors.length != contoursMinutes.length) {
    throw new ServicesException("Number of color elements "
      + "must match number of minute elements provided.");
  }

  MapboxIsochrone isochrone = autoBuild();

  if (!MapboxUtils.isAccessTokenValid(isochrone.accessToken())) {
    throw new ServicesException("Using the Mapbox Isochrone API requires setting "
      + "a valid access token.");
  }

  if (TextUtils.isEmpty(isochrone.coordinates())) {
    throw new ServicesException("A query with longitude and latitude values is "
      + "required.");
  }

  if (TextUtils.isEmpty(isochrone.profile())) {
    throw new ServicesException("A query with a set Directions profile (cycling,"
      + " walking, or driving) is required.");
  }

  if (TextUtils.isEmpty(isochrone.contoursMinutes())) {
    throw new ServicesException("A query with at least one specified minute amount"
      + " is required.");
  }

  if (isochrone.contoursColors() != null) {
    if (isochrone.contoursColors().contains("#")) {
      throw new ServicesException("Make sure that none of the contour color HEX"
        + " values have a # in front of it. Provide a list of the HEX values "
        + "without any # symbols.");
    }
  }
  return isochrone;
}
 
Example #17
Source File: MapboxMapMatching.java    From mapbox-java with MIT License 4 votes vote down vote up
/**
 * This uses the provided parameters set using the {@link Builder} and first checks that all
 * values are valid, formats the values as strings for easier consumption by the API, and lastly
 * creates a new {@link MapboxMapMatching} object with the values provided.
 *
 * @return a new instance of Mapbox Map Matching
 * @throws ServicesException when a provided parameter is detected to be incorrect
 * @since 2.1.0
 */
public MapboxMapMatching build() {
  if (coordinates == null || coordinates.size() < 2) {
    throw new ServicesException("At least two coordinates must be provided with your API"
      + " request.");
  }

  if (radiuses != null && radiuses.length != coordinates.size()) {
    throw new ServicesException(
      "There must be as many radiuses as there are coordinates.");
  }

  if (timestamps != null && timestamps.length != coordinates.size()) {
    throw new ServicesException(
      "There must be as many timestamps as there are coordinates.");
  }

  if (waypointIndices != null) {
    if (waypointIndices.length < 2) {
      throw new ServicesException(
        "Waypoints must be a list of at least two indexes separated by ';'");
    }
    if (waypointIndices[0] != 0
      || waypointIndices[waypointIndices.length - 1] != coordinates.size() - 1) {
      throw new ServicesException(
        "Waypoints must contain indices of the first and last coordinates"
      );
    }
    for (int i = 1; i < waypointIndices.length - 1; i++) {
      if (waypointIndices[i] < 0 || waypointIndices[i] >= coordinates.size()) {
        throw new ServicesException(
          "Waypoints index too large (no corresponding coordinate)");
      }
    }
  }

  if (waypointNames != null) {
    final String waypointNamesStr
        = FormatUtils.formatWaypointNames(Arrays.asList(waypointNames));
    waypointNames(waypointNamesStr);
  }

  if (approaches != null) {
    if (approaches.length != coordinates.size()) {
      throw new ServicesException("Number of approach elements must match "
        + "number of coordinates provided.");
    }
    String formattedApproaches = FormatUtils.formatApproaches(Arrays.asList(approaches));
    if (formattedApproaches == null) {
      throw new ServicesException("All approaches values must be one of curb, unrestricted");
    }
    approaches(formattedApproaches);
  }

  coordinates(formatCoordinates(coordinates));
  timestamps(TextUtils.join(";", timestamps));
  annotations(TextUtils.join(",", annotations));
  radiuses(TextUtils.join(";", radiuses));
  waypointIndices(TextUtils.join(";", waypointIndices));

  // Generate build so that we can check that values are valid.
  MapboxMapMatching mapMatching = autoBuild();

  if (!MapboxUtils.isAccessTokenValid(mapMatching.accessToken())) {
    throw new ServicesException("Using Mapbox Services requires setting a valid access token.");
  }
  return mapMatching;
}
 
Example #18
Source File: InstructionLoader.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
private boolean hasImageUrl(BannerComponents components) {
  return !TextUtils.isEmpty(components.imageBaseUrl());
}
 
Example #19
Source File: InstructionLoader.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
private boolean hasAbbreviation(BannerComponents components) {
  return !TextUtils.isEmpty(components.abbreviation());
}
 
Example #20
Source File: MapboxIsochrone.java    From mapbox-java with MIT License 3 votes vote down vote up
/**
 * A {@link Point} object which represents a {longitude,latitude} coordinate
 * pair around which to center the isochrone lines.
 *
 * @param queryPoint center query point for the isochrone calculation
 * @return this builder for chaining options together
 * @since 4.6.0
 */
public Builder coordinates(@NonNull Point queryPoint) {
  coordinates(String.format(Locale.US, "%s,%s",
    TextUtils.formatCoordinate(queryPoint.longitude()),
    TextUtils.formatCoordinate(queryPoint.latitude())));
  return this;
}
 
Example #21
Source File: PlaceOptions.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 3 votes vote down vote up
/**
 * Limit results to a bounding box.
 *
 * @param minX a longitude coordinate which defines the right of the bounding box when the map's
 *             cardinal direction is north
 * @param minY a latitude coordinate which defines the bottom of the bounding box when the map's
 *             cardinal direction is north
 * @param maxX a longitude coordinate which defines the left of the bounding box when the map's
 *             cardinal direction is north
 * @param maxY a latitude coordinate which defines the top of the bounding box when the map's
 *             cardinal direction is north
 * @return this builder instance for chaining options together
 * @since 0.1.0
 */
public Builder bbox(@FloatRange(from = -180, to = 180) double minX,
                    @FloatRange(from = -90, to = 90) double minY,
                    @FloatRange(from = -180, to = 180) double maxX,
                    @FloatRange(from = -90, to = 90) double maxY) {
  bbox(String.format(Locale.US, "%s,%s,%s,%s",
    TextUtils.formatCoordinate(minX),
    TextUtils.formatCoordinate(minY),
    TextUtils.formatCoordinate(maxX),
    TextUtils.formatCoordinate(maxY))
  );
  return this;
}
 
Example #22
Source File: MapboxGeocoding.java    From mapbox-java with MIT License 3 votes vote down vote up
/**
 * Perform a reverse geocode on the provided {@link Point}. Only one point can be passed in as
 * the query and isn't guaranteed to return a result. If you
 * want to do a batch reverse Geocode, you can use the {@link #query(String)} method
 * separating them with a semicolon. For more information about batch geocoding, contact <a href="https://www.mapbox.com/contact/sales/">Mapbox sales</a>.
 *
 * @param point a GeoJSON point which matches to coordinate you'd like to reverse geocode
 * @return this builder for chaining options together
 * @since 3.0.0
 */
public Builder query(@NonNull Point point) {
  query(String.format(Locale.US, "%s,%s",
    TextUtils.formatCoordinate(point.longitude()),
    TextUtils.formatCoordinate(point.latitude())));
  return this;
}
 
Example #23
Source File: RouteUtils.java    From graphhopper-navigation-android with MIT License 2 votes vote down vote up
/**
 * Checks if the {@link String} route profile provided is a valid profile
 * that can be used with the directions API.
 *
 * @param routeProfile being validated
 * @return true if valid, false if not
 * @since 0.13.0
 */
public boolean isValidRouteProfile(String routeProfile) {
  return !TextUtils.isEmpty(routeProfile) && VALID_PROFILES.contains(routeProfile);
}