修复偶现的崩溃问题

This commit is contained in:
HapeLee
2025-09-11 02:01:15 +08:00
parent 5f32379543
commit e99157ca8c
2 changed files with 8 additions and 3 deletions
@@ -437,5 +437,10 @@ val Context.bookshelfLayoutGrid: Int
fun Context.themeColor(attr: Int): Int {
val typedValue = TypedValue()
theme.resolveAttribute(attr, typedValue, true)
return ContextCompat.getColor(this, typedValue.resourceId)
return if (typedValue.resourceId != 0) {
ContextCompat.getColor(this, typedValue.resourceId)
} else {
typedValue.data
}
}
+2 -2
View File
@@ -13,8 +13,8 @@
</style>
<style name="ThemeOverlay.PureBlack" parent="">
<item name="android:colorBackground">#000000</item>
<item name="colorSurface">#000000</item>
<item name="android:colorBackground">@color/black</item>
<item name="colorSurface">@color/black</item>
</style>
</resources>