Updated on 2026-08-14

This commit is contained in:
Tangem 2020-12-16 22:56:05 +03:00
parent d07ea21d77
commit 79cca95a0f

View file

@ -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)