use of com.nineoldandroids.animation.Animator in project PhotoNoter by yydcdut.
the class DetailActivity method initAnimationView.
@Override
public void initAnimationView() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(mCardView, "translationY", 0, mTranslateHeight));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mOverlayView.setVisibility(View.GONE);
mIsIgnoreClick = true;
}
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
mIsIgnoreClick = true;
}
});
animatorSet.setDuration(400);
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.start();
mAnimationHandler.postDelayed(mDownDelayRunnable, 350);
}
}, 500);
}
use of com.nineoldandroids.animation.Animator in project SuperRecyclerView by Malinskiy.
the class SwipeDismissRecyclerViewTouchListener method performDismiss.
private void performDismiss(final View dismissView, final int dismissPosition) {
// Animate the dismissed list item to zero-height and fire the dismiss callback when
// all dismissed list item animations have completed. This triggers layout on each animation
// frame; in the future we may want to do something smarter and more performant.
final ViewGroup.LayoutParams lp = dismissView.getLayoutParams();
final int originalHeight = dismissView.getHeight();
ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(mAnimationTime);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
--mDismissAnimationRefCount;
if (mDismissAnimationRefCount == 0) {
// No active animations, process all pending dismisses.
// Sort by descending position
Collections.sort(mPendingDismisses);
int[] dismissPositions = new int[mPendingDismisses.size()];
for (int i = mPendingDismisses.size() - 1; i >= 0; i--) {
dismissPositions[i] = mPendingDismisses.get(i).position;
}
mCallbacks.onDismiss(mRecyclerView, dismissPositions);
// Reset mDownPosition to avoid MotionEvent.ACTION_UP trying to start a dismiss
// animation with a stale position
mDownPosition = INVALID_POSITION;
ViewGroup.LayoutParams lp;
for (PendingDismissData pendingDismiss : mPendingDismisses) {
// Reset view presentation
setAlpha(pendingDismiss.view, 1f);
setTranslationX(pendingDismiss.view, 0);
lp = pendingDismiss.view.getLayoutParams();
lp.height = originalHeight;
pendingDismiss.view.setLayoutParams(lp);
}
// Send a cancel event
long time = SystemClock.uptimeMillis();
MotionEvent cancelEvent = MotionEvent.obtain(time, time, MotionEvent.ACTION_CANCEL, 0, 0, 0);
mRecyclerView.dispatchTouchEvent(cancelEvent);
mPendingDismisses.clear();
}
}
});
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
lp.height = (Integer) valueAnimator.getAnimatedValue();
dismissView.setLayoutParams(lp);
}
});
mPendingDismisses.add(new PendingDismissData(dismissPosition, dismissView));
animator.start();
}
use of com.nineoldandroids.animation.Animator in project android-shapeLoadingView by zzz40500.
the class LoadingView method stopLoading.
private void stopLoading() {
mStopped = true;
if (mUpAnimatorSet != null) {
if (mUpAnimatorSet.isRunning()) {
mUpAnimatorSet.cancel();
}
mUpAnimatorSet.removeAllListeners();
for (Animator animator : mUpAnimatorSet.getChildAnimations()) {
animator.removeAllListeners();
}
mUpAnimatorSet = null;
}
if (mDownAnimatorSet != null) {
if (mDownAnimatorSet.isRunning()) {
mDownAnimatorSet.cancel();
}
mDownAnimatorSet.removeAllListeners();
for (Animator animator : mDownAnimatorSet.getChildAnimations()) {
animator.removeAllListeners();
}
mDownAnimatorSet = null;
}
this.removeCallbacks(mFreeFallRunnable);
}
use of com.nineoldandroids.animation.Animator in project android-shapeLoadingView by zzz40500.
the class LoadingView method upThrow.
/**
* 上抛
*/
public void upThrow() {
if (mUpAnimatorSet == null) {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mShapeLoadingView, "translationY", mDistance, 0);
ObjectAnimator scaleIndication = ObjectAnimator.ofFloat(mIndicationIm, "scaleX", 1f, 0.2f);
ObjectAnimator objectAnimator1 = null;
switch(mShapeLoadingView.getShape()) {
case SHAPE_RECT:
objectAnimator1 = ObjectAnimator.ofFloat(mShapeLoadingView, "rotation", 0, 180);
break;
case SHAPE_CIRCLE:
objectAnimator1 = ObjectAnimator.ofFloat(mShapeLoadingView, "rotation", 0, 180);
break;
case SHAPE_TRIANGLE:
objectAnimator1 = ObjectAnimator.ofFloat(mShapeLoadingView, "rotation", 0, 180);
break;
}
mUpAnimatorSet = new AnimatorSet();
mUpAnimatorSet.playTogether(objectAnimator, objectAnimator1, scaleIndication);
mUpAnimatorSet.setDuration(ANIMATION_DURATION);
mUpAnimatorSet.setInterpolator(new DecelerateInterpolator(FACTOR));
mUpAnimatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (!mStopped) {
freeFall();
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
}
mUpAnimatorSet.start();
}
use of com.nineoldandroids.animation.Animator in project Signal-Android by signalapp.
the class TransferControlView method display.
private void display(@Nullable final View view) {
final int sourceWidth = current == downloadDetails ? expandedWidth : contractedWidth;
final int targetWidth = view == downloadDetails ? expandedWidth : contractedWidth;
if (current == view || current == null) {
ViewGroup.LayoutParams layoutParams = getLayoutParams();
layoutParams.width = targetWidth;
setLayoutParams(layoutParams);
} else {
ViewUtil.fadeOut(current, TRANSITION_MS);
Animator anim = getWidthAnimator(sourceWidth, targetWidth);
anim.start();
}
if (view == null) {
ViewUtil.fadeOut(this, TRANSITION_MS);
} else {
ViewUtil.fadeIn(this, TRANSITION_MS);
ViewUtil.fadeIn(view, TRANSITION_MS);
}
current = view;
}
Aggregations