Created
December 7, 2020 04:56
-
-
Save Dmuasya/bba878b4822854500278a6896478d6b5 to your computer and use it in GitHub Desktop.
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 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