• Stars
    star
    1,734
  • Rank 26,744 (Top 0.6 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android Library to handle software keyboard visibility change event.

KeyboardVisibilityEvent

Android Arsenal Android Gems Maven Central

Android Library to handle soft keyboard visibility change event. show/hide keyboard method is also included.

Library's status

Currently I don't have enough time to maintain this library, so I leave this as it is.
I'm going to merge PRs when they arrive though ;)

Features

  • handle keyboard visibility change
  • check if keyboard is currently visible
  • show/hide keyboard(check UIUtil.java)

Please note that as described in this issue, currently the library cannot detect visibility change when the activity's windowSoftInputMode do not change Activity's height(such as adjustNothing).

Installation

AAR is distributed via Maven Central. The latest version is Maven Central

dependencies {
    compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:LATEST_VERSION'
}

Usage

check out sample project!

Add event listener for keyboard change event

Automatically unregistering the event on the Activity's onDestroy

KeyboardVisibilityEvent.setEventListener(
        getActivity(),
        new KeyboardVisibilityEventListener() {
            @Override
            public void onVisibilityChanged(boolean isOpen) {
                // some code depending on keyboard visiblity status
            }
        });

Automatically unregistering the event on the LifecycleOwner's ON_DESTROY

This is convenient when you want to KeyboardVisibilityEvent from a Fragment.

KeyboardVisibilityEvent.setEventListener(
        getActivity(),
        getLifecycleOwner(),
        new KeyboardVisibilityEventListener() {
            @Override
            public void onVisibilityChanged(boolean isOpen) {
                // some code depending on keyboard visiblity status
            }
        });

Manually unregistering the event

// get Unregistrar
Unregistrar unregistrar = KeyboardVisibilityEvent.registerEventListener(
        getActivity(),
        new KeyboardVisibilityEventListener() {
            @Override
            public void onVisibilityChanged(boolean isOpen) {
                // some code depending on keyboard visiblity status
            }
        });

// call this method when you don't need the event listener anymore
unregistrar.unregister();

License

Copyright 2015-2021 Shimizu Yasuhiro (yshrsmz)

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.

More Repositories

1

BuildKonfig

BuildConfig for Kotlin Multiplatform Project
Kotlin
724
star
2

LicenseAdapter

adapter for RecyclerView to display app's oss dependencies' license
Java
213
star
3

monotweety

Simple Twitter Client just for tweeting, written in Kotlin with reactive MVVM-like approach
Kotlin
114
star
4

kgql

GraphQL Document wrapper generator for Kotlin Multiplatform Project and Android
Kotlin
57
star
5

simple-preferences

Android Library to simplify SharedPreferences use with code generation.
Java
48
star
6

photosearcher

Android App to search & fav photos
Java
32
star
7

historian

Custom Timber tree implementation that can save logs to SQLite
Java
24
star
8

GitHubKotlinMPPSample

Kotlin
15
star
9

unorm-dart

Dart
11
star
10

awesome-android-tech-sources

Curated list of awesome Android tech podcasts, blogs and mail magazines
11
star
11

twitter4kt

Twitter API client for KotlIn Multiplatform
Kotlin
10
star
12

bip39-dart

BIP39 mnemonic code implementation in Dart lang
Dart
5
star
13

node-googleplay-info

get app & device info from google play store
JavaScript
4
star
14

omniatp

post a message to Bluesky, from Chrome's omnibox
TypeScript
3
star
15

grunt-spritesheet-generator

grunt-spritesheet-generator
JavaScript
3
star
16

check-playstore-update

let's see if your update has been deployed!
Go
3
star
17

omnitweety

Update your Twitter status right from Chrome's Omnibox (URL bar).
TypeScript
3
star
18

OpenSSL_Flutter

Flutter binding of OpenSSL
C
3
star
19

HNKotlinNative

Kotlin
2
star
20

PartiallyStickyListHeader

Java
1
star
21

CoverageKotlinFunctionTest

Kotlin
1
star
22

blockchain-lite-kt

Kotlin
1
star
23

conductor-kotlin

Kotlin
1
star
24

docker-android

dockerfile for building android
Dockerfile
1
star
25

tailwindcss-issue-8160

JavaScript
1
star
26

yshrsmz.github.io

JavaScript
1
star
27

nico-dev

CSS
1
star
28

sqlstitch

Sort CREATE TABLEs by their relationships. Written in Rust.
Rust
1
star