public class

SimpleAnimatorListener

extends java.lang.Object

 java.lang.Object

↳androidx.wear.widget.SimpleAnimatorListener

Gradle dependencies

compile group: 'androidx.wear', name: 'wear', version: '1.4.0-alpha01'

  • groupId: androidx.wear
  • artifactId: wear
  • version: 1.4.0-alpha01

Artifact androidx.wear:wear:1.4.0-alpha01 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.wear:wear com.android.support:wear

Androidx class mapping:

androidx.wear.widget.SimpleAnimatorListener android.support.wear.widget.SimpleAnimatorListener

Overview

Convenience class for listening for Animator events that implements the AnimatorListener interface and allows extending only methods that are necessary.

Summary

Constructors
publicSimpleAnimatorListener()

Methods
public voidonAnimationCancel(Animator animator)

public voidonAnimationComplete(Animator animator)

Called when the animation finishes.

public voidonAnimationEnd(Animator animator)

public voidonAnimationRepeat(Animator animator)

public voidonAnimationStart(Animator animator)

public booleanwasCanceled()

Provides information if the animation was cancelled.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public SimpleAnimatorListener()

Methods

public void onAnimationCancel(Animator animator)

public void onAnimationEnd(Animator animator)

public void onAnimationRepeat(Animator animator)

public void onAnimationStart(Animator animator)

public void onAnimationComplete(Animator animator)

Called when the animation finishes. Not called if the animation was canceled.

public boolean wasCanceled()

Provides information if the animation was cancelled.

Returns:

True if animation was cancelled.

Source

/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.wear.widget;

import android.animation.Animator;

import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;

/**
 * Convenience class for listening for Animator events that implements the AnimatorListener
 * interface and allows extending only methods that are necessary.
 *
 */
@RestrictTo(Scope.LIBRARY)
public class SimpleAnimatorListener implements Animator.AnimatorListener {

    private boolean mWasCanceled;

    @Override
    public void onAnimationCancel(Animator animator) {
        mWasCanceled = true;
    }

    @Override
    public void onAnimationEnd(Animator animator) {
        if (!mWasCanceled) {
            onAnimationComplete(animator);
        }
    }

    @Override
    public void onAnimationRepeat(Animator animator) {}

    @Override
    public void onAnimationStart(Animator animator) {
        mWasCanceled = false;
    }

    /**
     * Called when the animation finishes. Not called if the animation was canceled.
     */
    public void onAnimationComplete(Animator animator) {}

    /**
     * Provides information if the animation was cancelled.
     *
     * @return True if animation was cancelled.
     */
    public boolean wasCanceled() {
        return mWasCanceled;
    }
}