File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
presentation/src/main/java/com/stop/ui/route Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,8 @@ class RouteFragment : Fragment() {
115
115
routeViewModel.lastTimeResponse.observe(viewLifecycleOwner) { event ->
116
116
event.getContentIfNotHandled()?.let { response ->
117
117
routeResultViewModel.setLastTimes(response)
118
+ routeResultViewModel.setOrigin(routeViewModel.origin.value)
119
+ routeResultViewModel.setDestination(routeViewModel.destination.value)
118
120
binding.root.findNavController()
119
121
.navigate(R .id.action_routeFragment_to_routeDetailFragment)
120
122
}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import androidx.lifecycle.MutableLiveData
5
5
import androidx.lifecycle.ViewModel
6
6
import com.stop.domain.model.route.TransportLastTime
7
7
import com.stop.domain.model.route.tmap.custom.Itinerary
8
+ import com.stop.model.route.Place
8
9
9
10
class RouteResultViewModel : ViewModel () {
10
11
@@ -16,11 +17,27 @@ class RouteResultViewModel : ViewModel() {
16
17
val lastTimes: LiveData <List <TransportLastTime ?>>
17
18
get() = _lastTimes
18
19
20
+ private val _origin = MutableLiveData <Place >()
21
+ val origin: LiveData <Place >
22
+ get() = _origin
23
+
24
+ private val _destination = MutableLiveData <Place >()
25
+ val destination: LiveData <Place >
26
+ get() = _destination
27
+
19
28
fun setItineraries (itinerary : Itinerary ) {
20
29
_itinerary .value = itinerary
21
30
}
22
31
23
32
fun setLastTimes (lastTimes : List <TransportLastTime ?>) {
24
33
_lastTimes .value = lastTimes
25
34
}
35
+
36
+ fun setOrigin (originPlace : Place ? ) {
37
+ _origin .value = originPlace ? : return
38
+ }
39
+
40
+ fun setDestination (destinationPlace : Place ? ) {
41
+ _destination .value = destinationPlace ? : return
42
+ }
26
43
}
You can’t perform that action at this time.
0 commit comments