Merge pull request #677 from esensar/fix/676-big-text-size-note-titles

Take all text scaling into account when determining pagerTabStrip height
This commit is contained in:
Tibor Kaputa 2023-08-22 17:15:01 +02:00 committed by GitHub
commit 453c44874a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -100,9 +100,10 @@ class MainActivity : SimpleActivity() {
initViewPager(intent.getLongExtra(OPEN_NOTE_ID, -1L))
binding.pagerTabStrip.drawFullUnderline = false
binding.pagerTabStrip.setTextSize(TypedValue.COMPLEX_UNIT_PX, getPercentageFontSize())
val textSize = getPercentageFontSize()
binding.pagerTabStrip.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
binding.pagerTabStrip.layoutParams.height =
(binding.pagerTabStrip.height + resources.getDimension(com.simplemobiletools.commons.R.dimen.activity_margin) * 2 * (config.fontSizePercentage / 100f)).toInt()
(textSize + resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin) * 2).toInt()
(binding.pagerTabStrip.layoutParams as ViewPager.LayoutParams).isDecor = true
checkWhatsNewDialog()
checkIntents(intent)
@ -138,7 +139,10 @@ class MainActivity : SimpleActivity() {
refreshMenuItems()
binding.pagerTabStrip.apply {
setTextSize(TypedValue.COMPLEX_UNIT_PX, getPercentageFontSize())
val textSize = getPercentageFontSize()
setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
layoutParams.height =
(textSize + resources.getDimension(com.simplemobiletools.commons.R.dimen.medium_margin) * 2).toInt()
setGravity(Gravity.CENTER_VERTICAL)
setNonPrimaryAlpha(0.4f)
setTextColor(getProperPrimaryColor())