-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new tip FilterGooglePlacesAutocomplete
- Loading branch information
1 parent
17b81ef
commit a63684f
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Filtering Google Places Autocomplete Results | ||
*/ | ||
|
||
/* | ||
* Field list to receive from the place instances | ||
*/ | ||
val fields = listOf( | ||
Place.Field.NAME, | ||
Place.Field.ADDRESS, | ||
Place.Field.LAT_LNG | ||
) | ||
|
||
/* | ||
* Rectangular area bounds to filter place results | ||
*/ | ||
val bounds = RectangularBounds.newInstance( | ||
LatLng(-33.880490, 151.184363), | ||
LatLng(-33.858754, 151.229596) | ||
) | ||
|
||
val placesBuilder = Autocomplete.IntentBuilder( | ||
AutocompleteActivityMode.OVERLAY, | ||
fields | ||
) | ||
|
||
/* | ||
* Filter places result by area bounds | ||
*/ | ||
placesBuilder.setLocationBias(bounds) | ||
|
||
/* | ||
* Filter places result by country code | ||
*/ | ||
placesBuilder.setCountry("TR") | ||
|
||
/* | ||
* Start places search intent | ||
*/ | ||
startActivityForResult(placesBuilder.build(context), 1000) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.