ParkSangGwon / TedKeyboardObserver

TedKeyboardObserver is keyboard's visibility observer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  • You can observe keyboard status like this

    Screenshot



    - Keyboard show / hide

    Screenshot Screenshot

Setup

Gradle

Maven Central

dependencies {
    implementation 'io.github.ParkSangGwon:tedkeyboardobserver:x.y.z'
    //implementation 'io.github.ParkSangGwon:tedkeyboardobserver:1.0.1'
}

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
               }



License

Copyright 2019 Ted Park

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.```

About

TedKeyboardObserver is keyboard's visibility observer


Languages

Language:Kotlin 100.0%