Skip to content

Commit

Permalink
Merge pull request #16 from applikationsprogramvara/fix/settextappear…
Browse files Browse the repository at this point in the history
…ance_on_api_lower_23

Fixing method setTextAppearance on API < 23
  • Loading branch information
acefalobi authored May 18, 2021
2 parents b7c39b4 + b14491d commit 9859d11
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.aceinteract.android.stepper.menus.tab
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.MenuItem
Expand Down Expand Up @@ -52,7 +53,10 @@ class TabNumberedStepperMenu(
override fun updateUI() {
_menuItems.forEachIndexed { index, item ->
val labelView = item.labelView.apply {
setTextAppearance(textAppearance)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
setTextAppearance(context, textAppearance)
else
setTextAppearance(textAppearance)
setTextColor(textColor)
textSizeInPX?.let { setTextSize(TypedValue.COMPLEX_UNIT_PX, it.toFloat()) }
}
Expand Down Expand Up @@ -177,7 +181,10 @@ class TabNumberedStepperMenu(

labelView.run {
text = title
setTextAppearance(textAppearance)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
setTextAppearance(context, textAppearance)
else
setTextAppearance(textAppearance)
setTextColor(textColor)
textSizeInPX?.let { setTextSize(TypedValue.COMPLEX_UNIT_PX, it.toFloat()) }
layoutParams.width = maxWidth
Expand Down

0 comments on commit 9859d11

Please sign in to comment.