mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-23 11:36:13 +02:00
5914fb9f36
* feat: check for license headers * add headers * format
30 lines
871 B
Kotlin
30 lines
871 B
Kotlin
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|