Hi everyone! I want to use Kotlin extension functi...
# android
r
Hi everyone! I want to use Kotlin extension function to remove
if(Build.VERSION.SDK_INT)
from my code. I've created this:
Copy code
inline fun <T> T.applyForOreoOrAbove(block: T.() -> Unit): T {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    block()
  }
  return this
}
Unfortunately, Android Lint still complains that call requires... Is it a bug in the Lint or am I doing something wrong?
Effect:

https://i.imgur.com/Ts3EGv7.png

l
Lint check for API level is not smart enough yet. Please, suggest an improvement on b.android.com
j
Use 3.1 alpha 5 or newer
r
I've tested it with AS 3.1 alpha 7 with same result 😞
j
r
Sure thing! Thanks for help!