Skip to content

Instantly share code, notes, and snippets.

@Dmuasya
Created December 7, 2020 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dmuasya/bba878b4822854500278a6896478d6b5 to your computer and use it in GitHub Desktop.
Save Dmuasya/bba878b4822854500278a6896478d6b5 to your computer and use it in GitHub Desktop.
package dennis.pull.delegate
import android.view.View
class ScrollHeaderDelegate(private val mTargetView: View) : ScrollerDelegate(mTargetView) {
var isScrollShow: Boolean = false
private var mDuration = NORMAL_DURATION
fun scrollShow() {
if (!isScrollShow) {
return
}
val height = mTargetView.measuredHeight
if (height <= 0) {
return
}
smoothScrollTo(0, height, 0, -height, mDuration)
isScrollShow = false
}
fun setDuration(duration: Int) {
mDuration = duration
}
companion object {
private val NORMAL_DURATION = 800
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment