Java Code Examples for io.codetail.animation.SupportAnimator#start()

The following examples show how to use io.codetail.animation.SupportAnimator#start() . 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: 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 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: 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 4
Source File: MainActivity.java    From Jide-Note with MIT License 5 votes vote down vote up
/**
     * 切换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 5
Source File: PersistentSearchView.java    From PersistentSearchView with Apache License 2.0 5 votes vote down vote up
/***
 * 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 6
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 7
Source File: NotificationActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 4 votes vote down vote up
private SupportAnimator 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() {
			mTransitionViewBlue.setLayerType(View.LAYER_TYPE_NONE, null);
			mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null);
			transitionAnimationBlue = blueTransitionAnimation;
		}

		@Override
		public void onAnimationCancel() {

		}

		@Override
		public void onAnimationRepeat() {

		}
	});

	whiteTransitionAnimation.start();
	blueTransitionAnimation.setStartDelay(REVEAL_ANIMATION_DELAY);
	blueTransitionAnimation.start();

	return blueTransitionAnimation;
}
 
Example 8
Source File: PersistentSearchView.java    From PersistentSearchView with Apache License 2.0 4 votes vote down vote up
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 9
Source File: TooltipWindow.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 4 votes vote down vote up
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 10
Source File: SearchBox.java    From ExpressHelper with GNU General Public License v3.0 4 votes vote down vote up
/***
 * 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 11
Source File: LoginActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 4 votes vote down vote up
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(new View.OnClickListener() {
				@Override
				public void onClick(View 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(new Runnable() {
		@Override
		public void run() {
			whiteReversed.start();
		}
	}, REVEAL_ANIMATION_DELAY);
	hasTransitioned = false;
}
 
Example 12
Source File: LoginActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 13
Source File: LoginActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 4 votes vote down vote up
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 14
Source File: SearchBox.java    From NHentai-android with GNU General Public License v3.0 4 votes vote down vote up
private void revealFrom(float x, float y, Activity a, SearchBox s) {
	FrameLayout layout = (FrameLayout) a.getWindow().getDecorView()
			.findViewById(android.R.id.content);
	RelativeLayout root = (RelativeLayout) s.findViewById(R.id.search_root);
	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 15
Source File: SearchBox.java    From NHentai-android with GNU General Public License v3.0 4 votes vote down vote up
/***
 * Hide the searchbox using the circle animation. Can be called regardless of result list length
 * @param activity 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(250);
	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 16
Source File: TooltipWindow.java    From Twire with GNU General Public License v3.0 4 votes vote down vote up
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 17
Source File: CreditCardView.java    From CreditCardView with Apache License 2.0 4 votes vote down vote up
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 18
Source File: LoginActivity.java    From Twire with GNU General Public License v3.0 4 votes vote down vote up
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 19
Source File: NotificationActivity.java    From Twire with GNU General Public License v3.0 4 votes vote down vote up
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 20
Source File: NotificationActivity.java    From Twire with GNU General Public License v3.0 4 votes vote down vote up
private SupportAnimator 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() {
            mTransitionViewBlue.setLayerType(View.LAYER_TYPE_NONE, null);
            mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null);
            transitionAnimationBlue = blueTransitionAnimation;
        }

        @Override
        public void onAnimationCancel() {

        }

        @Override
        public void onAnimationRepeat() {

        }
    });

    whiteTransitionAnimation.start();
    blueTransitionAnimation.setStartDelay(REVEAL_ANIMATION_DELAY);
    blueTransitionAnimation.start();

    return blueTransitionAnimation;
}