Created
March 7, 2016 17:11
-
-
Save emmaguy/8cd13c080062b3f39dfc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Build | |
public fun supportsKitKat(code:() -> Unit){ | |
supportsVersion(code, 19) | |
} | |
public fun supportsLollipop(code:() -> Unit){ | |
supportsVersion(code, 21) | |
} | |
private fun supportsVersion(code:() -> Unit, sdk: Int){ | |
if (Build.VERSION.SDK_INT >= sdk){ | |
code.invoke() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment