Search in sources :

Example 56 with RotateAnimation

use of android.view.animation.RotateAnimation in project Android-Bootstrap by Bearded-Hen.

the class AwesomeTextView method startRotate.

/**
     * Starts a rotating animation on the AwesomeTextView
     *
     * @param clockwise true for clockwise, false for anti clockwise spinning
     * @param speed     how fast the item should rotate
     */
public void startRotate(boolean clockwise, AnimationSpeed speed) {
    Animation rotate;
    //set up the rotation animation
    if (clockwise) {
        rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    } else {
        rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    }
    //set up some extra variables
    rotate.setRepeatCount(Animation.INFINITE);
    rotate.setInterpolator(new LinearInterpolator());
    rotate.setStartOffset(0);
    rotate.setRepeatMode(Animation.RESTART);
    rotate.setDuration(speed.getRotateDuration());
    startAnimation(rotate);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) RotateAnimation(android.view.animation.RotateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation)

Example 57 with RotateAnimation

use of android.view.animation.RotateAnimation in project StyleableToast by Muddz.

the class StyleableToast method getAnimation.

private Animation getAnimation() {
    if (hasAnimation) {
        RotateAnimation anim = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        anim.setInterpolator(new LinearInterpolator());
        anim.setRepeatCount(Animation.INFINITE);
        anim.setDuration(1000);
        return anim;
    }
    return null;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator)

Example 58 with RotateAnimation

use of android.view.animation.RotateAnimation in project robolectric by robolectric.

the class ShadowAnimationSetTest method start_shouldRunAnimation.

@Test
@Ignore("Needs additional work")
public void start_shouldRunAnimation() {
    final AnimationSet set = new AnimationSet(true);
    final Animation move = new TranslateAnimation(0, 100, 0, 100);
    move.setDuration(1000);
    move.setAnimationListener(moveListener);
    final Animation spin = new RotateAnimation(0, 360);
    spin.setDuration(1000);
    spin.setStartOffset(1000);
    spin.setAnimationListener(spinListener);
    set.start();
    verify(moveListener).onAnimationStart(move);
    Robolectric.flushForegroundThreadScheduler();
    verify(moveListener).onAnimationEnd(move);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AnimationSet(android.view.animation.AnimationSet) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 59 with RotateAnimation

use of android.view.animation.RotateAnimation in project weex-example by KalicyZhou.

the class SplashActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    View textView = findViewById(R.id.fullscreen_content);
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    RotateAnimation rotateAnimation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(scaleAnimation);
    animationSet.addAnimation(rotateAnimation);
    animationSet.setDuration(1500);
    animationSet.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            startActivity(new Intent(SplashActivity.this, IndexActivity.class));
            finish();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    textView.startAnimation(animationSet);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) Intent(android.content.Intent) View(android.view.View) AnimationSet(android.view.animation.AnimationSet) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 60 with RotateAnimation

use of android.view.animation.RotateAnimation in project JustAndroid by chinaltz.

the class AbListViewHeader method initView.

/**
	 * 初始化View.
	 */
private void initView() {
    //顶部刷新栏整体内容
    headerView = new LinearLayout(context);
    headerView.setOrientation(LinearLayout.HORIZONTAL);
    headerView.setGravity(Gravity.CENTER);
    AbViewUtil.setPadding(headerView, 0, 10, 0, 10);
    //显示箭头与进度
    FrameLayout headImage = new FrameLayout(context);
    arrowImageView = new ImageView(context);
    //箭头图片
    arrowImageView.setImageResource(R.drawable.arrow);
    //style="?android:attr/progressBarStyleSmall" 默认的样式
    headerProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyle);
    headerProgressBar.setVisibility(View.GONE);
    LayoutParams layoutParamsWW = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    layoutParamsWW.gravity = Gravity.CENTER;
    layoutParamsWW.width = AbViewUtil.scaleValue(context, 50);
    layoutParamsWW.height = AbViewUtil.scaleValue(context, 50);
    headImage.addView(arrowImageView, layoutParamsWW);
    headImage.addView(headerProgressBar, layoutParamsWW);
    //顶部刷新栏文本内容
    LinearLayout headTextLayout = new LinearLayout(context);
    tipsTextview = new TextView(context);
    headerTimeView = new TextView(context);
    headTextLayout.setOrientation(LinearLayout.VERTICAL);
    headTextLayout.setGravity(Gravity.CENTER_VERTICAL);
    AbViewUtil.setPadding(headTextLayout, 0, 0, 0, 0);
    LayoutParams layoutParamsWW2 = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    headTextLayout.addView(tipsTextview, layoutParamsWW2);
    headTextLayout.addView(headerTimeView, layoutParamsWW2);
    tipsTextview.setTextColor(Color.rgb(107, 107, 107));
    headerTimeView.setTextColor(Color.rgb(107, 107, 107));
    AbViewUtil.setTextSize(tipsTextview, 30);
    AbViewUtil.setTextSize(headerTimeView, 27);
    LayoutParams layoutParamsWW3 = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    layoutParamsWW3.gravity = Gravity.CENTER;
    layoutParamsWW3.rightMargin = AbViewUtil.scaleValue(context, 10);
    LinearLayout headerLayout = new LinearLayout(context);
    headerLayout.setOrientation(LinearLayout.HORIZONTAL);
    headerLayout.setGravity(Gravity.CENTER);
    headerLayout.addView(headImage, layoutParamsWW3);
    headerLayout.addView(headTextLayout, layoutParamsWW3);
    LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.BOTTOM;
    //添加大布局
    headerView.addView(headerLayout, lp);
    this.addView(headerView, lp);
    //获取View的高度
    AbViewUtil.measureView(this);
    headerHeight = this.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);
    setState(STATE_NORMAL);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) FrameLayout(android.widget.FrameLayout) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout)

Aggregations

RotateAnimation (android.view.animation.RotateAnimation)63 LinearInterpolator (android.view.animation.LinearInterpolator)24 Animation (android.view.animation.Animation)15 AnimationSet (android.view.animation.AnimationSet)14 ScaleAnimation (android.view.animation.ScaleAnimation)12 AlphaAnimation (android.view.animation.AlphaAnimation)10 View (android.view.View)8 TranslateAnimation (android.view.animation.TranslateAnimation)6 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)5 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 LinearLayout (android.widget.LinearLayout)4 Paint (android.graphics.Paint)3 LayoutInflater (android.view.LayoutInflater)3 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)3 Context (android.content.Context)2 Intent (android.content.Intent)2 AbsListView (android.widget.AbsListView)2 ListView (android.widget.ListView)2 IOException (java.io.IOException)2