aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-05-24 18:20:26 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-05-24 19:04:49 +0900
commitfd60b2f97035382b14dce207b3613711982a613e (patch)
treebb40cb26610623db78ba4ba4173b8cd8a8d28a0b /java/src
parent49afe45d8ea09dd51bbe27f10b0210adf37cdb3f (diff)
downloadlatinime-fd60b2f97035382b14dce207b3613711982a613e.tar.gz
latinime-fd60b2f97035382b14dce207b3613711982a613e.tar.xz
latinime-fd60b2f97035382b14dce207b3613711982a613e.zip
Get rid of heavy IPC call from key drawing code
Bug: 6541544 Change-Id: I5c7df486ff72714ae09e1dbc21a8adbe3106ce95
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java4
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java16
2 files changed, 9 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 37fa674c2..2e4ce199e 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -31,6 +31,7 @@ import com.android.inputmethod.keyboard.KeyboardLayoutSet.KeyboardLayoutSetExcep
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
import com.android.inputmethod.keyboard.internal.KeyboardState;
import com.android.inputmethod.latin.DebugSettings;
+import com.android.inputmethod.latin.ImfUtils;
import com.android.inputmethod.latin.InputView;
import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger;
@@ -180,7 +181,8 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
|| !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
final boolean needsToDisplayLanguage = mSubtypeSwitcher.needsToDisplayLanguage(
keyboard.mId.mLocale);
- mKeyboardView.startDisplayLanguageOnSpacebar(subtypeChanged, needsToDisplayLanguage);
+ mKeyboardView.startDisplayLanguageOnSpacebar(subtypeChanged, needsToDisplayLanguage,
+ ImfUtils.hasMultipleEnabledIMEsOrSubtypes(mLatinIME, true));
}
public Keyboard getKeyboard() {
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index cb3767297..b1599937b 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -43,7 +43,6 @@ import com.android.inputmethod.accessibility.AccessibilityUtils;
import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy;
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
-import com.android.inputmethod.latin.ImfUtils;
import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
@@ -83,6 +82,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
private ObjectAnimator mLanguageOnSpacebarFadeoutAnimator;
private static final int ALPHA_OPAQUE = 255;
private boolean mNeedsToDisplayLanguage;
+ private boolean mHasMultipleEnabledIMEsOrSubtypes;
private int mLanguageOnSpacebarAnimAlpha = ALPHA_OPAQUE;
private final float mSpacebarTextRatio;
private float mSpacebarTextSize;
@@ -847,9 +847,10 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
}
public void startDisplayLanguageOnSpacebar(boolean subtypeChanged,
- boolean needsToDisplayLanguage) {
- final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
+ boolean needsToDisplayLanguage, boolean hasMultipleEnabledIMEsOrSubtypes) {
mNeedsToDisplayLanguage = needsToDisplayLanguage;
+ mHasMultipleEnabledIMEsOrSubtypes = hasMultipleEnabledIMEsOrSubtypes;
+ final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
if (animator == null) {
mNeedsToDisplayLanguage = false;
} else {
@@ -881,18 +882,13 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
}
if (key.mCode == Keyboard.CODE_SPACE) {
drawSpacebar(key, canvas, paint);
-
// Whether space key needs to show the "..." popup hint for special purposes
- if (key.isLongPressEnabled() && ImfUtils.hasMultipleEnabledIMEsOrSubtypes(
- getContext(), true /* include aux subtypes */)) {
+ if (key.isLongPressEnabled() && mHasMultipleEnabledIMEsOrSubtypes) {
drawKeyPopupHint(key, canvas, paint, params);
}
} else if (key.mCode == Keyboard.CODE_LANGUAGE_SWITCH) {
super.onDrawKeyTopVisuals(key, canvas, paint, params);
- if (ImfUtils.hasMultipleEnabledIMEsOrSubtypes(
- getContext(), true /* include aux subtypes */)) {
- drawKeyPopupHint(key, canvas, paint, params);
- }
+ drawKeyPopupHint(key, canvas, paint, params);
} else {
super.onDrawKeyTopVisuals(key, canvas, paint, params);
}