android.view.animation.RotateAnimation Java Examples

The following examples show how to use android.view.animation.RotateAnimation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlipLoadingLayout.java    From NetEasyNews with GNU General Public License v3.0 6 votes vote down vote up
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
Example #2
Source File: FlipLoadingLayout.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
Example #3
Source File: TweenedAnimationActivity.java    From AndroidAnimationExercise with Apache License 2.0 6 votes vote down vote up
/**
 * rotate Animation
 */
private void RotateAnimation() {
    animation = new RotateAnimation(-deValue, deValue, Animation.RELATIVE_TO_SELF,
            pxValue, Animation.RELATIVE_TO_SELF, pyValue);
    animation.setDuration(timeValue);

    if (keep.isChecked()) {
        animation.setFillAfter(true);
    } else {
        animation.setFillAfter(false);
    }
    if (loop.isChecked()) {
        animation.setRepeatCount(-1);
    } else {
        animation.setRepeatCount(0);
    }

    if (reverse.isChecked()) {
        animation.setRepeatMode(Animation.REVERSE);
    } else {
        animation.setRepeatMode(Animation.RESTART);
    }
    img.startAnimation(animation);
}
 
Example #4
Source File: AnimationUtils.java    From AndroidStudyDemo with GNU General Public License v2.0 6 votes vote down vote up
public static RotateAnimation initRotateAnimation(boolean isClockWise, long duration,
        boolean isFillAfter, int repeatCount) {
    int endAngle;
    if (isClockWise) {
        endAngle = 360;
    } else {
        endAngle = -360;
    }
    RotateAnimation mLoadingRotateAnimation = new RotateAnimation(0, endAngle,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    LinearInterpolator lirInterpolator = new LinearInterpolator();
    mLoadingRotateAnimation.setInterpolator(lirInterpolator);
    mLoadingRotateAnimation.setDuration(duration);
    mLoadingRotateAnimation.setFillAfter(isFillAfter);
    mLoadingRotateAnimation.setRepeatCount(repeatCount);
    mLoadingRotateAnimation.setRepeatMode(Animation.RESTART);
    return mLoadingRotateAnimation;
}
 
Example #5
Source File: FlipLoadingLayout.java    From Alibaba-Android-Certification with MIT License 6 votes vote down vote up
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
Example #6
Source File: FlipLoadingLayout.java    From Favorite-Android-Client with Apache License 2.0 6 votes vote down vote up
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
Example #7
Source File: FlipLoadingLayout.java    From sctalk with Apache License 2.0 6 votes vote down vote up
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
Example #8
Source File: RotateLoadingLayoutFooter.java    From BigApp_WordPress_Android with Apache License 2.0 6 votes vote down vote up
public RotateLoadingLayoutFooter(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs)
{
    super(context, mode, scrollDirection, attrs, true);

    mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

    mHeaderImage.setScaleType(ScaleType.MATRIX);
    mHeaderImageMatrix = new Matrix();
    mHeaderImage.setImageMatrix(mHeaderImageMatrix);

    mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
}
 
Example #9
Source File: PullToRefreshView.java    From wallpaper with GNU General Public License v2.0 6 votes vote down vote up
/**
 * init
 * 
 * @description
 * @param context
 *            hylin 2012-7-26上午10:08:33
 */
private void init() {
	// 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.from(getContext());
	// header view 在此添加,保证是第一个添加到linearlayout的最上端
	addHeaderView();
}
 
Example #10
Source File: RotateLoadingLayout.java    From GifAssistant with Apache License 2.0 6 votes vote down vote up
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

	mHeaderImage.setScaleType(ScaleType.MATRIX);
	mHeaderImageMatrix = new Matrix();
	mHeaderImage.setImageMatrix(mHeaderImageMatrix);

	mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setRepeatCount(Animation.INFINITE);
	mRotateAnimation.setRepeatMode(Animation.RESTART);
}
 
Example #11
Source File: RotateLoadingLayout.java    From Roid-Library with Apache License 2.0 6 votes vote down vote up
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
    super(context, mode, scrollDirection, attrs);

    mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

    mHeaderImage.setScaleType(ScaleType.MATRIX);
    mHeaderImageMatrix = new Matrix();
    mHeaderImage.setImageMatrix(mHeaderImageMatrix);

    mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
}
 
