Updated on 2026-08-14
This commit is contained in:
parent
d07ea21d77
commit
79cca95a0f
1 changed files with 9 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import android.content.ClipData
|
|||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.text.Spannable
|
||||
|
|
@ -39,6 +40,14 @@ fun View.getString(@StringRes id: Int): String {
|
|||
return context.getString(id)
|
||||
}
|
||||
|
||||
fun View.getResourceName(): String {
|
||||
return try {
|
||||
resources.getResourceEntryName(id)
|
||||
} catch (ex: Resources.NotFoundException) {
|
||||
"Not found"
|
||||
}
|
||||
}
|
||||
|
||||
fun View.show(show: Boolean, invokeBeforeStateChanged: (() -> Unit)? = null) {
|
||||
return if (show) this.show(invokeBeforeStateChanged)
|
||||
else this.hide(invokeBeforeStateChanged)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue