android.view.animation.RotateAnimation#setRepeatMode()源码实例Demo

下面列出了android.view.animation.RotateAnimation#setRepeatMode() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

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);
}
 
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);
}
 
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);
}
 
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);
}
 
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);
}
 
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);
}
 
源代码7 项目: SwipeMenuAndRefresh   文件: RotateLoadingLayout.java
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);
}
 
public WindmillDrawable(Context context, View parent) {
    resources = context.getResources();
    windmill = BitmapFactory.decodeResource(resources, R.drawable.windmill);

    matrix = new Matrix();

    this.parent = parent;


    animation = new RotateAnimation(360, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(800);
    animation.setRepeatMode(Animation.RESTART);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setFillAfter(true);

}
 
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);
}
 
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);
}
 
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);
}
 
源代码12 项目: ONE-Unofficial   文件: RotateLoadingLayout.java
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);
}
 
源代码13 项目: zen4android   文件: RotateLoadingLayout.java
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);
}
 
源代码14 项目: iSCAU-Android   文件: RotateLoadingLayout.java
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);
}
 
源代码15 项目: RecyclerViewManager   文件: RotateLoadingLayout.java
@Override
protected void init() {
    View view = LayoutInflater.from(mContext).inflate(R.layout.loadinglayout, this, false);
    mRootView = (RelativeLayout) view.findViewById(R.id.fl_root);
    mRefreshText = (TextView) view.findViewById(R.id.tv_refresh);
    mRefreshTime = (TextView) view.findViewById(R.id.tv_refresh_time);
    mImage = (ImageView) view.findViewById(R.id.iv_image);

    layoutParams = (LayoutParams) mRootView.getLayoutParams();

    mRefreshing = mContext.getResources().getString(R.string.refreshing);
    mLoading = mContext.getResources().getString(R.string.loading);
    mComplete = mContext.getResources().getString(R.string.complete);
    mLastUpdateTime = getLastTime();
    if (!TextUtils.isEmpty(mLastUpdateTime)) {
        mRefreshTime.setText(mLastUpdateTime);
    }

    imageDrawable = mContext.getResources().getDrawable(R.mipmap.default_ptr_rotate);
    mImage.setScaleType(ImageView.ScaleType.MATRIX);
    mImageMatrix = new Matrix();
    mImage.setImageMatrix(mImageMatrix);

    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);


    addView(view);
}
 
源代码16 项目: Android-Basics-Codes   文件: MainActivity.java
public void rotate(View v){
//		RotateAnimation ra = new RotateAnimation(0, 360);
		
		ra = new RotateAnimation(0, 360, 
				Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
		
		ra.setDuration(2000);
		ra.setRepeatCount(1);
		ra.setRepeatMode(Animation.REVERSE);
		
		iv.startAnimation(ra);
	}
 
源代码17 项目: Pharmacy-Android   文件: OrdersAdapter.java
private void startHangingAnimation(ImageView imageView) {
    // Clear animation before starting another
    clearAnimation(imageView);

    RotateAnimation rotate = new RotateAnimation(-10, 50, Animation.RELATIVE_TO_SELF, 0.2f, Animation.RELATIVE_TO_SELF, 0f);
    rotate.setRepeatCount(Animation.INFINITE);
    rotate.setRepeatMode(Animation.REVERSE);
    rotate.setDuration(1500);
    imageView.setAnimation(rotate);
    rotate.start();

}
 
源代码18 项目: AndroidStudyDemo   文件: AnimationUtils.java
public static RotateAnimation initRotateAnimation(long duration,
        int fromAngle, int toAngle,
        boolean isFillAfter, int repeatCount) {
    RotateAnimation mLoadingRotateAnimation = new RotateAnimation(fromAngle, toAngle,
            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;
}
 
源代码19 项目: Android-Basics-Codes   文件: MainActivity.java
public void mahang (View view){
	AnimationSet set = new AnimationSet(false);
	
	TranslateAnimation tras = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2,
			Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2);
	// ������ʾʱ�䳤��
	tras.setDuration(2000);
	// �����ظ�����
	tras.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	tras.setRepeatMode(Animation.REVERSE);
	
	RotateAnimation rotate = new RotateAnimation(360, 0,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);

	// ������ʾʱ�䳤��
	rotate.setDuration(2000);
	// �����ظ�����
	rotate.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	rotate.setRepeatMode(Animation.REVERSE);

	
	
	ScaleAnimation scale = new ScaleAnimation(4f, 0.2f, 4f, 0.2f,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);

	// ������ʾʱ�䳤��
	scale.setDuration(2000);
	// �����ظ�����
	scale.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	scale.setRepeatMode(Animation.REVERSE);

	
	Animation alpha = new AlphaAnimation(1f, 0.1f);

	// ������ʾʱ�䳤��
	alpha.setDuration(2000);
	// �����ظ�����
	alpha.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	alpha.setRepeatMode(Animation.REVERSE);
	
	set.addAnimation(tras);
	set.addAnimation(alpha);
	set.addAnimation(rotate);
	set.addAnimation(scale);
	
	// ��ImageView�ϲ��Ŷ���
	iv.startAnimation(set);

}
 
源代码20 项目: Android-Basics-Codes   文件: MainActivity.java
public void mahang (View view){
	AnimationSet set = new AnimationSet(false);
	
	TranslateAnimation tras = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2,
			Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2);
	// ������ʾʱ�䳤��
	tras.setDuration(2000);
	// �����ظ�����
	tras.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	tras.setRepeatMode(Animation.REVERSE);
	
	RotateAnimation rotate = new RotateAnimation(360, 0,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);

	// ������ʾʱ�䳤��
	rotate.setDuration(2000);
	// �����ظ�����
	rotate.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	rotate.setRepeatMode(Animation.REVERSE);

	
	
	ScaleAnimation scale = new ScaleAnimation(4f, 0.2f, 4f, 0.2f,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);

	// ������ʾʱ�䳤��
	scale.setDuration(2000);
	// �����ظ�����
	scale.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	scale.setRepeatMode(Animation.REVERSE);

	
	Animation alpha = new AlphaAnimation(1f, 0.1f);

	// ������ʾʱ�䳤��
	alpha.setDuration(2000);
	// �����ظ�����
	alpha.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	alpha.setRepeatMode(Animation.REVERSE);
	
	set.addAnimation(tras);
	set.addAnimation(alpha);
	set.addAnimation(rotate);
	set.addAnimation(scale);
	
	// ��ImageView�ϲ��Ŷ���
	iv.startAnimation(set);

}