Updated on 2026-08-14

This commit is contained in:
Tangem 2020-12-17 10:12:47 +00:00
commit b1792cc54a
16 changed files with 463 additions and 103 deletions

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)