Skip to content

Commit 92fbea4

Browse files
committed
feat: upgraded dependencies and places SDK
1 parent 397433d commit 92fbea4

File tree

7 files changed

+54
-39
lines changed

7 files changed

+54
-39
lines changed

app/src/main/java/com/google/places/android/ktx/demo/AutocompleteDemoActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ class AutocompleteDemoActivity : AppCompatActivity() {
3636
as AutocompleteSupportFragment
3737

3838
// Specify the types of place data to return.
39-
autocompleteFragment.setPlaceFields(listOf(Place.Field.ID, Place.Field.NAME))
39+
autocompleteFragment.setPlaceFields(listOf(Place.Field.ID, Place.Field.DISPLAY_NAME))
4040

4141
// Listen to place selection events
4242
lifecycleScope.launch {
4343
autocompleteFragment.placeSelectionEvents().collect { event ->
4444
when (event) {
4545
is PlaceSelectionSuccess -> Toast.makeText(
4646
this@AutocompleteDemoActivity,
47-
"Got place '${event.place.name}'",
47+
"Got place '${event.place.displayName}'",
4848
Toast.LENGTH_SHORT
4949
).show()
5050
is PlaceSelectionError -> Toast.makeText(

app/src/main/java/com/google/places/android/ktx/demo/PlacesSearchViewModel.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import com.google.android.libraries.places.ktx.api.net.awaitFetchPlace
3030
import com.google.android.libraries.places.ktx.api.net.awaitFindAutocompletePredictions
3131
import dagger.hilt.android.lifecycle.HiltViewModel
3232
import kotlinx.coroutines.CoroutineExceptionHandler
33+
import kotlinx.coroutines.ExperimentalCoroutinesApi
3334
import kotlinx.coroutines.Job
3435
import kotlinx.coroutines.delay
3536
import kotlinx.coroutines.launch
@@ -44,6 +45,7 @@ class PlacesSearchViewModel @Inject constructor(
4445

4546
private var searchJob: Job? = null
4647

48+
@OptIn(ExperimentalCoroutinesApi::class)
4749
fun onSearchQueryChanged(query: String) {
4850
searchJob?.cancel()
4951

@@ -75,6 +77,7 @@ class PlacesSearchViewModel @Inject constructor(
7577
}
7678
}
7779

80+
@OptIn(ExperimentalCoroutinesApi::class)
7881
fun onAutocompletePredictionClicked(prediction: AutocompletePrediction) {
7982
val handler = CoroutineExceptionHandler { _, e ->
8083
e.printStackTrace()
@@ -84,9 +87,9 @@ class PlacesSearchViewModel @Inject constructor(
8487
val place = placesClient.awaitFetchPlace(
8588
prediction.placeId,
8689
listOf(
87-
Place.Field.NAME,
88-
Place.Field.ADDRESS,
89-
Place.Field.LAT_LNG,
90+
Place.Field.DISPLAY_NAME,
91+
Place.Field.FORMATTED_ADDRESS,
92+
Place.Field.LOCATION,
9093
Place.Field.BUSINESS_STATUS
9194
)
9295
)

gradle/libs.versions.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
[versions]
22
androidCompileSdk = "34"
3-
androidMinSdk = "21"
3+
androidMinSdk = "23"
44
androidTargetSdk = "34"
55

6-
appcompat = "1.6.1"
6+
appcompat = "1.7.0"
77
coreKtx = "1.13.1"
88
dokkaGradlePlugin = "1.9.20"
9-
fragmentKtx = "1.7.1"
10-
gradle = "8.4.1"
9+
fragmentKtx = "1.8.3"
10+
gradle = "8.6.1"
1111
hiltAndroid = "2.51.1"
1212
jacocoAndroid = "0.2.1"
1313
kotlin = "2.0.0"
1414
kotlinGradlePlugin = "1.9.24"
1515
kotlinx-coroutines-core = "1.8.1"
16-
lifecycle-viewmodel-ktx = "2.8.0"
16+
lifecycle-viewmodel-ktx = "2.8.6"
1717
material = "1.12.0"
18-
playServicesMaps = "18.2.0"
18+
playServicesMaps = "19.0.0"
1919
secretsGradlePlugin = "2.0.1"
2020
truth = "1.4.2"
2121
volley = "1.2.1"
2222
multidex = "2.0.1"
2323
kotlinx-coroutines-play-services = "1.8.1"
24-
places = "3.4.0"
25-
junit-ext = "1.1.5"
26-
test-core = "1.5.0"
24+
places = "4.0.0"
25+
junit-ext = "1.2.1"
26+
test-core = "1.6.1"
2727
mockito-kotlin = "2.2.0"
2828
junit = "4.13.2"
29-
mockito-core = "5.9.0"
29+
mockito-core = "5.11.0"
3030

3131
[libraries]
3232
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }

gradle/wrapper/gradle-wrapper.jar

-16.9 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

gradlew

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,11 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
9088

9189
# Use the maximum available, or set MAX_FD != -1 to use that value.
9290
MAX_FD=maximum
@@ -133,22 +131,29 @@ location of your Java installation."
133131
fi
134132
else
135133
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137137
138138
Please set the JAVA_HOME variable in your environment to match the
139139
location of your Java installation."
140+
fi
140141
fi
141142

142143
# Increase the maximum file descriptors if we can.
143144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
147+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148+
# shellcheck disable=SC2039,SC3045
146149
MAX_FD=$( ulimit -H -n ) ||
147150
warn "Could not query maximum file descriptor limit"
148151
esac
149152
case $MAX_FD in #(
150153
'' | soft) :;; #(
151154
*)
155+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156+
# shellcheck disable=SC2039,SC3045
152157
ulimit -n "$MAX_FD" ||
153158
warn "Could not set maximum file descriptor limit to $MAX_FD"
154159
esac
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
193198
done
194199
fi
195200

196-
# Collect all arguments for the java command;
197-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198-
# shell script including quotes and variable substitutions, so put them in
199-
# double quotes to make sure that they get re-expanded; and
200-
# * put everything else in single quotes, so that it's not re-expanded.
201+
202+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204+
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
201210

202211
set -- \
203212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

gradlew.bat

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
2828
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

@@ -42,11 +43,11 @@ set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
4344
if %ERRORLEVEL% equ 0 goto execute
4445

45-
echo.
46-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47-
echo.
48-
echo Please set the JAVA_HOME variable in your environment to match the
49-
echo location of your Java installation.
46+
echo. 1>&2
47+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48+
echo. 1>&2
49+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50+
echo location of your Java installation. 1>&2
5051

5152
goto fail
5253

@@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5657

5758
if exist "%JAVA_EXE%" goto execute
5859

59-
echo.
60-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61-
echo.
62-
echo Please set the JAVA_HOME variable in your environment to match the
63-
echo location of your Java installation.
60+
echo. 1>&2
61+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62+
echo. 1>&2
63+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64+
echo location of your Java installation. 1>&2
6465

6566
goto fail
6667

0 commit comments

Comments
 (0)