From dad7a5dffd35f9dd6ef7ada03f030f8093ffa7ae Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 16 Sep 2014 17:56:18 +0900 Subject: [PATCH] Fix drawing of custom action label key Bug: 17488054 Change-Id: I433561ed19ec2a79402867a0395a3e388730f087 --- java/src/com/android/inputmethod/keyboard/Key.java | 4 ++++ java/src/com/android/inputmethod/keyboard/KeyboardView.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 86ea4c563..81ea90a4d 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -702,6 +702,10 @@ public class Key implements Comparable { return ((mLabelFlags | defaultFlags) & LABEL_FLAGS_KEEP_BACKGROUND_ASPECT_RATIO) != 0; } + public final boolean hasCustomActionLabel() { + return (mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0; + } + private final boolean isShiftedLetterActivated() { return (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) != 0 && !TextUtils.isEmpty(mHintLabel); diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index bb3cbb0eb..98cd1da54 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -343,7 +343,9 @@ public class KeyboardView extends View { final int keyWidth = key.getDrawWidth(); final int keyHeight = key.getHeight(); final int bgWidth, bgHeight, bgX, bgY; - if (key.needsToKeepBackgroundAspectRatio(mDefaultKeyLabelFlags)) { + if (key.needsToKeepBackgroundAspectRatio(mDefaultKeyLabelFlags) + // HACK: To disable expanding normal/functional key background. + && !key.hasCustomActionLabel()) { final int intrinsicWidth = background.getIntrinsicWidth(); final int intrinsicHeight = background.getIntrinsicHeight(); final float minScale = Math.min(