Skip to content

Commit

Permalink
Merge pull request #17 from mattiasrosberg/feature_allow_to_disable_s…
Browse files Browse the repository at this point in the history
…crolling

Add support to enable/disable scrolling in recyclerview
  • Loading branch information
sparrow007 authored Jan 18, 2022
2 parents 3d22398 + 4a35106 commit f8b60ce
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class CarouselLayoutManager constructor(
/** Use for restore scrolling in recyclerview at the time of orientation change*/
private var isOrientationChange = false

/** set to enable/disable scrolling in recyclerview */
private var isScrollingEnabled = true

/** Initialize all the attribute from the constructor and also apply some conditions */
init {
this.mInfinite = isLoop
Expand Down Expand Up @@ -172,7 +175,8 @@ class CarouselLayoutManager constructor(
* @return return boolean value to tell recyclerview for scroll handling with horizontal direction
* */
override fun canScrollHorizontally(): Boolean {
return true

return isScrollingEnabled
}

/**
Expand Down Expand Up @@ -637,6 +641,13 @@ class CarouselLayoutManager constructor(
this.mSelectedListener = l
}

/**
* set isScrollingEnabled value
*/
fun setIsScrollingEnabled(isScrollingEnabled: Boolean) {
this.isScrollingEnabled = isScrollingEnabled
}

/**
* Get the selected position or centered position
* @return selectedPosition
Expand Down

0 comments on commit f8b60ce

Please sign in to comment.