fixed user profile header flickering
This commit is contained in:
parent
6cea46b6c2
commit
49b6362e93
|
@ -22,9 +22,13 @@ package android.support.design.widget
|
|||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.OverScroller
|
||||
|
||||
internal open class AccessorHeaderBehavior<V : View>(context: Context, attrs: AttributeSet? = null) : HeaderBehavior<V>(context, attrs) {
|
||||
|
||||
internal val scroller: OverScroller?
|
||||
get() = mScroller
|
||||
|
||||
internal override fun getScrollRangeForDragFling(view: V): Int {
|
||||
return super.getScrollRangeForDragFling(view)
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class CursorObjectLivePagedListProvider<T : Any>(
|
|||
val selectionArgs: Array<String>? = null,
|
||||
val sortOrder: String? = null,
|
||||
val cls: Class<T>,
|
||||
val predicate: CursorObjectProcessor<T>?
|
||||
val processor: CursorObjectProcessor<T>?
|
||||
) : TiledDataSource<T>() {
|
||||
|
||||
private val lazyCount: Int by lazy { resolver.queryCount(uri, selection, selectionArgs) }
|
||||
|
@ -82,13 +82,13 @@ class CursorObjectLivePagedListProvider<T : Any>(
|
|||
}
|
||||
}
|
||||
resolver.registerContentObserver(uri, false, observer)
|
||||
predicate?.init(resolver)
|
||||
processor?.init(resolver)
|
||||
}
|
||||
|
||||
override fun countItems() = lazyCount
|
||||
|
||||
override fun loadRange(startPosition: Int, count: Int): List<T> {
|
||||
if (predicate == null) {
|
||||
if (processor == null) {
|
||||
return resolver.queryAll(uri, projection, selection, selectionArgs, sortOrder,
|
||||
"$startPosition,$count", cls)
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class CursorObjectLivePagedListProvider<T : Any>(
|
|||
"$offset,$limit", cls)
|
||||
val reachedEnd = list.size < count
|
||||
list.mapIndexedNotNullTo(result) lambda@ { index, item ->
|
||||
val processed = predicate.process(item)
|
||||
val processed = processor.process(item)
|
||||
filterStates[offset + index] = processed != null
|
||||
return@lambda processed
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class CursorObjectLivePagedListProvider<T : Any>(
|
|||
}
|
||||
|
||||
override fun invalidate() {
|
||||
predicate?.invalidate()
|
||||
processor?.invalidate()
|
||||
super.invalidate()
|
||||
}
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ internal class HeaderBehavior(context: Context, attrs: AttributeSet? = null) :
|
|||
type: Int) {
|
||||
// Keep a reference to the previous nested scrolling child
|
||||
lastNestedScrollingChild = target
|
||||
scroller?.forceFinished(true)
|
||||
}
|
||||
|
||||
override fun onMeasureChild(parent: CoordinatorLayout, child: ViewGroup,
|
||||
|
|
Loading…
Reference in New Issue