Android Library to handle soft keyboard visibility change event. show/hide keyboard method is also included.
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 ;)
- 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
).
from 2.0.0, AAR is distributed via jCenter. The latest version is
dependencies {
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:LATEST_VERSION'
}
check out sample project!
KeyboardVisibilityEvent.setEventListener(
getActivity(),
new KeyboardVisibilityEventListener() {
@Override
public void onVisibilityChanged(boolean isOpen) {
// some code depending on keyboard visiblity status
}
});
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
}
});
// 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();
Copyright 2015-2020 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.