Skip to content

Commit

Permalink
don't animate unnecessarily
Browse files Browse the repository at this point in the history
Fixes mozilla-mobile#11672, mozilla-mobile#11727: Empty default tab text and add padding to infinite character

Fixes mozilla-mobile#11739: Fix flicker

Update TabCounter.kt

make lint happy

don't animate unnecessarily

don't animate unnecessarily

Fixes mozilla-mobile#11739: Fix flicker

Update TabCounter.kt

squash commits

don't animate unnecessarily

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

Fixes mozilla-mobile#11739: Fix flicker

Update TabCounter.kt

make lint happy

don't animate unnecessarily
  • Loading branch information
hkaancaliskan authored and BranescuMihai committed Jun 24, 2020
1 parent 9ea395f commit 3f88fc9
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3f88fc9

Please sign in to comment.