fixing some timer threading
This commit is contained in:
parent
e515c6ff88
commit
1ff1665515
1 changed files with 6 additions and 8 deletions
|
@ -93,14 +93,12 @@ class TimerFragment : Fragment() {
|
|||
private fun refreshTimers(scrollToLatest: Boolean = false) {
|
||||
activity?.timerHelper?.getTimers { timers ->
|
||||
timerAdapter.submitList(timers) {
|
||||
activity?.runOnUiThread {
|
||||
if (getView() != null) {
|
||||
if (timerPositionToScrollTo != INVALID_POSITION && timerAdapter.itemCount > timerPositionToScrollTo) {
|
||||
view.timers_list.scrollToPosition(timerPositionToScrollTo)
|
||||
timerPositionToScrollTo = INVALID_POSITION
|
||||
} else if (scrollToLatest) {
|
||||
view.timers_list.scrollToPosition(timers.lastIndex)
|
||||
}
|
||||
getView()?.post {
|
||||
if (timerPositionToScrollTo != INVALID_POSITION && timerAdapter.itemCount > timerPositionToScrollTo) {
|
||||
view.timers_list.scrollToPosition(timerPositionToScrollTo)
|
||||
timerPositionToScrollTo = INVALID_POSITION
|
||||
} else if (scrollToLatest) {
|
||||
view.timers_list.scrollToPosition(timers.lastIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue