mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-28 14:24:12 +00:00
Android: Use java code to show or hide the keyboard
instead of coding it all in JNI This uses build.rs to compile the java code into bytecode that is then embedded in the binary and loaded at runtime
This commit is contained in:
parent
a46b70833a
commit
daa40f43cd
4 changed files with 178 additions and 38 deletions
|
@ -0,0 +1,24 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
|
||||
|
||||
import android.view.View;
|
||||
import android.content.Context;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.app.Activity;
|
||||
|
||||
public class SlintAndroidJavaHelper {
|
||||
Activity mActivity;
|
||||
|
||||
public SlintAndroidJavaHelper(Activity activity) {
|
||||
this.mActivity = activity;
|
||||
}
|
||||
public void show_keyboard() {
|
||||
InputMethodManager imm = (InputMethodManager)mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(mActivity.getWindow().getDecorView(), 0);
|
||||
}
|
||||
public void hide_keyboard() {
|
||||
InputMethodManager imm = (InputMethodManager)mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(mActivity.getWindow().getDecorView().getWindowToken(), 0);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue