aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/MainKeyboardView.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/MainKeyboardView.java31
1 files changed, 19 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 454469ce7..a0ac47535 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -333,6 +333,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
private static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
final ObjectAnimator animatorToStart) {
+ if (animatorToCancel == null || animatorToStart == null) {
+ // TODO: Stop using null as a no-operation animator.
+ return;
+ }
float startFraction = 0.0f;
if (animatorToCancel.isStarted()) {
animatorToCancel.cancel();
@@ -366,7 +370,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
// When user hits the space or the enter key, just cancel the while-typing timer.
final int typedCode = typedKey.mCode;
if (typedCode == Constants.CODE_SPACE || typedCode == Constants.CODE_ENTER) {
- startWhileTypingFadeinAnimation(keyboardView);
+ if (isTyping) {
+ startWhileTypingFadeinAnimation(keyboardView);
+ }
return;
}
@@ -581,6 +587,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
private ObjectAnimator loadObjectAnimator(final int resId, final Object target) {
if (resId == 0) {
+ // TODO: Stop returning null.
return null;
}
final ObjectAnimator animator = (ObjectAnimator)AnimatorInflater.loadAnimator(
@@ -609,8 +616,18 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
@ExternallyReferenced
public void setAltCodeKeyWhileTypingAnimAlpha(final int alpha) {
+ if (mAltCodeKeyWhileTypingAnimAlpha == alpha) {
+ return;
+ }
+ // Update the visual of alt-code-key-while-typing.
mAltCodeKeyWhileTypingAnimAlpha = alpha;
- updateAltCodeKeyWhileTyping();
+ final Keyboard keyboard = getKeyboard();
+ if (keyboard == null) {
+ return;
+ }
+ for (final Key key : keyboard.mAltCodeKeysWhileTyping) {
+ invalidateKey(key);
+ }
}
public void setKeyboardActionListener(final KeyboardActionListener listener) {
@@ -1277,16 +1294,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
invalidateKey(shortcutKey);
}
- private void updateAltCodeKeyWhileTyping() {
- final Keyboard keyboard = getKeyboard();
- if (keyboard == null) {
- return;
- }
- for (final Key key : keyboard.mAltCodeKeysWhileTyping) {
- invalidateKey(key);
- }
- }
-
public void startDisplayLanguageOnSpacebar(final boolean subtypeChanged,
final boolean needsToDisplayLanguage, final boolean hasMultipleEnabledIMEsOrSubtypes) {
mNeedsToDisplayLanguage = needsToDisplayLanguage;