Example #12
Source File: WelcomeActivity.java    From Twire with GNU General Public License v3.0 6 votes vote down vote up
private void startHideContinueIconAnimations() {
    Animation mScaleAnimation = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    Animation mRotateAnimation = new RotateAnimation(
            0, 360,
            Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f
    );
    mRotateAnimation.setRepeatCount(0);

    AnimationSet mAnimations = new AnimationSet(true);
    mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
    mAnimations.setFillAfter(true);
    mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
    mAnimations.addAnimation(mScaleAnimation);
    mAnimations.addAnimation(mRotateAnimation);

    mContinueIcon.startAnimation(mAnimations);
}
 
Example #13
Source File: WelcomeActivity.java    From Twire with GNU General Public License v3.0 6 votes vote down vote up
private void startShowContinueIconAnimations() {
    Animation mScaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    Animation mRotateAnimation = new RotateAnimation(
            0, 360,
            Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f
    );
    mRotateAnimation.setRepeatCount(0);

    AnimationSet mAnimations = new AnimationSet(true);
    mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
    mAnimations.setFillAfter(true);
    mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
    mAnimations.addAnimation(mScaleAnimation);
    mAnimations.addAnimation(mRotateAnimation);

    mContinueIcon.startAnimation(mAnimations);
}
 
Example #14
Source File: FlipLoadingLayout.java    From bmob-android-demo-paging with GNU General Public License v3.0 6 votes vote down vote up
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
Example #15
Source File: StickerRecyclerAdapter.java    From PLDroidShortVideo with Apache License 2.0 6 votes vote down vote up
/**
 * 显示进度动画
 */
public void showProgressAnimation(ImageView view) {
    if (view == null) return;

    view.setVisibility(View.VISIBLE);
    RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF,
            0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    LinearInterpolator lin = new LinearInterpolator();
    rotate.setInterpolator(lin);
    rotate.setDuration(2000);
    rotate.setRepeatCount(-1);
    rotate.setFillAfter(true);

    view.setAnimation(rotate);

}
 
Example #16
Source File: FlipLoadingLayout.java    From ONE-Unofficial with Apache License 2.0 6 votes vote down vote up
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
Example #17
Source File: XListViewHeader.java    From Android with MIT License 6 votes vote down vote up
private void initView(Context context) {
  // Initial settings, set the drop-down refresh view height
  LayoutParams lp = new LayoutParams(
      android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
  mContainer = (LinearLayout) LayoutInflater.from(context).inflate(
      R.layout.xlistview_header, null);
  addView(mContainer, lp);
  setGravity(Gravity.BOTTOM);

  mArrowImageView = (ImageView) findViewById(R.id.xlistview_header_arrow);
  mProgressBar = (ProgressBar) findViewById(R.id.xlistview_header_progressbar);

  mRotateUpAnim = new RotateAnimation(0.0f, -180.0f,
      Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
      0.5f);
  mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
  mRotateUpAnim.setFillAfter(true);
  mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f,
      Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
      0.5f);
  mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
  mRotateDownAnim.setFillAfter(true);
}
 
Example #18
Source File: MultiListView.java    From WifiChat with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 实例化下拉刷新的箭头的动画效果
 * 
 * @param pAnimDuration
 *            动画运行时长
 * @date 2015年2月14日 上午11:17
 * @change hillfly
 */
private void initPullImageAnimation(final int pAnimDuration) {

    int _Duration;

    if (pAnimDuration > 0) {
        _Duration = pAnimDuration;
    }
    else {
        _Duration = 250;
    }

    Interpolator _Interpolator = new LinearInterpolator();

    mArrowAnim = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mArrowAnim.setInterpolator(_Interpolator);
    mArrowAnim.setDuration(_Duration);
    mArrowAnim.setFillAfter(true);

    mArrowReverseAnim = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mArrowReverseAnim.setInterpolator(_Interpolator);
    mArrowReverseAnim.setDuration(_Duration);
    mArrowReverseAnim.setFillAfter(true);
}
 
Example #19
Source File: FlipLoadingLayout.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
Example #20
Source File: RotateLoadingLayout.java    From sctalk with Apache License 2.0 6 votes vote down vote up
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

	mHeaderImage.setScaleType(ScaleType.MATRIX);
	mHeaderImageMatrix = new Matrix();
	mHeaderImage.setImageMatrix(mHeaderImageMatrix);

	mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setRepeatCount(Animation.INFINITE);
	mRotateAnimation.setRepeatMode(Animation.RESTART);
}
 
Example #21
Source File: ArcLayout.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
        long startOffset, long duration, Interpolator interpolator) {
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.setFillAfter(true);

    final long preDuration = duration / 2;
    Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setStartOffset(startOffset);
    rotateAnimation.setDuration(preDuration);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setFillAfter(true);

    animationSet.addAnimation(rotateAnimation);

    Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
    translateAnimation.setStartOffset(startOffset + preDuration);
    translateAnimation.setDuration(duration - preDuration);
    translateAnimation.setInterpolator(interpolator);
    translateAnimation.setFillAfter(true);

    animationSet.addAnimation(translateAnimation);

    return animationSet;
}
 
Example #22
Source File: NeteaseRefreshHeaderView.java    From CloudReader with Apache License 2.0 6 votes vote down vote up
private void initView(Context context) {
    LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, 0);
    mContainer = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.refresh_view_netease, null);
    addView(mContainer, lp);
    setGravity(Gravity.BOTTOM);

    mIvArrow = (ImageView) mContainer.findViewById(R.id.iv_arrow);
    mProgress = (ImageView) mContainer.findViewById(R.id.iv_progress);
    tvRefreshTip = (TextView) mContainer.findViewById(R.id.tv_refresh_tip);
    mAnimationDrawable = (AnimationDrawable) mProgress.getDrawable();
    measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    mMeasuredHeight = getMeasuredHeight();

    mRotateUpAnim = new RotateAnimation(0.0f, -180.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateUpAnim.setFillAfter(true);

    mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateDownAnim.setFillAfter(true);

    this.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
 
Example #23
Source File: XListViewHeader.java    From XERUNG with Apache License 2.0 6 votes vote down vote up
private void initView(Context context) {
    // 初始情况,设置下拉刷新view高度为0
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            LayoutParams.FILL_PARENT, 0);
    mContainer = (LinearLayout) LayoutInflater.from(context).inflate(
            R.layout.xlistview_header, null);
    addView(mContainer, lp);
    setGravity(Gravity.BOTTOM);

    mArrowImageView = (ImageView)findViewById(R.id.xlistview_header_arrow);
    mHintTextView = (TextView)findViewById(R.id.xlistview_header_hint_textview);
    mProgressBar = (ProgressBarCircularIndeterminate)findViewById(R.id.xlistview_header_progressbar);

    mRotateUpAnim = new RotateAnimation(0.0f, -180.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateUpAnim.setFillAfter(true);
    mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateDownAnim.setFillAfter(true);
}
 
Example #24
Source File: FlipLoadingLayout.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public FlipLoadingLayout(Context context, com.handmark.pulltorefresh.library.PullToRefreshBase.Mode mode, com.handmark.pulltorefresh.library.PullToRefreshBase.Orientation orientation, TypedArray typedarray)
{
    super(context, mode, orientation, typedarray);
    int i;
    if (mode == com.handmark.pulltorefresh.library.PullToRefreshBase.Mode.PULL_FROM_START)
    {
        i = -180;
    } else
    {
        i = 180;
    }
    d = new RotateAnimation(0.0F, i, 1, 0.5F, 1, 0.5F);
    d.setInterpolator(c);
    d.setDuration(150L);
    d.setFillAfter(true);
    e = new RotateAnimation(i, 0.0F, 1, 0.5F, 1, 0.5F);
    e.setInterpolator(c);
    e.setDuration(150L);
    e.setFillAfter(true);
}
 
Example #25
Source File: WelcomeActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
private AnimationSet startHideContinueIconAnimations() {
	Animation mScaleAnimation = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
	Animation mRotateAnimation = new RotateAnimation(
				0, 360,
				Animation.RELATIVE_TO_SELF, 0.5f,
				Animation.RELATIVE_TO_SELF, 0.5f
	);
	mRotateAnimation.setRepeatCount(0);

	AnimationSet mAnimations = new AnimationSet(true);
	mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
	mAnimations.setFillAfter(true);
	mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
	mAnimations.addAnimation(mScaleAnimation);
	mAnimations.addAnimation(mRotateAnimation);

	mContinueIcon.startAnimation(mAnimations);
	return mAnimations;
}
 
Example #26
Source File: DynamicRotationGuideView.java    From AndroidStudyDemo with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 右边的动画
 */
private void playRight() {
    //混合动画
    AnimationSet animationSet = new AnimationSet(false);
    RotateAnimation rotateRight = new RotateAnimation(0, 359, Animation.ABSOLUTE, screenW/2-right.getLeft(), Animation.ABSOLUTE, (right.getBottom()-right.getTop())/2);
    RotateAnimation rotateSelf = new RotateAnimation(0, -359, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    //播放时间
    rotateSelf.setDuration(10*1000);
    //播放加速的模式
    rotateSelf.setInterpolator(interpolator);
    //设置无限循环
    rotateSelf.setRepeatCount(-1);
    rotateRight.setDuration(10*1000);
    rotateRight.setRepeatCount(-1);
    rotateRight.setInterpolator(interpolator);
    animationSet.addAnimation(rotateSelf);
    animationSet.addAnimation(rotateRight);
    //播放混合动画
    right.startAnimation(animationSet);
}
 
Example #27
Source File: RotateLoadingLayout.java    From AndroidBase with Apache License 2.0 6 votes vote down vote up
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

	mHeaderImage.setScaleType(ScaleType.MATRIX);
	mHeaderImageMatrix = new Matrix();
	mHeaderImage.setImageMatrix(mHeaderImageMatrix);

	mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setRepeatCount(Animation.INFINITE);
	mRotateAnimation.setRepeatMode(Animation.RESTART);
}
 
Example #28
Source File: FlipLoadingLayout.java    From GifAssistant with Apache License 2.0 6 votes vote down vote up
public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
Example #29
Source File: AboutActivity.java    From AndroidPlusJava with GNU General Public License v3.0 6 votes vote down vote up
private void startAnimation() {
    AnimationSet animationSet = new AnimationSet(true);
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);

    ScaleAnimation scaleAnimation = new ScaleAnimation(1.5f, 1, 1.5f, 1,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f);

    AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);

    animationSet.addAnimation(rotateAnimation);
    animationSet.addAnimation(scaleAnimation);
    animationSet.addAnimation(alphaAnimation);
    animationSet.setDuration(2000);
    mAboutInfo.startAnimation(animationSet);
}
 
