Polish fade-in/out animations for the gray-out-while-typing keys

Bug: 6326723
Change-Id: Idb6fa023c497cf1f0f584f496e7e5ae82b1c9f4f
main
Tadashi G. Takaoka 2012-04-12 16:25:53 +09:00
parent f1678ba802
commit 45213ed2a6
3 changed files with 10 additions and 10 deletions

View File

@ -22,6 +22,6 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="altCodeKeyWhileTypingAnimAlpha" android:propertyName="altCodeKeyWhileTypingAnimAlpha"
android:valueType="intType" android:valueType="intType"
android:duration="100" android:duration="1000"
android:valueFrom="128" android:valueFrom="128"
android:valueTo="255" /> android:valueTo="255" />

View File

@ -22,6 +22,6 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="altCodeKeyWhileTypingAnimAlpha" android:propertyName="altCodeKeyWhileTypingAnimAlpha"
android:valueType="intType" android:valueType="intType"
android:duration="70" android:duration="3000"
android:valueFrom="255" android:valueFrom="255"
android:valueTo="128" /> android:valueTo="128" />

View File

@ -227,16 +227,16 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
removeMessages(MSG_LONGPRESS_KEY); removeMessages(MSG_LONGPRESS_KEY);
} }
public static void cancelAndStartAnimators(ObjectAnimator animatorToCancel, public static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
ObjectAnimator animatorToStart) { final ObjectAnimator animatorToStart) {
if (animatorToCancel != null && animatorToCancel.isStarted()) { float startFraction = 0.0f;
if (animatorToCancel.isStarted()) {
animatorToCancel.cancel(); animatorToCancel.cancel();
startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
} }
// TODO: Start the animation with an initial value that is the same as the final value final long startTime = (long)(animatorToStart.getDuration() * startFraction);
// of the above animation when it gets cancelled. animatorToStart.start();
if (animatorToStart != null && !animatorToStart.isStarted()) { animatorToStart.setCurrentPlayTime(startTime);
animatorToStart.start();
}
} }
@Override @Override