am a68e0dd4: Fix NPE by disabling key preview popup of Emoji palette
* commit 'a68e0dd437daa1387edc65082f96a00ca258a7b0': Fix NPE by disabling key preview popup of Emoji palettemain
commit
32f417b93c
|
@ -195,7 +195,8 @@ public class Key implements Comparable<Key> {
|
||||||
mHintLabel = hintLabel;
|
mHintLabel = hintLabel;
|
||||||
mLabelFlags = labelFlags;
|
mLabelFlags = labelFlags;
|
||||||
mBackgroundType = backgroundType;
|
mBackgroundType = backgroundType;
|
||||||
mActionFlags = 0;
|
// TODO: Pass keyActionFlags as an argument.
|
||||||
|
mActionFlags = ACTION_FLAGS_NO_KEY_PREVIEW;
|
||||||
mMoreKeys = null;
|
mMoreKeys = null;
|
||||||
mMoreKeysColumnAndFlags = 0;
|
mMoreKeysColumnAndFlags = 0;
|
||||||
mLabel = label;
|
mLabel = label;
|
||||||
|
|
|
@ -446,15 +446,15 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showKeyPreview(final Key key) {
|
public void showKeyPreview(final Key key) {
|
||||||
// If key is invalid or IME is already closed, we must not show key preview.
|
// If the key is invalid or has no key preview, we must not show key preview.
|
||||||
// Trying to show key preview while root window is closed causes
|
if (key == null || key.noKeyPreview()) {
|
||||||
// WindowManager.BadTokenException.
|
|
||||||
if (key == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final KeyPreviewDrawParams previewParams = mKeyPreviewDrawParams;
|
|
||||||
final Keyboard keyboard = getKeyboard();
|
final Keyboard keyboard = getKeyboard();
|
||||||
|
if (keyboard == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final KeyPreviewDrawParams previewParams = mKeyPreviewDrawParams;
|
||||||
if (!previewParams.isPopupEnabled()) {
|
if (!previewParams.isPopupEnabled()) {
|
||||||
previewParams.setVisibleOffset(-keyboard.mVerticalGap);
|
previewParams.setVisibleOffset(-keyboard.mVerticalGap);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -444,6 +444,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final int labelFlags = row.getDefaultKeyLabelFlags();
|
final int labelFlags = row.getDefaultKeyLabelFlags();
|
||||||
|
// TODO: Should be able to assign default keyActionFlags as well.
|
||||||
final int backgroundType = row.getDefaultBackgroundType();
|
final int backgroundType = row.getDefaultBackgroundType();
|
||||||
final int x = (int)row.getKeyX(null);
|
final int x = (int)row.getKeyX(null);
|
||||||
final int y = row.getKeyY();
|
final int y = row.getKeyY();
|
||||||
|
|
|
@ -45,6 +45,7 @@ public final class KeyboardRow {
|
||||||
|
|
||||||
private final ArrayDeque<RowAttributes> mRowAttributesStack = new ArrayDeque<>();
|
private final ArrayDeque<RowAttributes> mRowAttributesStack = new ArrayDeque<>();
|
||||||
|
|
||||||
|
// TODO: Add keyActionFlags.
|
||||||
private static class RowAttributes {
|
private static class RowAttributes {
|
||||||
/** Default width of a key in this row. */
|
/** Default width of a key in this row. */
|
||||||
public final float mDefaultKeyWidth;
|
public final float mDefaultKeyWidth;
|
||||||
|
|
Loading…
Reference in New Issue