Skip to content

Commit 1e0053a

Browse files
authored
feat: add samples for release 3.2.0 (#600)
1 parent 0d1b558 commit 1e0053a

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

.github/snippet-bot.yml

Whitespace-only changes.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ build/
33
.gradle
44
*.iml
55
local.properties
6+
secrets.properties
67
.DS_Store
78
.java-version

demo-kotlin/app/build.gradle

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ plugins {
66
}
77

88
android {
9-
compileSdkVersion 33
9+
compileSdk 33
1010
defaultConfig {
1111
applicationId "com.example.placesdemo"
12-
minSdkVersion 21
13-
targetSdkVersion 33
12+
minSdk 21
13+
targetSdk 33
1414
multiDexEnabled true
1515
versionCode 1
1616
versionName "1.0"
@@ -36,22 +36,25 @@ dependencies {
3636
implementation "com.github.bumptech.glide:glide:4.13.2"
3737
implementation "com.android.databinding:viewbinding:8.0.0"
3838

39-
// Places SDK for Android
40-
implementation 'com.google.android.libraries.places:places:3.1.0'
41-
implementation 'com.google.maps.android:android-maps-utils:2.4.0'
39+
// KTX for the Places SDK for Android library
40+
implementation 'com.google.maps.android:places-ktx:3.0.0'
41+
42+
// KTX for the Maps SDK for Android Utility Library
43+
implementation 'com.google.maps.android:maps-utils-ktx:5.0.0'
4244
}
4345
repositories {
4446
mavenCentral()
4547
}
4648

4749
secrets {
4850
// To add your Google Maps Platform API key to this project:
49-
// 1. Create or open file local.properties in this folder, which will be ready by default
50-
// by secrets_gradle_plugin
51+
// 1. Create or open file secrets.properties in the root folder of the project, which will be
52+
// read by secrets_gradle_plugin
5153
// 2. Add this line, replacing YOUR_API_KEY with a key from a project with Places API enabled:
5254
// PLACES_API_KEY=YOUR_API_KEY
5355
// 3. Add this line, replacing YOUR_API_KEY with a key from a project with Maps SDK for Android
5456
// enabled (can be the same project and key as in Step 2):
5557
// MAPS_API_KEY=YOUR_API_KEY
58+
propertiesFileName = "secrets.properties"
5659
defaultPropertiesFileName 'local.defaults.properties'
5760
}

demo-kotlin/app/src/main/java/com/example/placesdemo/AutocompleteAddressActivity.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import com.google.android.gms.maps.model.MapStyleOptions
4141
import com.google.android.gms.maps.model.Marker
4242
import com.google.android.gms.maps.model.MarkerOptions
4343
import com.google.android.libraries.places.api.model.Place
44-
import com.google.android.libraries.places.api.model.TypeFilter
44+
import com.google.android.libraries.places.api.model.PlaceTypes
4545
import com.google.android.libraries.places.widget.Autocomplete
4646
import com.google.android.libraries.places.widget.model.AutocompleteActivityMode
4747
import com.google.maps.android.SphericalUtil.computeDistanceBetween
@@ -101,8 +101,7 @@ class AutocompleteAddressActivity : AppCompatActivity(R.layout.autocomplete_addr
101101
// Build the autocomplete intent with field, country, and type filters applied
102102
val intent = Autocomplete.IntentBuilder(AutocompleteActivityMode.OVERLAY, fields)
103103
.setCountries(listOf("US"))
104-
//TODO: https://developers.google.com/maps/documentation/places/android-sdk/autocomplete
105-
.setTypesFilter(listOf(TypeFilter.ADDRESS.toString().lowercase()))
104+
.setTypesFilter(listOf(PlaceTypes.ADDRESS))
106105
.build(this)
107106
startAutocomplete.launch(intent)
108107
}

demo-kotlin/app/src/main/java/com/example/placesdemo/CurrentPlaceActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class CurrentPlaceActivity : AppCompatActivity() {
7878
Place.Field.CURRENT_OPENING_HOURS,
7979
Place.Field.DELIVERY,
8080
Place.Field.DINE_IN,
81+
Place.Field.EDITORIAL_SUMMARY,
8182
Place.Field.OPENING_HOURS,
8283
Place.Field.PHONE_NUMBER,
8384
Place.Field.RESERVABLE,

demo-kotlin/app/src/main/java/com/example/placesdemo/StringUtil.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ object StringUtil {
4545

4646
fun convertToLatLngBounds(
4747
southWest: String?, northEast: String?): LatLngBounds? {
48-
val soundWestLatLng = convertToLatLng(southWest)
48+
val southWestLatLng = convertToLatLng(southWest)
4949
val northEastLatLng = convertToLatLng(northEast)
50-
return if (soundWestLatLng == null || northEast == null) {
50+
return if (southWestLatLng == null || northEastLatLng == null) {
5151
null
52-
} else LatLngBounds(soundWestLatLng, northEastLatLng)
52+
} else LatLngBounds(southWestLatLng, northEastLatLng)
5353
}
5454

5555
fun convertToLatLng(value: String?): LatLng? {

snippets/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ dependencies {
4747
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
4848
// [END_EXCLUDE]
4949
// [START maps_android_places_upgrade_snippet]
50-
implementation 'com.google.android.libraries.places:places:3.1.0'
50+
implementation 'com.google.android.libraries.places:places:3.2.0'
5151
// [END maps_android_places_upgrade_snippet]
5252
}
5353
// [END maps_android_places_install_snippet]

0 commit comments

Comments
 (0)