Skip to content

Commit

Permalink
Fix: list items aren't reset when page is collapsed immediately
Browse files Browse the repository at this point in the history
This usually happens when battery saver is on.
  • Loading branch information
saket committed Jul 30, 2019
1 parent bbf7b56 commit 5217691
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import android.view.ViewTreeObserver
import me.saket.inboxrecyclerview.page.ExpandablePageLayout

internal class PageLocationChangeDetector(
private val page: ExpandablePageLayout,
private val changeListener: () -> Unit
private val page: ExpandablePageLayout,
private val changeListener: () -> Unit
) : ViewTreeObserver.OnPreDrawListener, ViewTreeObserver.OnGlobalLayoutListener {

private var lastTranslationY = 0F
Expand All @@ -28,7 +28,7 @@ internal class PageLocationChangeDetector(
val dimensionsChanged = lastClippedDimens != page.clippedDimens
val stateChanged = lastState != page.currentState

if (page.isCollapsed.not() && (moved || dimensionsChanged || stateChanged)) {
if (moved || dimensionsChanged || stateChanged) {
changeListener()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ open class ExpandablePageLayout @JvmOverloads constructor(
override fun onRelease(collapseEligible: Boolean) {
dispatchOnPageReleaseCallback(collapseEligible)

if (!collapseEligible.not()) {
if (!collapseEligible.not()) { // TODO: remove double negation.
return
}

Expand Down

0 comments on commit 5217691

Please sign in to comment.