Android utilities for easier and faster Kotlin programming.
compile 'com.costular:kotlin-utils:0.1'
It depends on utilities. Some of them just work as function extensions and you don't have to do anything special, just call a method like another one.
setFullScreen()
showToolbar() // Support and native
hideToolbar() // Support and native
getClipboardManager()
copyTextToClipboard(value: String)
copyUriToClipboard(uri: Uri)
getTextFromClipboard(): CharSequence
getUriFromClipboard(): Uri?
getPreferences(): SharedPreferences
getPreferences(name: String, mode: Int): SharedPreferences
It automatically applies after lambda execution
val sharedPrefs = context.getPreferences()
sharedPrefs.edit {
putBoolean("first_use", false) // This refers to sharedPrefs instance
}
These methods are static.
doWithVersion(version: Int, lambda) // ==
doWithAtLeastVersion(version: Int, lambda) // >=
doWithHigherVersion(version: Int, lambda) // >
doWithLowerVersion(version: Int, lambda) // <
Example
doWithAtLeastVersion(21) {
// Do something on Lollipop version or higher
}