2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-11 13:11:01 +00:00

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

This commit is contained in:
Hakkı Kaan Çalışkan 2020-06-18 16:28:53 +03:00 committed by Emily Kager
parent a8ed913654
commit b95804c33b

View File

@ -29,7 +29,6 @@ open class TabCounter @JvmOverloads constructor(
val inflater = LayoutInflater.from(context) val inflater = LayoutInflater.from(context)
inflater.inflate(R.layout.mozac_ui_tabcounter_layout, this) inflater.inflate(R.layout.mozac_ui_tabcounter_layout, this)
counter_text.text = DEFAULT_TABS_COUNTER_TEXT
val shiftThreeDp = TypedValue.applyDimension( val shiftThreeDp = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, TWO_DIGIT_PADDING, context.resources.displayMetrics TypedValue.COMPLEX_UNIT_DIP, TWO_DIGIT_PADDING, context.resources.displayMetrics
).toInt() ).toInt()
@ -198,6 +197,7 @@ open class TabCounter @JvmOverloads constructor(
private fun formatForDisplay(count: Int): String { private fun formatForDisplay(count: Int): String {
return if (count > MAX_VISIBLE_TABS) { return if (count > MAX_VISIBLE_TABS) {
counter_text.setPadding(0,0,0,6)
SO_MANY_TABS_OPEN SO_MANY_TABS_OPEN
} else NumberFormat.getInstance().format(count.toLong()) } else NumberFormat.getInstance().format(count.toLong())
} }
@ -220,7 +220,6 @@ open class TabCounter @JvmOverloads constructor(
internal const val MAX_VISIBLE_TABS = 99 internal const val MAX_VISIBLE_TABS = 99
internal const val SO_MANY_TABS_OPEN = "" 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 ONE_DIGIT_SIZE_RATIO = 0.5f
internal const val TWO_DIGITS_SIZE_RATIO = 0.4f internal const val TWO_DIGITS_SIZE_RATIO = 0.4f