io.codetail.animation.SupportAnimator Java Examples

The following examples show how to use io.codetail.animation.SupportAnimator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnimationService.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
public static void setActivityToolbarCircularRevealAnimation(final Toolbar aDecorativeToolbar) {
	aDecorativeToolbar.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
		@Override
		public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
			v.removeOnLayoutChangeListener(this);

			int CIRCULAR_REVEAL_DURATION = 700;
			int cx = (aDecorativeToolbar.getLeft() + aDecorativeToolbar.getRight()) / 2;
			int cy = 0;

			// get the final radius for the clipping circle
			int finalRadius = Math.max(aDecorativeToolbar.getWidth(), aDecorativeToolbar.getHeight());

			SupportAnimator animator = ViewAnimationUtils.createCircularReveal(aDecorativeToolbar, cx, cy, 0, finalRadius);

			animator.setInterpolator(new AccelerateDecelerateInterpolator());
			animator.setDuration(CIRCULAR_REVEAL_DURATION);
			animator.start();
		}
	});
}
 
Example #2
Source File: ViewRevealer.java    From MaterialLife with GNU General Public License v2.0 6 votes vote down vote up
private void animateFor(View view, Point origin, int startRadius, int targetRadius, final AnimatorListenerAdapter animatorListenerAdapter) {
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(view, origin.x, origin.y, startRadius, targetRadius);
    animator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            animatorListenerAdapter.onAnimationStart(null);
        }

        @Override
        public void onAnimationEnd() {
            animatorListenerAdapter.onAnimationEnd(null);
        }

        @Override
        public void onAnimationCancel() {
            animatorListenerAdapter.onAnimationCancel(null);
        }

        @Override
        public void onAnimationRepeat() {
            animatorListenerAdapter.onAnimationRepeat(null);
        }
    });
    animator.setDuration(ANIMATION_DURATION);
    animator.start();
}
 
Example #3
Source File: NavHeaderView.java    From KernelAdiutor with GNU General Public License v3.0 6 votes vote down vote up
public void animateBg() {
    mImage.setVisibility(INVISIBLE);

    int cx = mImage.getWidth();
    int cy = mImage.getHeight();

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mImage, cx, cy, 0, Math.max(cx, cy));
    animator.addListener(new SupportAnimator.SimpleAnimatorListener() {
        @Override
        public void onAnimationStart() {
            super.onAnimationStart();
            mImage.setVisibility(VISIBLE);
        }
    });
    animator.setStartDelay(500);
    animator.start();
}
 
Example #4
Source File: AnimationService.java    From Twire with GNU General Public License v3.0 6 votes vote down vote up
public static void setActivityToolbarCircularRevealAnimation(final Toolbar aDecorativeToolbar) {
    aDecorativeToolbar.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
            v.removeOnLayoutChangeListener(this);

            int CIRCULAR_REVEAL_DURATION = 700;
            int cx = (aDecorativeToolbar.getLeft() + aDecorativeToolbar.getRight()) / 2;
            int cy = 0;

            // get the final radius for the clipping circle
            int finalRadius = Math.max(aDecorativeToolbar.getWidth(), aDecorativeToolbar.getHeight());

            SupportAnimator animator = ViewAnimationUtils.createCircularReveal(aDecorativeToolbar, cx, cy, 0, finalRadius);

            animator.setInterpolator(new AccelerateDecelerateInterpolator());
            animator.setDuration(CIRCULAR_REVEAL_DURATION);
            animator.start();
        }
    });
}
 
Example #5
Source File: NavHeaderView.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 6 votes vote down vote up
public void animateBg() {
    mImage.setVisibility(INVISIBLE);

    int cx = mImage.getWidth();
    int cy = mImage.getHeight();

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mImage, cx, cy, 0, Math.max(cx, cy));
    animator.addListener(new SupportAnimator.SimpleAnimatorListener() {
        @Override
        public void onAnimationStart() {
            super.onAnimationStart();
            mImage.setVisibility(VISIBLE);
        }
    });
    animator.setStartDelay(500);
    animator.start();
}
 
Example #6
Source File: ConfirmSetupActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
protected void onPostExecute(Void voi) {
	SupportAnimator.AnimatorListener animator = new SupportAnimator.AnimatorListener() {
		@Override
		public void onAnimationEnd() {
			navigateToNextActivity();
		}

		@Override
		public void onAnimationStart() {}
		@Override
		public void onAnimationCancel() {}
		@Override
		public void onAnimationRepeat() {}
	};

	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && !mTransitionViewWhite.isAttachedToWindow()) {
		animator.onAnimationEnd();
		return;
	}

	showTransitionAnimation().addListener(animator);
}
 
Example #7
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 6 votes vote down vote up
void disappearBluePair() {
    float finalRadius = Math.max(mBluePair.getWidth(), mBluePair.getHeight()) * 1.5f;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mBluePair, endBlueX, endBlueY,
            finalRadius, mBlue.getWidth() / 2f);
    animator.setDuration(500);
    animator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd() {
            mBluePair.setVisibility(View.INVISIBLE);
            returnBlue();
        }
    });
    animator.setInterpolator(DECELERATE);
    animator.start();
}
 
Example #8
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 6 votes vote down vote up
void disappearRed() {

        int cx = mRed.getWidth() / 2;
        int cy = mRed.getHeight() / 2;

        SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, mRed.getWidth() / 2, 0);
        animator.addListener(new SimpleListener() {
            @Override
            public void onAnimationEnd() {
                mRed.setVisibility(View.INVISIBLE);
                ViewHelper.setX(mRed, startRedX);
                ViewHelper.setY(mRed, startRedY);
                release();
            }
        });
        animator.setInterpolator(DECELERATE);
        animator.start();
    }
 
Example #9
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 6 votes vote down vote up
void appearRed() {
    mRed.setVisibility(View.VISIBLE);

    int cx = mRed.getWidth() / 2;
    int cy = mRed.getHeight() / 2;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, 0, mRed.getWidth() / 2);
    animator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd() {
            upRed();
        }
    });
    animator.setInterpolator(ACCELERATE);
    animator.start();
}
 
Example #10
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #11
Source File: DonationActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
private void quitWithAnimation() {
	SupportAnimator animator = revealTransition.reverse();
	if (animator == null) {
		super.onBackPressed();
		return;
	}
	animator.setDuration(1000);
	animator.addListener(new SupportAnimator.AnimatorListener() {
		@Override
		public void onAnimationStart() {}

		@Override
		public void onAnimationEnd() {
			mainContentLayout.setVisibility(View.INVISIBLE);
			finish();
		}

		@Override
		public void onAnimationCancel() {}

		@Override
		public void onAnimationRepeat() {}
	});
	animator.start();
}
 
Example #12
Source File: DonationActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
private void playInitAnimation() {
	DisplayMetrics dm = getResources().getDisplayMetrics();
	// Get the center for the FAB
	int cx = dm.widthPixels / 2;
	int cy = 0;

	float finalRadius = dm.heightPixels;

	revealTransition = ViewAnimationUtils.createCircularReveal(mainContentLayout, cx, cy, 0, finalRadius);
	revealTransition.setInterpolator(new AccelerateDecelerateInterpolator());
	revealTransition.setDuration(800);
	revealTransition.addListener(new SupportAnimator.AnimatorListener() {
		@Override
		public void onAnimationStart() {
			mainContentLayout.setVisibility(View.VISIBLE);
		}
		public void onAnimationEnd() {}
		public void onAnimationCancel() {}
		public void onAnimationRepeat() {}
	});
	revealTransition.start();
}
 
