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

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

源代码1 项目: SweetMusicPlayer   文件: 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 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);
}
 
源代码4 项目: android_gisapp   文件: LayersFragment.java
public void refresh(boolean start)
{
    if (mSyncButton == null) {
        return;
    }
    if (start) {
        RotateAnimation rotateAnimation = new RotateAnimation(
                0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        rotateAnimation.setFillAfter(true);
        rotateAnimation.setDuration(700);
        rotateAnimation.setRepeatCount(500);

        mSyncButton.startAnimation(rotateAnimation);
    } else {
        mSyncButton.clearAnimation();
    }
}
 
private void initView(Context context, AttributeSet attrs) {
    CircleProgressDrawable drawable = new CircleProgressDrawable();
    if (null != attrs) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleProgressBar, 0, 0);
        int arcColor = a.getColor(R.styleable.CircleProgressBar_color_arc, 0);
        int bgColor = a.getColor(R.styleable.CircleProgressBar_color_background, 0);
        float strokeWidth = a.getDimension(R.styleable.CircleProgressBar_stroke_width, 5.f);
        drawable.setStrokeWidth(strokeWidth);
        drawable.setArcColor(arcColor);
        drawable.setBackgroundColor(bgColor);
        a.recycle();
    }
    setImageDrawable(drawable);
    mAnimation = new RotateAnimation(0, 360, RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mAnimation.setDuration(800);
    mAnimation.setInterpolator(new LinearInterpolator());
    mAnimation.setRepeatCount(-1);
    mAnimation.setRepeatMode(RotateAnimation.RESTART);
    startAnimation(mAnimation);
}
 
源代码6 项目: AndroidBase   文件: 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);
}
 
源代码7 项目: star-zone-android   文件: PullRefreshFooter.java
private void initView(Context context) {
    View.inflate(context, R.layout.view_ptr_footer, this);
    loadingView = (ImageView) findViewById(R.id.iv_loading);
    rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setDuration(600);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setRepeatCount(Animation.INFINITE);
    setVisibility(GONE);
}
 
