Android kotlin infix issue -


i getting interesting problem. when debug application isrescolorid false. unfortunately, let function triggered, , see qwe on logcat.

fun drawabletint(context: context, view: view, colorid: int, isrescolorid: boolean = true) {     try {         val wrap = drawablecompat.wrap(view.background)         drawablecompat.settint(wrap, isrescolorid let { timber.d("qwe"); contextcompat.getcolor(context, colorid) } ?: colorid)         view.setbackgrounddrawable(wrap)     }catch (e: resources.notfoundexception){         timber.e(e, "c_id: $colorid coz: $isrescolorid")     } }  infix fun <t> boolean.then(param: t): t? = if (this) param else null 

logcat:

qwe 

to sure going on, should print it inside of lambda. happening is:

isrescolorid.then(this.let({...})) ?: colorid 

this means block inside let evaluated.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -