优化
This commit is contained in:
@@ -91,7 +91,7 @@ object ChapterProvider {
|
|||||||
private var titleBottomSpacing = 0
|
private var titleBottomSpacing = 0
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
var typeface: Typeface = Typeface.DEFAULT
|
var typeface: Typeface? = Typeface.DEFAULT
|
||||||
private set
|
private set
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@@ -637,7 +637,7 @@ object ChapterProvider {
|
|||||||
upLayout()
|
upLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTypeface(fontPath: String): Typeface {
|
private fun getTypeface(fontPath: String): Typeface? {
|
||||||
return kotlin.runCatching {
|
return kotlin.runCatching {
|
||||||
when {
|
when {
|
||||||
fontPath.isContentScheme() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O -> {
|
fontPath.isContentScheme() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O -> {
|
||||||
@@ -666,7 +666,7 @@ object ChapterProvider {
|
|||||||
} ?: Typeface.DEFAULT
|
} ?: Typeface.DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getPaints(typeface: Typeface): Pair<TextPaint, TextPaint> {
|
private fun getPaints(typeface: Typeface?): Pair<TextPaint, TextPaint> {
|
||||||
// 字体统一处理
|
// 字体统一处理
|
||||||
val bold = Typeface.create(typeface, Typeface.BOLD)
|
val bold = Typeface.create(typeface, Typeface.BOLD)
|
||||||
val normal = Typeface.create(typeface, Typeface.NORMAL)
|
val normal = Typeface.create(typeface, Typeface.NORMAL)
|
||||||
|
|||||||
Reference in New Issue
Block a user