File tree Expand file tree Collapse file tree 1 file changed +22
-10
lines changed
app/src/main/kotlin/org/fossify/clock/fragments Expand file tree Collapse file tree 1 file changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,9 @@ class TimerFragment : Fragment() {
9898
9999 fun showSortingDialog () {
100100 ChangeTimerSortDialog (activity as SimpleActivity ) {
101- refreshTimers()
101+ refreshTimers(
102+ animate = false // disable sorting animations for now.
103+ )
102104 }
103105 }
104106
@@ -116,16 +118,26 @@ class TimerFragment : Fragment() {
116118 }
117119 }
118120
119- private fun refreshTimers () {
121+ private fun refreshTimers (animate : Boolean = true ) {
120122 getSortedTimers { timers ->
121- timerAdapter.submitList(timers.toMutableList()) {
122- view?.post {
123- if (
124- timerPositionToScrollTo != INVALID_POSITION &&
125- timerAdapter.itemCount > timerPositionToScrollTo
126- ) {
127- binding.timersList.smoothScrollToPosition(timerPositionToScrollTo)
128- timerPositionToScrollTo = INVALID_POSITION
123+ with (binding.timersList) {
124+ val originalAnimator = itemAnimator
125+ if (! animate) {
126+ itemAnimator = null
127+ }
128+
129+ timerAdapter.submitList(timers.toMutableList()) {
130+ view?.post {
131+ if (timerPositionToScrollTo != INVALID_POSITION &&
132+ timerAdapter.itemCount > timerPositionToScrollTo
133+ ) {
134+ smoothScrollToPosition(timerPositionToScrollTo)
135+ timerPositionToScrollTo = INVALID_POSITION
136+ }
137+
138+ if (! animate) {
139+ itemAnimator = originalAnimator
140+ }
129141 }
130142 }
131143 }
You can’t perform that action at this time.
0 commit comments