Add "RobotoMono-Bold" font
This commit is contained in:
parent
6739e71018
commit
4a1e8f847f
3 changed files with 9 additions and 4 deletions
|
@ -114,6 +114,7 @@ task downloadPrebuiltTelegram {
|
||||||
|
|
||||||
task collectFonts(type: Copy) {
|
task collectFonts(type: Copy) {
|
||||||
from "../../resources/fonts"
|
from "../../resources/fonts"
|
||||||
|
from "../../resources/fonts-telegram"
|
||||||
into "assets/fonts"
|
into "assets/fonts"
|
||||||
include "*.ttf"
|
include "*.ttf"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="font_roboto_regular">fonts/Roboto-Regular.ttf</string>
|
<string name="font_roboto_regular">fonts/Roboto-Regular.ttf</string>
|
||||||
<string name="font_roboto_medium">fonts/Roboto-Medium.ttf</string>
|
<string name="font_roboto_medium">fonts/Roboto-Medium.ttf</string>
|
||||||
|
<string name="font_roboto_mono_bold">fonts/RobotoMono-Bold.ttf</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -3,22 +3,25 @@ package net.osmand.telegram.helpers
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import net.osmand.telegram.R
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
|
||||||
private const val TAG = "FontCache"
|
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 {
|
object FontCache {
|
||||||
|
|
||||||
private val fontsMap = ConcurrentHashMap<String, Typeface>()
|
private val fontsMap = ConcurrentHashMap<String, Typeface>()
|
||||||
|
|
||||||
fun getRobotoMedium(context: Context): 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? {
|
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? {
|
fun getFont(context: Context, fontName: String): Typeface? {
|
||||||
|
|
Loading…
Reference in a new issue