use of com.nineoldandroids.animation.ValueAnimator in project fresco by facebook.
the class AnimatedDrawableSupportTest method testValueAnimator.
@Test
public void testValueAnimator() {
ValueAnimator valueAnimator = mDrawable.createValueAnimator();
assertEquals(mBackend.getDurationMs(), valueAnimator.getDuration());
assertEquals(ValueAnimator.INFINITE, valueAnimator.getRepeatCount());
}
use of com.nineoldandroids.animation.ValueAnimator in project Android-ObservableScrollView by ksoichiro.
the class ToolbarControlBaseActivity method moveToolbar.
private void moveToolbar(float toTranslationY) {
if (ViewHelper.getTranslationY(mToolbar) == toTranslationY) {
return;
}
ValueAnimator animator = ValueAnimator.ofFloat(ViewHelper.getTranslationY(mToolbar), toTranslationY).setDuration(200);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float translationY = (float) animation.getAnimatedValue();
ViewHelper.setTranslationY(mToolbar, translationY);
ViewHelper.setTranslationY((View) mScrollable, translationY);
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) ((View) mScrollable).getLayoutParams();
lp.height = (int) -translationY + getScreenHeight() - lp.topMargin;
((View) mScrollable).requestLayout();
}
});
animator.start();
}
use of com.nineoldandroids.animation.ValueAnimator in project Android-ObservableScrollView by ksoichiro.
the class FillGap3BaseActivity method changeHeaderBackgroundHeightAnimated.
private void changeHeaderBackgroundHeightAnimated(boolean shouldShowGap, boolean animated) {
if (mGapIsChanging) {
return;
}
final int heightOnGapShown = mHeaderBar.getHeight();
final int heightOnGapHidden = mHeaderBar.getHeight() + mActionBarSize;
final float from = mHeaderBackground.getLayoutParams().height;
final float to;
if (shouldShowGap) {
if (!mGapHidden) {
// Already shown
return;
}
to = heightOnGapShown;
} else {
if (mGapHidden) {
// Already hidden
return;
}
to = heightOnGapHidden;
}
if (animated) {
ViewPropertyAnimator.animate(mHeaderBackground).cancel();
ValueAnimator a = ValueAnimator.ofFloat(from, to);
a.setDuration(100);
a.setInterpolator(new AccelerateDecelerateInterpolator());
a.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float height = (float) animation.getAnimatedValue();
changeHeaderBackgroundHeight(height, to, heightOnGapHidden);
}
});
a.start();
} else {
changeHeaderBackgroundHeight(to, to, heightOnGapHidden);
}
}
use of com.nineoldandroids.animation.ValueAnimator in project loadtoast by code-mc.
the class LoadToastView method done.
private void done() {
cmp = ValueAnimator.ofFloat(0, 1);
cmp.setDuration(600);
cmp.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
WIDTH_SCALE = 2f * (valueAnimator.getAnimatedFraction());
//Log.d("lt", "ws " + WIDTH_SCALE);
postInvalidate();
}
});
cmp.setInterpolator(new DecelerateInterpolator());
cmp.start();
}
use of com.nineoldandroids.animation.ValueAnimator in project UltimateAndroid by cymcsg.
the class DynamicListView method touchEventsEnded.
/**
* Resets all the appropriate fields to a default state while also animating
* the hover cell back to its correct location.
*/
private void touchEventsEnded() {
final View mobileView = getViewForId(mMobileItemId);
if (mCellIsMobile || mIsWaitingForScrollFinish) {
mCellIsMobile = false;
mIsWaitingForScrollFinish = false;
mIsMobileScrolling = false;
mActivePointerId = INVALID_POINTER_ID;
/* Restore the transcript mode */
setTranscriptMode(mOriginalTranscriptMode);
// should be animated to.
if (mScrollState != OnScrollListener.SCROLL_STATE_IDLE) {
mIsWaitingForScrollFinish = true;
return;
}
mHoverCellCurrentBounds.offsetTo(mHoverCellOriginalBounds.left, mobileView.getTop());
ObjectAnimator hoverViewAnimator = ObjectAnimator.ofObject(mHoverCell, "bounds", sBoundEvaluator, mHoverCellCurrentBounds);
hoverViewAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
invalidate();
}
});
hoverViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
setEnabled(false);
}
@Override
public void onAnimationEnd(Animator animation) {
mAboveItemId = INVALID_ID;
mMobileItemId = INVALID_ID;
mBelowItemId = INVALID_ID;
mobileView.setVisibility(VISIBLE);
mHoverCell = null;
setEnabled(true);
invalidate();
if (mOnItemMovedListener != null) {
mOnItemMovedListener.onItemMoved(mLastMovedToIndex - getHeaderViewsCount());
}
}
});
hoverViewAnimator.start();
} else {
touchEventsCancelled();
}
}
Aggregations