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