Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.11 KB

README.md

File metadata and controls

50 lines (37 loc) · 1.11 KB

Kandroid Kotlin Extensions

Common view-based Kotlin extensions to used in Android projects.

Latest Version 👉

Installation

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"
}

Usage

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)

        //

    }
}