use of com.marshalchen.common.uimodule.nineoldandroids.animation.Animator in project UltimateAndroid by cymcsg.
the class AnimationAdapter method concatAnimators.
private Animator[] concatAnimators(final Animator[] childAnimators, final Animator[] animators, final Animator alphaAnimator) {
Animator[] allAnimators = new Animator[childAnimators.length + animators.length + 1];
int i;
for (i = 0; i < animators.length; ++i) {
allAnimators[i] = animators[i];
}
for (Animator childAnimator : childAnimators) {
allAnimators[i] = childAnimator;
++i;
}
allAnimators[allAnimators.length - 1] = alphaAnimator;
return allAnimators;
}
use of com.marshalchen.common.uimodule.nineoldandroids.animation.Animator in project UltimateAndroid by cymcsg.
the class PanningViewAttacher method animate.
private void animate(float start, float end, long duration) {
Log.d(TAG, "startPanning : " + start + " to " + end + ", in " + duration + "ms");
mCurrentAnimator = ValueAnimator.ofFloat(start, end);
mCurrentAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = (Float) animation.getAnimatedValue();
mMatrix.reset();
applyScaleOnMatrix();
if (mIsPortrait) {
mMatrix.postTranslate(value, 0);
} else {
mMatrix.postTranslate(0, value);
}
refreshDisplayRect();
mCurrentPlayTime = animation.getCurrentPlayTime();
setCurrentImageMatrix();
}
});
mCurrentAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
Log.d(TAG, "animation has finished, startPanning in the other way");
changeWay();
animate_();
}
@Override
public void onAnimationCancel(Animator animation) {
Log.d(TAG, "panning animation canceled");
}
});
mCurrentAnimator.setDuration(duration);
mCurrentAnimator.setInterpolator(mLinearInterpolator);
mCurrentAnimator.start();
}
use of com.marshalchen.common.uimodule.nineoldandroids.animation.Animator in project UltimateAndroid by cymcsg.
the class AnimateDismissAdapter method animateDismiss.
/**
* Animate dismissal of the items at given positions.
*/
public void animateDismiss(final Collection<Integer> positions) {
final List<Integer> positionsCopy = new ArrayList<Integer>(positions);
if (getAbsListView() == null) {
throw new IllegalStateException("Call setAbsListView() on this AnimateDismissAdapter before calling setAdapter()!");
}
List<View> views = getVisibleViewsForPositions(positionsCopy);
if (!views.isEmpty()) {
List<Animator> animators = new ArrayList<Animator>();
for (final View view : views) {
animators.add(createAnimatorForView(view));
}
AnimatorSet animatorSet = new AnimatorSet();
Animator[] animatorsArray = new Animator[animators.size()];
for (int i = 0; i < animatorsArray.length; i++) {
animatorsArray[i] = animators.get(i);
}
animatorSet.playTogether(animatorsArray);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animator) {
invokeCallback(positionsCopy);
}
});
animatorSet.start();
} else {
invokeCallback(positionsCopy);
}
}
use of com.marshalchen.common.uimodule.nineoldandroids.animation.Animator in project UltimateAndroid by cymcsg.
the class FilckerAnimationListView method doAnimation.
private void doAnimation() {
setEnabled(false);
animating = true;
final float durationUnit = (float) MAX_ANIM_DURATION / getHeight();
animatePreLayout(durationUnit, new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
adapter.notifyDataSetChanged();
getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
@Override
public boolean onPreDraw() {
getViewTreeObserver().removeOnPreDrawListener(this);
animatePostLayout(durationUnit);
return true;
}
});
}
});
}
Aggregations