Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Jan 11, 2018
1 parent c6de876 commit a289d1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class SessionDetailActivity : BaseActivity(), HasSupportFragmentInjector {
}

override fun getCount(): Int = sessions.size

}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ class SessionDetailFragment : Fragment(), Injectable {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val sessionId = arguments!!.getString(EXTRA_SESSION_ID)
sessionDetailViewModel.sessions.observe(this) { result ->
when (result) {
is Result.Success -> {
bindSession(result
.data
.first { it.id == arguments!!.getString(EXTRA_SESSION_ID) })
val sessions = result.data
bindSession(sessions.first { it.id == sessionId })
}
is Result.Failure -> {
Timber.e(result.e)
Expand All @@ -59,11 +59,9 @@ class SessionDetailFragment : Fragment(), Injectable {

private fun bindSession(session: Session.SpeechSession) {
binding.session = session

binding.fab.setOnClickListener {
sessionDetailViewModel.onFavoriteClick(session)
}

binding.sessionTopic.text = session.topic.getNameByLang(lang())
val speakerImages = arrayOf(
binding.speakerImage1,
Expand All @@ -88,7 +86,6 @@ class SessionDetailFragment : Fragment(), Injectable {
imageView.toGone()
}
}

binding.speakers.text = session.speakers.joinToString { it.name }
}

Expand Down

0 comments on commit a289d1e

Please sign in to comment.