File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
src/main/java/com/stop/data/di
domain/src/main/java/com/stop/domain/model/route/tmap/custom Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ dependencies {
67
67
// Moshi
68
68
implementation ' com.squareup.moshi:moshi-kotlin:1.14.0'
69
69
implementation ' com.squareup.moshi:moshi:1.14.0'
70
+ implementation ' com.squareup.moshi:moshi-adapters:1.14.0'
70
71
kapt ' com.squareup.moshi:moshi-kotlin-codegen:1.14.0'
71
72
72
73
// xml parser
Original file line number Diff line number Diff line change 1
1
package com.stop.data.di
2
2
3
3
import com.squareup.moshi.Moshi
4
+ import com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory
4
5
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
5
6
import com.stop.data.BuildConfig
6
7
import com.stop.data.remote.ResultCallAdapter
8
+ import com.stop.domain.model.route.tmap.custom.Route
9
+ import com.stop.domain.model.route.tmap.custom.TransportRoute
10
+ import com.stop.domain.model.route.tmap.custom.WalkRoute
7
11
import com.tickaroo.tikxml.TikXml
8
12
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory
9
13
import dagger.Module
@@ -46,6 +50,11 @@ internal object NetworkModule {
46
50
@Singleton
47
51
fun provideMoshi (): Moshi {
48
52
return Moshi .Builder ()
53
+ .add(PolymorphicJsonAdapterFactory
54
+ .of(Route ::class .java," Route" )
55
+ .withSubtype(TransportRoute ::class .java, " TransportRoute" )
56
+ .withSubtype(WalkRoute ::class .java, " WalkRoute" )
57
+ )
49
58
.addLast(KotlinJsonAdapterFactory ())
50
59
.build()
51
60
}
Original file line number Diff line number Diff line change 1
1
package com.stop.domain.model.route.tmap.custom
2
2
3
3
interface Route {
4
-
5
4
val distance: Double
6
5
val end: Place
7
6
val mode: MoveType
You can’t perform that action at this time.
0 commit comments