1
0
Fork 0

don't animate unnecessarily

Fixes #11672, #11727: Empty default tab text and add padding to infinite character

Fixes #11739: Fix flicker

Update TabCounter.kt

make lint happy

don't animate unnecessarily

don't animate unnecessarily

Fixes #11739: Fix flicker

Update TabCounter.kt

squash commits

don't animate unnecessarily

Fixes #11672, #11727: Empty default tab text and add padding to infinite character

Fixes #11739: Fix flicker

Update TabCounter.kt

make lint happy

don't animate unnecessarily
master
Hakkı Kaan Çalışkan 2020-06-22 20:58:14 +03:00 committed by Emily Kager
parent 3dc6c438f4
commit 9068c96ab3
1 changed files with 10 additions and 5 deletions

View File

@ -43,14 +43,19 @@ class TabCounter @JvmOverloads constructor(
}
fun setCountWithAnimation(count: Int) {
setCount(count)
// No need to animate on these cases.
when {
INTERNAL_COUNT == 0 -> return // Initial state.
INTERNAL_COUNT == count -> return // There isn't any tab added or removed.
INTERNAL_COUNT > MAX_VISIBLE_TABS -> return // There are still over MAX_VISIBLE_TABS tabs open.
count == INTERNAL_COUNT -> return // There isn't any tab added or removed.
INTERNAL_COUNT == 0 -> {
setCount(count)
return
} // Initial state.
count > MAX_VISIBLE_TABS && INTERNAL_COUNT > MAX_VISIBLE_TABS -> {
INTERNAL_COUNT = count
return
} // There are still over MAX_VISIBLE_TABS tabs open.
}
setCount(count)
// Cancel previous animations if necessary.
if (animationSet.isRunning) {