forked from woowacourse/android-movie-ticket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MovieDetailViewInitializer.kt
34 lines (27 loc) · 1.11 KB
/
MovieDetailViewInitializer.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package woowacourse.movie.activity.moviedetail
import android.widget.ImageView
import android.widget.TextView
import woowacourse.movie.R
import woowacourse.movie.model.MovieDTO
import java.time.format.DateTimeFormatter
class MovieDetailViewInitializer(private val movieDTO: MovieDTO) {
fun initDescription(textView: TextView) {
textView.text = movieDTO.description
}
fun initRunningTime(textView: TextView) {
textView.text = textView.context.getString(R.string.running_time, movieDTO.runningTime)
}
fun initPlayingDate(textView: TextView) {
textView.text = textView.context.getString(
R.string.playing_time,
DateTimeFormatter.ofPattern(textView.context.getString(R.string.date_format)).format(movieDTO.playingTimes.startDate),
DateTimeFormatter.ofPattern(textView.context.getString(R.string.date_format)).format(movieDTO.playingTimes.endDate)
)
}
fun initTitle(textView: TextView) {
textView.text = movieDTO.title
}
fun initImageView(imageView: ImageView) {
imageView.setImageResource(movieDTO.image)
}
}