Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - costular/kotlin-android-utils: Android utilities for easier and faster Kotlin programming.

Android utilities for easier and faster Kotlin programming. - costular/kotlin-android-utils

Visit SiteGitHub - costular/kotlin-android-utils: Android utilities for easier and faster Kotlin programming.

GitHub - costular/kotlin-android-utils: Android utilities for easier and faster Kotlin programming.

Android utilities for easier and faster Kotlin programming. - costular/kotlin-android-utils

Powered by 0x5a.live ๐Ÿ’—

Logo

Build Status Download license

Android utilities for easier and faster Kotlin programming.

Download

Gradle

compile 'com.costular:kotlin-utils:0.1'

How to use

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.

API

Activity

setFullScreen()
showToolbar() // Support and native
hideToolbar() // Support and native

Context

getClipboardManager()
copyTextToClipboard(value: String)
copyUriToClipboard(uri: Uri)
getTextFromClipboard(): CharSequence
getUriFromClipboard(): Uri?
getPreferences(): SharedPreferences
getPreferences(name: String, mode: Int): SharedPreferences

SharedPreferences

SharedPreferences.use(lambda)

It automatically applies after lambda execution

val sharedPrefs = context.getPreferences()
sharedPrefs.edit {
    putBoolean("first_use", false) // This refers to sharedPrefs instance
}

Versions

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
}

Kotlin Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.