Search in sources :

Example 16 with RotateAnimation

use of android.view.animation.RotateAnimation in project MVPFrames by RockyQu.

the class AnimationUtils method getRotateAnimation.

/**
 * 获取一个旋转动画
 *
 * @param fromDegrees       开始角度
 * @param toDegrees         结束角度
 * @param pivotXType        旋转中心点X轴坐标相对类型
 * @param pivotXValue       旋转中心点X轴坐标
 * @param pivotYType        旋转中心点Y轴坐标相对类型
 * @param pivotYValue       旋转中心点Y轴坐标
 * @param durationMillis    持续时间
 * @param animationListener 动画监听器
 * @return 一个旋转动画
 */
public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue, long durationMillis, AnimationListener animationListener) {
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
    rotateAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        rotateAnimation.setAnimationListener(animationListener);
    }
    return rotateAnimation;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation)

Example 17 with RotateAnimation

use of android.view.animation.RotateAnimation in project summer-android by cn-cerc.

the class FrmScanProduct method onGetText.

@Override
public void onGetText(View view, Record item, int position) {
    TextView lblBarcode = (TextView) view.findViewById(R.id.lblBarcode);
    String desc = !"".equals(item.getString("descSpec")) ? item.getString("descSpec") : item.getString("barcode");
    lblBarcode.setText(desc);
    lblBarcode.setOnClickListener(this);
    lblBarcode.setTag(position);
    TextView lblSpare = (TextView) view.findViewById(R.id.lblSpare);
    lblSpare.setText(item.getBoolean("isSpare") ? "赠" : "");
    TextView lblNum = (TextView) view.findViewById(R.id.lblNum);
    lblNum.setText("" + item.getInt("num"));
    lblNum.setOnClickListener(this);
    lblNum.setTag(position);
    ImageView imgView = (ImageView) view.findViewById(R.id.imgView);
    switch(item.getInt("state")) {
        case 0:
            imgView.setImageResource(R.mipmap.reload);
            // 设置动画效果
            RotateAnimation animation = new RotateAnimation(0f, -360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
            // 设置动画持续时间
            animation.setDuration(3000);
            // 设定无限循环
            animation.setRepeatCount(Animation.INFINITE);
            // 设定重复模式
            animation.setRepeatMode(Animation.RESTART);
            imgView.setOnClickListener(this);
            imgView.setTag(position);
            imgView.startAnimation(animation);
            imgView.setBackgroundColor(Color.WHITE);
            animation.startNow();
            break;
        case 1:
            imgView.clearAnimation();
            imgView.setImageResource(R.mipmap.refresh_succeed);
            imgView.setBackgroundColor(Color.BLUE);
            break;
        default:
            imgView.clearAnimation();
            imgView.setImageResource(R.mipmap.refresh_failed);
            imgView.setBackgroundColor(Color.RED);
            break;
    }
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 18 with RotateAnimation

use of android.view.animation.RotateAnimation in project BaseProject by wareine.

the class JxbRefreshHeader method initView.

private void initView(Context context) {
    this.setGravity(Gravity.CENTER);
    this.setOrientation(LinearLayout.VERTICAL);
    mHeaderText = new TextView(context);
    mHeaderText.setText(REFRESH_HEADER_PULLDOWN);
    mHeaderText.setTextColor(0xff8b8b8b);
    mHeaderText.setTextSize(13);
    LayoutParams lpProgress = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    mProgressView = new ImageView(context);
    mProgressView.setImageResource(R.drawable.default_ptr_rotate);
    addView(mProgressView, lpProgress);
    LayoutParams lpHeaderText = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    lpHeaderText.topMargin = DensityUtil.dp2px(5);
    addView(mHeaderText, lpHeaderText);
    setPadding(0, DensityUtil.dp2px(10), 0, DensityUtil.dp2px(18));
    setMinimumHeight(DensityUtil.dp2px(60));
    mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 19 with RotateAnimation

use of android.view.animation.RotateAnimation in project vlc-android by GeoffreyMetais.

the class VideoPlayerActivity method startLoading.

/**
 * Start the video loading animation.
 */
private void startLoading() {
    if (mIsLoading)
        return;
    mIsLoading = true;
    final AnimationSet anim = new AnimationSet(true);
    final 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.setVisibility(View.VISIBLE);
    mLoading.startAnimation(anim);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) RotateAnimation(android.view.animation.RotateAnimation) AnimationSet(android.view.animation.AnimationSet)

Example 20 with RotateAnimation

use of android.view.animation.RotateAnimation in project remusic by aa112901.

the class AddDownTask method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
    // 设置无标题
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
    if (getArguments() != null) {
        ids = getArguments().getStringArray("ids");
        names = getArguments().getStringArray("names");
    }
    if (getContext() != null) {
        mContext = getContext();
    }
    final LoadDownInfos loadDownInfos = new LoadDownInfos();
    loadDownInfos.execute();
    View view = inflater.inflate(R.layout.loading_dialog_fragment, container);
    SimpleDraweeView draweeView = (SimpleDraweeView) view.findViewById(R.id.loding_circle);
    RotateAnimation animation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(5000);
    draweeView.setAnimation(animation);
    animation.start();
    isLoding = "loding";
    HandlerUtil.getInstance(mContext).postDelayed(new Runnable() {

        @Override
        public void run() {
            if (isLoding != null) {
                loadDownInfos.cancel(true);
                dismiss();
            }
        }
    }, 10000);
    return view;
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) RotateAnimation(android.view.animation.RotateAnimation) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View)

Aggregations

RotateAnimation (android.view.animation.RotateAnimation)111 LinearInterpolator (android.view.animation.LinearInterpolator)38 Animation (android.view.animation.Animation)27 AnimationSet (android.view.animation.AnimationSet)24 ScaleAnimation (android.view.animation.ScaleAnimation)17 ImageView (android.widget.ImageView)15 View (android.view.View)14 TextView (android.widget.TextView)14 AlphaAnimation (android.view.animation.AlphaAnimation)13 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)12 TranslateAnimation (android.view.animation.TranslateAnimation)9 Context (android.content.Context)5 LinearLayout (android.widget.LinearLayout)5 Intent (android.content.Intent)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 IOException (java.io.IOException)4 Paint (android.graphics.Paint)3 Drawable (android.graphics.drawable.Drawable)3 RecyclerView (android.support.v7.widget.RecyclerView)3 AttributeSet (android.util.AttributeSet)3