1
private fun setMark(location: UserLocation) {
val marker = Marker()
if (location != null) {
marker.position = LatLng(location.latitude, location.longitude)
}
marker.zIndex = 10
marker.map = naverMap
marker.isIconPerspectiveEnabled = true
marker.alpha = 0.8f
marker.icon = OverlayImage.fromResource(R.drawable.heart)
marker.width = 130
marker.height = 120
}
2 (fail)
- 경로 잘못 설정
- 시도는 좋았으나..
private fun setMark(location: UserLocation) {
val marker = Marker()
if (location != null) {
marker.position = LatLng(location.latitude, location.longitude)
}
marker.zIndex = 10
marker.map = naverMap
marker.isIconPerspectiveEnabled = true
marker.alpha = 0.8f
marker.width = 130
marker.height = 120
val storageRef = FirebaseStorage
.getInstance()
.getReference("images/IMAGE_20231020_230927.png")
val imageRef = storageRef.child("images/IMAGE_20231020_230927.png")
Log.d("sooj", "받아짐 ? ${storageRef}")
imageRef.getBytes(ONE_MEGABYTE).addOnSuccessListener {data ->
val bitmap = BitmapFactory.decodeByteArray(data,0, data.size)
val overlayImage = OverlayImage.fromBitmap(bitmap)
val marker = Marker()
marker.icon = overlayImage
}
.addOnFailureListener { }
}
3 (Success !)
- 코일 -> 비트맵으로 변환
private fun setMark(location: UserLocation) = lifecycleScope.launch {
val marker = Marker()
if (location != null) {
marker.position = LatLng(location.latitude, location.longitude)
}
marker.zIndex = 10
marker.map = naverMap
marker.isIconPerspectiveEnabled = true
marker.alpha = 0.8f
marker.width = 130
marker.height = 120
val image = "https://firebasestorage.googleapis.com/v0/b/frompet-70b42.appspot.com/o/images%2FIMAGE_20231018_215401.png?alt=media&token=7353dc7b-f260-4ca9-b9ba-47ea95911b79"
val imageLoader = context?.let { Coil.imageLoader(it) }
val request = ImageRequest.Builder(requireContext()).data(image).target {
val bitmap = (it as BitmapDrawable).bitmap
val imageOverlay = OverlayImage.fromBitmap(bitmap)
marker.icon = imageOverlay
}.build()
imageLoader?.execute(request)
}