Skip to content

Commit

Permalink
Rename enableLayoutChangesWhileScrolling to setLayoutWhileScrollingEn…
Browse files Browse the repository at this point in the history
…abled
  • Loading branch information
rubensousa committed Mar 14, 2024
1 parent 7bd009b commit faf7fe7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ open class DpadRecyclerView @JvmOverloads constructor(
private var isOverlappingRenderingEnabled = true
private var isRetainingFocus = false
private var startedTouchScroll = false
private var enableLayoutChangesWhileScrolling = true
private var layoutWhileScrollingEnabled = true
private var hasPendingLayout = false
private var touchInterceptListener: OnTouchInterceptListener? = null
private var smoothScrollByBehavior: SmoothScrollByBehavior? = null
Expand Down Expand Up @@ -229,7 +229,7 @@ open class DpadRecyclerView @JvmOverloads constructor(
}

final override fun requestLayout() {
if (enableLayoutChangesWhileScrolling || scrollState == SCROLL_STATE_IDLE) {
if (layoutWhileScrollingEnabled || scrollState == SCROLL_STATE_IDLE) {
hasPendingLayout = false
super.requestLayout()
return
Expand Down Expand Up @@ -1254,8 +1254,8 @@ open class DpadRecyclerView @JvmOverloads constructor(
* or false if they should be postponed until [RecyclerView.SCROLL_STATE_IDLE].
* Default is true.
*/
fun enableLayoutChangesWhileScrolling(enabled: Boolean) {
enableLayoutChangesWhileScrolling = enabled
fun setLayoutWhileScrollingEnabled(enabled: Boolean) {
layoutWhileScrollingEnabled = enabled
}

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NestedComposeListViewHolder(
recyclerView.setRecycledViewPool(viewPool)
// Compose animations trigger a full layout-pass,
// so disable layout changes while scrolling
recyclerView.enableLayoutChangesWhileScrolling(false)
recyclerView.setLayoutWhileScrollingEnabled(false)
recyclerView.addItemDecoration(
DpadLinearSpacingDecoration.create(
itemSpacing = itemView.resources.getDimensionPixelOffset(
Expand Down

0 comments on commit faf7fe7

Please sign in to comment.