File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
presentation/src/main/java/com/stop/ui Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,14 @@ class MapFragment : Fragment(), MapHandler {
52
52
initNavigateAction()
53
53
initBottomSheetBehavior()
54
54
initBottomSheetView()
55
+
56
+ observeClickPlace()
57
+ observeClickCurrentLocation()
55
58
}
56
59
57
60
override fun alertTMapReady () {
58
61
requestPermissionsLauncher.launch(PERMISSIONS )
59
-
60
62
tMap.initListener()
61
- observeClickPlace()
62
- observeClickCurrentLocation()
63
63
}
64
64
65
65
private fun initBinding () {
@@ -69,8 +69,14 @@ class MapFragment : Fragment(), MapHandler {
69
69
}
70
70
71
71
private fun initTMap () {
72
- tMap = MapTMap (requireActivity(), this )
73
- tMap.init ()
72
+ placeSearchViewModel.tMap?.let {
73
+ tMap = it
74
+ tMap.setHandler(this )
75
+ } ? : run {
76
+ tMap = MapTMap (requireActivity(), this )
77
+ tMap.init ()
78
+ placeSearchViewModel.tMap = tMap
79
+ }
74
80
75
81
binding.layoutContainer.addView(tMap.tMapView)
76
82
}
@@ -232,6 +238,7 @@ class MapFragment : Fragment(), MapHandler {
232
238
}
233
239
234
240
override fun onDestroyView () {
241
+ binding.layoutContainer.removeView(tMap.tMapView)
235
242
_binding = null
236
243
237
244
super .onDestroyView()
Original file line number Diff line number Diff line change @@ -13,12 +13,16 @@ import com.stop.ui.util.TMap
13
13
14
14
class MapTMap (
15
15
context : Context ,
16
- private val handler : MapHandler ,
16
+ private var handler : MapHandler ,
17
17
) : TMap(context, handler) {
18
18
19
19
private val enablePoints = mutableSetOf<Location >()
20
20
private var isLongClick = false
21
21
22
+ fun setHandler (handler : MapHandler ) {
23
+ this .handler = handler
24
+ }
25
+
22
26
fun initListener () {
23
27
tMapView.setOnClickListenerCallback(onClickListenerCallback)
24
28
tMapView.setOnLongClickListenerCallback(onLongClickListenerCallback)
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import com.stop.domain.usecase.nearplace.InsertRecentPlaceSearchUseCase
15
15
import com.stop.model.Event
16
16
import com.stop.model.Location
17
17
import com.stop.model.route.Coordinate
18
+ import com.stop.ui.map.MapTMap
18
19
import dagger.hilt.android.lifecycle.HiltViewModel
19
20
import kotlinx.coroutines.Dispatchers
20
21
import kotlinx.coroutines.channels.Channel
@@ -37,6 +38,8 @@ class PlaceSearchViewModel @Inject constructor(
37
38
38
39
var panelInfo: com.stop.model.route.Place ? = null
39
40
41
+ var tMap: MapTMap ? = null
42
+
40
43
private val _nearPlaces = MutableStateFlow <List <PlaceUseCaseItem >>(emptyList())
41
44
val nearPlaces: StateFlow <List <PlaceUseCaseItem >> = _nearPlaces
42
45
You can’t perform that action at this time.
0 commit comments