Example #13
Source File: UpdateDialogHandler.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
private void circularDismissView(final View view) {
	final int DURATION = 600;

	// Get the center for the FAB
	int cx = (int) view.getX() + view.getMeasuredHeight() / 2;
	int cy = (int) view.getY() + view.getMeasuredWidth() / 2;

	// get the final radius for the clipping circle
	int dx = Math.max(cx, view.getWidth() - cx);
	int dy = Math.max(cy, view.getHeight() - cy);
	float finalRadius = (float) Math.hypot(dx, dy);

	final SupportAnimator dismissAnimation = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius).reverse();
	dismissAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
	dismissAnimation.setDuration(DURATION);
	dismissAnimation.start();
	new Handler().postDelayed(new Runnable() {
		@Override
		public void run() {
			mSuperContainer.setVisibility(View.GONE);
		}
	}, DURATION);
}
 
Example #14
Source File: RevealLinearLayout.java    From material-sheet-fab with MIT License 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #15
Source File: RevealLinearLayout.java    From PersistentSearchView with Apache License 2.0 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #16
Source File: AwesomeSplash.java    From AwesomeSplash with MIT License 5 votes vote down vote up
public void startCircularReveal() {

        // get the final radius for the clipping circle
        int finalRadius = Math.max(mRlReveal.getWidth(), mRlReveal.getHeight()) + mRlReveal.getHeight() / 2;
        //bottom or top
        int y = UIUtil.getRevealDirection(mRlReveal, mConfigSplash.getRevealFlagY());
        //left or right
        int x = UIUtil.getRevealDirection(mRlReveal, mConfigSplash.getRevealFlagX());

        mRlReveal.setBackgroundColor(getResources().getColor(mConfigSplash.getBackgroundColor()));
        SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRlReveal, x, y, 0, finalRadius);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(mConfigSplash.getAnimCircularRevealDuration());
        animator.addListener(new SupportAnimator.AnimatorListener() {
            @Override
            public void onAnimationStart() {
            }

            @Override
            public void onAnimationCancel() {
            }

            @Override
            public void onAnimationRepeat() {
            }

            @Override
            public void onAnimationEnd() {

                if (pathOrLogo == Flags.WITH_PATH) {
                    mPathLogo.start();
                } else {
                    startLogoAnimation();
                }
            }
        });
        animator.start();
        hasAnimationStarted = true;
    }
 
Example #17
Source File: RevealFrameLayout.java    From material-sheet-fab with MIT License 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #18
Source File: RevealFrameLayout.java    From PersistentSearchView with Apache License 2.0 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #19
Source File: RevealViewGroup.java    From PersistentSearchView with Apache License 2.0 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #20
Source File: RevealFrameLayout.java    From fab-toolbar with MIT License 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #21
Source File: RevealLinearLayout.java    From RecyclerView-Animation-Demo with Apache License 2.0 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #22
Source File: FabAnimatorPreL.java    From fab-transformation with MIT License 5 votes vote down vote up
@Override
final void revealOff(final View fab, final View transformView, final RevealCallback callback) {
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(
            transformView,
            getCenterX(fab),
            getCenterY(fab),
            (float) Math.hypot(transformView.getWidth(), transformView.getHeight()) / 2,
            fab.getWidth() / 2);
    animator.setInterpolator(REVEAL_INTERPOLATOR);
    animator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            callback.onRevealStart();
        }

        @Override
        public void onAnimationEnd() {
            transformView.setVisibility(View.INVISIBLE);
            callback.onRevealEnd();
        }

        @Override
        public void onAnimationCancel() {
            //
        }

        @Override
        public void onAnimationRepeat() {
            //
        }
    });
    if (transformView.getVisibility() == View.VISIBLE) {
        animator.setDuration((int) getRevealAnimationDuration());
        animator.start();
        transformView.setEnabled(true);
    }
}
 
