Merge "Scroll to correct position on action up or cancel"

This commit is contained in:
Robert Snoeberger
2020-10-15 12:56:29 +00:00
committed by Android (Google) Code Review

View File

@@ -282,10 +282,12 @@ class MediaCarouselScrollHandler(
scrollXAmount = -1 * relativePos
}
if (scrollXAmount != 0) {
val dx = if (isRtl) -scrollXAmount else scrollXAmount
val newScrollX = scrollView.relativeScrollX + dx
// Delay the scrolling since scrollView calls springback which cancels
// the animation again..
mainExecutor.execute {
scrollView.smoothScrollBy(if (isRtl) -scrollXAmount else scrollXAmount, 0)
scrollView.smoothScrollTo(newScrollX, scrollView.scrollY)
}
}
val currentTranslation = scrollView.getContentTranslation()
@@ -553,4 +555,4 @@ class MediaCarouselScrollHandler(
}
}
}
}
}