Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yshrsmz/KeyboardVisibilityEvent
Android Library to handle software keyboard visibility change event.
https://github.com/yshrsmz/KeyboardVisibilityEvent
android android-library
Last synced: 3 months ago
JSON representation
Android Library to handle software keyboard visibility change event.
- Host: GitHub
- URL: https://github.com/yshrsmz/KeyboardVisibilityEvent
- Owner: yshrsmz
- License: apache-2.0
- Created: 2015-03-17T04:10:02.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-09-29T09:59:20.000Z (over 3 years ago)
- Last Synced: 2024-10-22T16:16:44.828Z (3 months ago)
- Topics: android, android-library
- Language: Kotlin
- Homepage:
- Size: 408 KB
- Stars: 1,734
- Watchers: 47
- Forks: 172
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin - KeyboardVisibilityEvent - Android Library to handle software keyboard visibility change event. (Libraries)
- awesome-list - yshrsmz/KeyboardVisibilityEvent - Android Library to handle software keyboard visibility change event. (Kotlin)
README
KeyboardVisibilityEvent
===[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-KeyboardVisibilityEvent-green.svg?style=flat)](https://android-arsenal.com/details/1/2519)
[![Android Gems](http://www.android-gems.com/badge/yshrsmz/KeyboardVisibilityEvent.svg?branch=master)](http://www.android-gems.com/lib/yshrsmz/KeyboardVisibilityEvent)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.yslibrary.keyboardvisibilityevent/keyboardvisibilityevent/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.yslibrary.keyboardvisibilityevent/keyboardvisibilityevent)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](https://github.com/yshrsmz/KeyboardVisibilityEvent/issues/1), 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](https://maven-badges.herokuapp.com/maven-central/net.yslibrary.keyboardvisibilityevent/keyboardvisibilityevent/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.yslibrary.keyboardvisibilityevent/keyboardvisibilityevent)
```groovy
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
```java
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.
```java
KeyboardVisibilityEvent.setEventListener(
getActivity(),
getLifecycleOwner(),
new KeyboardVisibilityEventListener() {
@Override
public void onVisibilityChanged(boolean isOpen) {
// some code depending on keyboard visiblity status
}
});
```#### Manually unregistering the event
```java
// 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 athttp://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.