|
|
|
|
1
|
package com.reactnativenavigation.utils;
|
1
|
package com.reactnativenavigation.utils;
|
2
|
|
2
|
|
3
|
-import android.app.Activity;
|
|
|
4
|
import android.content.Context;
|
3
|
import android.content.Context;
|
5
|
import android.graphics.Rect;
|
4
|
import android.graphics.Rect;
|
6
|
import android.view.View;
|
5
|
import android.view.View;
|
|
|
|
|
28
|
}
|
27
|
}
|
29
|
|
28
|
|
30
|
public void closeKeyboard(Runnable keyboardClosedListener) {
|
29
|
public void closeKeyboard(Runnable keyboardClosedListener) {
|
31
|
- Activity context = (Activity) screen.getContext();
|
|
|
32
|
- View view = context.getCurrentFocus();
|
|
|
33
|
- if (view != null) {
|
|
|
34
|
- this.keyboardCloseListener = keyboardClosedListener;
|
|
|
35
|
-
|
|
|
36
|
- InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
37
|
- imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
|
|
|
38
|
- }
|
|
|
|
|
30
|
+ this.keyboardCloseListener = keyboardClosedListener;
|
|
|
31
|
+ InputMethodManager imm = (InputMethodManager) screen.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
32
|
+ imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
|
39
|
}
|
33
|
}
|
40
|
|
34
|
|
41
|
private static class KeyboardVisibilityLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {
|
35
|
private static class KeyboardVisibilityLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {
|