Skip to content
Snippets Groups Projects
Commit bb4075bc authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android (Google) Code Review
Browse files

Merge "Fix possible NPE in MainKeyboardView"

parents 2ffcad11 a66069ab
No related branches found
No related tags found
No related merge requests found
...@@ -869,13 +869,16 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy ...@@ -869,13 +869,16 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
} }
private void drawLanguageOnSpacebar(final Key key, final Canvas canvas, final Paint paint) { 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 width = key.getWidth();
final int height = key.getHeight(); final int height = key.getHeight();
paint.setTextAlign(Align.CENTER); paint.setTextAlign(Align.CENTER);
paint.setTypeface(Typeface.DEFAULT); paint.setTypeface(Typeface.DEFAULT);
paint.setTextSize(mLanguageOnSpacebarTextSize); paint.setTextSize(mLanguageOnSpacebarTextSize);
final RichInputMethodSubtype subtype = getKeyboard().mId.mSubtype; final String language = layoutLanguageOnSpacebar(paint, keyboard.mId.mSubtype, width);
final String language = layoutLanguageOnSpacebar(paint, subtype, width);
// Draw language text with shadow // Draw language text with shadow
final float descent = paint.descent(); final float descent = paint.descent();
final float textHeight = -paint.ascent() + descent; final float textHeight = -paint.ascent() + descent;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment