perf: safe R

This commit is contained in:
lisonge 2024-05-13 12:32:38 +08:00
parent efa1829a39
commit b1ae97f211
2 changed files with 15 additions and 5 deletions

View File

@ -1,14 +1,12 @@
package li.songe.gkd.notif
import li.songe.gkd.R
import li.songe.gkd.app
import li.songe.gkd.util.SafeR
data class Notif(
val id: Int,
@Suppress("UNRESOLVED_REFERENCE")
val smallIcon: Int = R.drawable.ic_status,
@Suppress("UNRESOLVED_REFERENCE")
val title: String = app.resources.getString(R.string.app_name),
val smallIcon: Int = SafeR.ic_status,
val title: String = app.getString(SafeR.app_name),
val text: String,
val ongoing: Boolean,
val autoCancel: Boolean,

View File

@ -0,0 +1,12 @@
package li.songe.gkd.util
import li.songe.gkd.R
/**
* ![image](https://github.com/gkd-kit/gkd/assets/38517192/c9325110-d90f-4041-a01d-404d14c5d34d)
*/
@Suppress("UNRESOLVED_REFERENCE")
object SafeR {
val app_name: Int = R.string.app_name
val ic_status: Int = R.drawable.ic_status
}