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

The following examples show how to use android.animation.ObjectAnimator#isStarted() . 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 LokiBoard-Android-Keylogger with Apache License 2.0 6 votes vote down vote up
public void startDisplayLanguageOnSpacebar(final boolean subtypeChanged,
        final int languageOnSpacebarFormatType) {
    if (subtypeChanged) {
        KeyPreviewView.clearTextCache();
    }
    mLanguageOnSpacebarFormatType = languageOnSpacebarFormatType;
    final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
    if (animator == null) {
        mLanguageOnSpacebarFormatType = LanguageOnSpacebarUtils.FORMAT_TYPE_NONE;
    } else {
        if (subtypeChanged
                && languageOnSpacebarFormatType != LanguageOnSpacebarUtils.FORMAT_TYPE_NONE) {
            setLanguageOnSpacebarAnimAlpha(Constants.Color.ALPHA_OPAQUE);
            if (animator.isStarted()) {
                animator.cancel();
            }
            animator.start();
        } else {
            if (!animator.isStarted()) {
                mLanguageOnSpacebarAnimAlpha = mLanguageOnSpacebarFinalAlpha;
            }
        }
    }
    invalidateKey(mSpaceKey);
}
 
Example 2
Source File: MainKeyboardView.java    From simple-keyboard with Apache License 2.0 6 votes vote down vote up
public void startDisplayLanguageOnSpacebar(final boolean subtypeChanged,
        final int languageOnSpacebarFormatType) {
    if (subtypeChanged) {
        KeyPreviewView.clearTextCache();
    }
    mLanguageOnSpacebarFormatType = languageOnSpacebarFormatType;
    final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
    if (animator == null) {
        mLanguageOnSpacebarFormatType = LanguageOnSpacebarUtils.FORMAT_TYPE_NONE;
    } else {
        if (subtypeChanged
                && languageOnSpacebarFormatType != LanguageOnSpacebarUtils.FORMAT_TYPE_NONE) {
            setLanguageOnSpacebarAnimAlpha(Constants.Color.ALPHA_OPAQUE);
            if (animator.isStarted()) {
                animator.cancel();
            }
            animator.start();
        } else {
            if (!animator.isStarted()) {
                mLanguageOnSpacebarAnimAlpha = mLanguageOnSpacebarFinalAlpha;
            }
        }
    }
    invalidateKey(mSpaceKey);
}
 
Example 3
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 4
Source File: MainKeyboardView.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
public void startDisplayLanguageOnSpacebar(final boolean subtypeChanged,
        final int languageOnSpacebarFormatType,
        final boolean hasMultipleEnabledIMEsOrSubtypes) {
    if (subtypeChanged) {
        KeyPreviewView.clearTextCache();
    }
    mLanguageOnSpacebarFormatType = languageOnSpacebarFormatType;
    mHasMultipleEnabledIMEsOrSubtypes = hasMultipleEnabledIMEsOrSubtypes;
    final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
    if (animator == null) {
        mLanguageOnSpacebarFormatType = LanguageOnSpacebarUtils.FORMAT_TYPE_NONE;
    } else {
        if (subtypeChanged
                && languageOnSpacebarFormatType != LanguageOnSpacebarUtils.FORMAT_TYPE_NONE) {
            setLanguageOnSpacebarAnimAlpha(Constants.Color.ALPHA_OPAQUE);
            if (animator.isStarted()) {
                animator.cancel();
            }
            animator.start();
        } else {
            if (!animator.isStarted()) {
                mLanguageOnSpacebarAnimAlpha = mLanguageOnSpacebarFinalAlpha;
            }
        }
    }
    invalidateKey(mSpaceKey);
}
 
Example 5
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 6
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 7
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 8
Source File: MainKeyboardView.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
public void startDisplayLanguageOnSpacebar(final boolean subtypeChanged,
        final int languageOnSpacebarFormatType,
        final boolean hasMultipleEnabledIMEsOrSubtypes) {
    if (subtypeChanged) {
        KeyPreviewView.clearTextCache();
    }
    mLanguageOnSpacebarFormatType = languageOnSpacebarFormatType;
    mHasMultipleEnabledIMEsOrSubtypes = hasMultipleEnabledIMEsOrSubtypes;
    final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
    if (animator == null) {
        mLanguageOnSpacebarFormatType = LanguageOnSpacebarUtils.FORMAT_TYPE_NONE;
    } else {
        if (subtypeChanged
                && languageOnSpacebarFormatType != LanguageOnSpacebarUtils.FORMAT_TYPE_NONE) {
            setLanguageOnSpacebarAnimAlpha(Constants.Color.ALPHA_OPAQUE);
            if (animator.isStarted()) {
                animator.cancel();
            }
            animator.start();
        } else {
            if (!animator.isStarted()) {
                mLanguageOnSpacebarAnimAlpha = mLanguageOnSpacebarFinalAlpha;
            }
        }
    }
    invalidateKey(mSpaceKey);
}
 
Example 9
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);
}
 
Example 10
Source File: MainKeyboardView.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
public void startDisplayLanguageOnSpacebar(final boolean subtypeChanged,
        final int languageOnSpacebarFormatType,
        final boolean hasMultipleEnabledIMEsOrSubtypes) {
    if (subtypeChanged) {
        KeyPreviewView.clearTextCache();
    }
    mLanguageOnSpacebarFormatType = languageOnSpacebarFormatType;
    mHasMultipleEnabledIMEsOrSubtypes = hasMultipleEnabledIMEsOrSubtypes;
    final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
    if (animator == null) {
        mLanguageOnSpacebarFormatType = LanguageOnSpacebarUtils.FORMAT_TYPE_NONE;
    } else {
        if (subtypeChanged
                && languageOnSpacebarFormatType != LanguageOnSpacebarUtils.FORMAT_TYPE_NONE) {
            setLanguageOnSpacebarAnimAlpha(Constants.Color.ALPHA_OPAQUE);
            if (animator.isStarted()) {
                animator.cancel();
            }
            animator.start();
        } else {
            if (!animator.isStarted()) {
                mLanguageOnSpacebarAnimAlpha = mLanguageOnSpacebarFinalAlpha;
            }
        }
    }
    invalidateKey(mSpaceKey);
}