com.nineoldandroids.animation.AnimatorSet Java Examples

The following examples show how to use com.nineoldandroids.animation.AnimatorSet. 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: AnimationAdapter.java    From HPlayer with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: FlatButton.java    From MaterialButton with MIT License 6 votes vote down vote up
protected void init() {
	bgPaint = new Paint();
	bgPaint.setAntiAlias(true);
	bgPaint.setColor(backgroundColor);

	focusPaint = new Paint();
	focusPaint.setAntiAlias(true);
	focusPaint.setColor(focusColor);

	animatorSet = new AnimatorSet();

	bgRectF = new RectF();

       mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);

       this.setBackgroundResource(0);
}
 
Example #3
Source File: AnimationAdapter.java    From ALLGO with Apache License 2.0 6 votes vote down vote up
private void animateView(int position, ViewGroup parent, 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);
}
 
Example #4
Source File: MyRapidFloatingActionContentLabelList.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
public void onCollapseAnimator(AnimatorSet animatorSet) {
    int count = this.contentView.getChildCount();

    for(int i = 0; i < count; ++i) {
        View rootView = this.contentView.getChildAt(i);
        ImageView iconIv = (ImageView)ABViewUtil.obtainView(rootView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_icon_iv);
        if(null == iconIv) {
            return;
        }

        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(new float[]{0.0F, 45.0F});
        animator.setPropertyName("rotation");
        animator.setInterpolator(this.mOvershootInterpolator);
        //animator.setStartDelay((long)(count * i * 20));
        animatorSet.playTogether(new Animator[]{animator});
    }

}
 
Example #5
Source File: MyRapidFloatingActionContentLabelList.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
public void onExpandAnimator(AnimatorSet animatorSet) {
    int count = this.contentView.getChildCount();

    for(int i = 0; i < count; ++i) {
        View rootView = this.contentView.getChildAt(i);
        ImageView iconIv = (ImageView)ABViewUtil.obtainView(rootView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_icon_iv);
        if(null == iconIv) {
            return;
        }

        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(new float[]{45.0F, 0.0F});
        animator.setPropertyName("rotation");
        animator.setInterpolator(this.mOvershootInterpolator);
        //animator.setStartDelay((long)(count * i * 20));
        animatorSet.playTogether(new Animator[]{animator});
    }

}
 
Example #6
Source File: ResideMenu.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * show the reside menu;
 */
public void openMenu(int direction) {

	setScaleDirection(direction);

	isOpened = true;
	AnimatorSet scaleDown_activity = buildScaleDownAnimation(viewActivity,
			mScaleValue, mScaleValue);
	AnimatorSet scaleDown_shadow = buildScaleDownAnimation(imageViewShadow,
			mScaleValue + shadowAdjustScaleX, mScaleValue
					+ shadowAdjustScaleY);
	// AnimatorSet scaleDown_activity =
	// buildMoveRightAnimation(viewActivity,
	// getScreenWidth()*(mScaleValue + shadowAdjustScaleX));
	// AnimatorSet scaleDown_shadow =
	// buildMoveRightAnimation(imageViewShadow,
	// getScreenWidth()*(mScaleValue + shadowAdjustScaleX));
	AnimatorSet alpha_menu = buildMenuAnimation(scrollViewMenu, 1.0f);
	scaleDown_shadow.addListener(animationListener);
	scaleDown_activity.playTogether(scaleDown_shadow);
	scaleDown_activity.playTogether(alpha_menu);
	scaleDown_activity.start();
}
 
Example #7
Source File: ResideMenu.java    From GifAssistant with Apache License 2.0 6 votes vote down vote up
/**
 * show the reside menu;
 */
public void openMenu(int direction){
    if (isInDisableDirection(direction))
        throw new IllegalArgumentException("You have set this direction disable, " +
                "but now you want to open menu in this direction.");
    setScaleDirection(direction);

    isOpened = true;
    AnimatorSet scaleDown_activity = buildScaleDownAnimation(viewActivity, 0.5f, 0.5f);
    AnimatorSet scaleDown_shadow = buildScaleDownAnimation(imageViewShadow,
            0.5f + shadowAdjustScaleX, 0.5f + shadowAdjustScaleY);
    AnimatorSet alpha_menu = buildMenuAnimation(scrollViewMenu, 1.0f);
    scaleDown_shadow.addListener(animationListener);
    scaleDown_activity.playTogether(scaleDown_shadow);
    scaleDown_activity.playTogether(alpha_menu);
    scaleDown_activity.start();
}
 
Example #8
Source File: FragmentAnimationActivity.java    From Android-Anim-Playground with MIT License 6 votes vote down vote up
private void slideInToTop(View editContainer, View movableView, View v)
{
    Log.d(TAG, "container view height :" + String.valueOf(v.getHeight()));

    ObjectAnimator anim = ObjectAnimator.ofFloat(v, "translationY", mMainContainer.getHeight());
    anim.setDuration(0);
    anim.start();

    v.setVisibility(View.VISIBLE);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(
            ObjectAnimator.ofFloat(v, "translationY", editContainer.getTop()+movableView.getHeight()),
            ObjectAnimator.ofFloat(v, "alpha", 0, 1)
    );
    set.setDuration(ANIMATION_DURATION);
    set.setInterpolator(ANIMATION_INTERPOLATOR);
    set.start();
}
 
Example #9
Source File: ViewAnimator.java    From ListViewAnimations with Apache License 2.0 6 votes vote down vote up
/**
 * Animates given View.
 *
 * @param view the View that should be animated.
 */
private void animateView(final int position, @NonNull final View view, @NonNull final Animator[] animators) {
    if (mAnimationStartMillis == -1) {
        mAnimationStartMillis = SystemClock.uptimeMillis();
    }

    ViewHelper.setAlpha(view, 0);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(animators);
    set.setStartDelay(calculateAnimationDelay(position));
    set.setDuration(mAnimationDurationMillis);
    set.start();

    mAnimators.put(view.hashCode(), set);
}
 
Example #10
Source File: ResideMenu.java    From Libraries-for-Android-Developers with MIT License 6 votes vote down vote up
/**
 * a helper method to build scale down animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target,float targetScaleX,float targetScaleY){

    // set the pivotX and pivotY to scale;
    int pivotX = (int) (getScreenWidth()  * 1.5);
    int pivotY = (int) (getScreenHeight() * 0.5);

    ViewHelper.setPivotX(target, pivotX);
    ViewHelper.setPivotY(target, pivotY);
    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
 
Example #11
Source File: SwipeTouchListener.java    From ListViewAnimations with Apache License 2.0 6 votes vote down vote up
/**
 * Flings given {@link android.view.View} out of sight.
 *
 * @param view         the parent {@link android.view.View}.
 * @param position     the position of the item in the {@link android.widget.ListAdapter} corresponding to the {@code View}.
 * @param flingToRight {@code true} if the {@code View} should be flinged to the right, {@code false} if it should be flinged to the left.
 */
private void flingView(@NonNull final View view, final int position, final boolean flingToRight) {
    if (mViewWidth < 2) {
        mViewWidth = mListViewWrapper.getListView().getWidth();
    }

    View swipeView = getSwipeView(view);
    ObjectAnimator xAnimator = ObjectAnimator.ofFloat(swipeView, TRANSLATION_X, flingToRight ? mViewWidth : -mViewWidth);
    ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(swipeView, ALPHA, 0);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(xAnimator, alphaAnimator);
    animatorSet.setDuration(mAnimationTime);
    animatorSet.addListener(new FlingAnimatorListener(view, position));
    animatorSet.start();
}
 
Example #12
Source File: SimpleAnimation.java    From Android-PullToNextLayout with Apache License 2.0 6 votes vote down vote up
public Animator getPullDownAnimIn(View view) {

        ObjectAnimator in = ObjectAnimator.ofFloat(view, "translationY", -view.getMeasuredHeight(), 0);

        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.6f, 1);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0.6f, 1);

        AnimatorSet set = new AnimatorSet();
        set.setInterpolator(new DecelerateInterpolator());
        in.setDuration(ANIMATION_DURATION);
        scaleY.setDuration(ANIMATION_DURATION);
        scaleX.setDuration(ANIMATION_DURATION);
        set.setDuration(ANIMATION_DURATION);
        set.playTogether(scaleY, scaleX, in);


        return set;
    }
 
Example #13
Source File: SimpleAnimation.java    From Android-PullToNextLayout with Apache License 2.0 6 votes vote down vote up
private Animator getPullUpAnimIn(View view) {

        ObjectAnimator in =   ObjectAnimator.ofFloat(view, "translationY", view.getMeasuredHeight(), 0);
//        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "rotationX", 20, 0);
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.6f, 1);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0.6f, 1f);
        AnimatorSet set = new AnimatorSet();
        set.setInterpolator(new DecelerateInterpolator());
        in.setDuration(ANIMATION_DURATION);
        scaleY.setDuration(ANIMATION_DURATION);
        scaleX.setDuration(ANIMATION_DURATION);
        set.setDuration(ANIMATION_DURATION);
        set.playTogether(scaleY, scaleX, in);


        return set;
    }
 
Example #14
Source File: AnimationAdapter.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #15
Source File: MenuItemTransitionBuilder.java    From android-transition with Apache License 2.0 6 votes vote down vote up
@Override
public void setupAnimation(@NonNull MenuItem mMenuItem, @NonNull TransitionControllerManager manager,
                           @IntRange(from = 0) int itemIndex, @IntRange(from = 0) int menuCount) {
    if(mDelayed!=null) {
        final int size = mDelayed.size();
        for (int i = 0; i < size; i++) {
            mDelayed.get(i).evaluate(manager.getTarget(), this);
        }
    }

    ObjectAnimator anim = new ObjectAnimator();
    anim.setValues(getValuesHolders());
    AnimatorSet set = new AnimatorSet();
    set.play(anim);
    set.setStartDelay((long) (itemIndex * mCascade * SCALE_FACTOR));
    set.setDuration((long) (SCALE_FACTOR - itemIndex * mCascade * SCALE_FACTOR));
    manager.addAnimatorSetAsTransition(set).setRange(mStart, mEnd);
}
 
Example #16
Source File: SwipeUndoTouchListener.java    From ListViewAnimations with Apache License 2.0 6 votes vote down vote up
/**
 * Performs the undo animation and restores the original state for given {@link android.view.View}.
 *
 * @param view the parent {@code View} which contains both primary and undo {@code View}s.
 */
public void undo(@NonNull final View view) {
    int position = AdapterViewUtil.getPositionForView(getListViewWrapper(), view);
    mUndoPositions.remove(position);

    View primaryView = mCallback.getPrimaryView(view);
    View undoView = mCallback.getUndoView(view);

    primaryView.setVisibility(View.VISIBLE);

    ObjectAnimator undoAlphaAnimator = ObjectAnimator.ofFloat(undoView, ALPHA, 1f, 0f);
    ObjectAnimator primaryAlphaAnimator = ObjectAnimator.ofFloat(primaryView, ALPHA, 0f, 1f);
    ObjectAnimator primaryXAnimator = ObjectAnimator.ofFloat(primaryView, TRANSLATION_X, primaryView.getWidth(), 0f);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(undoAlphaAnimator, primaryAlphaAnimator, primaryXAnimator);
    animatorSet.addListener(new UndoAnimatorListener(undoView));
    animatorSet.start();

    mCallback.onUndo(view, position);
}
 
Example #17
Source File: BlurLayout.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
private void startBlurImageDisappearAnimator(){
    if(!enableBlurBackground || mBlurImage == null)    return;

    AnimatorSet set = new AnimatorSet();
    if(enableBackgroundZoom)
        set.playTogether(
                ObjectAnimator.ofFloat(mBlurImage, "alpha", 1f, 0.8f),
                ObjectAnimator.ofFloat(mBlurImage, "scaleX", mZoomRatio, 1f),
                ObjectAnimator.ofFloat(mBlurImage, "scaleY", mZoomRatio, 1f)
        );
    else
        set.playTogether(
                ObjectAnimator.ofFloat(mBlurImage, "alpha", 1f, 0f)
        );

    set.addListener(mGlobalListener);
    set.addListener(mGlobalDisappearAnimators);
    set.setDuration(mBlurDuration);
    set.start();
}
 
Example #18
Source File: AnimateDismissAdapter.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example #19
Source File: ResideMenu.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
private AnimatorSet buildMenuAnimation(View target, float alpha) {

		AnimatorSet alphaAnimation = new AnimatorSet();
		alphaAnimation.playTogether(ObjectAnimator.ofFloat(target, "alpha",
				alpha));

		alphaAnimation.setDuration(130); // 250
		return alphaAnimation;
	}
 
Example #20
Source File: FragmentAnimationActivity.java    From Android-Anim-Playground with MIT License 5 votes vote down vote up
private void slideInToBottom(View editContainer, View v)
{
    AnimatorSet set = new AnimatorSet();
    set.playTogether(
            ObjectAnimator.ofFloat(v, "translationY", mMainContainer.getHeight()),
            ObjectAnimator.ofFloat(v, "alpha", 1, 0)
    );
    set.setDuration(ANIMATION_DURATION);
    set.setInterpolator(ANIMATION_INTERPOLATOR);
    set.start();

}
 
Example #21
Source File: ResideMenu.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * a helper method to build scale up animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleUpAnimation(View target,float targetScaleX,float targetScaleY){

    AnimatorSet scaleUp = new AnimatorSet();
    scaleUp.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    scaleUp.setDuration(250);
    return scaleUp;
}
 
