fix NPE
This commit is contained in:
parent
1a4b3801e5
commit
c10963dcbd
1 changed files with 6 additions and 9 deletions
|
@ -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
|
smoothScroller.targetPosition = i
|
||||||
objectives_recyclerview.layoutManager?.startSmoothScroll(smoothScroller)
|
objectives_recyclerview.layoutManager?.startSmoothScroll(smoothScroller)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue