Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add banner component type #1098

Merged
merged 3 commits into from
Jan 8, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringDef;

import com.google.auto.value.AutoValue;
import com.google.gson.Gson;
Expand All @@ -11,6 +12,8 @@
import com.mapbox.api.directions.v5.DirectionsAdapterFactory;
import com.mapbox.api.directions.v5.MapboxDirections;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;

/**
Expand All @@ -25,6 +28,66 @@
public abstract class BannerComponents extends DirectionsJsonObject
implements Comparable<BannerComponents> {

/**
* Default. Indicates the text is part of the instructions and no other type.
*
* @since 3.0.0
*/
public static final String TEXT = "text";

/**
* This is text that can be replaced by an imageBaseURL icon.
*
* @since 3.0.0
*/
public static final String ICON = "icon";

/**
* This is text that can be dropped, and should be dropped if you are rendering icons.
*
* @since 3.0.0
*/
public static final String DELIMITER = "delimiter";

/**
* Indicates the exit number for the maneuver.
*
* @since 3.0.0
*/
public static final String EXIT_NUMBER = "exit-number";

/**
* Provides the the word for exit in the local language.
*
* @since 3.0.0
*/
public static final String EXIT = "exit";

/**
* Indicates which lanes can be used to complete the maneuver.
*
* @since 3.0.0
*/
public static final String LANE = "lane";

/**
* Banner component types.
* https://docs.mapbox.com/api/navigation/#banner-instruction-object
*
* @since 3.0.0
*/
@Retention(RetentionPolicy.SOURCE)
@StringDef( {
TEXT,
ICON,
DELIMITER,
EXIT_NUMBER,
EXIT,
LANE
})
public @interface BannerComponentsType {
}

/**
* Create a new instance of this class by using the {@link Builder} class.
*
Expand Down Expand Up @@ -64,6 +127,7 @@ public static Builder builder() {
* @since 3.0.0
*/
@NonNull
@BannerComponentsType
public abstract String type();

/**
Expand Down Expand Up @@ -230,7 +294,7 @@ public abstract static class Builder {
* @return this builder for chaining options together
* @since 3.0.0
*/
public abstract Builder type(@NonNull String type);
public abstract Builder type(@NonNull @BannerComponentsType String type);


/**
Expand Down