Search in sources :

Example 46 with ObjectAnimator

use of android.animation.ObjectAnimator in project ShowcaseView by amlcurran.

the class AnimatorAnimationFactory method fadeOutView.

@Override
public void fadeOutView(View target, long duration, final AnimationEndListener listener) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(target, ALPHA, INVISIBLE);
    oa.setDuration(duration).addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animator) {
            listener.onAnimationEnd();
        }
    });
    oa.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 47 with ObjectAnimator

use of android.animation.ObjectAnimator in project ShowcaseView by amlcurran.

the class AnimatorAnimationFactory method fadeInView.

@Override
public void fadeInView(View target, long duration, final AnimationStartListener listener) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(target, ALPHA, INVISIBLE, VISIBLE);
    oa.setDuration(duration).addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animator) {
            listener.onAnimationStart();
        }
    });
    oa.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 48 with ObjectAnimator

use of android.animation.ObjectAnimator in project gdk-apidemo-sample by googleglass.

the class SliderActivity method processSliderRequest.

/**
     * Processes a request to show a slider.
     *
     * Starting a new Slider, regardless of its type, automatically hides any shown Slider.
     */
private void processSliderRequest(int position) {
    switch(position) {
        case SCROLLER:
            Slider.Scroller scroller = mSlider.startScroller(MAX_SLIDER_VALUE, 0);
            // Start an animation showing the different positions of the slider, the slider
            // automatically hides after a short time of inactivity.
            ObjectAnimator.ofFloat(scroller, "position", 0, MAX_SLIDER_VALUE).setDuration(ANIMATION_DURATION_MILLIS).start();
            break;
        case DETERMINATE:
            final Slider.Determinate determinate = mSlider.startDeterminate(MAX_SLIDER_VALUE, 0);
            ObjectAnimator animator = ObjectAnimator.ofFloat(determinate, "position", 0, MAX_SLIDER_VALUE);
            // Hide the slider when the animation stops.
            animator.addListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    determinate.hide();
                }
            });
            // Start an animation showing the different positions of the slider.
            animator.setDuration(ANIMATION_DURATION_MILLIS).start();
            break;
        case GRACE_PERIOD:
            // Start the grace period slider and play a sound when one of the listener method
            // gets fired.
            mGracePeriod = mSlider.startGracePeriod(mGracePeriodListener);
            break;
        case INDETERMINATE:
            // Toggle between showing/hiding the indeterminate slider.
            if (mIndeterminate != null) {
                mIndeterminate.hide();
                mIndeterminate = null;
            } else {
                mIndeterminate = mSlider.startIndeterminate();
            }
            break;
    }
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) Scroller(com.google.android.glass.widget.Slider.Scroller) Slider(com.google.android.glass.widget.Slider) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) Determinate(com.google.android.glass.widget.Slider.Determinate)

Example 49 with ObjectAnimator

use of android.animation.ObjectAnimator in project android-topeka by googlesamples.

the class AbsQuizView method resizeViewProperty.

private void resizeViewProperty(Property<View, Float> property, float targetScale, int durationOffset) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(this, property, 1f, targetScale);
    animator.setInterpolator(mLinearOutSlowInInterpolator);
    animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY + durationOffset);
    animator.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator)

Example 50 with ObjectAnimator

use of android.animation.ObjectAnimator in project iosched by google.

the class SessionDetailFragment method displayTrackColor.

/**
     * Update the header box background color & status bar color depending upon which track this
     * session belongs to.
     * <p>
     * Note this requires both the {@link SessionDetailQueryEnum#SESSIONS} &
     * {@link SessionDetailQueryEnum#TAG_METADATA) queries to have returned.
     */
private void displayTrackColor(SessionDetailModel data) {
    if (data.isSessionTrackColorAvailable()) {
        int trackColor = data.getSessionTrackColor();
        if (trackColor == Color.TRANSPARENT) {
            trackColor = UIUtils.getThemeColor(getContext(), R.attr.colorPrimary, R.color.theme_primary);
        }
        final Drawable background = mHeaderBox.getBackground();
        if (background instanceof ColorDrawable && ((ColorDrawable) background).getColor() == trackColor) {
            return;
        }
        // Animate the color change to make the transition smoother
        final ObjectAnimator color = ObjectAnimator.ofInt(mHeaderBox, UIUtils.BACKGROUND_COLOR, trackColor);
        color.setEvaluator(new ArgbEvaluator());
        if (mHasEnterTransition) {
            color.setStartDelay(200L);
        }
        color.setDuration(300L);
        color.start();
        if (mCollapsingToolbar.getFitsSystemWindows() && mPhotoViewContainer.getVisibility() == View.VISIBLE) {
            // immersive+photo
            mCollapsingToolbar.setStatusBarScrimColor(trackColor);
        } else {
            UIUtils.adjustAndSetStatusBarColor(getActivity(), trackColor);
        }
    }
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ObjectAnimator(android.animation.ObjectAnimator) ArgbEvaluator(android.animation.ArgbEvaluator) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)791 Animator (android.animation.Animator)313 AnimatorSet (android.animation.AnimatorSet)214 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)208 PropertyValuesHolder (android.animation.PropertyValuesHolder)128 ValueAnimator (android.animation.ValueAnimator)111 View (android.view.View)102 Paint (android.graphics.Paint)68 TextView (android.widget.TextView)49 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)48 ViewGroup (android.view.ViewGroup)45 Rect (android.graphics.Rect)35 LinearInterpolator (android.view.animation.LinearInterpolator)35 ImageView (android.widget.ImageView)31 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)30 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)29 OvershootInterpolator (android.view.animation.OvershootInterpolator)29 ArrayList (java.util.ArrayList)22 TargetApi (android.annotation.TargetApi)21 Interpolator (android.view.animation.Interpolator)20