Java Code Examples for android.view.animation.RotateAnimation#setRepeatCount()

The following examples show how to use android.view.animation.RotateAnimation#setRepeatCount() . 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: RotateLoadingLayout.java    From SweetMusicPlayer 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 2
Source File: RotateLoadingLayout.java    From PullToRefresh-PinnedSection-ListView with MIT License 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 3
Source File: RotateLoadingLayout.java    From BigApp_Discuz_Android 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 4
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 5
Source File: CircleProgressBar.java    From Android-Application-ZJB with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 6
Source File: LayersFragment.java    From android_gisapp with GNU General Public License v3.0 6 votes vote down vote up
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();
    }
}
 
Example 7
Source File: CommonViewAnimationActivity.java    From Android-Animation-Set with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 8
Source File: RotateLoadingLayout.java    From MagicHeaderViewPager with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 9
Source File: AnimationUtils.java    From AndroidStudyDemo with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: AnimationController.java    From FamilyChat with Apache License 2.0 5 votes vote down vote up
/**
 * 旋转
 * @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);
}
 
Example 11
Source File: SettingFragment.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 12
Source File: ViewLoading.java    From YCDialog with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 13
Source File: RefreshActionItem.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 14
Source File: PullRefreshFooter.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 15
Source File: EverydayFragment.java    From CloudReader with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 16
Source File: VideoPlayerActivity.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 17
Source File: AnimationUtils.java    From v9porn with MIT License 5 votes vote down vote up
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);
}
 
Example 18
Source File: CustomProgressDialog.java    From ETSMobile-Android2 with Apache License 2.0 5 votes vote down vote up
@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);
	
}
 
Example 19
Source File: ActivityEditTransaction.java    From fingen with Apache License 2.0 4 votes vote down vote up
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);
        }
    }
}
 
Example 20
Source File: MainActivity.java    From Android-Basics-Codes with Artistic License 2.0 4 votes vote down vote up
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);

}