Search in sources :

Example 61 with AnimatorListenerAdapter

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

the class PhotoDetailActivity method hideWidget.

@Override
public void hideWidget(final IPhotoDetailPresenter.OnAnimationAdapter onAnimationAdapter) {
    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) {
            if (onAnimationAdapter != null) {
                onAnimationAdapter.onAnimationStarted(IPhotoDetailPresenter.STATE_HIDE);
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (onAnimationAdapter != null) {
                onAnimationAdapter.onAnimationEnded(IPhotoDetailPresenter.STATE_HIDE);
            }
        }
    });
    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 62 with AnimatorListenerAdapter

use of com.nineoldandroids.animation.AnimatorListenerAdapter 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 63 with AnimatorListenerAdapter

use of com.nineoldandroids.animation.AnimatorListenerAdapter 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 64 with AnimatorListenerAdapter

use of com.nineoldandroids.animation.AnimatorListenerAdapter 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 65 with AnimatorListenerAdapter

use of com.nineoldandroids.animation.AnimatorListenerAdapter 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

Animator (com.nineoldandroids.animation.Animator)68 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)68 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)49 StateAnimator (carbon.animation.StateAnimator)29 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)16 Interpolator (android.view.animation.Interpolator)11 Reveal (carbon.internal.Reveal)11 AnimatorSet (com.nineoldandroids.animation.AnimatorSet)11 View (android.view.View)10 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)7 RecyclerView (android.support.v7.widget.RecyclerView)5 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 MotionEvent (android.view.MotionEvent)3 ViewGroup (android.view.ViewGroup)3 ViewPropertyAnimator (android.view.ViewPropertyAnimator)3 AbsListView (android.widget.AbsListView)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 IDetailView (com.yydcdut.note.views.note.IDetailView)2 FontTextView (com.yydcdut.note.widget.FontTextView)2