Example #30
Source File: AbsClassicRefreshView.java    From SmoothRefreshLayout with MIT License 5 votes vote down vote up
public AbsClassicRefreshView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mStyle = new me.dkzwm.widget.srl.extra.RefreshViewStyle(context, attrs, defStyleAttr, 0);
    mFlipAnimation =
            new RotateAnimation(
                    0,
                    -180,
                    RotateAnimation.RELATIVE_TO_SELF,
                    0.5f,
                    RotateAnimation.RELATIVE_TO_SELF,
                    0.5f);
    mFlipAnimation.setInterpolator(sLinearInterpolator);
    mFlipAnimation.setDuration(mRotateAniTime);
    mFlipAnimation.setFillAfter(true);

    mReverseFlipAnimation =
            new RotateAnimation(
                    -180,
                    0,
                    RotateAnimation.RELATIVE_TO_SELF,
                    0.5f,
                    RotateAnimation.RELATIVE_TO_SELF,
                    0.5f);
    mReverseFlipAnimation.setInterpolator(sLinearInterpolator);
    mReverseFlipAnimation.setDuration(mRotateAniTime);
    mReverseFlipAnimation.setFillAfter(true);
    createClassicViews();
    mArrowImageView = findViewById(R.id.sr_classic_arrow);
    mTitleTextView = findViewById(R.id.sr_classic_title);
    mLastUpdateTextView = findViewById(R.id.sr_classic_last_update);
    mProgressBar = findViewById(R.id.sr_classic_progress);
    mLastUpdateTimeUpdater = new LastUpdateTimeUpdater(this);
    mArrowImageView.clearAnimation();
    mArrowImageView.setVisibility(VISIBLE);
    mProgressBar.setVisibility(INVISIBLE);
}