Search in sources :

Example 1 with SupportAnimator

use of io.codetail.animation.SupportAnimator in project Euclid by Yalantis.

the class EuclidActivity method getAvatarRevealAnimator.

/**
     * This method creates and setups circle reveal animation on list item overlay view.
     *
     * @return - animator object that starts circle reveal animation.
     */
private SupportAnimator getAvatarRevealAnimator() {
    final LinearLayout mWrapperListItemReveal = (LinearLayout) mOverlayListItemView.findViewById(R.id.wrapper_list_item_reveal);
    int finalRadius = Math.max(mOverlayListItemView.getWidth(), mOverlayListItemView.getHeight());
    final SupportAnimator mRevealAnimator = ViewAnimationUtils.createCircularReveal(mWrapperListItemReveal, sScreenWidth / 2, sProfileImageHeight / 2, dpToPx(getCircleRadiusDp() * 2), finalRadius);
    mRevealAnimator.setDuration(getRevealAnimationDuration());
    mRevealAnimator.addListener(new SupportAnimator.AnimatorListener() {

        @Override
        public void onAnimationStart() {
            mWrapperListItemReveal.setVisibility(View.VISIBLE);
            mOverlayListItemView.setX(0);
        }

        @Override
        public void onAnimationEnd() {
        }

        @Override
        public void onAnimationCancel() {
        }

        @Override
        public void onAnimationRepeat() {
        }
    });
    return mRevealAnimator;
}
Also used : SupportAnimator(io.codetail.animation.SupportAnimator) LinearLayout(android.widget.LinearLayout)

Example 2 with SupportAnimator

use of io.codetail.animation.SupportAnimator in project Side-Menu.Android by Yalantis.

the class MainActivity method replaceFragment.

private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPosition) {
    this.res = this.res == R.drawable.content_music ? R.drawable.content_films : R.drawable.content_music;
    View view = findViewById(R.id.content_frame);
    int finalRadius = Math.max(view.getWidth(), view.getHeight());
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.setDuration(ViewAnimator.CIRCULAR_REVEAL_ANIMATION_DURATION);
    findViewById(R.id.content_overlay).setBackgroundDrawable(new BitmapDrawable(getResources(), screenShotable.getBitmap()));
    animator.start();
    ContentFragment contentFragment = ContentFragment.newInstance(this.res);
    getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, contentFragment).commit();
    return contentFragment;
}
Also used : ContentFragment(yalantis.com.sidemenu.sample.fragment.ContentFragment) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) SupportAnimator(io.codetail.animation.SupportAnimator) BitmapDrawable(android.graphics.drawable.BitmapDrawable) View(android.view.View)

Example 3 with SupportAnimator

use of io.codetail.animation.SupportAnimator in project CoCoin by Nightonke.

the class SplashActivity method startCircularReveal.

private void startCircularReveal() {
    // get the center for the clipping circle
    int[] location = new int[2];
    image.getLocationOnScreen(location);
    int cx = location[0] + CoCoinUtil.dpToPx(24);
    int cy = location[1] + CoCoinUtil.dpToPx(24);
    // get the final radius for the clipping circle
    int dx = Math.max(cx, ly.getWidth() - cx);
    int dy = Math.max(cy, ly.getHeight() - cy);
    float finalRadius = (float) Math.hypot(dx, dy);
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(ly, cx, cy, 0, finalRadius);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(3000);
    animator.start();
    animator.addListener(new SupportAnimator.AnimatorListener() {

        @Override
        public void onAnimationStart() {
        }

        @Override
        public void onAnimationEnd() {
            Log.d("CoCoin", "Showing animation completed");
            showAnimationCompleted = true;
            if (loadDataCompleted && showAnimationCompleted && !activityStarted) {
                activityStarted = true;
                startActivity(new Intent(mContext, MainActivity.class));
                finish();
            }
        }

        @Override
        public void onAnimationCancel() {
        }

        @Override
        public void onAnimationRepeat() {
        }
    });
    hasAnimationStarted = true;
}
Also used : SupportAnimator(io.codetail.animation.SupportAnimator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Intent(android.content.Intent)

Example 4 with SupportAnimator

use of io.codetail.animation.SupportAnimator in project MaterialCalendar by Haoxiqiang.

the class MemoFragment method appearBluePair.

void appearBluePair() {
    mBluePair.setVisibility(View.VISIBLE);
    float finalRadius = Math.max(mBluePair.getWidth(), mBluePair.getHeight()) * 1.5f;
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mBluePair, endBlueX, endBlueY, mBlue.getWidth() / 2f, finalRadius);
    animator.setDuration(500);
    animator.setInterpolator(ACCELERATE);
    animator.addListener(new SimpleListener() {

        @Override
        public void onAnimationEnd() {
            raise();
        }
    });
    animator.start();
}
Also used : SupportAnimator(io.codetail.animation.SupportAnimator)

Example 5 with SupportAnimator

use of io.codetail.animation.SupportAnimator in project material-sheet-fab by gowong.

the class MaterialSheetAnimation method startCircularRevealAnim.

protected void startCircularRevealAnim(View view, int centerX, int centerY, float startRadius, float endRadius, long duration, Interpolator interpolator, final AnimationListener listener) {
    // Use native circular reveal on Android 5.0+
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // Native circular reveal uses coordinates relative to the view
        int relativeCenterX = (int) (centerX - view.getX());
        int relativeCenterY = (int) (centerY - view.getY());
        // Setup animation
        Animator anim = ViewAnimationUtils.createCircularReveal(view, relativeCenterX, relativeCenterY, startRadius, endRadius);
        anim.setDuration(duration);
        anim.setInterpolator(interpolator);
        // Add listener
        anim.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animation) {
                if (listener != null) {
                    listener.onStart();
                }
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                if (listener != null) {
                    listener.onEnd();
                }
            }
        });
        // Start animation
        anim.start();
    } else {
        // Circular reveal library uses absolute coordinates
        // Setup animation
        SupportAnimator anim = io.codetail.animation.ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius);
        anim.setDuration((int) duration);
        anim.setInterpolator(interpolator);
        // Add listener
        anim.addListener(new SupportAnimator.SimpleAnimatorListener() {

            @Override
            public void onAnimationStart() {
                if (listener != null) {
                    listener.onStart();
                }
            }

            @Override
            public void onAnimationEnd() {
                if (listener != null) {
                    listener.onEnd();
                }
            }
        });
        // Start animation
        anim.start();
    }
}
Also used : Animator(android.animation.Animator) SupportAnimator(io.codetail.animation.SupportAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) SupportAnimator(io.codetail.animation.SupportAnimator)

Aggregations

SupportAnimator (io.codetail.animation.SupportAnimator)9 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)2 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 ValueAnimator (android.animation.ValueAnimator)1 Intent (android.content.Intent)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 View (android.view.View)1 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)1 LinearLayout (android.widget.LinearLayout)1 ContentFragment (yalantis.com.sidemenu.sample.fragment.ContentFragment)1