Skip to content

Commit

Permalink
fix font type support
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimsn98 committed May 27, 2019
1 parent 95a0025 commit dd379cd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ A lightweight Android material bottom navigation bar library
}
dependencies {
implementation 'com.github.ibrahimsn98:NiceBottomBar:1.3'
implementation 'com.github.ibrahimsn98:NiceBottomBar:1.8'
}
```
14 changes: 14 additions & 0 deletions app/src/main/res/font/quicksand.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">

<font
app:fontStyle="normal"
app:fontWeight="400"
app:font="@font/quicksand_regular" />

<font
app:fontStyle="normal"
app:fontWeight="700"
app:font="@font/quicksand_bold" />

</font-family>
Binary file added app/src/main/res/font/quicksand_bold.ttf
Binary file not shown.
Binary file added app/src/main/res/font/quicksand_regular.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
android:layout_height="60dp"
android:layout_gravity="bottom"
app:menu="@menu/bottom_menu"
app:itemFontFamily="@font/quicksand"
app:indicatorInterpolator="anticipateOvershoot" />

</FrameLayout>
4 changes: 2 additions & 2 deletions lib/src/main/java/me/ibrahimsn/lib/NiceBottomBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import android.annotation.SuppressLint
import android.animation.ArgbEvaluator
import android.graphics.*
import android.os.Build
import android.support.v4.content.res.ResourcesCompat

class NiceBottomBar : View {

Expand Down Expand Up @@ -92,8 +93,7 @@ class NiceBottomBar : View {
paintBadge.color = itemBadgeColor

if (itemFontFamily != 0)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
paintText.typeface = resources.getFont(itemFontFamily)
paintText.typeface = ResourcesCompat.getFont(context, itemFontFamily)
}

override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
Expand Down

0 comments on commit dd379cd

Please sign in to comment.