Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit c1cb203

Browse files
committed
2 parents 6850e6e + de52bff commit c1cb203

9 files changed

Lines changed: 30 additions & 26 deletions

File tree

solution/app/build.gradle.kts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,40 +65,40 @@ kapt {
6565

6666
dependencies {
6767

68-
implementation("androidx.core:core-ktx:1.12.0")
68+
implementation("androidx.core:core-ktx:1.13.0")
6969
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
70-
implementation("androidx.activity:activity-compose:1.8.2")
71-
implementation(platform("androidx.compose:compose-bom:2024.03.00"))
70+
implementation("androidx.activity:activity-compose:1.9.0")
71+
implementation(platform("androidx.compose:compose-bom:2024.04.01"))
7272
implementation("androidx.compose.ui:ui")
7373
implementation("androidx.compose.ui:ui-graphics")
7474
implementation("androidx.compose.ui:ui-tooling-preview")
7575
implementation("androidx.compose.material3:material3")
7676

7777
testImplementation("junit:junit:4.13.2")
78-
testImplementation("org.robolectric:robolectric:4.11.1")
78+
testImplementation("org.robolectric:robolectric:4.12.1")
7979
testImplementation("androidx.test:core:1.5.0")
8080
testImplementation("com.google.truth:truth:1.4.2")
8181

8282
androidTestImplementation("androidx.test.ext:junit:1.1.5")
8383
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
84-
androidTestImplementation(platform("androidx.compose:compose-bom:2024.03.00"))
84+
androidTestImplementation(platform("androidx.compose:compose-bom:2024.04.01"))
8585
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
8686

8787
debugImplementation("androidx.compose.ui:ui-tooling")
8888
debugImplementation("androidx.compose.ui:ui-test-manifest")
8989

9090
// Hilt
91-
val hiltVersion = "2.51"
91+
val hiltVersion = "2.51.1"
9292
implementation("com.google.dagger:hilt-android:$hiltVersion")
9393
kapt("com.google.dagger:hilt-android-compiler:$hiltVersion")
9494
implementation(kotlin("reflect"))
9595

9696
// Google Maps Compose library
97-
implementation("com.google.maps.android:maps-compose:4.3.3")
97+
implementation("com.google.maps.android:maps-compose:4.4.0")
9898
// Google Maps Compose utility library
99-
implementation("com.google.maps.android:maps-compose-utils:4.3.3")
99+
implementation("com.google.maps.android:maps-compose-utils:4.4.0")
100100
// Google Maps Compose widgets library
101-
implementation("com.google.maps.android:maps-compose-widgets:4.3.3")
101+
implementation("com.google.maps.android:maps-compose-widgets:4.4.0")
102102
}
103103

104104
secrets {

solution/app/src/main/java/com/example/mountainmarkers/MountainMap.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import com.google.android.gms.maps.model.LatLng
3838
import com.google.android.gms.maps.model.LatLngBounds
3939
import com.google.android.gms.maps.model.MapStyleOptions
4040
import com.google.maps.android.compose.CameraPositionState
41-
import com.google.maps.android.compose.Circle
4241
import com.google.maps.android.compose.GoogleMap
4342
import com.google.maps.android.compose.GoogleMapComposable
4443
import com.google.maps.android.compose.MapEffect
@@ -115,19 +114,19 @@ fun MountainMap(
115114
when (selectedMarkerType) {
116115
MarkerType.Basic -> {
117116
BasicMarkersMapContent(
118-
mountainsScreenViewState = viewState,
117+
mountains = viewState.mountains,
119118
)
120119
}
121120

122121
MarkerType.Advanced -> {
123122
AdvancedMarkersMapContent(
124-
mountainsScreenViewState = viewState,
123+
mountains = viewState.mountains,
125124
)
126125
}
127126

128127
MarkerType.Clustered -> {
129128
ClusteringMarkersMapContent(
130-
mountainsScreenViewState = viewState,
129+
mountains = viewState.mountains,
131130
onClusterClick = { cluster ->
132131
val newZoom = cameraPositionState.position.zoom + 1
133132
scope.launch {

solution/app/src/main/java/com/example/mountainmarkers/presentation/AdvancedMarkersMapContent.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import androidx.compose.runtime.Composable
1919
import androidx.compose.ui.graphics.toArgb
2020
import androidx.compose.ui.platform.LocalContext
2121
import com.example.mountainmarkers.R
22+
import com.example.mountainmarkers.data.local.Mountain
2223
import com.example.mountainmarkers.data.local.is14er
2324
import com.example.mountainmarkers.data.utils.toElevationString
2425
import com.example.mountainmarkers.presentation.MountainsScreenViewState.MountainList
@@ -37,7 +38,7 @@ import com.google.maps.android.compose.rememberMarkerState
3738
@Composable
3839
@GoogleMapComposable
3940
fun AdvancedMarkersMapContent(
40-
mountainsScreenViewState: MountainList,
41+
mountains: List<Mountain>,
4142
onMountainClick: (Marker) -> Boolean = { false },
4243
) {
4344
val mountainIcon = vectorToBitmap(
@@ -70,7 +71,7 @@ fun AdvancedMarkersMapContent(
7071
build()
7172
}
7273

73-
mountainsScreenViewState.mountains.forEach { mountain ->
74+
mountains.forEach { mountain ->
7475
val pin = if (mountain.is14er()) fourteenerPin else mountainPin
7576
AdvancedMarker(
7677
state = rememberMarkerState(position = mountain.location),

solution/app/src/main/java/com/example/mountainmarkers/presentation/BasicMarkersMapContent.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import androidx.compose.ui.geometry.Offset
2020
import androidx.compose.ui.graphics.toArgb
2121
import androidx.compose.ui.platform.LocalContext
2222
import com.example.mountainmarkers.R
23+
import com.example.mountainmarkers.data.local.Mountain
2324
import com.example.mountainmarkers.data.local.is14er
2425
import com.example.mountainmarkers.presentation.utils.BitmapParameters
2526
import com.example.mountainmarkers.data.utils.toElevationString
@@ -36,7 +37,7 @@ import com.google.maps.android.compose.rememberMarkerState
3637
@Composable
3738
@GoogleMapComposable
3839
fun BasicMarkersMapContent(
39-
mountainsScreenViewState: MountainList,
40+
mountains: List<Mountain>,
4041
onMountainClick: (Marker) -> Boolean = { false }
4142
) {
4243
// Create mountainIcon and fourteenerIcon
@@ -58,7 +59,7 @@ fun BasicMarkersMapContent(
5859
)
5960
)
6061

61-
mountainsScreenViewState.mountains.forEach { mountain ->
62+
mountains.forEach { mountain ->
6263
val icon = if (mountain.is14er()) fourteenerIcon else mountainIcon
6364
Marker(
6465
state = rememberMarkerState(position = mountain.location),

solution/app/src/main/java/com/example/mountainmarkers/presentation/ClusteringMarkersMapContent.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import com.google.maps.android.compose.GoogleMapComposable
4141
import com.google.maps.android.compose.MapsComposeExperimentalApi
4242
import com.google.maps.android.compose.clustering.Clustering
4343

44-
class IconColor(val iconColor: Color, val backgroundColor: Color, val borderColor: Color)
44+
data class IconColor(val iconColor: Color, val backgroundColor: Color, val borderColor: Color)
4545

4646
data class MountainClusterItem(
4747
val mountain: Mountain,
@@ -60,7 +60,7 @@ data class MountainClusterItem(
6060
@Composable
6161
@GoogleMapComposable
6262
fun ClusteringMarkersMapContent(
63-
mountainsScreenViewState: MountainList,
63+
mountains: List<Mountain>,
6464
onClusterClick: (Cluster<out ClusterItem>) -> Boolean = { false },
6565
onMountainClick: (ClusterItem) -> Boolean = { false },
6666
) {
@@ -81,9 +81,9 @@ fun ClusteringMarkersMapContent(
8181
borderColor = MaterialTheme.colorScheme.secondary
8282
)
8383

84-
val mountainClusterItems by remember(mountainsScreenViewState.mountains) {
84+
val mountainClusterItems by remember(mountains) {
8585
mutableStateOf(
86-
mountainsScreenViewState.mountains.map { mountain ->
86+
mountains.map { mountain ->
8787
MountainClusterItem(
8888
mountain = mountain,
8989
snippetString = unitsConverter.toElevationString(resources, mountain.elevation)

starter/app/src/main/java/com/example/mountainmarkers/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import androidx.compose.runtime.CompositionLocalProvider
2525
import androidx.compose.runtime.collectAsState
2626
import androidx.compose.runtime.getValue
2727
import androidx.compose.runtime.mutableStateOf
28-
import androidx.compose.runtime.remember
28+
import androidx.compose.runtime.saveable.rememberSaveable
2929
import androidx.compose.runtime.setValue
3030
import androidx.compose.ui.Modifier
3131
import androidx.compose.ui.platform.LocalConfiguration
@@ -69,7 +69,7 @@ class MainActivity : ComponentActivity() {
6969
dynamicColor = false
7070
) {
7171
// Remember the type of marker we want to show
72-
var selectedMarkerType by remember {
72+
var selectedMarkerType by rememberSaveable {
7373
mutableStateOf(MarkerType.Basic)
7474
}
7575

starter/app/src/main/java/com/example/mountainmarkers/presentation/AdvancedMarkersMapContent.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package com.example.mountainmarkers.presentation
1616

1717
import androidx.compose.runtime.Composable
18+
import com.example.mountainmarkers.data.local.Mountain
1819
import com.example.mountainmarkers.presentation.MountainsScreenViewState.MountainList
1920
import com.google.android.gms.maps.model.Marker
2021

@@ -23,7 +24,7 @@ import com.google.android.gms.maps.model.Marker
2324
*/
2425
@Composable
2526
fun AdvancedMarkersMapContent(
26-
mountainsScreenViewState: MountainList,
27+
mountains: List<Mountain>,
2728
onMountainClick: (Marker) -> Boolean = { false },
2829
) {
2930
}

starter/app/src/main/java/com/example/mountainmarkers/presentation/BasicMarkersMapContent.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package com.example.mountainmarkers.presentation
1616

1717
import androidx.compose.runtime.Composable
18+
import com.example.mountainmarkers.data.local.Mountain
1819
import com.example.mountainmarkers.presentation.MountainsScreenViewState.MountainList
1920
import com.google.android.gms.maps.model.Marker
2021

@@ -23,7 +24,7 @@ import com.google.android.gms.maps.model.Marker
2324
*/
2425
@Composable
2526
fun BasicMarkersMapContent(
26-
mountainsScreenViewState: MountainList,
27+
mountains: List<Mountain>,
2728
onMountainClick: (Marker) -> Boolean = { false }
2829
) {
2930
}

starter/app/src/main/java/com/example/mountainmarkers/presentation/ClusteringMarkersMapContent.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package com.example.mountainmarkers.presentation
1616

1717
import androidx.compose.runtime.Composable
18+
import com.example.mountainmarkers.data.local.Mountain
1819
import com.example.mountainmarkers.presentation.MountainsScreenViewState.MountainList
1920
import com.google.maps.android.clustering.Cluster
2021
import com.google.maps.android.clustering.ClusterItem
@@ -24,7 +25,7 @@ import com.google.maps.android.clustering.ClusterItem
2425
*/
2526
@Composable
2627
fun ClusteringMarkersMapContent(
27-
mountainsScreenViewState: MountainList,
28+
mountains: List<Mountain>,
2829
onClusterClick: (Cluster<out ClusterItem>) -> Boolean = { false },
2930
onMountainClick: (ClusterItem) -> Boolean = { false },
3031
) {

0 commit comments

Comments
 (0)