Skip to content

Commit 9d60339

Browse files
authored
Merge pull request #90 from boostcampwm-2022/88-mission-bug-and-bottom-sheet-ui-bug
[PR] 지난 pr bug 해결 - bottom_sheet 에러 해결, 초기 위치 추가
2 parents c84f510 + 64d33bc commit 9d60339

File tree

8 files changed

+210
-145
lines changed

8 files changed

+210
-145
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ class MissionFragment : Fragment(), MissionHandler {
138138
lateinit var beforeLocation: Location
139139
lifecycleScope.launch {
140140
missionViewModel.userLocation.collectIndexed { index, userLocation ->
141-
if (index == 1) {
141+
if (index == 0) {
142142
initMarker(userLocation)
143143
beforeLocation = userLocation
144-
} else if (index > 1) {
144+
} else if (index > 0) {
145145
drawNowLocationLine(TMapPoint(userLocation.latitude, userLocation.longitude), TMapPoint(beforeLocation.latitude, beforeLocation.longitude))
146146
personCurrentLocation = userLocation
147147
if (tMap.isTracking) {

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
package com.stop.ui.mission
22

33
import android.content.Context
4+
import androidx.core.content.ContextCompat
45
import com.skt.tmap.TMapPoint
56
import com.skt.tmap.overlay.TMapPolyLine
67
import com.stop.domain.model.route.tmap.custom.WalkRoute
78
import com.stop.ui.util.TMap
89

910
class MissionTMap(
10-
context: Context,
11+
private val context: Context,
1112
handler: MissionHandler,
1213
) : TMap(context, handler) {
1314

1415
fun drawMoveLine(nowLocation: TMapPoint, beforeLocation: TMapPoint, id: String, color: Int) {
1516
val points = arrayListOf(nowLocation, beforeLocation)
1617
val polyLine = TMapPolyLine(id, points).apply {
17-
lineColor = color
18-
outLineColor = color
18+
lineColor = ContextCompat.getColor(context, color)
19+
outLineColor = ContextCompat.getColor(context, color)
1920
}
2021

2122
tMapView.addTMapPolyLine(polyLine)
2223
}
2324

2425
fun drawWalkLines(points: ArrayList<TMapPoint>, id: String, color: Int) {
2526
val polyLine = TMapPolyLine(id, points).apply {
26-
lineColor = color
27-
outLineColor = color
27+
lineColor = ContextCompat.getColor(context, color)
28+
outLineColor = ContextCompat.getColor(context, color)
2829
}
2930
tMapView.addTMapPolyLine(polyLine)
3031
}

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import android.content.pm.PackageManager
1010
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION
1111
import android.os.Build
1212
import android.os.Looper
13-
import android.util.Log
1413
import androidx.core.app.ActivityCompat
1514
import androidx.core.app.NotificationCompat
1615
import androidx.hilt.work.HiltWorker
@@ -51,6 +50,16 @@ class MissionWorker @AssistedInject constructor(
5150
}
5251

5352
private fun getPersonLocation() {
53+
fusedLocationClient.lastLocation
54+
.addOnSuccessListener { location ->
55+
if (location != null) {
56+
missionManager.userLocation.value = Location(location.latitude, location.longitude)
57+
}
58+
}
59+
.addOnFailureListener {
60+
it.printStackTrace()
61+
}
62+
5463
if (ActivityCompat.checkSelfPermission(
5564
applicationContext,
5665
Manifest.permission.ACCESS_FINE_LOCATION
@@ -102,7 +111,6 @@ class MissionWorker @AssistedInject constructor(
102111

103112
private fun createChannel(id: String) {
104113
if (isMoreThanOreo()) {
105-
Log.d("MissionWorker", "createChannel ${notificationManager.getNotificationChannel(id)}")
106114
if (notificationManager.getNotificationChannel(id) == null) {
107115
val name = applicationContext.getString(R.string.mission_notification_channel_name)
108116
NotificationChannel(id, name, NotificationManager.IMPORTANCE_DEFAULT).apply {
@@ -115,7 +123,6 @@ class MissionWorker @AssistedInject constructor(
115123
companion object {
116124
const val NOTIFICATION_ID = 82
117125
private const val NOTIFICATION_CONTENT = "사용자의 위치를 추적중입니다."
118-
private var NUM = 0
119126
private const val INTERVAL_UNIT = 1000L
120127
const val MISSION_CODE = 88
121128
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.stop.ui.util
22

3-
import android.graphics.Color
43
import com.stop.R
54

65
object Marker {
@@ -16,11 +15,11 @@ object Marker {
1615
const val PERSON_MARKER = "person_marker"
1716
const val PERSON_MARKER_IMG = R.drawable.ic_person_marker
1817
const val PERSON_LINE = "person_line"
19-
const val PERSON_LINE_COLOR = Color.MAGENTA
18+
const val PERSON_LINE_COLOR = R.color.mint
2019

2120
const val DESTINATION_MARKER = "destination_marker"
2221
const val DESTINATION_MARKER_IMG = R.drawable.ic_start_marker
2322

2423
const val WALK_LINE = "walk_line"
25-
const val WALK_LINE_COLOR = Color.BLACK
24+
const val WALK_LINE_COLOR = R.color.main_dark_grey
2625
}

presentation/src/main/res/drawable-v24/ic_person_marker.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
android:viewportHeight="24">
66

77
<path
8-
android:fillColor="#5DC19B"
8+
android:fillColor="@color/mint"
99
android:pathData="M19,2L5,2c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h4l2.29,2.29c0.39,0.39 1.02,0.39 1.41,0L15,20h4c1.1,0 2,-0.9 2,-2L21,4c0,-1.1 -0.9,-2 -2,-2zM12,5.3c1.49,0 2.7,1.21 2.7,2.7s-1.21,2.7 -2.7,2.7S9.3,9.49 9.3,8s1.21,-2.7 2.7,-2.7zM18,16L6,16v-0.9c0,-2 4,-3.1 6,-3.1s6,1.1 6,3.1v0.9z"
1010
android:strokeWidth="1"
1111
android:strokeColor="#FFFFFF" />

0 commit comments

Comments
 (0)