/** * Converts String array with waypoint_names values * to a string ready for API consumption. * * @param waypointNames a string representing approaches to each coordinate. * @return a formatted string. * @since 3.3.0 */ public static String formatWaypointNames(String[] waypointNames) { for (int i = 0; i < waypointNames.length; i++) { if (waypointNames[i] == null) { waypointNames[i] = ""; } } return TextUtils.join(";", waypointNames); } }
/** * Computes a full user agent header of the form: * {@code MapboxJava/1.2.0 Mac OS X/10.11.5 (x86_64)}. * * @param clientAppName Application Name * @return {@link String} representing the header user agent * @since 1.0.0 */ public static String getHeaderUserAgent(@Nullable String clientAppName) { String osName = System.getProperty("os.name"); String osVersion = System.getProperty("os.version"); String osArch = System.getProperty("os.arch"); if (TextUtils.isEmpty(osName) || TextUtils.isEmpty(osVersion) || TextUtils.isEmpty(osArch)) { return Constants.HEADER_USER_AGENT; } else { return getHeaderUserAgent(clientAppName, osName, osVersion, osArch); } }
/** * Checks that the provided access token is not empty or null, and that it starts with * the right prefixes. Note that this method does not check Mapbox servers to verify that * it actually belongs to an account. * * @param accessToken A Mapbox access token. * @return true if the provided access token is valid, false otherwise. * @since 1.0.0 */ public static boolean isAccessTokenValid(String accessToken) { return !TextUtils.isEmpty(accessToken) && !(!accessToken.startsWith("pk.") && !accessToken.startsWith("sk.") && !accessToken.startsWith("tk.")); } }
@Override protected Call<RouteTileVersionsResponse> initializeCall() { return getService().getCall( ApiCallHelper.getHeaderUserAgent(clientAppName()), accessToken() ); }
/** * Set the inner line fill color. * * @param red the value of the fill color * @param green the value of the fill color * @param blue the value of the fill color * @return this builder for chaining options together * @since 3.1.0 */ public Builder fillColor(int red, int green, int blue) { return fillColor(toHexString(red, green, blue)); }
@Override protected Call<RouteTileVersionsResponse> initializeCall() { return getService().getCall( ApiCallHelper.getHeaderUserAgent(clientAppName()), accessToken() ); }
@Test public void joinTest() throws Exception { Float[] numbers = new Float[4]; for (int i = 0; i < 4; i++) { numbers[i] = 1.0f * i; } Assert.assertEquals("0.0-1.0-2.0-3.0", TextUtils.join("-", numbers)); } }
/** * Set the inner line fill color. * * @param red the value of the fill color * @param green the value of the fill color * @param blue the value of the fill color * @return this builder for chaining options together * @since 3.1.0 */ public Builder fillColor(int red, int green, int blue) { return fillColor(toHexString(red, green, blue)); }
@Override protected Call<RouteTileVersionsResponse> initializeCall() { return getService().getCall( ApiCallHelper.getHeaderUserAgent(clientAppName()), accessToken() ); }
/** * A hex representation of the markers color. * * @param red the value of the marker icon color * @param green the value of the marker icon color * @param blue the value of the marker icon color * @return this builder for chaining options together * @since 3.1.0 */ public Builder color(int red, int green, int blue) { return color(toHexString(red, green, blue)); }
@Override protected Call<ResponseBody> initializeCall() { return getService().getCall( ApiCallHelper.getHeaderUserAgent(clientAppName()), formatBoundingBox(boundingBox()), version(), accessToken() ); }
/** * Set the line outer stroke color. * * @param red the value of the stroke color * @param green the value of the stroke color * @param blue the value of the stroke color * @return this builder for chaining options together * @since 3.1.0 */ public Builder strokeColor(int red, int green, int blue) { return strokeColor(toHexString(red, green, blue)); }
@Override protected Call<ResponseBody> initializeCall() { return getService().getCall( ApiCallHelper.getHeaderUserAgent(clientAppName()), formatBoundingBox(boundingBox()), version(), accessToken() ); }
/** * Set the inner line fill color. * * @param red the value of the fill color * @param green the value of the fill color * @param blue the value of the fill color * @return this builder for chaining options together * @since 3.1.0 */ public Builder fillColor(int red, int green, int blue) { return fillColor(toHexString(red, green, blue)); }
@Override protected Call<ResponseBody> initializeCall() { return getService().getCall( ApiCallHelper.getHeaderUserAgent(clientAppName()), formatBoundingBox(boundingBox()), version(), accessToken() ); }
/** * A hex representation of the markers color. * * @param red the value of the marker icon color * @param green the value of the marker icon color * @param blue the value of the marker icon color * @return this builder for chaining options together * @since 3.1.0 */ public Builder color(int red, int green, int blue) { return color(toHexString(red, green, blue)); }
/** * Set the line outer stroke color. * * @param red the value of the stroke color * @param green the value of the stroke color * @param blue the value of the stroke color * @return this builder for chaining options together * @since 3.1.0 */ public Builder strokeColor(int red, int green, int blue) { return strokeColor(toHexString(red, green, blue)); }
/** * Set the line outer stroke color. * * @param red the value of the stroke color * @param green the value of the stroke color * @param blue the value of the stroke color * @return this builder for chaining options together * @since 3.1.0 */ public Builder strokeColor(int red, int green, int blue) { return strokeColor(toHexString(red, green, blue)); }
/** * A hex representation of the markers color. * * @param red the value of the marker icon color * @param green the value of the marker icon color * @param blue the value of the marker icon color * @return this builder for chaining options together * @since 3.1.0 */ public Builder color(int red, int green, int blue) { return color(toHexString(red, green, blue)); }