add a function for updating fastscroller handle color

This commit is contained in:
tibbi 2017-03-29 19:03:24 +02:00
parent a15bf1d947
commit dcf2fa2cc0
2 changed files with 6 additions and 2 deletions

View file

@ -29,5 +29,5 @@ ext {
propMinSdkVersion = 16
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '2.14.6'
propVersionName = '2.14.7'
}

View file

@ -32,7 +32,7 @@ class FastScroller : LinearLayout {
fun setViews(recyclerView: RecyclerView, swipeRefreshLayout: SwipeRefreshLayout? = null) {
this.recyclerView = recyclerView
this.swipeRefreshLayout = swipeRefreshLayout
handle.background.setColorFilter(context.baseConfig.primaryColor, PorterDuff.Mode.SRC_IN)
updateHandleColor()
recyclerView.setOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(rv: RecyclerView, dx: Int, dy: Int) {
@ -50,6 +50,10 @@ class FastScroller : LinearLayout {
})
}
fun updateHandleColor() {
handle.background.setColorFilter(context.baseConfig.primaryColor, PorterDuff.Mode.SRC_IN)
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
currHeight = h