Skip to content

Commit

Permalink
add new tip FilterGooglePlacesAutocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimsn98 committed May 4, 2021
1 parent 17b81ef commit a63684f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
[![alt text][InstagramIcon]][Instagram]
[![alt text][TelegramIcon]][Telegram]

### #185 Filter Google Places Autocomplete
![alt text](/screenshots/FilterGooglePlacesAutocomplete.png)

### #184 String Extension JoinToString
![alt text](/screenshots/JoinToString.png)

Expand Down
40 changes: 40 additions & 0 deletions codes/FilterGooglePlacesAutocomplete.kt.kt
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)
Binary file added screenshots/FilterGooglePlacesAutocomplete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a63684f

Please sign in to comment.