# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1631648347 0 # Node ID 297456a381e48eff2630badf7013680cbca2f8ad # Parent 42151fd096d49037baef8f59cdb7fd29cb7bae51 Android: Similar resource change for bitmap buttons. Could be another few of these still in the source to change. diff -r 42151fd096d4 -r 297456a381e4 android/DWindows.kt --- a/android/DWindows.kt Tue Sep 14 11:12:45 2021 +0000 +++ b/android/DWindows.kt Tue Sep 14 19:39:07 2021 +0000 @@ -1466,6 +1466,8 @@ waitOnUiThread { button = ImageButton(this) val dataArrayMap = SimpleArrayMap() + val exts = arrayOf("", ".png", ".webp", ".jpg", ".jpeg", ".gif") + var filename: String? = null button!!.tag = dataArrayMap button!!.id = resid @@ -1474,6 +1476,26 @@ lastClickView = button!! eventHandlerSimple(button!!, DWEvent.CLICKED) } + + if(resid > 0 && resid < 65536) { + filename = resid.toString() + } + + if(filename != null) { + for (ext in exts) { + // Try to load the image, and protect against exceptions + try { + val f = this.assets.open(filename + ext) + val b = BitmapFactory.decodeStream(f) + + if (b != null) { + button!!.setImageBitmap(b) + break + } + } catch (e: IOException) { + } + } + } } return button }