Fixed formatting

This commit is contained in:
Christophe Smet
2018-10-30 15:13:02 +01:00
parent 5740def0f9
commit 8b83050f87

View File

@@ -268,9 +268,6 @@ class StackLayoutManager(scrollOrientation: ScrollOrientation,
} }
override fun canScrollHorizontally(): Boolean { override fun canScrollHorizontally(): Boolean {
if (itemCount == 0) {
return false
}
return when(mScrollOrientation) { return when(mScrollOrientation) {
ScrollOrientation.LEFT_TO_RIGHT, ScrollOrientation.RIGHT_TO_LEFT -> true ScrollOrientation.LEFT_TO_RIGHT, ScrollOrientation.RIGHT_TO_LEFT -> true
else -> false else -> false
@@ -278,9 +275,6 @@ class StackLayoutManager(scrollOrientation: ScrollOrientation,
} }
override fun canScrollVertically(): Boolean { override fun canScrollVertically(): Boolean {
if (itemCount == 0) {
return false
}
return when(mScrollOrientation) { return when(mScrollOrientation) {
ScrollOrientation.TOP_TO_BOTTOM, ScrollOrientation.BOTTOM_TO_TOP -> true ScrollOrientation.TOP_TO_BOTTOM, ScrollOrientation.BOTTOM_TO_TOP -> true
else -> false else -> false
@@ -288,16 +282,14 @@ class StackLayoutManager(scrollOrientation: ScrollOrientation,
} }
override fun onLayoutChildren(recycler: RecyclerView.Recycler, state: RecyclerView.State) { override fun onLayoutChildren(recycler: RecyclerView.Recycler, state: RecyclerView.State) {
mLayout?.requestLayout() mLayout?.requestLayout()
removeAndRecycleAllViews(recycler) removeAndRecycleAllViews(recycler)
if (itemCount > 0) {
mScrollOffset = getValidOffset(mScrollOffset) mScrollOffset = getValidOffset(mScrollOffset)
loadItemView(recycler) loadItemView(recycler)
} }
}
override fun scrollHorizontallyBy(dx: Int, recycler: RecyclerView.Recycler, state: RecyclerView.State): Int { override fun scrollHorizontallyBy(dx: Int, recycler: RecyclerView.Recycler, state: RecyclerView.State): Int {
return handleScrollBy(dx, recycler) return handleScrollBy(dx, recycler)