Search in sources :

Example 76 with ObjectAnimator

use of com.nineoldandroids.animation.ObjectAnimator in project XhsEmoticonsKeyboard by w446108264.

the class AnimEmoticonsIndicatorView method playBy.

public void playBy(int startPosition, int nextPosition, PageSetEntity pageSetEntity) {
    if (!checkPageSetEntity(pageSetEntity)) {
        return;
    }
    updateIndicatorCount(pageSetEntity.getPageCount());
    boolean isShowInAnimOnly = false;
    if (startPosition < 0 || nextPosition < 0 || nextPosition == startPosition) {
        startPosition = nextPosition = 0;
    }
    if (startPosition < 0) {
        isShowInAnimOnly = true;
        startPosition = nextPosition = 0;
    }
    final ImageView imageViewStrat = mImageViews.get(startPosition);
    final ImageView imageViewNext = mImageViews.get(nextPosition);
    ObjectAnimator anim1 = ObjectAnimator.ofFloat(imageViewStrat, "scaleX", 1.0f, 0.25f);
    ObjectAnimator anim2 = ObjectAnimator.ofFloat(imageViewStrat, "scaleY", 1.0f, 0.25f);
    if (mPlayByOutAnimatorSet != null && mPlayByOutAnimatorSet.isRunning()) {
        mPlayByOutAnimatorSet.cancel();
        mPlayByOutAnimatorSet = null;
    }
    mPlayByOutAnimatorSet = new AnimatorSet();
    mPlayByOutAnimatorSet.play(anim1).with(anim2);
    mPlayByOutAnimatorSet.setDuration(100);
    ObjectAnimator animIn1 = ObjectAnimator.ofFloat(imageViewNext, "scaleX", 0.25f, 1.0f);
    ObjectAnimator animIn2 = ObjectAnimator.ofFloat(imageViewNext, "scaleY", 0.25f, 1.0f);
    if (mPlayByInAnimatorSet != null && mPlayByInAnimatorSet.isRunning()) {
        mPlayByInAnimatorSet.cancel();
        mPlayByInAnimatorSet = null;
    }
    mPlayByInAnimatorSet = new AnimatorSet();
    mPlayByInAnimatorSet.play(animIn1).with(animIn2);
    mPlayByInAnimatorSet.setDuration(100);
    if (isShowInAnimOnly) {
        mPlayByInAnimatorSet.start();
        return;
    }
    anim1.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            imageViewStrat.setImageDrawable(mDrawableNomal);
            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.setImageDrawable(mDrawableSelect);
            mPlayByInAnimatorSet.start();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    mPlayByOutAnimatorSet.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) ImageView(android.widget.ImageView)

Example 77 with ObjectAnimator

use of com.nineoldandroids.animation.ObjectAnimator in project AndroidSweetSheet by zzz40500.

the class IndicatorView method alphaDismiss.

public void alphaDismiss(boolean isAnimation) {
    if (isAnimation) {
        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "alpha", 1, 0);
        objectAnimator.setDuration(300);
        objectAnimator.start();
    } else {
        ViewHelper.setAlpha(this, 0);
    }
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator)

Example 78 with ObjectAnimator

use of com.nineoldandroids.animation.ObjectAnimator in project AndroidSweetSheet by zzz40500.

the class CustomDelegate method alphaAnimation.

private void alphaAnimation() {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(getContentRelativeLayout(), "alpha", 0, 1);
    objectAnimator.setDuration(1200);
    objectAnimator.setInterpolator(new DecelerateInterpolator());
    objectAnimator.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator)

Example 79 with ObjectAnimator

use of com.nineoldandroids.animation.ObjectAnimator in project AndroidSweetSheet by zzz40500.

the class Delegate method dismiss.

/**
     * 消失
     */
protected void dismiss() {
    if (getStatus() == SweetSheet.Status.DISMISS) {
        return;
    }
    mBg.setClickable(false);
    dismissShowdown();
    ObjectAnimator translationOut = ObjectAnimator.ofFloat(mRootView, "translationY", 0, mRootView.getHeight());
    translationOut.setDuration(600);
    translationOut.setInterpolator(new DecelerateInterpolator());
    translationOut.addListener(new SimpleAnimationListener() {

        @Override
        public void onAnimationStart(Animator animation) {
            mStatus = SweetSheet.Status.DISMISSING;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mStatus = SweetSheet.Status.DISMISS;
            mParentVG.removeView(mRootView);
        }
    });
    translationOut.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) SimpleAnimationListener(com.mingle.SimpleAnimationListener)

Example 80 with ObjectAnimator

use of com.nineoldandroids.animation.ObjectAnimator in project AndroidSweetSheet by zzz40500.

the class Delegate method showShowdown.

/**
     * 显示模糊背景
     */
protected void showShowdown() {
    ViewHelper.setTranslationY(mRootView, 0);
    mEffect.effect(mParentVG, mBg);
    ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    if (mBg.getParent() != null) {
        mParentVG.removeView(mBg);
    }
    mParentVG.addView(mBg, lp);
    ViewHelper.setAlpha(mBg, 0);
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 0, 1);
    objectAnimator.setDuration(400);
    objectAnimator.start();
}
Also used : ViewGroup(android.view.ViewGroup) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator)

Aggregations

ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)81 AnimatorSet (com.nineoldandroids.animation.AnimatorSet)27 Animator (com.nineoldandroids.animation.Animator)20 View (android.view.View)11 PropertyValuesHolder (com.nineoldandroids.animation.PropertyValuesHolder)10 Keyframe (com.nineoldandroids.animation.Keyframe)9 Paint (android.graphics.Paint)8 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)8 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)6 TextView (android.widget.TextView)5 AdapterView (android.widget.AdapterView)4 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)4 SuppressLint (android.annotation.SuppressLint)3 TargetApi (android.annotation.TargetApi)3 LinearInterpolator (android.view.animation.LinearInterpolator)3 OvershootInterpolator (android.view.animation.OvershootInterpolator)3 AbsListView (android.widget.AbsListView)3 ListView (android.widget.ListView)3 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)3 SupportAnimator (io.codetail.animation.SupportAnimator)3