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
Post a Comment