Java Code Examples for com.nineoldandroids.animation.AnimatorSet#start()

The following examples show how to use com.nineoldandroids.animation.AnimatorSet#start() . 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: ResideMenu.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 6 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 scaleUp_activity = buildMoveLeftAnimation(viewActivity,
	// 0.0f);
	// AnimatorSet scaleUp_shadow = buildMoveLeftAnimation(imageViewShadow,
	// 0.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();
}
 
Example 2
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 3
Source File: BlurLayout.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
private void startBlurImageAppearAnimator(){
    if(!enableBlurBackground || mBlurImage == null)    return;

    AnimatorSet set = new AnimatorSet();
     if(enableBackgroundZoom){
        set.playTogether(
                ObjectAnimator.ofFloat(mBlurImage, "alpha", 0.8f, 1f),
                ObjectAnimator.ofFloat(mBlurImage, "scaleX", 1f, mZoomRatio),
                ObjectAnimator.ofFloat(mBlurImage, "scaleY", 1f, mZoomRatio)
        );
    }
    else{
        set.playTogether(
                ObjectAnimator.ofFloat(mBlurImage, "alpha", 0f, 1f)
        );
    }
    set.addListener(mGlobalListener);
    set.addListener(mGlobalAppearingAnimators);
    set.setDuration(mBlurDuration);
    set.start();
}
 
Example 4
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 5
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 6
Source File: MusicAdapter.java    From AirFree-Client with GNU General Public License v3.0 5 votes vote down vote up
private void addAnimation(View view) {
    float[] vaules = new float[]{0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.5f, 0.6f, 0.65f, 0.7f, 0.8f, 0.7f, 0.65f, 0.6f, 0.5f};
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(view, "scaleX", vaules), ObjectAnimator.ofFloat(view, "scaleY", vaules));
    set.setDuration(150);
    set.start();
}
 
Example 7
Source File: CellViewHolder.java    From MaterialLeanBack with Apache License 2.0 5 votes vote down vote up
public void enlarge(boolean withAnimation) {
    if (!enlarged && settings.animateCards) {

        if (currentAnimator != null) {
            currentAnimator.cancel();
            currentAnimator = null;
        }

        int duration = withAnimation ? 300 : 0;

        adapter.itemPosition = getAdapterPosition();

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setDuration(duration);

        List<Animator> animatorList = new ArrayList<>();
        animatorList.add(ObjectAnimator.ofFloat(cardView, "scaleX", scaleEnlarged));
        animatorList.add(ObjectAnimator.ofFloat(cardView, "scaleY", scaleEnlarged));

        if (settings.overlapCards) {
            //animatorList.add(ObjectAnimator.ofFloat(cardView, "translationX", translationX));
            animatorSet.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    cardView.setCardElevation(settings.elevationEnlarged);
                    currentAnimator = null;
                }
            });
        }

        animatorSet.playTogether(animatorList);
        currentAnimator = animatorSet;
        animatorSet.start();

        enlarged = true;
    }
}
 
Example 8
Source File: SwitchAnimationUtil.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void runHorizonRightAnimation(View view, long delay) {
	view.setAlpha(0);
	ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view,
			"translationX", ViewUtils.getScreenWidth(), 0);
	objectAnimator.setInterpolator(new LinearInterpolator());
	ObjectAnimator objectAnimatorAlpha = ObjectAnimator.ofFloat(view,
			"alpha", 0f, 1f);
	AnimatorSet set = new AnimatorSet();
	set.setStartDelay(delay);
	set.setDuration(mDuration);
	set.playTogether(objectAnimator, objectAnimatorAlpha);
	set.start();
}
 
Example 9
Source File: PickPictureAdapter.java    From jmessage-android-uikit with MIT License 5 votes vote down vote up
/**
 * 给CheckBox加点击动画,利用开源库nineoldandroids设置动画
 */
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 10
Source File: SwipeTouchListener.java    From ListViewAnimations with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the pending {@link android.view.View} back to its original position.
 */
private void restoreCurrentViewTranslation() {
    if (mCurrentView == null) {
        return;
    }

    ObjectAnimator xAnimator = ObjectAnimator.ofFloat(mSwipingView, TRANSLATION_X, 0);
    ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mSwipingView, ALPHA, 1);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(xAnimator, alphaAnimator);
    animatorSet.setDuration(mAnimationTime);
    animatorSet.addListener(new RestoreAnimatorListener(mCurrentView, mCurrentPosition));
    animatorSet.start();
}
 
Example 11
Source File: SwitchAnimationUtil.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void runFlipHorizonAnimation(View view, long delay) {
	view.setAlpha(0);
	AnimatorSet set = new AnimatorSet();
	ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(view,
			"rotationY", -180f, 0f);
	ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(view, "alpha",
			0f, 1f);
	set.setDuration(mDuration);
	set.playTogether(objectAnimator1, objectAnimator2);
	set.setStartDelay(delay);
	set.start();
}
 
Example 12
Source File: MobileAdapter.java    From AirFree-Client with GNU General Public License v3.0 5 votes vote down vote up
private void addAnimation(View view) {
    float[] vaules = new float[]{0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.5f, 0.6f, 0.65f, 0.7f, 0.8f, 0.7f, 0.65f, 0.6f, 0.5f};
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(view, "scaleX", vaules), ObjectAnimator.ofFloat(view, "scaleY", vaules));
    set.setDuration(150);
    set.start();
}
 
Example 13
Source File: ResideMenu.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * close the reslide main;
 */
public void closeMenu(){

    isOpened = false;
    AnimatorSet scaleUp_activity = buildScaleUpAnimation(view_activity, 1.0f, 1.0f);
    AnimatorSet scaleUp_shadow = buildScaleUpAnimation(iv_shadow, 1.0f, 1.0f);
    AnimatorSet alpha_menu = buildMenuAnimation(sv_menu, 0.0f);
    scaleUp_activity.addListener(animationListener);
    scaleUp_activity.playTogether(scaleUp_shadow);
    scaleUp_activity.playTogether(alpha_menu);
    scaleUp_activity.start();
}
 
Example 14
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 15
Source File: VideoAdapter.java    From AirFree-Client with GNU General Public License v3.0 5 votes vote down vote up
private void addAnimation(View view) {
    float[] vaules = new float[]{0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.5f, 0.6f, 0.65f, 0.7f, 0.8f, 0.7f, 0.65f, 0.6f, 0.5f};
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(view, "scaleX", vaules), ObjectAnimator.ofFloat(view, "scaleY", vaules));
    set.setDuration(150);
    set.start();
}
 
Example 16
Source File: CellViewHolder.java    From MaterialLeanBack with Apache License 2.0 5 votes vote down vote up
public void reduce(boolean withAnimation) {
    if (enlarged && settings.animateCards) {
        if (currentAnimator != null) {
            currentAnimator.cancel();
            currentAnimator = null;
        }

        int duration = withAnimation ? 300 : 0;

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setDuration(duration);

        List<Animator> animatorList = new ArrayList<>();
        animatorList.add(ObjectAnimator.ofFloat(cardView, "scaleX", scaleReduced));
        animatorList.add(ObjectAnimator.ofFloat(cardView, "scaleY", scaleReduced));

        if (settings.overlapCards) {
            //animatorList.add(ObjectAnimator.ofFloat(cardView, "translationX", translationX));
            animatorSet.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    cardView.setCardElevation(settings.elevationReduced);
                    currentAnimator = null;
                }
            });
        }

        animatorSet.playTogether(animatorList);
        currentAnimator = animatorSet;
        animatorSet.start();

        enlarged = false;
    }
}
 
Example 17
Source File: PicSelectAdapter.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
/**
 * @param view
 */
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 18
Source File: EmoticonsIndicatorView.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
/**
 * 过渡选中点
 *
 * @param imageViewStrat
 * @param imageViewNext
 */
private void animPointTrans(ImageView imageViewStrat, ImageView imageViewNext) {
    imageViewStrat.setImageBitmap(bmpNomal);
    ObjectAnimator animFil1l = ObjectAnimator.ofFloat(imageViewStrat, "scaleX", 1.0f);
    ObjectAnimator animFill2 = ObjectAnimator.ofFloat(imageViewStrat, "scaleY", 1.0f);
    AnimatorSet mFillAnimatorSet = new AnimatorSet();
    mFillAnimatorSet.play(animFil1l).with(animFill2);
    mFillAnimatorSet.start();
    imageViewNext.setImageBitmap(bmpSelect);
    mPlayByInAnimatorSet.start();
}
 
Example 19
Source File: ScaleAnimater.java    From JPTabBar with Apache License 2.0 5 votes vote down vote up
@Override
public void onSelectChanged(View v,boolean selected) {
    AnimatorSet scaleAnimator = new AnimatorSet();
    float end = selected?1.2f:1f;
    ObjectAnimator scaleX ;
    ObjectAnimator scaleY;
    scaleX = ObjectAnimator.ofFloat(v,"scaleX",end);
    scaleY  = ObjectAnimator.ofFloat(v,"scaleY",end);
    scaleAnimator.playTogether(scaleX,scaleY);
    scaleAnimator.setDuration(300);
    scaleAnimator.start();
}
 
Example 20
Source File: AnimUtil.java    From PullRefreshView with Apache License 2.0 4 votes vote down vote up
public static Animator startScale(final View view, float fromScale, float toScale) {
    AnimatorSet animator = new AnimatorSet();
    animator.playTogether(ObjectAnimator.ofFloat(view, "scaleX", fromScale, toScale), ObjectAnimator.ofFloat(view, "scaleY", fromScale, toScale));
    animator.start();
    return animator;
}