A DSL to handle soft keyboard visibility change event written in Kotlin. This fork was created to fix a null pointer exception crash due to an incorrect override function signature.
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.BradPatras:keyboard-visibility-event-android:1.0.10'
}
Step 3. Code example
Use the keyboard
extension function available on Activity
and Fragment
keyboard {
onClosed { Toast.makeText(this@MainActivity, "onClosed", Toast.LENGTH_SHORT).show() }
onOpened { Toast.makeText(this@MainActivity, "onOpened", Toast.LENGTH_SHORT).show() }
}