Skip to content

Commit

Permalink
Fixes mozilla-mobile#11672, mozilla-mobile#11727: Empty default tab t…
Browse files Browse the repository at this point in the history
…ext and add padding to infinite character
  • Loading branch information
Hakkı Kaan Çalışkan authored and BranescuMihai committed Jun 24, 2020
1 parent 673507d commit 3e5f982
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ open class TabCounter @JvmOverloads constructor(
val inflater = LayoutInflater.from(context)
inflater.inflate(R.layout.mozac_ui_tabcounter_layout, this)

counter_text.text = DEFAULT_TABS_COUNTER_TEXT
val shiftThreeDp = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, TWO_DIGIT_PADDING, context.resources.displayMetrics
).toInt()
Expand Down Expand Up @@ -198,6 +197,7 @@ open class TabCounter @JvmOverloads constructor(

private fun formatForDisplay(count: Int): String {
return if (count > MAX_VISIBLE_TABS) {
counter_text.setPadding(0,0,0,6)
SO_MANY_TABS_OPEN
} else NumberFormat.getInstance().format(count.toLong())
}
Expand All @@ -220,7 +220,6 @@ open class TabCounter @JvmOverloads constructor(
internal const val MAX_VISIBLE_TABS = 99

internal const val SO_MANY_TABS_OPEN = ""
internal const val DEFAULT_TABS_COUNTER_TEXT = ":)"

internal const val ONE_DIGIT_SIZE_RATIO = 0.5f
internal const val TWO_DIGITS_SIZE_RATIO = 0.4f
Expand Down

0 comments on commit 3e5f982

Please sign in to comment.