public class MapIntent extends BaseIntent<MapIntent>
BaseIntent builder implementation providing API for building and starting of intents
targeting a maps related applications.
location(double, double). You can also specify either label for the requested
location via label(String) or zoom level via zoomLevel(int).
locationQuery(String), which can contain
name of place (town/city) and state that you want to show on map. In this case you can also
specify the location label via label(String) as for lat + lng based map intent.| Modifier and Type | Field and Description |
|---|---|
static double |
LAT_MAX
Maximum allowed value for latitude.
|
static double |
LAT_MIN
Minimum allowed value for latitude.
|
static double |
LNG_MAX
Maximum allowed value for longitude.
|
static double |
LNG_MIN
Minimum allowed value for longitude.
|
static String |
URI_SCHEME
Uri scheme for map targeting intents.
|
static int |
ZOOM_LEVEL_MAX
Maximum allowed value for zoom level.
|
static int |
ZOOM_LEVEL_MIN
Minimum allowed value for zoom level.
|
| Constructor and Description |
|---|
MapIntent() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
ensureCanBuildOrThrow()
Called to ensure that this builder can build its Intent from its current data.
|
String |
label()
Returns the label text for the requested map location.
|
MapIntent |
label(String label)
Sets a text by which should be labeled the requested location on map.
|
double |
lat()
Returns the latitude position of a location to show on map.
|
double |
lng()
Returns the longitude position of a location to show on map.
|
MapIntent |
location(double lat,
double lng)
Sets latitude and longitude of a location to show on a map.
|
String |
locationQuery()
Returns the location query targeting a specific location on a map.
|
MapIntent |
locationQuery(String query)
Sets a location query that will be used to target a desired location on a map.
|
protected Intent |
onBuild(Context context)
Invoked from
BaseIntent.build(Context) after BaseIntent.ensureCanBuildOrThrow() to build intent
specific for this intent builder from the current data. |
int |
zoomLevel()
Returns the zoom level at which will be map displayed.
|
MapIntent |
zoomLevel(int level)
Sets a zoom level at which should be a desired location on a map displayed to a user.
|
activityNotFoundMessage, activityNotFoundMessage, build, cannotBuildIntentException, dialogTitle, dialogTitle, enterTransition, enterTransition, exitTransition, exitTransition, isActivityForIntentAvailable, notifyActivityNotFound, onStartWith, startWith, transitionspublic static final String URI_SCHEME
Constant value: geo
public static final double LAT_MIN
public static final double LAT_MAX
public static final double LNG_MIN
public static final double LNG_MAX
public static final int ZOOM_LEVEL_MIN
public static final int ZOOM_LEVEL_MAX
public MapIntent location(double lat, double lng)
public double lat()
[-90, 90], 0 by default.location(double, double),
lng()public double lng()
[-180, 180], 0 by default.location(double, double),
lat()public MapIntent locationQuery(String query)
query - The desired location query. Can be for example name of a desired town with street
address and address number to show on a map.locationQuery()public String locationQuery()
locationQuery(String)public MapIntent zoomLevel(int level)
level - The desired zoom level in the range [1, 23]. The highest level, the closest
to map.zoomLevel()public int zoomLevel()
[1, 23] or 0 by default.zoomLevel(int)public MapIntent label(String label)
label - The desired label text.label()public String label()
label(String)protected void ensureCanBuildOrThrow()
BaseIntent
If there are some required data missing/not specified, an exception indicating such state
should be thrown. The default exception may be created via BaseIntent.cannotBuildIntentException(String).
ensureCanBuildOrThrow in class BaseIntent<MapIntent>protected Intent onBuild(Context context)
BaseIntentBaseIntent.build(Context) after BaseIntent.ensureCanBuildOrThrow() to build intent
specific for this intent builder from the current data.onBuild in class BaseIntent<MapIntent>context - Context obtained from the IntentStarter.