Merge "Don't reset animation alpha value when keyboard is set"
commit
9945f36406
|
@ -383,6 +383,7 @@ public class Keyboard {
|
|||
case CODE_ACTION_ENTER: return "actionEnter";
|
||||
case CODE_ACTION_NEXT: return "actionNext";
|
||||
case CODE_ACTION_PREVIOUS: return "actionPrevious";
|
||||
case CODE_LANGUAGE_SWITCH: return "languageSwitch";
|
||||
case CODE_UNSPECIFIED: return "unspec";
|
||||
case CODE_TAB: return "tab";
|
||||
case CODE_ENTER: return "enter";
|
||||
|
|
|
@ -84,7 +84,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||
private static final int ALPHA_OPAQUE = 255;
|
||||
private boolean mNeedsToDisplayLanguage;
|
||||
private Locale mSpacebarLocale;
|
||||
private int mSpacebarTextAlpha;
|
||||
private int mSpacebarTextAlpha = ALPHA_OPAQUE;
|
||||
private final float mSpacebarTextRatio;
|
||||
private float mSpacebarTextSize;
|
||||
private final int mSpacebarTextColor;
|
||||
|
@ -101,7 +101,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||
// Stuff to draw altCodeWhileTyping keys.
|
||||
private ValueAnimator mAltCodeKeyWhileTypingFadeoutAnimator;
|
||||
private ValueAnimator mAltCodeKeyWhileTypingFadeinAnimator;
|
||||
private int mAltCodeKeyWhileTypingAnimAlpha;
|
||||
private int mAltCodeKeyWhileTypingAnimAlpha = ALPHA_OPAQUE;
|
||||
|
||||
// More keys keyboard
|
||||
private PopupWindow mMoreKeysWindow;
|
||||
|
@ -154,16 +154,8 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||
}
|
||||
break;
|
||||
case MSG_TYPING_STATE_EXPIRED:
|
||||
final ValueAnimator fadeout = keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator;
|
||||
if (fadeout != null && fadeout.isStarted()) {
|
||||
fadeout.cancel();
|
||||
}
|
||||
// TODO: Start the fade in animation with an initial value that is the same as the
|
||||
// final value when the above fade out animation gets cancelled.
|
||||
final ValueAnimator fadein = keyboardView.mAltCodeKeyWhileTypingFadeinAnimator;
|
||||
if (fadein != null && !fadein.isStarted()) {
|
||||
fadein.start();
|
||||
}
|
||||
cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator,
|
||||
keyboardView.mAltCodeKeyWhileTypingFadeinAnimator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -238,26 +230,34 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||
removeMessages(MSG_LONGPRESS_KEY);
|
||||
}
|
||||
|
||||
private static void cancelAndStartAnimators(ValueAnimator animatorToCancel,
|
||||
ValueAnimator animatorToStart) {
|
||||
if (animatorToCancel != null && animatorToCancel.isStarted()) {
|
||||
animatorToCancel.cancel();
|
||||
}
|
||||
// TODO: Start the animation with an initial value that is the same as the final value
|
||||
// of the above animation when it gets cancelled.
|
||||
if (animatorToStart != null && !animatorToStart.isStarted()) {
|
||||
animatorToStart.start();
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelTypingStateTimer() {
|
||||
removeMessages(MSG_TYPING_STATE_EXPIRED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTypingStateTimer() {
|
||||
final boolean isTyping = isTypingState();
|
||||
removeMessages(MSG_TYPING_STATE_EXPIRED);
|
||||
cancelTypingStateTimer();
|
||||
sendMessageDelayed(
|
||||
obtainMessage(MSG_TYPING_STATE_EXPIRED), mParams.mIgnoreAltCodeKeyTimeout);
|
||||
final LatinKeyboardView keyboardView = getOuterInstance();
|
||||
if (isTyping) {
|
||||
return;
|
||||
}
|
||||
final ValueAnimator fadein = keyboardView.mAltCodeKeyWhileTypingFadeinAnimator;
|
||||
if (fadein != null && fadein.isStarted()) {
|
||||
fadein.cancel();
|
||||
}
|
||||
// TODO: Start the fade out animation with an initial value that is the same as the
|
||||
// final value when the above fade in animation gets cancelled.
|
||||
final ValueAnimator fadeout = keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator;
|
||||
if (fadeout != null && !fadeout.isStarted()) {
|
||||
fadeout.start();
|
||||
}
|
||||
final LatinKeyboardView keyboardView = getOuterInstance();
|
||||
cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeinAnimator,
|
||||
keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -289,6 +289,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||
|
||||
public void cancelAllMessages() {
|
||||
cancelKeyTimers();
|
||||
cancelTypingStateTimer();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,15 +324,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||
public final int mLongPressSpaceKeyTimeout;
|
||||
public final int mIgnoreAltCodeKeyTimeout;
|
||||
|
||||
KeyTimerParams() {
|
||||
mKeyRepeatStartTimeout = 0;
|
||||
mKeyRepeatInterval = 0;
|
||||
mLongPressKeyTimeout = 0;
|
||||
mLongPressShiftKeyTimeout = 0;
|
||||
mLongPressSpaceKeyTimeout = 0;
|
||||
mIgnoreAltCodeKeyTimeout = 0;
|
||||
}
|
||||
|
||||
public KeyTimerParams(TypedArray latinKeyboardViewAttr) {
|
||||
mKeyRepeatStartTimeout = latinKeyboardViewAttr.getInt(
|
||||
R.styleable.LatinKeyboardView_keyRepeatStartTimeout, 0);
|
||||
|
@ -424,12 +416,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||
updateAltCodeKeyWhileTyping();
|
||||
}
|
||||
});
|
||||
fadeout.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator a) {
|
||||
final ValueAnimator valueAnimator = (ValueAnimator)a;
|
||||
}
|
||||
});
|
||||
}
|
||||
mAltCodeKeyWhileTypingFadeoutAnimator = fadeout;
|
||||
|
||||
|
@ -442,12 +428,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||
updateAltCodeKeyWhileTyping();
|
||||
}
|
||||
});
|
||||
fadein.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator a) {
|
||||
final ValueAnimator valueAnimator = (ValueAnimator)a;
|
||||
}
|
||||
});
|
||||
}
|
||||
mAltCodeKeyWhileTypingFadeinAnimator = fadein;
|
||||
}
|
||||
|
@ -510,8 +490,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||
final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap;
|
||||
mSpacebarTextSize = keyHeight * mSpacebarTextRatio;
|
||||
mSpacebarLocale = keyboard.mId.mLocale;
|
||||
mSpacebarTextAlpha = ALPHA_OPAQUE;
|
||||
mAltCodeKeyWhileTypingAnimAlpha = ALPHA_OPAQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue