android.support.v4.view.ViewPropertyAnimatorCompat Java Examples
The following examples show how to use
android.support.v4.view.ViewPropertyAnimatorCompat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MaterialRefreshLayout.java From styT with Apache License 2.0 | 6 votes |
public void finishRefreshing() { if (mChildView != null) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView); viewPropertyAnimatorCompat.setDuration(200); viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView)); viewPropertyAnimatorCompat.translationY(0); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.start(); if (mMaterialHeaderView != null) { mMaterialHeaderView.onComlete(MaterialRefreshLayout.this); } else if (mSunLayout != null) { mSunLayout.onComlete(MaterialRefreshLayout.this); } if (refreshListener != null) { refreshListener.onfinish(); } } isRefreshing = false; progressValue = 0; }
Example #2
Source File: MaterialRefreshLayout.java From BitkyShop with MIT License | 6 votes |
public void finishRefreshing() { if (mChildView != null) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView); viewPropertyAnimatorCompat.setDuration(200); viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView)); viewPropertyAnimatorCompat.translationY(0); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.start(); if (mMaterialHeaderView != null) { mMaterialHeaderView.onComlete(MaterialRefreshLayout.this); } else if (mSunLayout != null) { mSunLayout.onComlete(MaterialRefreshLayout.this); } if (refreshListener != null) { refreshListener.onfinish(); } } isRefreshing = false; progressValue = 0; }
Example #3
Source File: AnimateOnSubscribe.java From RxAnimations with Apache License 2.0 | 6 votes |
@Override public void call(final CompletableSubscriber completableSubscriber) { final View view = viewWeakRef.get(); if (view == null) { completableSubscriber.onCompleted(); return; } final ViewPropertyAnimatorCompat animator = ViewCompat.animate(view); completableSubscriber.onSubscribe(createClearSubscription(animator)); if (preTransformActions != null) { applyActions(preTransformActions, animator); animator.setDuration(NONE).setStartDelay(NONE) .withEndAction(() -> runAnimation(completableSubscriber, animator)) .start(); } else { runAnimation(completableSubscriber, animator); } }
Example #4
Source File: MaterialRefreshLayout.java From MousePaint with MIT License | 6 votes |
public void finishRefreshing() { if (mChildView != null) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView); viewPropertyAnimatorCompat.setDuration(200); viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView)); viewPropertyAnimatorCompat.translationY(0); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.start(); if (materialHeadView != null) { materialHeadView.onComlete(MaterialRefreshLayout.this); } if (refreshListener != null) { refreshListener.onfinish(); } } isRefreshing = false; progressValue = 0; setProgressValue(0); }
Example #5
Source File: MaterialRefreshLayout.java From SprintNBA with Apache License 2.0 | 6 votes |
public void finishRefreshing() { if (mChildView != null) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView); viewPropertyAnimatorCompat.setDuration(200); viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView)); viewPropertyAnimatorCompat.translationY(0); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.start(); if (mMaterialHeaderView != null) { mMaterialHeaderView.onComplete(MaterialRefreshLayout.this); } else if (mSunLayout != null) { mSunLayout.onComplete(MaterialRefreshLayout.this); } if (refreshListener != null) { refreshListener.onfinish(); } } isRefreshing = false; progressValue = 0; }
Example #6
Source File: PendingItemAnimator.java From RecyclerViewLib with Apache License 2.0 | 6 votes |
/** Preform your animation. You do not need to override this in most cases cause the default is pretty good. * Listeners will be overridden **/ protected ViewPropertyAnimatorCompat animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) { final View view = holder.itemView; final int deltaX = toX - fromX; final int deltaY = toY - fromY; ViewCompat.animate(view).cancel(); if (deltaX != 0) { ViewCompat.animate(view).translationX(0); } if (deltaY != 0) { ViewCompat.animate(view).translationY(0); } // TODO: make EndActions end listeners instead, since end actions aren't called when // vpas are canceled (and can't end them. why?) // need listener functionality in VPACompat for this. Ick. return ViewCompat.animate(view).setInterpolator(null).setDuration(getMoveDuration()); }
Example #7
Source File: FromTopItemAnimator.java From RecyclerViewLib with Apache License 2.0 | 5 votes |
@Override protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) { Point screen = DisplayUtils.getScreenDimensions(holder.itemView.getContext()); int top = holder.itemView.getTop(); return ViewCompat.animate(holder.itemView) .rotation(80) .translationY(screen.y - top) .setInterpolator(new AccelerateInterpolator()); }
Example #8
Source File: SlideItemAnimator.java From RecyclerViewLib with Apache License 2.0 | 5 votes |
protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) { final View view = holder.itemView; ViewCompat.animate(view).cancel(); return ViewCompat.animate(view) .translationX(DisplayUtils.getScreenDimensions(holder.itemView.getContext()).x) .setInterpolator(new AnticipateOvershootInterpolator()); }
Example #9
Source File: AnimateOnSubscribe.java From RxAnimations with Apache License 2.0 | 5 votes |
public AnimateOnSubscribe(final WeakReference<View> viewWeakRef, @Nullable final List<Action1<ViewPropertyAnimatorCompat>> preAnimationActions, final List<Action1<ViewPropertyAnimatorCompat>> animationActions, final Action1<View> onAnimationCancelAction) { this.viewWeakRef = viewWeakRef; this.preTransformActions = preAnimationActions; this.animationActions = animationActions; this.onAnimationCancelAction = onAnimationCancelAction; }
Example #10
Source File: BadgeItem.java From JD-Test with Apache License 2.0 | 5 votes |
/** * @param animate whether to animate the change * @return this, to allow builder pattern */ public BadgeItem show(boolean animate) { mIsHidden = false; if (isWeakReferenceValid()) { TextView textView = mTextViewRef.get(); if (animate) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { textView.setScaleX(0); textView.setScaleY(0); } textView.setVisibility(View.VISIBLE); ViewPropertyAnimatorCompat animatorCompat = ViewCompat.animate(textView); animatorCompat.cancel(); animatorCompat.setDuration(mAnimationDuration); animatorCompat.scaleX(1).scaleY(1); animatorCompat.setListener(null); animatorCompat.start(); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { textView.setScaleX(1); textView.setScaleY(1); } textView.setVisibility(View.VISIBLE); } } return this; }
Example #11
Source File: MaterialRefreshLayout.java From styT with Apache License 2.0 | 5 votes |
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v); viewPropertyAnimatorCompat.setDuration(250); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.translationY(h); viewPropertyAnimatorCompat.start(); viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() { @Override public void onAnimationUpdate(View view) { float height = ViewCompat.getTranslationY(v); fl.getLayoutParams().height = (int) height; fl.requestLayout(); } }); }
Example #12
Source File: SlideInUpDelayedAnimator.java From onboarding-examples-android with Apache License 2.0 | 5 votes |
@Override protected ViewPropertyAnimatorCompat onAnimatedAdd(RecyclerView.ViewHolder holder) { return ViewCompat.animate(holder.itemView) .translationY(0) .setInterpolator(mInterpolator) .setStartDelay(offsetDelay*holder.getLayoutPosition()); }
Example #13
Source File: OnboardingWithCenterAnimationActivity.java From onboarding-examples-android with Apache License 2.0 | 5 votes |
private void animate() { ImageView logoImageView = (ImageView) findViewById(R.id.img_logo); ViewGroup container = (ViewGroup) findViewById(R.id.container); ViewCompat.animate(logoImageView) .translationY(-250) .setStartDelay(STARTUP_DELAY) .setDuration(ANIM_ITEM_DURATION).setInterpolator( new DecelerateInterpolator(1.2f)).start(); for (int i = 0; i < container.getChildCount(); i++) { View v = container.getChildAt(i); ViewPropertyAnimatorCompat viewAnimator; if (!(v instanceof Button)) { viewAnimator = ViewCompat.animate(v) .translationY(50).alpha(1) .setStartDelay((ITEM_DELAY * i) + 500) .setDuration(1000); } else { viewAnimator = ViewCompat.animate(v) .scaleY(1).scaleX(1) .setStartDelay((ITEM_DELAY * i) + 500) .setDuration(500); } viewAnimator.setInterpolator(new DecelerateInterpolator()).start(); } }
Example #14
Source File: BottomBarTab.java From BottomBar with Apache License 2.0 | 5 votes |
private void animateTitle(int padding, float scale, float alpha) { if (type == Type.TABLET && isTitleless) { return; } setTopPaddingAnimated(iconView.getPaddingTop(), padding); ViewPropertyAnimatorCompat titleAnimator = ViewCompat.animate(titleView) .setDuration(ANIMATION_DURATION) .scaleX(scale) .scaleY(scale); titleAnimator.alpha(alpha); titleAnimator.start(); }
Example #15
Source File: MainActivity.java From FloatingSearchView with Apache License 2.0 | 5 votes |
@Override protected ViewPropertyAnimatorCompat onAnimateAdd(RecyclerView.ViewHolder holder) { if(!mSearchView.isActivated()) return null; return ViewCompat.animate(holder.itemView) .translationY(0) .alpha(1) .setStartDelay((getAddDuration() / 2) * holder.getLayoutPosition()) .setInterpolator(INTERPOLATOR_ADD); }
Example #16
Source File: MainActivity.java From FloatingSearchView with Apache License 2.0 | 5 votes |
@Override protected ViewPropertyAnimatorCompat onAnimateRemove(RecyclerView.ViewHolder holder) { return ViewCompat.animate(holder.itemView) .alpha(0) .setStartDelay(0) .setInterpolator(INTERPOLATOR_REMOVE); }
Example #17
Source File: MaterialRefreshLayout.java From SprintNBA with Apache License 2.0 | 5 votes |
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v); viewPropertyAnimatorCompat.setDuration(250); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.translationY(h); viewPropertyAnimatorCompat.start(); viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() { @Override public void onAnimationUpdate(View view) { float height = ViewCompat.getTranslationY(v); fl.getLayoutParams().height = (int) height; fl.requestLayout(); } }); }
Example #18
Source File: AnimateOnSubscribe.java From RxAnimations with Apache License 2.0 | 5 votes |
private Subscription createClearSubscription(final ViewPropertyAnimatorCompat animator) { return new ClearSubscription(() -> { animator.setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationCancel(final View view) { onAnimationCancelAction.call(view); } }); animator.cancel(); animator.setListener(null); }); }
Example #19
Source File: MaterialRefreshLayout.java From BitkyShop with MIT License | 5 votes |
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v); viewPropertyAnimatorCompat.setDuration(250); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.translationY(h); viewPropertyAnimatorCompat.start(); viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() { @Override public void onAnimationUpdate(View view) { float height = ViewCompat.getTranslationY(v); fl.getLayoutParams().height = (int) height; fl.requestLayout(); } }); }
Example #20
Source File: MaterialRefreshLayout.java From MousePaint with MIT License | 5 votes |
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v); viewPropertyAnimatorCompat.setDuration(200); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.translationY(h); viewPropertyAnimatorCompat.start(); viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() { @Override public void onAnimationUpdate(View view) { float height = ViewCompat.getTranslationY(v); fl.getLayoutParams().height = (int) height; fl.requestLayout(); } }); }
Example #21
Source File: FlipDownItemAnimator.java From RecyclerViewLib with Apache License 2.0 | 5 votes |
@Override protected ViewPropertyAnimatorCompat animateAddImpl(ViewHolder holder) { return ViewCompat.animate(holder.itemView) .rotationY(0) .translationX(0) .setInterpolator(new BounceInterpolator()); }
Example #22
Source File: FlipDownItemAnimator.java From RecyclerViewLib with Apache License 2.0 | 5 votes |
@Override protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) { return ViewCompat.animate(holder.itemView) .rotationY(90) .translationX( - (holder.itemView.getMeasuredWidth() / 4)) .scaleX(0.5F) .scaleY(0.5F) .setInterpolator(new AccelerateInterpolator()); }
Example #23
Source File: MainActivity.java From FloatingSearchView with Apache License 2.0 | 5 votes |
@Override protected ViewPropertyAnimatorCompat onAnimateAdd(RecyclerView.ViewHolder holder) { if(!mSearchView.isActivated()) return null; return ViewCompat.animate(holder.itemView) .translationY(0) .alpha(1) .setStartDelay((getAddDuration() / 2) * holder.getLayoutPosition()) .setInterpolator(INTERPOLATOR_ADD); }
Example #24
Source File: MainActivity.java From FloatingSearchView with Apache License 2.0 | 5 votes |
@Override protected ViewPropertyAnimatorCompat onAnimateRemove(RecyclerView.ViewHolder holder) { return ViewCompat.animate(holder.itemView) .alpha(0) .setStartDelay(0) .setInterpolator(INTERPOLATOR_REMOVE); }
Example #25
Source File: Anims.java From MultiView with Apache License 2.0 | 5 votes |
public static ViewPropertyAnimatorCompat defaultChangeOldViewAnim( View view, final BaseItemAnimator.ChangeInfo changeInfo) { return ViewCompat.animate(view) .translationX(changeInfo.toX - changeInfo.fromX) .translationY(changeInfo.toY - changeInfo.fromY) .alpha(0); }
Example #26
Source File: Anims.java From MultiView with Apache License 2.0 | 5 votes |
public static ViewPropertyAnimatorCompat defaultChangeNewViewAnim( View view, final BaseItemAnimator.ChangeInfo changeInfo) { return ViewCompat.animate(view) .translationX(0) .translationY(0) .alpha(1); }
Example #27
Source File: Anims.java From MultiView with Apache License 2.0 | 5 votes |
public static ViewPropertyAnimatorCompat teleportChangeOldViewAnim( View view, final BaseItemAnimator.ChangeInfo changeInfo) { return ViewCompat.animate(view) .scaleX(0) .scaleY(0) .alpha(0); }
Example #28
Source File: Anims.java From MultiView with Apache License 2.0 | 5 votes |
public static ViewPropertyAnimatorCompat teleportChangeNewViewAnim( View view, final BaseItemAnimator.ChangeInfo changeInfo) { return ViewCompat.animate(view) .scaleX(1) .scaleY(1) .alpha(1); }
Example #29
Source File: Anims.java From MultiView with Apache License 2.0 | 5 votes |
public static ViewPropertyAnimatorCompat flipDownOut(final View view) { return ViewCompat.animate(view) .rotationY(90) .translationX(-(view.getMeasuredWidth() / 4)) .scaleX(0.5F) .scaleY(0.5F) .setInterpolator(new AccelerateInterpolator()); }
Example #30
Source File: Anims.java From MultiView with Apache License 2.0 | 5 votes |
public static ViewPropertyAnimatorCompat flipDownIn(final View view) { return ViewCompat.animate(view).withStartAction( new Runnable() { @Override public void run() { ViewCompat.setTranslationX(view, -(view.getMeasuredWidth() / 2)); ViewCompat.setRotationY(view, -90); } }) .rotationY(0) .translationX(0) .setInterpolator(new BounceInterpolator()); }