use of com.marshalchen.common.uimodule.nineoldandroids.animation.Animator in project UltimateAndroid by cymcsg.
the class DemoOfUiActivity method initShimmerTextView.
private void initShimmerTextView() {
main_content_frame.setVisibility(View.INVISIBLE);
shimmer = new Shimmer();
shimmer.setRepeatCount(0).setDuration(800).setStartDelay(300).setDirection(Shimmer.ANIMATION_DIRECTION_LTR).setAnimatorListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
main_content_frame.setVisibility(View.VISIBLE);
main_content_frame.startAnimation(AnimationUtils.loadAnimation(DemoOfUiActivity.this, R.anim.fade_ins));
favShimmerReaLayout.setVisibility(View.GONE);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
shimmer.start(favShimmerTextView);
}
use of com.marshalchen.common.uimodule.nineoldandroids.animation.Animator in project UltimateAndroid by cymcsg.
the class ContextualUndoAdapter method swipeView.
private void swipeView(final View view, final int dismissPosition) {
ObjectAnimator animator = ObjectAnimator.ofFloat(view, X, view.getMeasuredWidth());
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animator) {
onViewSwiped(((ContextualUndoView) view).getItemId(), dismissPosition);
}
});
animator.start();
}
use of com.marshalchen.common.uimodule.nineoldandroids.animation.Animator in project UltimateAndroid by cymcsg.
the class ContextualUndoListViewTouchListener method handleUpCancelEvent.
@SuppressWarnings("UnusedParameters")
private boolean handleUpCancelEvent(final View view, final MotionEvent motionEvent) {
mDisallowSwipe = false;
if (mVelocityTracker == null) {
return false;
}
float deltaX = motionEvent.getRawX() - mDownX;
mVelocityTracker.addMovement(motionEvent);
mVelocityTracker.computeCurrentVelocity(1000);
float velocityX = Math.abs(mVelocityTracker.getXVelocity());
float velocityY = Math.abs(mVelocityTracker.getYVelocity());
boolean dismiss = false;
boolean dismissRight = false;
final float absDeltaX = Math.abs(deltaX);
if (absDeltaX > mViewWidth / 2) {
dismiss = true;
dismissRight = deltaX > 0;
} else if (mMinFlingVelocity <= velocityX && velocityX <= mMaxFlingVelocity && velocityY < velocityX && absDeltaX > mSlop) {
dismiss = true;
dismissRight = mVelocityTracker.getXVelocity() > 0;
}
if (dismiss) {
// dismiss
final long itemId = ((ContextualUndoView) mDownView).getItemId();
// before animation ends
final int downPosition = mDownPosition;
animate(mDownView).translationX(dismissRight ? mViewWidth : -mViewWidth).alpha(0).setDuration(mAnimationTime).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
mCallback.onViewSwiped(itemId, downPosition);
}
});
} else {
// cancel
animate(mDownView).translationX(0).alpha(1).setDuration(mAnimationTime).setListener(null);
}
mVelocityTracker.recycle();
mVelocityTracker = null;
mDownX = 0;
mDownView = null;
mDownPosition = AdapterView.INVALID_POSITION;
mSwiping = false;
return false;
}
use of com.marshalchen.common.uimodule.nineoldandroids.animation.Animator in project UltimateAndroid by cymcsg.
the class AnimationAdapter method cancelExistingAnimation.
private void cancelExistingAnimation(final View convertView) {
int hashCode = convertView.hashCode();
Animator animator = mAnimators.get(hashCode);
if (animator != null) {
animator.end();
mAnimators.remove(hashCode);
}
}
use of com.marshalchen.common.uimodule.nineoldandroids.animation.Animator in project UltimateAndroid by cymcsg.
the class AnimationAdapter method animateView.
private void animateView(final ViewGroup parent, final View view) {
if (mAnimationStartMillis == -1) {
mAnimationStartMillis = System.currentTimeMillis();
}
ViewHelper.setAlpha(view, 0);
Animator[] childAnimators;
if (mDecoratedBaseAdapter instanceof AnimationAdapter) {
childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view);
} else {
childAnimators = new Animator[0];
}
Animator[] animators = getAnimators(parent, view);
Animator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1);
AnimatorSet set = new AnimatorSet();
set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator));
set.setStartDelay(calculateAnimationDelay());
set.setDuration(getAnimationDurationMillis());
set.start();
mAnimators.put(view.hashCode(), set);
}
Aggregations