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