mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-25 11:46:06 +02:00
feat(notification): implement Android and iOS APIs (#340)
This commit is contained in:
committed by
GitHub
parent
1397172e95
commit
be1c775b8d
@@ -0,0 +1,25 @@
|
||||
package app.tauri.notification
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
|
||||
class AssetUtils {
|
||||
companion object {
|
||||
const val RESOURCE_ID_ZERO_VALUE = 0
|
||||
|
||||
@SuppressLint("DiscouragedApi")
|
||||
fun getResourceID(context: Context, resourceName: String?, dir: String?): Int {
|
||||
return context.resources.getIdentifier(resourceName, dir, context.packageName)
|
||||
}
|
||||
|
||||
fun getResourceBaseName(resPath: String?): String? {
|
||||
if (resPath == null) return null
|
||||
if (resPath.contains("/")) {
|
||||
return resPath.substring(resPath.lastIndexOf('/') + 1)
|
||||
}
|
||||
return if (resPath.contains(".")) {
|
||||
resPath.substring(0, resPath.lastIndexOf('.'))
|
||||
} else resPath
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user