Search in sources :

Example 61 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 62 with ObjectAnimator

use of com.nineoldandroids.animation.ObjectAnimator in project ActionBarSherlock by JakeWharton.

the class MainActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case android.R.id.home:
            // TODO handle clicking the app icon/logo
            return false;
        case R.id.menu_refresh:
            // switch to a progress animation
            item.setActionView(R.layout.indeterminate_progress_action);
            return true;
        case R.id.menu_both:
            // rotation animation of green fragment
            rotateLeftFrag();
            return true;
        case R.id.menu_text:
            // alpha animation of blue fragment
            ObjectAnimator alpha = ObjectAnimator.ofFloat(rightFrag.getView(), "alpha", 1f, 0f);
            alpha.setRepeatMode(ObjectAnimator.REVERSE);
            alpha.setRepeatCount(1);
            alpha.setDuration(800);
            alpha.start();
            return true;
        case R.id.menu_logo:
            useLogo = !useLogo;
            item.setChecked(useLogo);
            getSupportActionBar().setDisplayUseLogoEnabled(useLogo);
            return true;
        case R.id.menu_up:
            showHomeUp = !showHomeUp;
            item.setChecked(showHomeUp);
            getSupportActionBar().setDisplayHomeAsUpEnabled(showHomeUp);
            return true;
        case R.id.menu_nav_tabs:
            item.setChecked(true);
            showTabsNav();
            return true;
        case R.id.menu_nav_label:
            item.setChecked(true);
            showStandardNav();
            return true;
        case R.id.menu_nav_drop_down:
            item.setChecked(true);
            showDropDownNav();
            return true;
        case R.id.menu_bak_none:
            item.setChecked(true);
            getSupportActionBar().setBackgroundDrawable(null);
            return true;
        case R.id.menu_bak_gradient:
            item.setChecked(true);
            getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ad_action_bar_gradient_bak));
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator)

Example 63 with ObjectAnimator

use of com.nineoldandroids.animation.ObjectAnimator in project NineOldAndroids by JakeWharton.

the class PathAnimationActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.pathanimator);
    mButton = (Button) findViewById(R.id.button);
    mButtonProxy = AnimatorProxy.wrap(mButton);
    // Set up the path we're animating along
    AnimatorPath path = new AnimatorPath();
    path.moveTo(0, 0);
    path.lineTo(0, 300);
    path.curveTo(100, 0, 300, 900, 400, 500);
    // Set up the animation
    final ObjectAnimator anim = ObjectAnimator.ofObject(this, "buttonLoc", new PathEvaluator(), path.getPoints().toArray());
    anim.setDuration(1000);
    mButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            anim.start();
        }
    });
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) View(android.view.View)

Example 64 with ObjectAnimator

use of com.nineoldandroids.animation.ObjectAnimator in project MaterialCalendar by Haoxiqiang.

the class MemoFragment method upRed.

void upRed() {
    startRedX = ViewHelper.getX(mRed);
    startRedY = ViewHelper.getY(mRed);
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mRed, "y", ViewHelper.getY(mRed), mBluePair.getBottom() - mRed.getHeight() / 2);
    objectAnimator.addListener(new SimpleListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            disappearRed();
        }
    });
    objectAnimator.setDuration(650);
    objectAnimator.setInterpolator(ACCELERATE_DECELERATE);
    objectAnimator.start();
}
Also used : ArcAnimator(io.codetail.animation.arcanimator.ArcAnimator) Animator(com.nineoldandroids.animation.Animator) SupportAnimator(io.codetail.animation.SupportAnimator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator)

Example 65 with ObjectAnimator

use of com.nineoldandroids.animation.ObjectAnimator in project MaterialCalendar by Haoxiqiang.

the class MemoFragment method raise.

void raise() {
    startBluePairBottom = mBluePair.getBottom();
    ObjectAnimator objectAnimator = ObjectAnimator.ofInt(mBluePair, "bottom", mBluePair.getBottom(), mBluePair.getTop() + dpToPx(100));
    objectAnimator.addListener(new SimpleListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            appearRed();
        }
    });
    objectAnimator.setInterpolator(ACCELERATE_DECELERATE);
    objectAnimator.start();
}
Also used : ArcAnimator(io.codetail.animation.arcanimator.ArcAnimator) Animator(com.nineoldandroids.animation.Animator) SupportAnimator(io.codetail.animation.SupportAnimator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) 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