public class KeyboardUtil extends Object
getValidPanelHeight(Context).
Adapt the panel height with the keyboard height just relate attach(Activity, IPanelHeightTarget).KeyBoardSharedPreferences| Modifier and Type | Class and Description |
|---|---|
static interface |
KeyboardUtil.OnKeyboardShowingListener
The interface is used to listen the keyboard showing state.
|
| Constructor and Description |
|---|
KeyboardUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
attach(Activity activity,
IPanelHeightTarget target) |
static void |
attach(Activity activity,
IPanelHeightTarget target,
KeyboardUtil.OnKeyboardShowingListener listener)
Recommend invoked by
Activity.onCreate(Bundle)
For align the height of the keyboard to target as much as possible. |
static int |
getKeyboardHeight(Context context) |
static int |
getMaxPanelHeight(Resources res) |
static int |
getMinPanelHeight(Resources res) |
static int |
getValidPanelHeight(Context context) |
static void |
hideKeyboard(View view) |
static void |
showKeyboard(View view) |
public static void showKeyboard(View view)
public static void hideKeyboard(View view)
public static int getKeyboardHeight(Context context)
context - the keyboard height is stored by shared-preferences, so need context.getValidPanelHeight(Context),
Handle and refresh the keyboard height by {@link #attach(Activity, IPanelHeightTarget)}.public static int getValidPanelHeight(Context context)
context - the keyboard height is stored by shared-preferences, so need context.getMaxPanelHeight(Resources),
getMinPanelHeight(Resources),
getKeyboardHeight(Context),
The keyboard height may be too short or too height. we intercept the keyboard height in
[{@link #getMinPanelHeight(Resources)}, {@link #getMaxPanelHeight(Resources)}].public static int getMaxPanelHeight(Resources res)
public static int getMinPanelHeight(Resources res)
public static void attach(Activity activity, IPanelHeightTarget target, KeyboardUtil.OnKeyboardShowingListener listener)
Activity.onCreate(Bundle)
For align the height of the keyboard to target as much as possible.
For save the refresh the keyboard height to shared-preferences.activity - contain the viewtarget - whose height will be align to the keyboard height.listener - the listener to listen in: keyboard is showing or not.saveKeyboardHeight(Context, int)public static void attach(Activity activity, IPanelHeightTarget target)