mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-06 08:55:34 +00:00
Handling invalid orientations updating orientation logic refresh webview height if ApplyKeyboardHeight() has been applied without KB active I ran into a bug building this code into app-builders and fixed it downstream. This commit pushes it upstream. While resize dialog is open: - Keyboard WebView is NOT loaded (isKeyboardLoaded() == false) - ACTION_UP saves to SharedPreferences: ✅ Works -But skips WebView layout update: ❌ Because keyboard not loaded - User exits dialog, keyboard appears: - If the keyboard WebView loads and reads from SharedPreferences properly: ✅ Works - But if there's a timing issue or the WebView had old layout params cached: ❌ Touch zone mismatch
57 lines
1.5 KiB
Markdown
57 lines
1.5 KiB
Markdown
---
|
|
title: KMManager.getKeyboardHeightMax()
|
|
---
|
|
|
|
## Summary
|
|
|
|
The **`getKeyboardHeightMax()`** method returns the maximum allowed height of the keyboard frame for this context.
|
|
|
|
## Syntax
|
|
|
|
``` javascript
|
|
KMManager.getKeyboardHeightMax(Context context)
|
|
```
|
|
or
|
|
``` javascript
|
|
KMManager.getKeyboardHeightMax(Context context, int orientation)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
`context`
|
|
: The context.
|
|
|
|
`orientation` _(Optional)_
|
|
: Accepts a [screen orientation](https://developer.android.com/training/multiscreen/screensizes#TaskUseOriQuali) value. This is most useful if you want to get the size of the keyboard in the other (non-current) orientation. If `orientation` is not defined, maximum keyboard height is returned for the current device orientation.
|
|
|
|
### Returns
|
|
|
|
Returns the maximum allowed height of the keyboard frame in *density-independent pixels
|
|
(dp)*.
|
|
|
|
## Description
|
|
|
|
Use this method to get the maximum allowed height of the keyboard frame.
|
|
|
|
## Examples
|
|
|
|
### Example: Using `getKeyboardHeightMax()`
|
|
|
|
The following script illustrate the use of `getKeyboardHeightMax()`:
|
|
|
|
``` javascript
|
|
int maxKeyboardHeight = KMManager.getKeyboardHeightMax(this);
|
|
```
|
|
or
|
|
```java
|
|
import android.content.res.Configuration;
|
|
...
|
|
// Get the maximum allowed Keyman keyboard height for landscape mode.
|
|
int maxKeyboardHeightLandscape = KMManager.getKeyboardHeightMax(this, Configuration.ORIENTATION_LANDSCAPE);
|
|
```
|
|
|
|
## See also
|
|
|
|
- [applyKeyboardHeight()](applyKeyboardHeight)
|
|
- [getKeyboardHeight()](getKeyboardHeight)
|
|
- [getKeyboardHeightMin()](getKeyboardHeightMin)
|