Skip to content

Commit 6aeadf3

Browse files
committed
style : when -> if 로 수정
1 parent 6e698e4 commit 6aeadf3

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

presentation/src/main/java/com/stop/ui/mission/MissionFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ class MissionFragment : Fragment(), MissionHandler {
195195
)
196196
PERSON_LINE_NUM += 1
197197

198+
Log.d("Mission","now $nowLocation before $beforeLocation")
198199
viewModel.personCurrentLocation = Location(nowLocation.latitude, nowLocation.longitude)
199200
}
200201

201202
override fun setOnEnableScrollWithZoomLevelListener() {
202203
tMap.apply {
203204
tMapView.setOnEnableScrollWithZoomLevelListener { _, _ ->
204205
isTracking = false
205-
Log.d("Mission","실행되나?")
206206
}
207207
}
208208
}

presentation/src/main/java/com/stop/ui/util/TMap.kt

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ open class TMap(
2929
tMapView.mapType = TMapView.MapType.DEFAULT
3030
tMapView.zoomLevel = 16
3131

32-
when (this@TMap.handler) {
33-
is MissionHandler -> {
34-
(this@TMap.handler).alertTMapReady()
35-
(this@TMap.handler).setOnEnableScrollWithZoomLevelListener()
36-
}
37-
is MapHandler -> {
38-
(this@TMap.handler).alertTMapReady()
39-
}
32+
if (this@TMap.handler is MissionHandler) {
33+
(this@TMap.handler).alertTMapReady()
34+
(this@TMap.handler).setOnEnableScrollWithZoomLevelListener()
35+
} else if (this@TMap.handler is MapHandler) {
36+
(this@TMap.handler).alertTMapReady()
37+
4038
}
4139
initLocation = Location(tMapView.locationPoint.latitude, tMapView.locationPoint.longitude)
4240
}
@@ -59,15 +57,12 @@ open class TMap(
5957
if (location != null && checkKoreaLocation(location)) {
6058
val beforeLocation = tMapView.locationPoint
6159
val nowLocation = TMapPoint(location.latitude, location.longitude)
62-
when (handler) {
63-
is MissionHandler -> {
64-
if (Location(beforeLocation.latitude, beforeLocation.longitude) != initLocation) {
65-
handler.setOnLocationChangeListener(nowLocation, beforeLocation)
66-
}
67-
}
68-
is MapHandler -> {
69-
handler.setOnLocationChangeListener(location)
60+
if (handler is MissionHandler) {
61+
if (Location(beforeLocation.latitude, beforeLocation.longitude) != initLocation) {
62+
handler.setOnLocationChangeListener(nowLocation, beforeLocation)
7063
}
64+
} else if (handler is MapHandler) {
65+
handler.setOnLocationChangeListener(location)
7166
}
7267

7368
tMapView.setLocationPoint(location.latitude, location.longitude)

presentation/src/main/res/navigation/nav_graph.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
xmlns:tools="http://schemas.android.com/tools"
55
android:id="@+id/nav_graph"
6-
app:startDestination="@id/missionFragment">
6+
app:startDestination="@id/mapFragment">
77

88
<fragment
99
android:id="@+id/mapFragment"

0 commit comments

Comments
 (0)