Fix possible NPE in MainKeyboardView
Change-Id: I1fc21a981d9f1740315763b5ca0c1024ece1fa4dmain
parent
a94733cbca
commit
a66069abd8
|
@ -895,13 +895,16 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
|||
}
|
||||
|
||||
private void drawLanguageOnSpacebar(final Key key, final Canvas canvas, final Paint paint) {
|
||||
final Keyboard keyboard = getKeyboard();
|
||||
if (keyboard == null) {
|
||||
return;
|
||||
}
|
||||
final int width = key.getWidth();
|
||||
final int height = key.getHeight();
|
||||
paint.setTextAlign(Align.CENTER);
|
||||
paint.setTypeface(Typeface.DEFAULT);
|
||||
paint.setTextSize(mLanguageOnSpacebarTextSize);
|
||||
final RichInputMethodSubtype subtype = getKeyboard().mId.mSubtype;
|
||||
final String language = layoutLanguageOnSpacebar(paint, subtype, width);
|
||||
final String language = layoutLanguageOnSpacebar(paint, keyboard.mId.mSubtype, width);
|
||||
// Draw language text with shadow
|
||||
final float descent = paint.descent();
|
||||
final float textHeight = -paint.ascent() + descent;
|
||||
|
|
Loading…
Reference in New Issue