TedKeyboardObserver

Additional

Language
Kotlin
Version
N/A
Created
Feb 26, 2019
Updated
Mar 23, 2019
Owner
Ted Park (ParkSangGwon)
Contributors
Ted Park (ParkSangGwon)
ted-prnd
sjjeong
3
Activity
Badge
Generate
Download
Source code
APK file

Blurb

What is TedKeyboardObserver?

  • Sometime we want to know keyboard's visibility. (When keyboard shown, change some layout or do something. etc..)
  • But Android SDK doesn't have any observer.
  • TedKeyboardObserver provide keyboard visibility



Demo

Setup

Gradle

dependencies {
    implementation 'gun0912.ted:tedkeyboardobserver:x.y.z'
    //implementation 'gun0912.ted:tedkeyboardobserver:1.0.0-alpha2'
}

If you think this library is useful, please press star button at upside.



How to use

TedKeyboardObserver support Listener and RxJava style

RxJava

  • You don't need dispose this observable. When activity destroy, TedRxKeyboardObserver will call onComplete()

Java

       new TedRxKeyboardObserver(this)
                .listen()
                .subscribe(isShow -> {
                            // do something
                        }, Throwable::printStackTrace);

Kotlin

       
        TedRxKeyboardObserver(this)
            .listen()
            .subscribe({ isShow -> // do something }
                , { throwable -> throwable.printStackTrace() })



Listener

Java

      new TedKeyboardObserver(this)
                .listen(isShow -> {
                    // do something
                });

Kotlin

      TedKeyboardObserver(this)
               .listen { isShow ->
                    // do something
               }