This commit is contained in:
Milos Kozak 2019-10-27 15:48:09 +01:00
parent 1a4b3801e5
commit c10963dcbd

View file

@ -104,17 +104,14 @@ class ObjectivesFragment : Fragment() {
for (i in 0 until ObjectivesPlugin.objectives.size) { for (i in 0 until ObjectivesPlugin.objectives.size) {
val objective = ObjectivesPlugin.objectives[i] val objective = ObjectivesPlugin.objectives[i]
if (!objective.isStarted || !objective.isAccomplished) { if (!objective.isStarted || !objective.isAccomplished) {
val smoothScroller = object : LinearSmoothScroller(context!!) { context?.let {
override fun getVerticalSnapPreference(): Int { val smoothScroller = object : LinearSmoothScroller(it) {
return SNAP_TO_START override fun getVerticalSnapPreference(): Int = SNAP_TO_START
} override fun calculateTimeForScrolling(dx: Int): Int = super.calculateTimeForScrolling(dx) * 4
override fun calculateTimeForScrolling(dx: Int): Int {
return super.calculateTimeForScrolling(dx) * 4
} }
smoothScroller.targetPosition = i
objectives_recyclerview.layoutManager?.startSmoothScroll(smoothScroller)
} }
smoothScroller.targetPosition = i
objectives_recyclerview.layoutManager?.startSmoothScroll(smoothScroller)
break break
} }
} }