Last active
June 21, 2020 00:00
-
-
Save ricknout/43a5d80edae86f3758457ae7be4c0c42 to your computer and use it in GitHub Desktop.
Change order of args to enable trailing lambda syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nickrout.snaphelperlistener | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.recyclerview.widget.SnapHelper | |
fun RecyclerView.attachSnapHelperWithListener( | |
snapHelper: SnapHelper, | |
behavior: SnapOnScrollListener.Behavior = SnapOnScrollListener.Behavior.NOTIFY_ON_SCROLL, | |
onSnapPositionChangeListener: OnSnapPositionChangeListener) { | |
snapHelper.attachToRecyclerView(this) | |
val snapOnScrollListener = SnapOnScrollListener(snapHelper, onSnapPositionChangeListener, behavior) | |
addOnScrollListener(snapOnScrollListener) | |
} |
Great point @nickbutcher, updated ๐
Great point @nickbutcher, updated ๐
@ricknout where have you updated it? can you mention it?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Could make the
onSnapPositionChangeListener
the last param to enable trailing lambda syntax?