use of android.view.animation.RotateAnimation in project BGARefreshLayout-Android by bingoogolapple.
the class BGANormalRefreshViewHolder method initAnimation.
private void initAnimation() {
mUpAnim = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mUpAnim.setDuration(150);
mUpAnim.setFillAfter(true);
mDownAnim = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mDownAnim.setFillAfter(true);
}
use of android.view.animation.RotateAnimation in project LuaViewSDK by alibaba.
the class UDAnimation method build.
/**
* build an animation
*
* @return
*/
public Animation build(View view) {
Animation animation = null;
if (view != null) {
switch(mAnimationType) {
case TYPE_ALPHA:
if (this.mValues != null && this.mValues.length > 0) {
animation = new AlphaAnimation(view.getAlpha(), this.mValues[0]);
}
break;
case TYPE_ROTATE:
if (this.mValues != null && this.mValues.length > 0) {
animation = new RotateAnimation(view.getRotation(), this.mValues[0]);
}
break;
case TYPE_SCALE:
if (this.mValues != null && this.mValues.length > 1) {
animation = new ScaleAnimation(view.getScaleX(), this.mValues[0], view.getScaleY(), this.mValues[1]);
}
break;
case TYPE_TRANSLATE:
if (this.mValues != null && this.mValues.length > 1) {
animation = new TranslateAnimation(view.getX(), DimenUtil.dpiToPx(this.mValues[0]), view.getY(), DimenUtil.dpiToPx(this.mValues[1]));
}
break;
}
if (animation != null) {
animation.setFillEnabled(true);
//默认结束后设置属性
animation.setFillAfter(true);
animation.setFillBefore(true);
animation.setDuration(mDuration);
animation.setStartOffset(mStartOffset);
animation.setRepeatCount(mRepeatCount);
if (mOnStartCallback != null || mOnRepeatCallback != null || mOnEndCallback != null) {
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
LuaUtil.callFunction(mOnStartCallback);
}
@Override
public void onAnimationEnd(Animation animation) {
LuaUtil.callFunction(mOnEndCallback);
}
@Override
public void onAnimationRepeat(Animation animation) {
LuaUtil.callFunction(mOnRepeatCallback);
}
});
}
}
}
return animation;
}
use of android.view.animation.RotateAnimation in project Ushahidi_Android by ushahidi.
the class PullToRefreshListView method init.
private void init(Context context) {
// Load all of the animations we need in code rather than through XML
mFlipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mFlipAnimation.setInterpolator(new LinearInterpolator());
mFlipAnimation.setDuration(250);
mFlipAnimation.setFillAfter(true);
mReverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
mReverseFlipAnimation.setDuration(250);
mReverseFlipAnimation.setFillAfter(true);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mRefreshView = (RelativeLayout) mInflater.inflate(R.layout.list_header, this, false);
mRefreshViewText = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
mRefreshViewImage = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_image);
mRefreshViewProgress = (ProgressBar) mRefreshView.findViewById(R.id.pull_to_refresh_progress);
mRefreshViewLastUpdated = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);
mRefreshViewImage.setMinimumHeight(50);
mRefreshView.setOnClickListener(new OnClickRefreshListener());
mRefreshOriginalTopPadding = mRefreshView.getPaddingTop();
mRefreshState = TAP_TO_REFRESH;
addHeaderView(mRefreshView);
super.setOnScrollListener(this);
measureView(mRefreshView);
mRefreshViewHeight = mRefreshView.getMeasuredHeight();
}
use of android.view.animation.RotateAnimation in project android-satellite-menu by siyamed.
the class SatelliteAnimationCreator method createItemInAnimation.
public static Animation createItemInAnimation(Context context, int index, long expandDuration, int x, int y) {
RotateAnimation rotate = new RotateAnimation(720, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setInterpolator(context, R.anim.sat_item_in_rotate_interpolator);
rotate.setDuration(expandDuration);
TranslateAnimation translate = new TranslateAnimation(x, 0, y, 0);
long delay = 250;
if (expandDuration <= 250) {
delay = expandDuration / 3;
}
long duration = 400;
if ((expandDuration - delay) > duration) {
duration = expandDuration - delay;
}
translate.setDuration(duration);
translate.setStartOffset(delay);
translate.setInterpolator(context, R.anim.sat_item_anticipate_interpolator);
AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0f);
long alphaDuration = 10;
if (expandDuration < 10) {
alphaDuration = expandDuration / 10;
}
alphaAnimation.setDuration(alphaDuration);
alphaAnimation.setStartOffset((delay + duration) - alphaDuration);
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(false);
animationSet.setFillBefore(true);
animationSet.setFillEnabled(true);
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(rotate);
animationSet.addAnimation(translate);
animationSet.setStartOffset(30 * index);
animationSet.start();
animationSet.startNow();
return animationSet;
}
use of android.view.animation.RotateAnimation in project StickyHeaderListView by sfsheng0322.
the class FilterView method rotateArrowDownAnimation.
// 旋转箭头向下
public static void rotateArrowDownAnimation(final ImageView iv) {
if (iv == null)
return;
RotateAnimation animation = new RotateAnimation(180f, 0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animation.setDuration(200);
animation.setFillAfter(true);
iv.startAnimation(animation);
}
Aggregations