Example #23
Source File: FabAnimatorPreL.java    From fab-transformation with MIT License 5 votes vote down vote up
@Override
final void revealOn(final View fab, final View transformView, final RevealCallback callback) {
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(
            transformView,
            getCenterX(fab),
            getCenterY(fab),
            fab.getWidth() / 2,
            (float) Math.hypot(transformView.getWidth(), transformView.getHeight()) / 2);
    transformView.setVisibility(View.VISIBLE);
    animator.setInterpolator(FAB_INTERPOLATOR);
    animator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            callback.onRevealStart();
        }

        @Override
        public void onAnimationEnd() {
            callback.onRevealEnd();
        }

        @Override
        public void onAnimationCancel() {
            //
        }

        @Override
        public void onAnimationRepeat() {
            //
        }
    });
    if (transformView.getVisibility() == View.VISIBLE) {
        animator.setDuration((int) getRevealAnimationDuration());
        animator.start();
        transformView.setEnabled(true);
    }
}
 
Example #24
Source File: RevealFrameLayout.java    From fab-transformation with MIT License 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if (mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #25
Source File: RevealLinearLayout.java    From fab-transformation with MIT License 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if (mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #26
Source File: RevealRelativeLayout.java    From Slide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if (mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example #27
Source File: MaterialSheet.java    From FABtransitions with MIT License 5 votes vote down vote up
public boolean HideReveal( final View Rootview) {

                frame.removeView(overlay);
                frame.setClickable(true);
                revealAnimator = ViewAnimationUtils.createCircularReveal(Rootview, (int) revealX,(int)revealY+changeY, revealRadius, 0);
                revealAnimator.setDuration(121);
                revealAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
                revealArc = ArcAnimator.createArcAnimator(fab, fabX, fabY,-45, Side.LEFT);
                revealArc.setDuration(120);
                revealArc.setInterpolator(new AccelerateDecelerateInterpolator());
                revealAnimator.start();
                revealAnimator.addListener(new SupportAnimator.AnimatorListener() {
                    @Override
                    public void onAnimationStart() {

                    }

                    @Override
                    public void onAnimationEnd() {
                        Rootview.setVisibility(View.INVISIBLE);
                        fab.setVisibility(View.VISIBLE);
                        fab.showFloatingActionButton();
                        revealArc.start();

                    }

                    @Override
                    public void onAnimationCancel() {

                    }

                    @Override
                    public void onAnimationRepeat() {

                    }
                });

        return  true;

    }
 
Example #28
Source File: CoolSwitchRevealAnimation.java    From CoolSwitch with Apache License 2.0 5 votes vote down vote up
void startRevealAnimation(float initialRadius, float endRadius,
		final View invisibleView, View visibleView, int initialAlpha, int endAlpha,
		long backgroundAnimationDuration) {
	Point revealAnimationCenter = getRevealAnimationCenter();

	SupportAnimator anim = ViewAnimationUtils.createCircularReveal(enabledView,
			revealAnimationCenter.x, revealAnimationCenter.y, initialRadius, endRadius);
	anim.addListener(new CircularAnimatorListener(invisibleView, initialAlpha, endAlpha,
			backgroundAnimationDuration));

	visibleView.setVisibility(View.VISIBLE);
	anim.start();
}
 
Example #29
Source File: SheetLayout.java    From HaiNaBaiChuan with Apache License 2.0 5 votes vote down vote up
private void contractPreLollipop(int x, int y, float startRadius, float endRadius) {

        final SupportAnimator toolbarContractAnim = io.codetail.animation.ViewAnimationUtils
                .createCircularReveal(mFabExpandLayout, x, y, startRadius, endRadius);
        toolbarContractAnim.setDuration(animationDuration);

        toolbarContractAnim.addListener(new SupportAnimator.AnimatorListener() {
            @Override
            public void onAnimationStart() {

            }

            @Override
            public void onAnimationEnd() {
                contractAnimationEnd();
            }

            @Override
            public void onAnimationCancel() {

            }

            @Override
            public void onAnimationRepeat() {

            }
        });

        toolbarContractAnim.start();
    }
 
Example #30
Source File: RevealLinearLayout.java    From fab-toolbar with MIT License 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}