Add "RobotoMono-Bold" font

This commit is contained in:
Alex Sytnyk 2018-06-28 12:16:22 +03:00
parent 6739e71018
commit 4a1e8f847f
3 changed files with 9 additions and 4 deletions

View file

@ -114,6 +114,7 @@ task downloadPrebuiltTelegram {
task collectFonts(type: Copy) {
from "../../resources/fonts"
from "../../resources/fonts-telegram"
into "assets/fonts"
include "*.ttf"
}

View file

@ -2,4 +2,5 @@
<resources>
<string name="font_roboto_regular">fonts/Roboto-Regular.ttf</string>
<string name="font_roboto_medium">fonts/Roboto-Medium.ttf</string>
<string name="font_roboto_mono_bold">fonts/RobotoMono-Bold.ttf</string>
</resources>

View file

@ -3,22 +3,25 @@ package net.osmand.telegram.helpers
import android.content.Context
import android.graphics.Typeface
import android.util.Log
import net.osmand.telegram.R
import java.util.concurrent.ConcurrentHashMap
private const val TAG = "FontCache"
private const val ROBOTO_MEDIUM = "fonts/Roboto-Medium.ttf"
private const val ROBOTO_REGULAR = "fonts/Roboto-Regular.ttf"
object FontCache {
private val fontsMap = ConcurrentHashMap<String, Typeface>()
fun getRobotoMedium(context: Context): Typeface? {
return getFont(context, ROBOTO_MEDIUM)
return getFont(context, context.getString(R.string.font_roboto_medium))
}
fun getRobotoRegular(context: Context): Typeface? {
return getFont(context, ROBOTO_REGULAR)
return getFont(context, context.getString(R.string.font_roboto_regular))
}
fun getRobotoMonoBold(context: Context): Typeface? {
return getFont(context, context.getString(R.string.font_roboto_mono_bold))
}
fun getFont(context: Context, fontName: String): Typeface? {