Refactoring

This commit is contained in:
M66B
2021-08-23 14:43:38 +02:00
parent 3ca8c54889
commit e0bab3e77c
4 changed files with 17 additions and 31 deletions

View File

@@ -1131,22 +1131,26 @@ public class Helper {
return (tv.string != null && !"light".contentEquals(tv.string));
}
static void hideKeyboard(final View view) {
static void showKeyboard(final View view) {
final Context context = view.getContext();
InputMethodManager imm =
(InputMethodManager) view.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
(InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
if (imm == null)
return;
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
Log.i("showKeyboard view=" + view);
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}
static void hideKeyboard(Activity activity) {
if (activity == null)
static void hideKeyboard(final View view) {
final Context context = view.getContext();
InputMethodManager imm =
(InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
if (imm == null)
return;
View focused = activity.getCurrentFocus();
if (focused == null)
return;
hideKeyboard(focused);
Log.i("hideKeyboard view=" + view);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
// Formatting