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;
}
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);
}
}
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);
}
}
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();
}
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();
}
Aggregations