Search in sources :

Example 1 with BezierDecelerateInterpolator

use of acr.browser.lightning.interpolator.BezierDecelerateInterpolator in project Lightning-Browser by anthonycr.

the class BrowserActivity method hideActionBar.

/**
     * Hide the ActionBar using an animation if we are in full-screen
     * mode. This method also re-parents the ActionBar if its parent is
     * incorrect so that the animation can happen correctly.
     */
@Override
public void hideActionBar() {
    if (mFullScreen) {
        if (mToolbarLayout == null || mBrowserFrame == null)
            return;
        final int height = mToolbarLayout.getHeight();
        if (mToolbarLayout.getTranslationY() > -0.01f) {
            Animation show = new Animation() {

                @Override
                protected void applyTransformation(float interpolatedTime, Transformation t) {
                    float trans = interpolatedTime * height;
                    mToolbarLayout.setTranslationY(-trans);
                    setWebViewTranslation(height - trans);
                }
            };
            show.setDuration(250);
            show.setInterpolator(new BezierDecelerateInterpolator());
            mBrowserFrame.startAnimation(show);
        }
    }
}
Also used : Transformation(android.view.animation.Transformation) BezierDecelerateInterpolator(acr.browser.lightning.interpolator.BezierDecelerateInterpolator) Animation(android.view.animation.Animation)

Example 2 with BezierDecelerateInterpolator

use of acr.browser.lightning.interpolator.BezierDecelerateInterpolator in project Lightning-Browser by anthonycr.

the class HorizontalItemAnimator method animateAddImpl.

private void animateAddImpl(final ViewHolder holder) {
    final View view = holder.itemView;
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    mAddAnimations.add(holder);
    animation.alpha(1).translationY(0).setInterpolator(new BezierDecelerateInterpolator()).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() {

        @Override
        public void onAnimationStart(View view) {
            dispatchAddStarting(holder);
        }

        @Override
        public void onAnimationCancel(View view) {
            ViewCompat.setTranslationY(view, 0);
            ViewCompat.setAlpha(view, 1);
        }

        @Override
        public void onAnimationEnd(View view) {
            animation.setListener(null);
            dispatchAddFinished(holder);
            mAddAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
}
Also used : BezierDecelerateInterpolator(acr.browser.lightning.interpolator.BezierDecelerateInterpolator) ViewPropertyAnimatorCompat(android.support.v4.view.ViewPropertyAnimatorCompat) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 3 with BezierDecelerateInterpolator

use of acr.browser.lightning.interpolator.BezierDecelerateInterpolator in project Lightning-Browser by anthonycr.

the class VerticalItemAnimator method animateAddImpl.

private void animateAddImpl(final ViewHolder holder) {
    final View view = holder.itemView;
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    mAddAnimations.add(holder);
    animation.alpha(1).translationX(0).setDuration(getAddDuration()).setInterpolator(new BezierDecelerateInterpolator()).setListener(new VpaListenerAdapter() {

        @Override
        public void onAnimationStart(View view) {
            dispatchAddStarting(holder);
        }

        @Override
        public void onAnimationCancel(View view) {
            ViewCompat.setAlpha(view, 1);
            ViewCompat.setTranslationX(view, 0);
        }

        @Override
        public void onAnimationEnd(View view) {
            animation.setListener(null);
            dispatchAddFinished(holder);
            mAddAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
}
Also used : BezierDecelerateInterpolator(acr.browser.lightning.interpolator.BezierDecelerateInterpolator) ViewPropertyAnimatorCompat(android.support.v4.view.ViewPropertyAnimatorCompat) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 4 with BezierDecelerateInterpolator

use of acr.browser.lightning.interpolator.BezierDecelerateInterpolator in project Lightning-Browser by anthonycr.

the class BrowserActivity method showActionBar.

/**
     * Display the ActionBar using an animation if we are in full-screen
     * mode. This method also re-parents the ActionBar if its parent is
     * incorrect so that the animation can happen correctly.
     */
@Override
public void showActionBar() {
    if (mFullScreen) {
        Log.d(TAG, "showActionBar");
        if (mToolbarLayout == null)
            return;
        int height = mToolbarLayout.getHeight();
        if (height == 0) {
            mToolbarLayout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
            height = mToolbarLayout.getMeasuredHeight();
        }
        final int totalHeight = height;
        if (mToolbarLayout.getTranslationY() < -(height - 0.01f)) {
            Animation show = new Animation() {

                @Override
                protected void applyTransformation(float interpolatedTime, Transformation t) {
                    float trans = interpolatedTime * totalHeight;
                    mToolbarLayout.setTranslationY(trans - totalHeight);
                    setWebViewTranslation(trans);
                }
            };
            show.setDuration(250);
            show.setInterpolator(new BezierDecelerateInterpolator());
            mBrowserFrame.startAnimation(show);
        }
    }
}
Also used : Transformation(android.view.animation.Transformation) BezierDecelerateInterpolator(acr.browser.lightning.interpolator.BezierDecelerateInterpolator) Animation(android.view.animation.Animation)

Aggregations

BezierDecelerateInterpolator (acr.browser.lightning.interpolator.BezierDecelerateInterpolator)4 ViewPropertyAnimatorCompat (android.support.v4.view.ViewPropertyAnimatorCompat)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 Animation (android.view.animation.Animation)2 Transformation (android.view.animation.Transformation)2