Skip to content

Commit

Permalink
Fix some more potential leaks in Watched + Followed
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbanes committed Nov 7, 2019
1 parent d863604 commit abbe211
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package app.tivi.home.followed


import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.View
import app.tivi.common.epoxy.TotalSpanOverride import app.tivi.common.epoxy.TotalSpanOverride
import app.tivi.common.layouts.emptyState import app.tivi.common.layouts.emptyState
import app.tivi.common.layouts.filter import app.tivi.common.layouts.filter
Expand Down Expand Up @@ -89,10 +88,8 @@ class FollowedEpoxyController @Inject constructor(
posterImage(item.images.findHighestRatedPoster()) posterImage(item.images.findHighestRatedPoster())
posterTransitionName("show_${item.show.homepage}") posterTransitionName("show_${item.show.homepage}")
selected(item.show.id in state.selectedShowIds) selected(item.show.id in state.selectedShowIds)
callbacks?.also { cb -> clickListener { _ -> callbacks?.onItemClicked(item) }
clickListener(View.OnClickListener { cb.onItemClicked(item) }) longClickListener { _ -> callbacks?.onItemLongClicked(item) ?: false }
longClickListener(View.OnLongClickListener { cb.onItemLongClicked(item) })
}
} else { } else {
id("item_placeholder_$currentPosition") id("item_placeholder_$currentPosition")
} }
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package app.tivi.home.watched


import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.View
import app.tivi.common.epoxy.TotalSpanOverride import app.tivi.common.epoxy.TotalSpanOverride
import app.tivi.common.layouts.emptyState import app.tivi.common.layouts.emptyState
import app.tivi.common.layouts.filter import app.tivi.common.layouts.filter
Expand Down Expand Up @@ -92,10 +91,8 @@ class WatchedEpoxyController @Inject constructor(
posterImage(item.images.findHighestRatedPoster()) posterImage(item.images.findHighestRatedPoster())
posterTransitionName("show_${item.show.homepage}") posterTransitionName("show_${item.show.homepage}")
selected(item.show.id in state.selectedShowIds) selected(item.show.id in state.selectedShowIds)
callbacks?.also { cb -> clickListener { _ -> callbacks?.onItemClicked(item) }
clickListener(View.OnClickListener { cb.onItemClicked(item) }) longClickListener { _ -> callbacks?.onItemLongClicked(item) ?: false }
longClickListener(View.OnLongClickListener { cb.onItemLongClicked(item) })
}
} else { } else {
id("item_placeholder_$currentPosition") id("item_placeholder_$currentPosition")
} }
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class WatchedFragment : TiviFragmentWithBinding<FragmentWatchedBinding>() {


@Inject lateinit var controller: WatchedEpoxyController @Inject lateinit var controller: WatchedEpoxyController


private lateinit var authStateMenuItemBinder: AuthStateMenuItemBinder private var authStateMenuItemBinder: AuthStateMenuItemBinder? = null


private var currentActionMode: ActionMode? = null private var currentActionMode: ActionMode? = null


Expand Down Expand Up @@ -145,7 +145,7 @@ class WatchedFragment : TiviFragmentWithBinding<FragmentWatchedBinding>() {


binding.state = state binding.state = state


authStateMenuItemBinder.bind(state.authState, state.user) authStateMenuItemBinder?.bind(state.authState, state.user)


if (state.watchedShows != null) { if (state.watchedShows != null) {
// PagingEpoxyController does not like being updated before it has a list // PagingEpoxyController does not like being updated before it has a list
Expand Down

0 comments on commit abbe211

Please sign in to comment.