Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,15 @@ public Keyboard(AppCompatActivity activity, boolean resizeOnFullScreen) {
FrameLayout content = activity.getWindow().getDecorView().findViewById(android.R.id.content);
rootView = content.getRootView();

ViewCompat.setOnApplyWindowInsetsListener(
rootView,
(v, insets) -> {
boolean showingKeyboard = ViewCompat.getRootWindowInsets(rootView).isVisible(WindowInsetsCompat.Type.ime());

if (showingKeyboard && resizeOnFullScreen) {
possiblyResizeChildOfContent(true);
}
ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> {
boolean showingKeyboard = ViewCompat.getRootWindowInsets(rootView).isVisible(WindowInsetsCompat.Type.ime());

return insets;
if (showingKeyboard && resizeOnFullScreen) {
possiblyResizeChildOfContent(true);
}
);

return insets;
});

ViewCompat.setWindowInsetsAnimationCallback(
rootView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,36 @@ public class KeyboardPlugin extends Plugin {

@Override
public void load() {
execute(
() -> {
boolean resizeOnFullScreen = getConfig().getBoolean("resizeOnFullScreen", false);
implementation = new Keyboard(getBridge(), resizeOnFullScreen);
execute(() -> {
boolean resizeOnFullScreen = getConfig().getBoolean("resizeOnFullScreen", false);
implementation = new Keyboard(getBridge(), resizeOnFullScreen);

implementation.setKeyboardEventListener(this::onKeyboardEvent);
}
);
implementation.setKeyboardEventListener(this::onKeyboardEvent);
});
}

@PluginMethod
public void show(final PluginCall call) {
execute(
() ->
new Handler(Looper.getMainLooper())
.postDelayed(
() -> {
implementation.show();
call.resolve();
},
350
)
execute(() ->
new Handler(Looper.getMainLooper()).postDelayed(
() -> {
implementation.show();
call.resolve();
},
350
)
);
}

@PluginMethod
public void hide(final PluginCall call) {
execute(
() -> {
if (!implementation.hide()) {
call.reject("Can't close keyboard, not currently focused");
} else {
call.resolve();
}
execute(() -> {
if (!implementation.hide()) {
call.reject("Can't close keyboard, not currently focused");
} else {
call.resolve();
}
);
});
}

@PluginMethod
Expand Down
Loading