Example #22
Source File: ResideMenu.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * a helper method to build scale down animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target,float targetScaleX,float targetScaleY){

    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
 
Example #23
Source File: ResideMenu.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
/**
 * a helper method to build scale up animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleUpAnimation(View target,float targetScaleX,float targetScaleY){

    AnimatorSet scaleUp = new AnimatorSet();
    scaleUp.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    scaleUp.setDuration(250);
    return scaleUp;
}
 
Example #24
Source File: StickyListAdapter.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addAnimation(View view) {
    float[] vaules = new float[] {0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.25f, 1.2f, 1.15f, 1.1f, 1.0f};
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(view, "scaleX", vaules),
            ObjectAnimator.ofFloat(view, "scaleY", vaules));
    set.setDuration(150);
    set.start();
}
 
Example #25
Source File: MaterialRippleLayoutNineOld.java    From AdvancedMaterialDrawer with Apache License 2.0 5 votes vote down vote up
private void startRipple(final Runnable animationEndRunnable) {
    if (eventCancelled) return;

    float endRadius = getEndRadius();

    cancelAnimations();

    rippleAnimator = new AnimatorSet();
    rippleAnimator.addListener(new AnimatorListenerAdapter() {
        @Override public void onAnimationEnd(Animator animation) {
            if (!ripplePersistent) {
                setRadius(0);
                setRippleAlpha(rippleAlpha);
            }
            if (animationEndRunnable != null && rippleDelayClick) {
                animationEndRunnable.run();
            }
            childView.setPressed(false);
        }
    });

    ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
    ripple.setDuration(rippleDuration);
    ripple.setInterpolator(new DecelerateInterpolator());
    ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0);
    fade.setDuration(rippleFadeDuration);
    fade.setInterpolator(new AccelerateInterpolator());
    fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);

    if (ripplePersistent) {
        rippleAnimator.play(ripple);
    } else if (getRadius() > endRadius) {
        fade.setStartDelay(0);
        rippleAnimator.play(fade);
    } else {
        rippleAnimator.playTogether(ripple, fade);
    }
    rippleAnimator.start();
}
 
Example #26
Source File: SwitchAnimationUtil.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void runScaleAnimation(View view, long delay) {
	view.setAlpha(0);
	AnimatorSet set = new AnimatorSet();

	ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(view, "scaleX",
			0f, 1f);
	ObjectAnimator objectAnimator3 = ObjectAnimator.ofFloat(view, "scaleY",
			0f, 1f);
	ObjectAnimator objectAnimator4 = ObjectAnimator.ofFloat(view, "alpha",
			0f, 1f);
	set.setDuration(mDuration);
	set.playTogether(objectAnimator2, objectAnimator3, objectAnimator4);
	set.setStartDelay(delay);
	set.start();
}
 
Example #27
Source File: ViewTransitionBuilder.java    From android-transition with Apache License 2.0 5 votes vote down vote up
@Override
public void setupAnimation(@NonNull TransitionControllerManager manager) {
    if (mView == null) {
        mView = manager.getTarget();
    }

    if (mDelayed != null) {
        for (int i = 0, size = mDelayed.size(); i < size; i++) {
            mDelayed.get(i).evaluate(manager.getTarget(), this);
        }
    }

    for (int i = 0, size = mSetupList.size(); i < size; i++) {
        mSetupList.get(i).setupAnimation(manager);
    }

    if (mCustomTransitionController != null) {
        mCustomTransitionController.setTarget(manager.getTarget());
        mCustomTransitionController.setRange(mStart, mEnd);
        manager.addTransitionController(mCustomTransitionController.clone());
    }

    ObjectAnimator anim = new ObjectAnimator();
    anim.setTarget(mView);
    anim.setValues(getValuesHolders());
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(anim);
    animatorSet.setDuration(SCALE_FACTOR);
    manager.addAnimatorSetAsTransition(mView, animatorSet).setRange(mStart, mEnd);
}
 
Example #28
Source File: MenuRVAdapter.java    From MousePaint with MIT License 5 votes vote down vote up
private void animation(MenuVH menuVH) {

        ViewHelper.setAlpha(menuVH.itemView, 0);

        ViewHelper.setTranslationY(menuVH.itemView, 300);
        ObjectAnimator translationY = ObjectAnimator.ofFloat(menuVH.itemView, "translationY", 500, 0);
        translationY.setDuration(300);
        translationY.setInterpolator(new OvershootInterpolator(1.6f));
        ObjectAnimator alphaIn = ObjectAnimator.ofFloat(menuVH.itemView, "alpha", 0, 1);
        alphaIn.setDuration(100);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(translationY, alphaIn);
        animatorSet.setStartDelay(30 * menuVH.getAdapterPosition());
        animatorSet.start();
    }
 
Example #29
Source File: MenuRVAdapter.java    From AndroidSweetSheet with Apache License 2.0 5 votes vote down vote up
private void animation(MenuVH menuVH) {

        ViewHelper.setAlpha(menuVH.itemView, 0);

        ViewHelper.setTranslationY(menuVH.itemView, 300);
        ObjectAnimator translationY = ObjectAnimator.ofFloat(menuVH.itemView, "translationY", 500, 0);
        translationY.setDuration(300);
        translationY.setInterpolator(new OvershootInterpolator(1.6f));
        ObjectAnimator alphaIn = ObjectAnimator.ofFloat(menuVH.itemView, "alpha", 0, 1);
        alphaIn.setDuration(100);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(translationY, alphaIn);
        animatorSet.setStartDelay(30 * menuVH.getAdapterPosition());
        animatorSet.start();
    }
 
Example #30
Source File: ResideMenu.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * close the reslide menu;
 */
public void closeMenu(){

    isOpened = false;
    AnimatorSet scaleUp_activity = buildScaleUpAnimation(viewActivity, 1.0f, 1.0f);
    AnimatorSet scaleUp_shadow = buildScaleUpAnimation(imageViewShadow, 1.0f, 1.0f);
    AnimatorSet alpha_menu = buildMenuAnimation(scrollViewMenu, 0.0f);
    scaleUp_activity.addListener(animationListener);
    scaleUp_activity.playTogether(scaleUp_shadow);
    scaleUp_activity.playTogether(alpha_menu);
    scaleUp_activity.start();
}