Skip to content

Commit 6237d73

Browse files
committed
feat: ModeType.TRANSFER 분기 추가
1 parent 3cbd568 commit 6237d73

File tree

7 files changed

+18
-5130
lines changed

7 files changed

+18
-5130
lines changed

data/src/main/java/com/stop/data/di/NetworkModule.kt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ import dagger.Provides
1111
import dagger.hilt.InstallIn
1212
import dagger.hilt.components.SingletonComponent
1313
import okhttp3.Interceptor
14-
import okhttp3.MediaType.Companion.toMediaTypeOrNull
1514
import okhttp3.OkHttpClient
16-
import okhttp3.Protocol
1715
import okhttp3.Response
18-
import okhttp3.ResponseBody.Companion.toResponseBody
1916
import okhttp3.logging.HttpLoggingInterceptor
2017
import retrofit2.Retrofit
2118
import retrofit2.converter.moshi.MoshiConverterFactory
@@ -32,9 +29,6 @@ internal object NetworkModule {
3229
private const val APIS_KEY_NAME = "ServiceKey"
3330
private const val WS_KEY_NAME = "ServiceKey"
3431

35-
private const val TRANSPORT_URL = "transit/routes"
36-
private const val FAKE_JSON_URL = "response.json"
37-
3832
@Provides
3933
@Singleton
4034
fun provideOkHttpClient(
@@ -156,20 +150,6 @@ internal object NetworkModule {
156150
override fun intercept(chain: Interceptor.Chain): Response {
157151
val url = chain.request().url.toUri().toString()
158152

159-
if (chain.request().url.toUri().toString().contains(TRANSPORT_URL)) {
160-
val response = readJson(FAKE_JSON_URL)
161-
return chain.proceed(chain.request())
162-
.newBuilder()
163-
.code(200)
164-
.protocol(Protocol.HTTP_2)
165-
.message("success")
166-
.body(
167-
response.toByteArray()
168-
.toResponseBody("application/json".toMediaTypeOrNull())
169-
).addHeader("content-type", "application/json")
170-
.build()
171-
}
172-
173153
val (name: String, key: String) = when {
174154
url.contains(BuildConfig.OPEN_API_SEOUL_URL) -> Pair(
175155
OPEN_API_SEOUL_KEY_NAME,
@@ -196,12 +176,6 @@ internal object NetworkModule {
196176
.build()
197177
proceed(newRequest)
198178
}
199-
200-
}
201-
202-
private fun readJson(fileName: String): String {
203-
return Thread.currentThread().contextClassLoader?.getResource(fileName)
204-
?.readText() ?: ""
205179
}
206180
}
207181
}

data/src/main/resources/response.json

Lines changed: 0 additions & 5095 deletions
This file was deleted.

presentation/src/main/java/com/stop/ui/route/RouteViewModel.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,19 @@ class RouteViewModel @Inject constructor(
140140
MoveType.WALK -> R.drawable.ic_walk_white
141141
MoveType.BUS -> R.drawable.ic_bus_white
142142
MoveType.SUBWAY -> R.drawable.ic_subway_white
143+
MoveType.TRANSFER -> R.drawable.ic_transfer_white
143144
else -> R.drawable.ic_star_white
144145
}
145146
}
146147

147148
private fun getRouteItemColor(route: Route, isCurrent: Boolean): Int {
148149
return if (isCurrent) {
149-
routeItemColor = when (route) {
150-
is TransportRoute -> Color.parseColor("#${route.routeColor}")
151-
is WalkRoute -> Color.parseColor(MAIN_WALK_GREY)
152-
else -> Color.parseColor(MAIN_YELLOW)
150+
routeItemColor = if (route is TransportRoute) {
151+
Color.parseColor("#${route.routeColor}")
152+
} else if (route.mode == MoveType.WALK) {
153+
Color.parseColor(MAIN_WALK_GREY)
154+
} else {
155+
Color.parseColor(MAIN_YELLOW)
153156
}
154157
routeItemColor
155158
} else {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="30dp"
3+
android:height="30dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24"
6+
android:tint="@color/white">
7+
8+
<path
9+
android:fillColor="@android:color/white"
10+
android:pathData="M22,18v-2H8V4h2L7,1 4,4h2v2H2v2h4v8c0,1.1 0.9,2 2,2h8v2h-2l3,3 3,-3h-2v-2h4zM10,8h6v6h2V8c0,-1.1 -0.9,-2 -2,-2h-6v2z"/>
11+
</vector>

presentation/src/main/res/layout/fragment_route_detail.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
android:layout_height="match_parent"
6262
android:layout_marginStart="10dp"
6363
android:layout_marginEnd="5dp"
64-
android:layout_marginBottom="1dp"
6564
android:maxLines="1"
6665
android:ellipsize="end"
6766
android:gravity="center_vertical|center_horizontal"
@@ -89,7 +88,6 @@
8988
android:layout_height="match_parent"
9089
android:layout_marginStart="5dp"
9190
android:layout_marginEnd="10dp"
92-
android:layout_marginBottom="1dp"
9391
android:maxLines="1"
9492
android:ellipsize="end"
9593
android:gravity="center_vertical|center_horizontal"

presentation/src/main/res/layout/route_detail_drawer.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
android:layout_width="wrap_content"
8989
android:layout_height="wrap_content"
9090
android:layout_marginStart="10dp"
91-
android:layout_marginBottom="2dp"
9291
android:text="@string/alarm_setting"
9392
android:textSize="13sp"
9493
android:gravity="center"

presentation/src/main/res/layout/route_path_item.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
android:layout_width="wrap_content"
3737
android:layout_height="wrap_content"
3838
android:layout_marginStart="15dp"
39-
android:layout_marginBottom="2dp"
4039
android:text="@{routeItem.name}"
4140
android:textColor="@color/main_dark_grey"
4241
android:textSize="15sp"
@@ -64,7 +63,6 @@
6463
android:layout_width="wrap_content"
6564
android:layout_height="wrap_content"
6665
android:layout_marginEnd="5dp"
67-
android:layout_marginBottom="1dp"
6866
android:text="@{routeItem.lastTime != null ? @string/last_time : null}"
6967
android:textSize="12sp"
7068
android:textColor="@color/main_light_grey"

0 commit comments

Comments
 (0)