Search in sources :

Example 51 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.

the class DetailActivity method upAnimation.

@Override
public void upAnimation() {
    View adapterPositionView = mDetailPagerAdapter.getItemView(mViewPager.getCurrentItem());
    View blurView;
    if (adapterPositionView != null) {
        blurView = adapterPositionView.findViewById(R.id.img_blur);
    } else {
        blurView = mOverlayView;
    }
    final View finalBlurView = blurView;
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(ObjectAnimator.ofFloat(mCardView, "translationY", mTranslateHeight, 0), ObjectAnimator.ofFloat(mViewPager, "scaleX", 1f, 1.1f), ObjectAnimator.ofFloat(mViewPager, "scaleY", 1f, 1.1f), ObjectAnimator.ofFloat(finalBlurView, "alpha", 0f, 1f));
    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            finalBlurView.setVisibility(View.VISIBLE);
            mOverlayView.setVisibility(View.VISIBLE);
            mIsIgnoreClick = true;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mIsIgnoreClick = false;
        }
    });
    animatorSet.setDuration(400);
    animatorSet.setInterpolator(new OvershootInterpolator());
    animatorSet.start();
    mAnimationHandler.postDelayed(mUpDelayRunnable, 500);
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) IDetailView(com.yydcdut.note.views.note.IDetailView) RevealView(com.yydcdut.note.widget.RevealView) View(android.view.View) FontTextView(com.yydcdut.note.widget.FontTextView) TextView(android.widget.TextView)

Example 52 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.

the class DetailActivity method downAnimation.

@Override
public void downAnimation() {
    View adapterPositionView = mDetailPagerAdapter.getItemView(mViewPager.getCurrentItem());
    View blurView;
    if (adapterPositionView != null) {
        blurView = adapterPositionView.findViewById(R.id.img_blur);
    } else {
        blurView = mOverlayView;
    }
    final View finalBlurView = blurView;
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(ObjectAnimator.ofFloat(mCardView, "translationY", 0, mTranslateHeight), ObjectAnimator.ofFloat(mViewPager, "scaleX", 1.1f, 1.0f), ObjectAnimator.ofFloat(mViewPager, "scaleY", 1.1f, 1.0f), ObjectAnimator.ofFloat(finalBlurView, "alpha", 1f, 0f));
    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            finalBlurView.setVisibility(View.GONE);
            mOverlayView.setVisibility(View.GONE);
            mIsIgnoreClick = true;
        }

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            mIsIgnoreClick = true;
        }
    });
    animatorSet.setDuration(400);
    animatorSet.setInterpolator(new DecelerateInterpolator());
    animatorSet.start();
    mAnimationHandler.postDelayed(mDownDelayRunnable, 350);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) IDetailView(com.yydcdut.note.views.note.IDetailView) RevealView(com.yydcdut.note.widget.RevealView) View(android.view.View) FontTextView(com.yydcdut.note.widget.FontTextView) TextView(android.widget.TextView)

Example 53 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.

the class IntroduceActivity method showStartImage.

private void showStartImage() {
    if (mBtnStart.getVisibility() == View.GONE) {
        AnimatorSet animation = new AnimatorSet();
        animation.setDuration(300);
        animation.playTogether(ObjectAnimator.ofFloat(mBtnStart, "alpha", 0f, 1f));
        animation.addListener(new Animator.AnimatorListener() {

            @Override
            public void onAnimationStart(Animator animation) {
                mBtnStart.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationEnd(Animator animation) {
            }

            @Override
            public void onAnimationCancel(Animator animation) {
            }

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

Example 54 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.

the class PhotoDetailActivity method hideWidget.

private void hideWidget() {
    AnimatorSet animation = new AnimatorSet();
    animation.setDuration(1000);
    animation.playTogether(ObjectAnimator.ofFloat(mAppBarLayout, "Y", AppCompat.AFTER_LOLLIPOP ? getStatusBarSize() : 0, -getActionBarSize() - (AppCompat.AFTER_LOLLIPOP ? getStatusBarSize() : 0)), ObjectAnimator.ofFloat(mBottomLayout, "Y", mBottomLayout.getTop(), mBottomLayout.getTop() + getActionBarSize()), ObjectAnimator.ofFloat(mStatusCoverView, "Y", 0f, -getActionBarSize()));
    animation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            isAnimationDoing = true;
            if (AppCompat.AFTER_LOLLIPOP) {
                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
                getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            isAnimationDoing = false;
            isWidgetShowed = false;
        }
    });
    animation.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 55 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.

the class PhotoDetailActivity method showWidget.

private void showWidget() {
    AnimatorSet animation = new AnimatorSet();
    animation.setDuration(1000);
    animation.playTogether(ObjectAnimator.ofFloat(mAppBarLayout, "Y", -getActionBarSize() - (AppCompat.AFTER_LOLLIPOP ? getStatusBarSize() : 0), AppCompat.AFTER_LOLLIPOP ? getStatusBarSize() : 0), ObjectAnimator.ofFloat(mBottomLayout, "Y", mBottomLayout.getTop() + getActionBarSize(), mBottomLayout.getTop()), ObjectAnimator.ofFloat(mStatusCoverView, "Y", -getActionBarSize(), 0f));
    animation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            isAnimationDoing = true;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            isAnimationDoing = false;
            isWidgetShowed = true;
            if (AppCompat.AFTER_LOLLIPOP) {
                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
                getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            }
        }
    });
    animation.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Aggregations

AnimatorSet (com.nineoldandroids.animation.AnimatorSet)57 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)42 Animator (com.nineoldandroids.animation.Animator)24 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)11 View (android.view.View)6 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)4 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 SuppressLint (android.annotation.SuppressLint)3 Paint (android.graphics.Paint)3 OvershootInterpolator (android.view.animation.OvershootInterpolator)3 Point (android.graphics.Point)2 DisplayMetrics (android.util.DisplayMetrics)2 LinearInterpolator (android.view.animation.LinearInterpolator)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)2 IDetailView (com.yydcdut.note.views.note.IDetailView)2 FontTextView (com.yydcdut.note.widget.FontTextView)2 RevealView (com.yydcdut.note.widget.RevealView)2