mirror of https://github.com/M66B/FairEmail.git
Queue keyboard show/hide
This commit is contained in:
parent
05648b0e06
commit
2470316fd0
|
@ -1171,25 +1171,43 @@ public class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showKeyboard(final View view) {
|
static void showKeyboard(final View view) {
|
||||||
final Context context = view.getContext();
|
Context context = view.getContext();
|
||||||
InputMethodManager imm =
|
InputMethodManager imm =
|
||||||
(InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
(InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
if (imm == null)
|
if (imm == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
view.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
Log.i("showKeyboard view=" + view);
|
Log.i("showKeyboard view=" + view);
|
||||||
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hideKeyboard(final View view) {
|
static void hideKeyboard(final View view) {
|
||||||
final Context context = view.getContext();
|
Context context = view.getContext();
|
||||||
InputMethodManager imm =
|
InputMethodManager imm =
|
||||||
(InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
(InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
if (imm == null)
|
if (imm == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
view.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
Log.i("hideKeyboard view=" + view);
|
Log.i("hideKeyboard view=" + view);
|
||||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Formatting
|
// Formatting
|
||||||
|
|
Loading…
Reference in New Issue