Java Code Examples for android.animation.ObjectAnimator#getAnimatedFraction()

The following examples show how to use android.animation.ObjectAnimator#getAnimatedFraction() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainKeyboardView.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
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();
        startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
    }
    final long startTime = (long)(animatorToStart.getDuration() * startFraction);
    animatorToStart.start();
    animatorToStart.setCurrentPlayTime(startTime);
}
 
Example 2
Source File: MainKeyboardView.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
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();
        startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
    }
    final long startTime = (long)(animatorToStart.getDuration() * startFraction);
    animatorToStart.start();
    animatorToStart.setCurrentPlayTime(startTime);
}
 
Example 3
Source File: MainKeyboardView.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
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();
        startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
    }
    final long startTime = (long)(animatorToStart.getDuration() * startFraction);
    animatorToStart.start();
    animatorToStart.setCurrentPlayTime(startTime);
}
 
Example 4
Source File: MainKeyboardView.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
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();
        startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
    }
    final long startTime = (long)(animatorToStart.getDuration() * startFraction);
    animatorToStart.start();
    animatorToStart.setCurrentPlayTime(startTime);
}
 
Example 5
Source File: MainKeyboardView.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
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();
        startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
    }
    final long startTime = (long)(animatorToStart.getDuration() * startFraction);
    animatorToStart.start();
    animatorToStart.setCurrentPlayTime(startTime);
}