源代码8 项目: ETSMobile-Android2   文件: CustomProgressDialog.java
@Override
public void show() {
	super.show();
	
	RotateAnimation anim = new RotateAnimation(0.0f, 359.0f , Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
	anim.setInterpolator(new LinearInterpolator());
	anim.setRepeatCount(Animation.INFINITE);
	anim.setDuration(3000);
	
	rotatingImageView.setAnimation(anim);
	rotatingImageView.startAnimation(anim);
	
}
 
源代码9 项目: v9porn   文件: AnimationUtils.java
public static void rotateDown(View view) {
    RotateAnimation rotate = new RotateAnimation(180f, 0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    LinearInterpolator lin = new LinearInterpolator();
    rotate.setInterpolator(lin);
    rotate.setDuration(200);
    rotate.setRepeatCount(0);
    rotate.setFillAfter(true);
    rotate.setStartOffset(10);
    view.startAnimation(rotate);
}
 
源代码10 项目: VCL-Android   文件: VideoPlayerActivity.java
/**
 * Start the video loading animation.
 */
private void startLoading() {
    mIsLoading = true;
    mOverlayProgress.setVisibility(View.INVISIBLE);
    AnimationSet anim = new AnimationSet(true);
    RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(800);
    rotate.setInterpolator(new DecelerateInterpolator());
    rotate.setRepeatCount(RotateAnimation.INFINITE);
    anim.addAnimation(rotate);
    mLoading.startAnimation(anim);
}
 
源代码11 项目: CloudReader   文件: EverydayFragment.java
private void initAnimation() {
    bindingView.llLoading.setVisibility(View.VISIBLE);
    animation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(3000);//设置动画持续时间
    animation.setInterpolator(new LinearInterpolator());//不停顿
    animation.setRepeatMode(ValueAnimator.RESTART);//重新从头执行
    animation.setRepeatCount(ValueAnimator.INFINITE);//设置重复次数
    bindingView.ivLoading.setAnimation(animation);
    animation.startNow();
}
 
private Animation getRotateAnimation() {
    RotateAnimation rotateAnimation = new RotateAnimation(0f, 360f,
            getWidth() / 2, getHeight() / 2);
    rotateAnimation.setDuration(2000);
    rotateAnimation.setRepeatCount(1);
    rotateAnimation.setFillAfter(true);
    rotateAnimation.setFillBefore(false);
    rotateAnimation.setRepeatMode(Animation.REVERSE);
    return rotateAnimation;
}
 
源代码13 项目: iSCAU-Android   文件: RefreshActionItem.java
public void startProgress(){
    if (mRefreshButton.getAnimation() != null)
        return;
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF,
            0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setDuration(500);
    rotateAnimation.setFillAfter(false);
    rotateAnimation.setRepeatCount(-1);
    rotateAnimation.setRepeatMode(Animation.RESTART);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    mRefreshButton.startAnimation(rotateAnimation);
}
 
源代码14 项目: YCDialog   文件: ViewLoading.java
private ViewLoading(Context context , String content , boolean canNotCancel) {
    super(context, R.style.Loading);
    this.canNotCancel = canNotCancel;
    // 加载布局
    if(content!=null && content.length()>0){
        setContentView(R.layout.layout_dialog_loading);
        TextView message = findViewById(R.id.message);
        message.setText(content);
    }else {
        setContentView(R.layout.layout_dialog_loaded);
    }
    ImageView progressImageView = findViewById(R.id.iv_image);
    //创建旋转动画
    animation = new RotateAnimation(0f, 360f,
            Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(2000);
    //动画的重复次数
    animation.setRepeatCount(10);
    //设置为true,动画转化结束后被应用
    animation.setFillAfter(true);
    //开始动画
    progressImageView.startAnimation(animation);
    // 设置Dialog参数
    Window window = getWindow();
    if(window!=null){
        WindowManager.LayoutParams params = window.getAttributes();
        params.gravity = Gravity.CENTER;
        window.setAttributes(params);
    }
}
 
源代码15 项目: MiBandDecompiled   文件: SettingFragment.java
private void e()
{
    A = new RotateAnimation(-5F, 5F, 0, Utils.convertDpToPixel(16F, getActivity()), 0, Utils.convertDpToPixel(33F, getActivity()));
    A.setAnimationListener(new bR(this));
    A.setDuration(50L);
    A.setRepeatCount(20);
    A.setInterpolator(new AccelerateDecelerateInterpolator());
    A.setRepeatMode(2);
}
 
源代码16 项目: FamilyChat   文件: AnimationController.java
/**
 * 旋转
 * @param view
 * @param durationMillis
 * @param delayMillis
 */
public void viewRotateForver(View view, long durationMillis, long delayMillis)
{
	view.measure(0, 0);
	float x=view.getMeasuredHeight();
	float y=view.getMeasuredWidth();
	RotateAnimation animation=new RotateAnimation(0,359,x/2,y/2);
	animation.setFillAfter(true);
	animation.setRepeatCount(-1);
	animation.setDuration(1500);
	LinearInterpolator lin = new LinearInterpolator();  
	animation.setInterpolator(lin); 
	view.startAnimation(animation);
}
 
源代码17 项目: 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;
}
 
源代码18 项目: MagicHeaderViewPager   文件: RotateLoadingLayout.java
public RotateLoadingLayout(Context context, PullToRefreshBase.Mode mode, PullToRefreshBase.Orientation scrollDirection, TypedArray attrs, int layoutId) {
    super(context, mode, scrollDirection, attrs, layoutId);

    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);
}
 
源代码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 项目: fingen   文件: ActivityEditTransaction.java
private void loadProducts() {
    if (mFtsHelper.isFtsCredentialsAvailiable(this)) {
        final RotateAnimation spinAnim = new RotateAnimation(360, 0f,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);

        spinAnim.setInterpolator(new LinearInterpolator());
        spinAnim.setDuration(2000);
        spinAnim.setRepeatCount(Animation.INFINITE);
        mLayoutLoadingProducts.setVisibility(View.VISIBLE);
        mImageViewLoadingProducts.setVisibility(View.VISIBLE);
        mImageViewLoadingProducts.startAnimation(spinAnim);
        mTextViewLoadingProducts.setText(getString(R.string.ttl_loading_products));
        updateControlsState();
        IDownloadProductsListener downloadProductsListener = new IDownloadProductsListener() {
            @Override
            public void onDownload(List<ProductEntry> productEntries, String payeeName) {
                spinAnim.cancel();
                spinAnim.reset();
                mLayoutLoadingProducts.setVisibility(View.GONE);
                transaction.getProductEntries().clear();
                transaction.getProductEntries().addAll(productEntries);
                getIntent().removeExtra("load_products");
                fillProductList();
                if ((viewPager.getCurrentItem() == 0) && mPayeeName != null && mPayeeName.isEmpty()) {
                    setPayeeName(payeeName);
                }
                isErrorLoadingProducts = false;
            }

            @Override
            public void onAccepted() {
                initProductList();
            }

            @Override
            public void onFailure(String errorMessage, boolean tryAgain) {
                isErrorLoadingProducts = true;
                getIntent().removeExtra("load_products");
                spinAnim.cancel();
                spinAnim.reset();
                mImageViewLoadingProducts.setVisibility(View.GONE);
                mTextViewLoadingProducts.setText(errorMessage);
                updateControlsState();
            }
        };
        unsubscribeOnDestroy(mFtsHelper.downloadProductEntryList(transaction, downloadProductsListener));
    } else {
        mLayoutLoadingProducts.setVisibility(View.GONE);
        fillProductList();
        if (!mPreferences.getBoolean(FgConst.PREF_FTS_DO_NOT_SHOW_AGAIN, false)) {
            startActivityForResult(
                    new Intent(ActivityEditTransaction.this, ActivityFtsLogin.class),
                    RequestCodes.REQUEST_CODE_ENTER_FTS_LOGIN);
        }
    }
}