Skip to content

Commit

Permalink
perf: safe R
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed May 13, 2024
1 parent efa1829 commit b1ae97f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/src/main/kotlin/li/songe/gkd/notif/Notif.kt
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/kotlin/li/songe/gkd/util/SafeR.kt
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit b1ae97f

Please sign in to comment.