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