Skip to content

Commit

Permalink
Disabled the custom font of BpkBottomNav for RTL locales (#1728)
Browse files Browse the repository at this point in the history
  • Loading branch information
bvitaliyg authored Sep 15, 2023
1 parent 4406f0d commit 363d562
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ open class BpkBottomNav @JvmOverloads constructor(
Menu.NONE,
id,
menu.size(),
SpannableStringBuilder().append(title, fontSpan, Spannable.SPAN_INCLUSIVE_INCLUSIVE),
wrapFontSpan(title),
)
.setIcon(icon)

Expand Down Expand Up @@ -100,6 +100,13 @@ open class BpkBottomNav @JvmOverloads constructor(
throw UnsupportedOperationException("Not supported")
}

private fun wrapFontSpan(text: CharSequence): CharSequence =
if (resources.configuration.layoutDirection == LAYOUT_DIRECTION_LTR) {
SpannableStringBuilder().append(text, fontSpan, Spannable.SPAN_INCLUSIVE_INCLUSIVE)
} else {
text
}

private class ListenersDelegate(
private val menu: Menu,
) : OnItemSelectedListener, OnItemReselectedListener {
Expand Down

0 comments on commit 363d562

Please sign in to comment.