Skip to content

Commit

Permalink
Merge pull request #41 from Project-Unifest/feature/map-screen-ui
Browse files Browse the repository at this point in the history
[setting] [#40] 구글 지도 네이버 지도로 변경
  • Loading branch information
wjdtkdgns777 authored Apr 4, 2024
2 parents 31b77e6 + 14f6baf commit 8fc43cf
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 31 deletions.
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

</provider>

<meta-data
android:name="com.naver.maps.map.CLIENT_ID"
android:value="${NAVER_MAP_CLIENT_ID}" />

</application>

</manifest>
4 changes: 4 additions & 0 deletions feature/map/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ dependencies {
libs.play.service.maps,
libs.play.service.location,
libs.maps.compose,
libs.naver.map.sdk,
libs.naver.map.compose,
libs.naver.map.location,
libs.tedclustering.naver,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.google.android.gms.maps.model.BitmapDescriptorFactory
import com.google.android.gms.maps.model.CameraPosition
import com.google.android.gms.maps.model.LatLng
import com.google.maps.android.compose.GoogleMap
import com.google.maps.android.compose.MapUiSettings
import com.google.maps.android.compose.Marker
import com.google.maps.android.compose.MarkerState
import com.google.maps.android.compose.rememberCameraPositionState
import com.naver.maps.map.compose.ExperimentalNaverMapApi
import com.naver.maps.map.compose.Marker
import com.naver.maps.map.compose.NaverMap
import com.naver.maps.map.compose.rememberCameraPositionState
import com.naver.maps.map.overlay.OverlayImage
import com.unifest.android.core.designsystem.theme.UnifestTheme
import com.unifest.android.core.ui.DevicePreview
import com.unifest.android.feature.map.viewmodel.MapUiState
import com.unifest.android.feature.map.viewmodel.MapViewModel
import com.naver.maps.map.CameraPosition
import com.naver.maps.map.compose.MarkerState
import com.naver.maps.geometry.LatLng
import com.unifest.android.core.designsystem.R

@Composable
internal fun MapRoute(
Expand All @@ -39,15 +39,12 @@ internal fun MapRoute(
)
}

@OptIn(ExperimentalNaverMapApi::class)
@Composable
internal fun MapScreen(
padding: PaddingValues,
uiState: MapUiState,
) {
val uiSettings = remember {
MapUiSettings(zoomControlsEnabled = false)
}

Column(
modifier = Modifier
.fillMaxSize()
Expand All @@ -56,27 +53,14 @@ internal fun MapScreen(
verticalArrangement = Arrangement.Center,
) {
val cameraPositionState = rememberCameraPositionState {
position = CameraPosition.fromLatLngZoom(LatLng(37.540470588662664, 127.0765263757882), 16.5f)
position = CameraPosition(LatLng(37.540470588662664, 127.0765263757882), 14.0)
}

GoogleMap(
modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState,
properties = uiState.properties,
uiSettings = uiSettings,
onMapClick = {},
) {
NaverMap(cameraPositionState = cameraPositionState) {
uiState.boothSpots.forEach { spot ->
Marker(
state = MarkerState(
position = LatLng(spot.lat, spot.lng),
),
title = "Booth spot (${spot.lat}, ${spot.lng})",
snippet = "click",
onClick = { true },
icon = BitmapDescriptorFactory.defaultMarker(
BitmapDescriptorFactory.HUE_GREEN,
),
state = MarkerState(position = LatLng(spot.lat, spot.lng)),
icon = OverlayImage.fromResource(R.drawable.ic_general),
)
}
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
android.enableJetifier=true
10 changes: 10 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ calendar-compose = "2.5.0"
maps-compose = "4.3.3"
flexible-bottomsheet = "0.1.2"

naver-map-sdk = "3.17.0"
naver-map-compose = "1.4.1"
naver-map-location = "21.0.1"
tedclustering-naver = "1.0.2"

[libraries]

gradle-android = { group = "com.android.tools.build", name = "gradle", version.ref = "android-gradle-plugin" }
Expand Down Expand Up @@ -112,6 +117,11 @@ calendar-compose = { group = "com.kizitonwose.calendar", name = "compose", versi
maps-compose = { group = "com.google.maps.android", name = "maps-compose", version.ref = "maps-compose" }
flexible-bottomsheet = { group = "com.github.skydoves", name = "flexible-bottomsheet-material3", version.ref = "flexible-bottomsheet"}

naver-map-sdk = { group = "com.naver.maps", name = "map-sdk", version.ref = "naver-map-sdk" }
naver-map-compose = { group = "io.github.fornewid", name = "naver-map-compose", version.ref = "naver-map-compose" }
naver-map-location = { group = "io.github.fornewid", name = "naver-map-location", version.ref = "naver-map-location" }
tedclustering-naver = { group = "io.github.ParkSangGwon", name = "tedclustering-naver", version.ref = "tedclustering-naver" }

[plugins]

gradle-dependency-handler-extensions = { id = "land.sungbin.dependency.handler.extensions", version.ref = "gradle-dependency-handler-extensions" }
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencyResolutionManagement {
google()
mavenCentral()
maven { url = uri("https://devrepo.kakao.com/nexus/content/groups/public/") }
maven("https://repository.map.naver.com/archive/maven")
}
}

Expand Down

0 comments on commit 8fc43cf

Please sign in to comment.