use of com.nineoldandroids.animation.ValueAnimator in project cw-omnibus by commonsguy.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
word = (TextView) findViewById(R.id.word);
ValueAnimator positionAnim = ObjectAnimator.ofInt(this, "wordPosition", 0, 24);
positionAnim.setDuration(12500);
positionAnim.setRepeatCount(ValueAnimator.INFINITE);
positionAnim.setRepeatMode(ValueAnimator.RESTART);
positionAnim.start();
}
use of com.nineoldandroids.animation.ValueAnimator in project cw-omnibus by commonsguy.
the class ViewPropertyAnimatorHC method startAnimation.
/**
* Starts the underlying Animator for a set of properties. We use a single animator that
* simply runs from 0 to 1, and then use that fractional value to set each property
* value accordingly.
*/
private void startAnimation() {
ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
ArrayList<NameValuesHolder> nameValueList = (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
mPendingAnimations.clear();
int propertyMask = 0;
int propertyCount = nameValueList.size();
for (int i = 0; i < propertyCount; ++i) {
NameValuesHolder nameValuesHolder = nameValueList.get(i);
propertyMask |= nameValuesHolder.mNameConstant;
}
mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
animator.addUpdateListener(mAnimatorEventListener);
animator.addListener(mAnimatorEventListener);
if (mStartDelaySet) {
animator.setStartDelay(mStartDelay);
}
if (mDurationSet) {
animator.setDuration(mDuration);
}
if (mInterpolatorSet) {
animator.setInterpolator(mInterpolator);
}
animator.start();
}
use of com.nineoldandroids.animation.ValueAnimator in project cw-omnibus by commonsguy.
the class ViewPropertyAnimatorPreHC method startAnimation.
/**
* Starts the underlying Animator for a set of properties. We use a single animator that
* simply runs from 0 to 1, and then use that fractional value to set each property
* value accordingly.
*/
private void startAnimation() {
ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
ArrayList<NameValuesHolder> nameValueList = (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
mPendingAnimations.clear();
int propertyMask = 0;
int propertyCount = nameValueList.size();
for (int i = 0; i < propertyCount; ++i) {
NameValuesHolder nameValuesHolder = nameValueList.get(i);
propertyMask |= nameValuesHolder.mNameConstant;
}
mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
animator.addUpdateListener(mAnimatorEventListener);
animator.addListener(mAnimatorEventListener);
if (mStartDelaySet) {
animator.setStartDelay(mStartDelay);
}
if (mDurationSet) {
animator.setDuration(mDuration);
}
if (mInterpolatorSet) {
animator.setInterpolator(mInterpolator);
}
animator.start();
}
use of com.nineoldandroids.animation.ValueAnimator in project Android-ObservableScrollView by ksoichiro.
the class ViewPagerTab2Activity method animateToolbar.
private void animateToolbar(final float toY) {
float layoutTranslationY = ViewHelper.getTranslationY(mInterceptionLayout);
if (layoutTranslationY != toY) {
ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mInterceptionLayout), toY).setDuration(200);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float translationY = (float) animation.getAnimatedValue();
ViewHelper.setTranslationY(mInterceptionLayout, translationY);
if (translationY < 0) {
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mInterceptionLayout.getLayoutParams();
lp.height = (int) (-translationY + getScreenHeight());
mInterceptionLayout.requestLayout();
}
}
});
animator.start();
}
}
use of com.nineoldandroids.animation.ValueAnimator in project Android-ObservableScrollView by ksoichiro.
the class SlidingUpBaseActivity method changeHeaderBarColorAnimated.
private void changeHeaderBarColorAnimated(boolean animated) {
if (mHeaderColorIsChanging) {
return;
}
boolean shouldBeWhite = getAnchorYBottom() == ViewHelper.getTranslationY(mInterceptionLayout);
if (!mHeaderIsAtBottom && !mHeaderColorChangedToBottom && shouldBeWhite) {
mHeaderIsAtBottom = true;
mHeaderIsNotAtBottom = false;
if (animated) {
ValueAnimator animator = ValueAnimator.ofFloat(0, 1).setDuration(100);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float alpha = (float) animation.getAnimatedValue();
mHeaderColorIsChanging = (alpha != 1);
changeHeaderBarColor(alpha);
}
});
animator.start();
} else {
changeHeaderBarColor(1);
}
} else if (!mHeaderIsNotAtBottom && !shouldBeWhite) {
mHeaderIsAtBottom = false;
mHeaderIsNotAtBottom = true;
if (animated) {
ValueAnimator animator = ValueAnimator.ofFloat(1, 0).setDuration(100);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float alpha = (float) animation.getAnimatedValue();
mHeaderColorIsChanging = (alpha != 0);
changeHeaderBarColor(alpha);
}
});
animator.start();
} else {
changeHeaderBarColor(0);
}
}
}
Aggregations