Java Code Examples for io.codetail.animation.SupportAnimator#setDuration()
The following examples show how to use
io.codetail.animation.SupportAnimator#setDuration() .
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: MemoFragment.java From MaterialCalendar with Apache License 2.0 | 6 votes |
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 2
Source File: MemoFragment.java From MaterialCalendar with Apache License 2.0 | 6 votes |
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 3
Source File: ViewRevealer.java From MaterialLife with GNU General Public License v2.0 | 6 votes |
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 4
Source File: PersistentSearchView.java From PersistentSearchView with Apache License 2.0 | 5 votes |
/*** * Hide the PersistentSearchView using the circle animation. Can be called regardless of result list length */ private void hideCircularly(int x, int y) { Resources r = getResources(); float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 96, r.getDisplayMetrics()); int finalRadius = (int) Math.max(this.getMeasuredWidth() * 1.5, px); SupportAnimator animator = ViewAnimationUtils.createCircularReveal( mSearchCardView, x, y, 0, finalRadius); animator = animator.reverse(); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(DURATION_REVEAL_CLOSE); animator.start(); animator.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { } @Override public void onAnimationEnd() { setVisibility(View.GONE); closeSearchInternal(); // closeSearch(); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); }
Example 5
Source File: MainActivity.java From Jide-Note with MIT License | 5 votes |
/** * 切换Fragment * @param screenShotable * 一个实现了 ScreenShotable 接口的 Fragment 对象 * @param topPosition * @return */ private ScreenShotable replaceFragment(Resourceble slideMenuItem,ScreenShotable screenShotable, int topPosition) { 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(); switch (slideMenuItem.getName()){ case RECORD: recordFragment = ContentFragment.newInstance(ContentFragment.RECORD); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, recordFragment).commit(); return recordFragment; // case LIST: // listFragment = ListFragment.newInstance(); // getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, listFragment).commit(); // return listFragment; case REMIND: remindFragment = ContentFragment.newInstance(ContentFragment.REMIND); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, remindFragment).commit(); return remindFragment; case ARCHIVE: archiveFragment = ContentFragment.newInstance(ContentFragment.ARCHIVE); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,archiveFragment).commit(); return archiveFragment; case RECYCLE: recycleFragment = ContentFragment.newInstance(ContentFragment.RECYCLE); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,recycleFragment).commit(); return recycleFragment; default: break; } return recordFragment; }
Example 6
Source File: SheetLayout.java From HaiNaBaiChuan with Apache License 2.0 | 5 votes |
private void expandPreLollipop(int x, int y, float startRadius, float endRadius) { SupportAnimator toolbarExpandAnim = io.codetail.animation.ViewAnimationUtils .createCircularReveal( mFabExpandLayout, x, y, startRadius, endRadius); toolbarExpandAnim.setDuration(animationDuration); toolbarExpandAnim.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mFabExpandLayout.setAlpha(1f); } @Override public void onAnimationEnd() { //mFab.setAlpha(1f); expandAnimationEnd(); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); toolbarExpandAnim.start(); }
Example 7
Source File: LoginActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 4 votes |
/** * Animations only here from and down */ private void showTransitionAnimation() { // Get the center for the FAB int cx = (int) mContinueFABContainer.getX() + mContinueFABContainer.getMeasuredHeight() / 2; int cy = (int) mContinueFABContainer.getY() + mContinueFABContainer.getMeasuredWidth() / 2; // get the final radius for the clipping circle int dx = Math.max(cx, mTransitionViewWhite.getWidth() - cx); int dy = Math.max(cy, mTransitionViewWhite.getHeight() - cy); float finalRadius = (float) Math.hypot(dx, dy); //mTransitionViewBlue.setLayerType(View.LAYER_TYPE_HARDWARE, null); //mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); final SupportAnimator whiteTransitionAnimation = ViewAnimationUtils.createCircularReveal(mTransitionViewWhite, cx, cy, 0, finalRadius); whiteTransitionAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); whiteTransitionAnimation.setDuration(REVEAL_ANIMATION_DURATION); whiteTransitionAnimation.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.bringToFront(); mTransitionViewWhite.setVisibility(View.VISIBLE); mContinueFABContainer.setClickable(false); if(mContinueIcon.getVisibility() == View.VISIBLE) { hideContinueIconAnimations(); } } @Override public void onAnimationEnd() { transitionAnimationWhite = whiteTransitionAnimation; } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); final SupportAnimator blueTransitionAnimation = ViewAnimationUtils.createCircularReveal(mTransitionViewBlue, cx, cy, 0, finalRadius); blueTransitionAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); blueTransitionAnimation.setDuration(REVEAL_ANIMATION_DURATION); blueTransitionAnimation.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewBlue.setVisibility(View.VISIBLE); mTransitionViewBlue.bringToFront(); mContinueFABShadow.bringToFront(); mContinueFAB.bringToFront(); } @Override public void onAnimationEnd() { transitionAnimationBlue = blueTransitionAnimation; mTransitionViewBlue.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null); } @Override public void onAnimationCancel() { onAnimationEnd(); } @Override public void onAnimationRepeat() { } }); whiteTransitionAnimation.start(); blueTransitionAnimation.setStartDelay(REVEAL_ANIMATION_DELAY); blueTransitionAnimation.start(); new Handler().postDelayed(new Runnable() { @Override public void run() { Log.d(LOG_TAG, "Navigating to NotificationActivity"); navigateToNotificationActivity(); } }, REVEAL_ANIMATION_DELAY + REVEAL_ANIMATION_DURATION); }
Example 8
Source File: LoginActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 4 votes |
private void showSkippingAnimation() { // Get the center for the FAB int cx = (int) mContinueFABContainer.getX() + mContinueFABContainer.getMeasuredHeight() / 2; int cy = (int) mContinueFABContainer.getY() + mContinueFABContainer.getMeasuredWidth() / 2; // get the final radius for the clipping circle int dx = Math.max(cx, mTransitionViewWhite.getWidth() - cx); int dy = Math.max(cy, mTransitionViewWhite.getHeight() - cy); float finalRadius = (float) Math.hypot(dx, dy); mTransitionViewBlue.setLayerType(View.LAYER_TYPE_HARDWARE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); final SupportAnimator whiteTransitionAnimation = ViewAnimationUtils.createCircularReveal(mTransitionViewWhite, cx, cy, 0, finalRadius); whiteTransitionAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); whiteTransitionAnimation.setDuration(REVEAL_ANIMATION_DURATION); whiteTransitionAnimation.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.bringToFront(); mTransitionViewWhite.setVisibility(View.VISIBLE); mContinueFABContainer.setClickable(false); if(mContinueIcon.getVisibility() == View.VISIBLE) { hideContinueIconAnimations(); } } @Override public void onAnimationEnd() { hasTransitioned = true; transitionAnimationWhite = whiteTransitionAnimation; new Settings(getBaseContext()).setSetup(true); new Settings(getBaseContext()).setLogin(false); Intent intent = Service.getNotLoggedInIntent(getBaseContext()); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); whiteTransitionAnimation.start(); }
Example 9
Source File: WelcomeActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 4 votes |
@Override public void onResume() { super.onResume(); // The user has returned from the login screen. Lol wtf? if(transitionAnimationWhite != null && hasTransitioned) { SupportAnimator blueReversed = transitionAnimationBlue.reverse(); blueReversed.setInterpolator(new AccelerateDecelerateInterpolator()); blueReversed.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewBlue.setVisibility(View.VISIBLE); mTransitionViewBlue.bringToFront(); } @Override public void onAnimationEnd() { Service.bringToBack(mTransitionViewBlue); mTransitionViewBlue.setVisibility(View.INVISIBLE); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); blueReversed.setDuration(REVEAL_ANIMATION_DURATION); blueReversed.start(); final SupportAnimator whiteReversed = transitionAnimationWhite.reverse(); whiteReversed.setInterpolator(new AccelerateDecelerateInterpolator()); whiteReversed.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.setVisibility(View.VISIBLE); mTransitionViewWhite.bringToFront(); } @Override public void onAnimationEnd() { Service.bringToBack(mTransitionViewWhite); mTransitionViewWhite.setVisibility(View.INVISIBLE); mContinueFAB.setClickable(true); startShowContinueIconAnimations(); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); whiteReversed.setDuration(REVEAL_ANIMATION_DURATION); new Handler().postDelayed(new Runnable() { @Override public void run() { whiteReversed.start(); } }, REVEAL_ANIMATION_DELAY_DURATION); hasTransitioned = false; } }
Example 10
Source File: NotificationActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 4 votes |
private SupportAnimator showReverseTransitionAnimation() { mTransitionViewBlue.setLayerType(View.LAYER_TYPE_HARDWARE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); SupportAnimator blueReversed = transitionAnimationBlue.reverse(); blueReversed.setInterpolator(new AccelerateDecelerateInterpolator()); blueReversed.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewBlue.setVisibility(View.VISIBLE); mTransitionViewBlue.bringToFront(); } @Override public void onAnimationEnd() { Service.bringToBack(mTransitionViewBlue); mTransitionViewBlue.setVisibility(View.INVISIBLE); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); blueReversed.setDuration(REVEAL_ANIMATION_DURATION); blueReversed.start(); final SupportAnimator whiteReversed = transitionAnimationWhite.reverse(); whiteReversed.setInterpolator(new AccelerateDecelerateInterpolator()); whiteReversed.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.setVisibility(View.VISIBLE); mTransitionViewWhite.bringToFront(); } @Override public void onAnimationEnd() { Service.bringToBack(mTransitionViewWhite); mTransitionViewBlue.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setVisibility(View.INVISIBLE); mContinueFABContainer.setClickable(true); mContinueIcon.bringToFront(); mContinueIcon.setVisibility(View.VISIBLE); showContinueIconAnimations(360); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); whiteReversed.setDuration(REVEAL_ANIMATION_DURATION); whiteReversed.setStartDelay(REVEAL_ANIMATION_DELAY); whiteReversed.start(); return whiteReversed; }
Example 11
Source File: ConfirmSetupActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 4 votes |
private SupportAnimator showReverseTransitionAnimation() { mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); final SupportAnimator whiteReversed = transitionAnimationWhite.reverse(); whiteReversed.setInterpolator(new AccelerateDecelerateInterpolator()); whiteReversed.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.setVisibility(View.VISIBLE); mTransitionViewWhite.bringToFront(); } @Override public void onAnimationEnd() { Service.bringToBack(mTransitionViewWhite); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setVisibility(View.INVISIBLE); mContinueFABContainer.setClickable(true); mContinueIcon.bringToFront(); mContinueIcon.setVisibility(View.VISIBLE); showContinueIconAnimations(360); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); whiteReversed.setDuration(REVEAL_ANIMATION_DURATION); new Handler().postDelayed(new Runnable() { @Override public void run() { whiteReversed.start(); } }, REVEAL_ANIMATION_DELAY); hasTransitioned = false; return whiteReversed; }
Example 12
Source File: SearchBox.java From ExpressHelper with GNU General Public License v3.0 | 4 votes |
/*** * Hide the searchbox using the circle animation. Can be called regardless of result list length * @param activity */ public void hideCircularly(Activity activity){ Display display = activity.getWindowManager().getDefaultDisplay(); Point size = new Point(); final FrameLayout layout = (FrameLayout) activity.getWindow().getDecorView() .findViewById(android.R.id.content); RelativeLayout root = (RelativeLayout) findViewById(R.id.search_root); display.getSize(size); Resources r = getResources(); float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 96, r.getDisplayMetrics()); int cx = layout.getLeft() + layout.getRight(); int cy = layout.getTop(); int finalRadius = (int) Math.max(layout.getWidth()*1.5, px); SupportAnimator animator = ViewAnimationUtils.createCircularReveal( root, cx, cy, 0, finalRadius); animator.setInterpolator(new ReverseInterpolator()); animator.setDuration(500); animator.start(); animator.addListener(new SupportAnimator.AnimatorListener(){ @Override public void onAnimationStart() { } @Override public void onAnimationEnd() { setVisibility(View.GONE); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); }
Example 13
Source File: TooltipWindow.java From Twire with GNU General Public License v3.0 | 4 votes |
public void handleMessage(Message msg) { if (msg.what == MSG_DISMISS_TOOLTIP) { if (tipWindow != null && tipWindow.isShowing()) { if (revealTransition != null) { SupportAnimator hideAnim = revealTransition.reverse(); if (hideAnim != null) { hideAnim.setInterpolator(new AccelerateDecelerateInterpolator()); hideAnim.setDuration(REVEAL_DURATION); hideAnim.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { } @Override public void onAnimationEnd() { if (tipWindow != null) { tipWindow.dismiss(); } } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); hideAnim.start(); } else { if (tipWindow != null) { tipWindow.dismiss(); } } } else { tipWindow.dismiss(); } } } }
Example 14
Source File: LoginActivity.java From Twire with GNU General Public License v3.0 | 4 votes |
private void showReverseTransitionAnimation() { mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); if (transitionAnimationBlue != null && mTransitionViewBlue != null) { mTransitionViewBlue.setLayerType(View.LAYER_TYPE_HARDWARE, null); SupportAnimator blueReversed = transitionAnimationBlue.reverse(); blueReversed.setInterpolator(new AccelerateDecelerateInterpolator()); blueReversed.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewBlue.setVisibility(View.VISIBLE); mTransitionViewBlue.bringToFront(); } @Override public void onAnimationEnd() { Service.bringToBack(mTransitionViewBlue); mTransitionViewBlue.setVisibility(View.INVISIBLE); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); blueReversed.setDuration(REVEAL_ANIMATION_DURATION); blueReversed.start(); } final SupportAnimator whiteReversed = transitionAnimationWhite.reverse(); whiteReversed.setInterpolator(new AccelerateDecelerateInterpolator()); whiteReversed.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.setVisibility(View.VISIBLE); mTransitionViewWhite.bringToFront(); } @Override public void onAnimationEnd() { Service.bringToBack(mTransitionViewWhite); mTransitionViewBlue.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setVisibility(View.INVISIBLE); mContinueFABContainer.setClickable(true); mContinueFABContainer.setOnClickListener(v -> showTransitionAnimation()); mContinueIcon.bringToFront(); mContinueIcon.setVisibility(View.VISIBLE); getContinueIconAnimations(360).start(); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); whiteReversed.setDuration(REVEAL_ANIMATION_DURATION); new Handler().postDelayed(whiteReversed::start, REVEAL_ANIMATION_DELAY); hasTransitioned = false; }
Example 15
Source File: CreditCardView.java From CreditCardView with Apache License 2.0 | 4 votes |
public void showAnimation(final View cardContainer, final View v, final int drawableId) { final View mRevealView = v; mRevealView.setBackgroundResource(drawableId); if (mCurrentDrawable == drawableId) { return; } int duration = 1000; int cx = mRevealView.getLeft(); int cy = mRevealView.getTop(); int radius = Math.max(mRevealView.getWidth(), mRevealView.getHeight()) * 4; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRevealView, cx, cy, 0, radius); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(duration); new Handler().postDelayed(new Runnable() { @Override public void run() { cardContainer.setBackgroundResource(drawableId); } }, duration); mRevealView.setVisibility(View.VISIBLE); animator.start(); mCurrentDrawable = drawableId; } else { Animator anim = android.view.ViewAnimationUtils.createCircularReveal(mRevealView, cx, cy, 0, radius); mRevealView.setVisibility(View.VISIBLE); anim.setDuration(duration); anim.start(); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); cardContainer.setBackgroundResource(drawableId); } }); mCurrentDrawable = drawableId; } }
Example 16
Source File: TooltipWindow.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 4 votes |
public void handleMessage(android.os.Message msg) { switch (msg.what) { case MSG_DISMISS_TOOLTIP: if (tipWindow != null && tipWindow.isShowing()) { if (revealTransition != null) { SupportAnimator hideAnim = revealTransition.reverse(); if (hideAnim != null) { hideAnim.setInterpolator(new AccelerateDecelerateInterpolator()); hideAnim.setDuration(REVEAL_DURATION); hideAnim.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { } @Override public void onAnimationEnd() { if (tipWindow != null) { tipWindow.dismiss(); } } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); hideAnim.start(); } else { if (tipWindow != null) { tipWindow.dismiss(); } } } else { tipWindow.dismiss(); } } break; } }
Example 17
Source File: NotificationActivity.java From Twire with GNU General Public License v3.0 | 4 votes |
private void showReverseTransitionAnimation() { mTransitionViewBlue.setLayerType(View.LAYER_TYPE_HARDWARE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); SupportAnimator blueReversed = transitionAnimationBlue.reverse(); blueReversed.setInterpolator(new AccelerateDecelerateInterpolator()); blueReversed.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewBlue.setVisibility(View.VISIBLE); mTransitionViewBlue.bringToFront(); } @Override public void onAnimationEnd() { Service.bringToBack(mTransitionViewBlue); mTransitionViewBlue.setVisibility(View.INVISIBLE); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); blueReversed.setDuration(REVEAL_ANIMATION_DURATION); blueReversed.start(); final SupportAnimator whiteReversed = transitionAnimationWhite.reverse(); whiteReversed.setInterpolator(new AccelerateDecelerateInterpolator()); whiteReversed.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.setVisibility(View.VISIBLE); mTransitionViewWhite.bringToFront(); } @Override public void onAnimationEnd() { Service.bringToBack(mTransitionViewWhite); mTransitionViewBlue.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setVisibility(View.INVISIBLE); mContinueFABContainer.setClickable(true); mContinueIcon.bringToFront(); mContinueIcon.setVisibility(View.VISIBLE); showContinueIconAnimations(); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); whiteReversed.setDuration(REVEAL_ANIMATION_DURATION); whiteReversed.setStartDelay(REVEAL_ANIMATION_DELAY); whiteReversed.start(); }
Example 18
Source File: SearchBox.java From ExpressHelper with GNU General Public License v3.0 | 4 votes |
private void revealFrom(float x, float y, Activity a, SearchBox s) { Display display = a.getWindowManager().getDefaultDisplay(); Point size = new Point(); FrameLayout layout = (FrameLayout) a.getWindow().getDecorView() .findViewById(android.R.id.content); RelativeLayout root = (RelativeLayout) s.findViewById(R.id.search_root); display.getSize(size); Resources r = getResources(); float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 96, r.getDisplayMetrics()); int cx = layout.getLeft() + layout.getRight(); int cy = layout.getTop(); int finalRadius = (int) Math.max(layout.getWidth(), px); SupportAnimator animator = ViewAnimationUtils.createCircularReveal( root, cx, cy, 0, finalRadius); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(500); animator.addListener(new SupportAnimator.AnimatorListener(){ @Override public void onAnimationCancel() { } @Override public void onAnimationEnd() { toggleSearch(); } @Override public void onAnimationRepeat() { } @Override public void onAnimationStart() { } }); animator.start(); }
Example 19
Source File: PersistentSearchView.java From PersistentSearchView with Apache License 2.0 | 4 votes |
private void revealFrom(float x, float y, int desireRevealWidth) { Resources r = getResources(); float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 96, r.getDisplayMetrics()); if(desireRevealWidth <= 0) desireRevealWidth = getMeasuredWidth(); if(desireRevealWidth <= 0) { DisplayMetrics metrics = getResources().getDisplayMetrics(); desireRevealWidth = metrics.widthPixels; } if(x <= 0 ) x = desireRevealWidth - mCardHeight / 2; if(y <= 0) y = mCardHeight / 2; int measuredHeight = getMeasuredWidth(); int finalRadius = (int) Math.max(Math.max(measuredHeight, px), desireRevealWidth); SupportAnimator animator = ViewAnimationUtils.createCircularReveal( mSearchCardView, (int) x, (int) y, 0, finalRadius); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(DURATION_REVEAL_OPEN); animator.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationCancel() { } @Override public void onAnimationEnd() { // show search view here openSearchInternal(true); } @Override public void onAnimationRepeat() { } @Override public void onAnimationStart() { } }); animator.start(); }
Example 20
Source File: NotificationActivity.java From Twire with GNU General Public License v3.0 | 4 votes |
/** * Animations from here and down */ private SupportAnimator showSingleTransitionAnimation() { // Get the center for the FAB int cx = (int) mContinueFABContainer.getX() + mContinueFABContainer.getMeasuredHeight() / 2; int cy = (int) mContinueFABContainer.getY() + mContinueFABContainer.getMeasuredWidth() / 2; // get the final radius for the clipping circle int dx = Math.max(cx, mTransitionViewWhite.getWidth() - cx); int dy = Math.max(cy, mTransitionViewWhite.getHeight() - cy); float finalRadius = (float) Math.hypot(dx, dy); mTransitionViewBlue.setLayerType(View.LAYER_TYPE_HARDWARE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); final SupportAnimator whiteTransitionAnimation = ViewAnimationUtils.createCircularReveal(mTransitionViewWhite, cx, cy, 0, finalRadius); whiteTransitionAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); whiteTransitionAnimation.setDuration(REVEAL_ANIMATION_DURATION); whiteTransitionAnimation.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.bringToFront(); mTransitionViewWhite.setVisibility(View.VISIBLE); mContinueFABContainer.setClickable(false); if (mContinueIcon.getVisibility() == View.VISIBLE) { hideContinueIconAnimations(); } } @Override public void onAnimationEnd() { transitionAnimationWhite = whiteTransitionAnimation; } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); whiteTransitionAnimation.start(); return whiteTransitionAnimation; }