Honor EditorType's IME_FLAG_NO_EXTRACT_UI and IME_FLAG_NO_FULLSCREEN flags
Bug: 5030408 Change-Id: I1c5649725780cd063db7a437b8559b7f2573469c
This commit is contained in:
parent
5ba0577eb2
commit
2811841ab4
2 changed files with 18 additions and 0 deletions
|
@ -26,12 +26,16 @@ public class EditorInfoCompatUtils {
|
||||||
EditorInfo.class, "IME_FLAG_NAVIGATE_NEXT");
|
EditorInfo.class, "IME_FLAG_NAVIGATE_NEXT");
|
||||||
private static final Field FIELD_IME_FLAG_NAVIGATE_PREVIOUS = CompatUtils.getField(
|
private static final Field FIELD_IME_FLAG_NAVIGATE_PREVIOUS = CompatUtils.getField(
|
||||||
EditorInfo.class, "IME_FLAG_NAVIGATE_PREVIOUS");
|
EditorInfo.class, "IME_FLAG_NAVIGATE_PREVIOUS");
|
||||||
|
private static final Field FIELD_IME_FLAG_NO_FULLSCREEN = CompatUtils.getField(
|
||||||
|
EditorInfo.class, "IME_FLAG_NO_FULLSCREEN");
|
||||||
private static final Field FIELD_IME_ACTION_PREVIOUS = CompatUtils.getField(
|
private static final Field FIELD_IME_ACTION_PREVIOUS = CompatUtils.getField(
|
||||||
EditorInfo.class, "IME_ACTION_PREVIOUS");
|
EditorInfo.class, "IME_ACTION_PREVIOUS");
|
||||||
private static final Integer OBJ_IME_FLAG_NAVIGATE_NEXT = (Integer) CompatUtils
|
private static final Integer OBJ_IME_FLAG_NAVIGATE_NEXT = (Integer) CompatUtils
|
||||||
.getFieldValue(null, null, FIELD_IME_FLAG_NAVIGATE_NEXT);
|
.getFieldValue(null, null, FIELD_IME_FLAG_NAVIGATE_NEXT);
|
||||||
private static final Integer OBJ_IME_FLAG_NAVIGATE_PREVIOUS = (Integer) CompatUtils
|
private static final Integer OBJ_IME_FLAG_NAVIGATE_PREVIOUS = (Integer) CompatUtils
|
||||||
.getFieldValue(null, null, FIELD_IME_FLAG_NAVIGATE_PREVIOUS);
|
.getFieldValue(null, null, FIELD_IME_FLAG_NAVIGATE_PREVIOUS);
|
||||||
|
private static final Integer OBJ_IME_FLAG_NO_FULLSCREEN = (Integer) CompatUtils
|
||||||
|
.getFieldValue(null, null, FIELD_IME_FLAG_NO_FULLSCREEN);
|
||||||
private static final Integer OBJ_IME_ACTION_PREVIOUS = (Integer) CompatUtils
|
private static final Integer OBJ_IME_ACTION_PREVIOUS = (Integer) CompatUtils
|
||||||
.getFieldValue(null, null, FIELD_IME_ACTION_PREVIOUS);
|
.getFieldValue(null, null, FIELD_IME_ACTION_PREVIOUS);
|
||||||
|
|
||||||
|
@ -47,6 +51,12 @@ public class EditorInfoCompatUtils {
|
||||||
return (imeOptions & OBJ_IME_FLAG_NAVIGATE_PREVIOUS) != 0;
|
return (imeOptions & OBJ_IME_FLAG_NAVIGATE_PREVIOUS) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasFlagNoFullscreen(int imeOptions) {
|
||||||
|
if (FIELD_IME_FLAG_NO_FULLSCREEN == null)
|
||||||
|
return false;
|
||||||
|
return (imeOptions & OBJ_IME_FLAG_NO_FULLSCREEN) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static void performEditorActionNext(InputConnection ic) {
|
public static void performEditorActionNext(InputConnection ic) {
|
||||||
ic.performEditorAction(EditorInfo.IME_ACTION_NEXT);
|
ic.performEditorAction(EditorInfo.IME_ACTION_NEXT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -894,6 +894,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEvaluateFullscreenMode() {
|
public boolean onEvaluateFullscreenMode() {
|
||||||
|
final EditorInfo ei = getCurrentInputEditorInfo();
|
||||||
|
if (ei != null) {
|
||||||
|
final int imeOptions = ei.imeOptions;
|
||||||
|
if (EditorInfoCompatUtils.hasFlagNoFullscreen(imeOptions))
|
||||||
|
return false;
|
||||||
|
if ((imeOptions & EditorInfo.IME_FLAG_NO_EXTRACT_UI) != 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
final Resources res = mResources;
|
final Resources res = mResources;
|
||||||
DisplayMetrics dm = res.getDisplayMetrics();
|
DisplayMetrics dm = res.getDisplayMetrics();
|
||||||
float displayHeight = dm.heightPixels;
|
float displayHeight = dm.heightPixels;
|
||||||
|
|
Loading…
Reference in a new issue