Skip to content

Commit cb73377

Browse files
committed
Disable sorting animations for now
It requires more polishing and animations need to be added in other lists before it can be enabled.
1 parent de176e8 commit cb73377

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

app/src/main/kotlin/org/fossify/clock/fragments/TimerFragment.kt

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)