MapIntent extends BaseIntent<MapIntent> { public MapIntent location(@FloatRange(from = LAT_MIN, to = LAT_MAX) final double lat, @FloatRange(from = LNG_MIN, to = LNG_MAX) final double lng) { this.lat = Math.max(LAT_MIN, Math.min(LAT_MAX, lat)); this.lng = Math.max(LNG_MIN, Math.min(LNG_MAX, lng)); this.latLngSet = true; return this; }  MapIntent location(@FloatRange(from = LAT_MIN, to = LAT_MAX) final double lat, @FloatRange(from = LNG_MIN, to = LNG_MAX) final double lng); @FloatRange(from = LAT_MIN, to = LAT_MAX) double lat(); @FloatRange(from = LNG_MIN, to = LNG_MAX) double lng(); MapIntent locationQuery(@Nullable final String query); @NonNull String locationQuery(); MapIntent zoomLevel(@IntRange(from = ZOOM_LEVEL_MIN, to = ZOOM_LEVEL_MAX) final int level); @IntRange(from = 0, to = ZOOM_LEVEL_MAX) int zoomLevel(); MapIntent label(@Nullable final String label); @NonNull String label(); static final String URI_SCHEME; static final double LAT_MIN; static final double LAT_MAX; static final double LNG_MIN; static final double LNG_MAX; static final int ZOOM_LEVEL_MIN; static final int ZOOM_LEVEL_MAX; }
@Test public void testBuildWithLocation() { final MapIntent mapIntent = new MapIntent().location(40.7141667, -74.0063889); final Intent intent = mapIntent.build(context); assertThatIntentIsValid(intent); assertThat( intent.getData(), is(Uri.parse("geo:" + Double.toString(40.7141667) + "," + Double.toString(-74.0063889))) ); }
@Test public void testLocation() { final MapIntent intent = new MapIntent(); intent.location(24.16546d, 135.154d); assertThat(intent.lat(), is(24.16546d)); assertThat(intent.lng(), is(135.154d)); }