Search in sources :

Example 16 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project Android-MaterialRefreshLayout by android-cjj.

the class MaterialRefreshLayout method finishRefreshing.

public void finishRefreshing() {
    if (mChildView != null) {
        ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView);
        viewPropertyAnimatorCompat.setDuration(200);
        viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView));
        viewPropertyAnimatorCompat.translationY(0);
        viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
        viewPropertyAnimatorCompat.start();
        if (mMaterialHeaderView != null) {
            mMaterialHeaderView.onComlete(MaterialRefreshLayout.this);
        } else if (mSunLayout != null) {
            mSunLayout.onComlete(MaterialRefreshLayout.this);
        }
        if (refreshListener != null) {
            refreshListener.onfinish();
        }
    }
    isRefreshing = false;
    progressValue = 0;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ViewPropertyAnimatorCompat(android.support.v4.view.ViewPropertyAnimatorCompat)

Example 17 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project androidquery by androidquery.

the class BitmapAjaxCallback method setBmAnimate.

private static void setBmAnimate(ImageView iv, Bitmap bm, Bitmap preset, int fallback, int animation, float ratio, float anchor, int source) {
    bm = filter(iv, bm, fallback);
    if (bm == null) {
        iv.setImageBitmap(null);
        return;
    }
    Drawable d = makeDrawable(iv, bm, ratio, anchor);
    Animation anim = null;
    if (fadeIn(animation, source)) {
        if (preset == null) {
            anim = new AlphaAnimation(0, 1);
            anim.setInterpolator(new DecelerateInterpolator());
            anim.setDuration(FADE_DUR);
        } else {
            Drawable pd = makeDrawable(iv, preset, ratio, anchor);
            Drawable[] ds = new Drawable[] { pd, d };
            TransitionDrawable td = new TransitionDrawable(ds);
            td.setCrossFadeEnabled(true);
            td.startTransition(FADE_DUR);
            d = td;
        }
    } else if (animation > 0) {
        anim = AnimationUtils.loadAnimation(iv.getContext(), animation);
    }
    iv.setImageDrawable(d);
    if (anim != null) {
        anim.setStartTime(AnimationUtils.currentAnimationTimeMillis());
        iv.startAnimation(anim);
    } else {
        iv.setAnimation(null);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) TransitionDrawable(android.graphics.drawable.TransitionDrawable) Drawable(android.graphics.drawable.Drawable) RatioDrawable(com.androidquery.util.RatioDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) TransitionDrawable(android.graphics.drawable.TransitionDrawable) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 18 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project Android-Universal-Image-Loader by nostra13.

the class FadeInBitmapDisplayer method animate.

/**
	 * Animates {@link ImageView} with "fade-in" effect
	 *
	 * @param imageView      {@link ImageView} which display image in
	 * @param durationMillis The length of the animation in milliseconds
	 */
public static void animate(View imageView, int durationMillis) {
    if (imageView != null) {
        AlphaAnimation fadeImage = new AlphaAnimation(0, 1);
        fadeImage.setDuration(durationMillis);
        fadeImage.setInterpolator(new DecelerateInterpolator());
        imageView.startAnimation(fadeImage);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 19 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project weiciyuan by qii.

the class GalleryActivity method animateClose.

private void animateClose(PhotoView imageView) {
    currentViewPositionLayout.setVisibility(View.INVISIBLE);
    animationView.setImageDrawable(imageView.getDrawable());
    pager.setVisibility(View.INVISIBLE);
    final Rect startBounds = rect;
    final Rect finalBounds = new Rect();
    final Point globalOffset = new Point();
    animationView.getGlobalVisibleRect(finalBounds, globalOffset);
    startBounds.offset(-globalOffset.x, -globalOffset.y);
    finalBounds.offset(-globalOffset.x, -globalOffset.y);
    float startScale;
    if ((float) finalBounds.width() / finalBounds.height() > (float) startBounds.width() / startBounds.height()) {
        // Extend start bounds horizontally
        startScale = (float) startBounds.height() / finalBounds.height();
        float startWidth = startScale * finalBounds.width();
        float deltaWidth = (startWidth - startBounds.width()) / 2;
        startBounds.left -= deltaWidth;
        startBounds.right += deltaWidth;
    } else {
        // Extend start bounds vertically
        startScale = (float) startBounds.width() / finalBounds.width();
        float startHeight = startScale * finalBounds.height();
        float deltaHeight = (startHeight - startBounds.height()) / 2;
        startBounds.top -= deltaHeight;
        startBounds.bottom += deltaHeight;
    }
    animationView.setPivotX(0f);
    animationView.setPivotY(0f);
    final float startScaleFinal = startScale;
    animationView.animate().setInterpolator(new DecelerateInterpolator()).x(startBounds.left).y(startBounds.top).scaleY(startScaleFinal).scaleX(startScaleFinal).setDuration(300).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            GalleryActivity.this.finish();
            overridePendingTransition(0, 0);
        }
    }).start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Rect(android.graphics.Rect) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) Point(android.graphics.Point)

Example 20 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project weiciyuan by qii.

the class AnimationUtility method translateFragmentX.

public static void translateFragmentX(Fragment fragment, int from, int to) {
    final View fragmentView = fragment.getView();
    if (fragmentView == null) {
        return;
    }
    FragmentViewXWrapper wrapper = new FragmentViewXWrapper(fragmentView);
    ObjectAnimator objectAnimator = ObjectAnimator.ofInt(wrapper, "change", from, to);
    objectAnimator.setDuration(300);
    objectAnimator.setInterpolator(new DecelerateInterpolator());
    objectAnimator.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) ImageView(android.widget.ImageView) View(android.view.View)

Aggregations

DecelerateInterpolator (android.view.animation.DecelerateInterpolator)312 ObjectAnimator (android.animation.ObjectAnimator)80 Animator (android.animation.Animator)66 ValueAnimator (android.animation.ValueAnimator)59 View (android.view.View)58 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)55 AnimatorSet (android.animation.AnimatorSet)52 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)36 ImageView (android.widget.ImageView)32 AlphaAnimation (android.view.animation.AlphaAnimation)30 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)29 Animation (android.view.animation.Animation)21 TextView (android.widget.TextView)20 Point (android.graphics.Point)18 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)18 Paint (android.graphics.Paint)14 LinearInterpolator (android.view.animation.LinearInterpolator)14 ScaleAnimation (android.view.animation.ScaleAnimation)14 AnimatorSet (com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet)14 ObjectAnimator (com.actionbarsherlock.internal.nineoldandroids.animation.ObjectAnimator)14