Common view-based Kotlin extensions to used in Android projects.
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation "com.github.kevintorch:Kandroid-ktx:$latest_version"
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// animation
someView.animate {
isVisible = true
}
// individual padding with "dp" extension (returns px as Int in view-based system)
someView.padding(top = 16.dp)
someView.padding(vertical = 24.dp)
//
}
}