Merge "Get rid of heavy IPC call from key drawing code" into jb-dev
commit
f11c8cd15a
|
@ -31,6 +31,7 @@ import com.android.inputmethod.keyboard.KeyboardLayoutSet.KeyboardLayoutSetExcep
|
||||||
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
|
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
|
||||||
import com.android.inputmethod.keyboard.internal.KeyboardState;
|
import com.android.inputmethod.keyboard.internal.KeyboardState;
|
||||||
import com.android.inputmethod.latin.DebugSettings;
|
import com.android.inputmethod.latin.DebugSettings;
|
||||||
|
import com.android.inputmethod.latin.ImfUtils;
|
||||||
import com.android.inputmethod.latin.InputView;
|
import com.android.inputmethod.latin.InputView;
|
||||||
import com.android.inputmethod.latin.LatinIME;
|
import com.android.inputmethod.latin.LatinIME;
|
||||||
import com.android.inputmethod.latin.LatinImeLogger;
|
import com.android.inputmethod.latin.LatinImeLogger;
|
||||||
|
@ -180,7 +181,8 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
|| !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
|
|| !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
|
||||||
final boolean needsToDisplayLanguage = mSubtypeSwitcher.needsToDisplayLanguage(
|
final boolean needsToDisplayLanguage = mSubtypeSwitcher.needsToDisplayLanguage(
|
||||||
keyboard.mId.mLocale);
|
keyboard.mId.mLocale);
|
||||||
mKeyboardView.startDisplayLanguageOnSpacebar(subtypeChanged, needsToDisplayLanguage);
|
mKeyboardView.startDisplayLanguageOnSpacebar(subtypeChanged, needsToDisplayLanguage,
|
||||||
|
ImfUtils.hasMultipleEnabledIMEsOrSubtypes(mLatinIME, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Keyboard getKeyboard() {
|
public Keyboard getKeyboard() {
|
||||||
|
|
|
@ -43,7 +43,6 @@ import com.android.inputmethod.accessibility.AccessibilityUtils;
|
||||||
import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
|
import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
|
||||||
import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy;
|
import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy;
|
||||||
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
|
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
|
||||||
import com.android.inputmethod.latin.ImfUtils;
|
|
||||||
import com.android.inputmethod.latin.LatinIME;
|
import com.android.inputmethod.latin.LatinIME;
|
||||||
import com.android.inputmethod.latin.LatinImeLogger;
|
import com.android.inputmethod.latin.LatinImeLogger;
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
|
@ -83,6 +82,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
private ObjectAnimator mLanguageOnSpacebarFadeoutAnimator;
|
private ObjectAnimator mLanguageOnSpacebarFadeoutAnimator;
|
||||||
private static final int ALPHA_OPAQUE = 255;
|
private static final int ALPHA_OPAQUE = 255;
|
||||||
private boolean mNeedsToDisplayLanguage;
|
private boolean mNeedsToDisplayLanguage;
|
||||||
|
private boolean mHasMultipleEnabledIMEsOrSubtypes;
|
||||||
private int mLanguageOnSpacebarAnimAlpha = ALPHA_OPAQUE;
|
private int mLanguageOnSpacebarAnimAlpha = ALPHA_OPAQUE;
|
||||||
private final float mSpacebarTextRatio;
|
private final float mSpacebarTextRatio;
|
||||||
private float mSpacebarTextSize;
|
private float mSpacebarTextSize;
|
||||||
|
@ -847,9 +847,10 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startDisplayLanguageOnSpacebar(boolean subtypeChanged,
|
public void startDisplayLanguageOnSpacebar(boolean subtypeChanged,
|
||||||
boolean needsToDisplayLanguage) {
|
boolean needsToDisplayLanguage, boolean hasMultipleEnabledIMEsOrSubtypes) {
|
||||||
final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
|
|
||||||
mNeedsToDisplayLanguage = needsToDisplayLanguage;
|
mNeedsToDisplayLanguage = needsToDisplayLanguage;
|
||||||
|
mHasMultipleEnabledIMEsOrSubtypes = hasMultipleEnabledIMEsOrSubtypes;
|
||||||
|
final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
|
||||||
if (animator == null) {
|
if (animator == null) {
|
||||||
mNeedsToDisplayLanguage = false;
|
mNeedsToDisplayLanguage = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -881,18 +882,13 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
}
|
}
|
||||||
if (key.mCode == Keyboard.CODE_SPACE) {
|
if (key.mCode == Keyboard.CODE_SPACE) {
|
||||||
drawSpacebar(key, canvas, paint);
|
drawSpacebar(key, canvas, paint);
|
||||||
|
|
||||||
// Whether space key needs to show the "..." popup hint for special purposes
|
// Whether space key needs to show the "..." popup hint for special purposes
|
||||||
if (key.isLongPressEnabled() && ImfUtils.hasMultipleEnabledIMEsOrSubtypes(
|
if (key.isLongPressEnabled() && mHasMultipleEnabledIMEsOrSubtypes) {
|
||||||
getContext(), true /* include aux subtypes */)) {
|
|
||||||
drawKeyPopupHint(key, canvas, paint, params);
|
drawKeyPopupHint(key, canvas, paint, params);
|
||||||
}
|
}
|
||||||
} else if (key.mCode == Keyboard.CODE_LANGUAGE_SWITCH) {
|
} else if (key.mCode == Keyboard.CODE_LANGUAGE_SWITCH) {
|
||||||
super.onDrawKeyTopVisuals(key, canvas, paint, params);
|
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 {
|
} else {
|
||||||
super.onDrawKeyTopVisuals(key, canvas, paint, params);
|
super.onDrawKeyTopVisuals(key, canvas, paint, params);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue