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

The following examples show how to use io.codetail.animation.SupportAnimator#addListener() . 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: 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 2
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 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: 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 5
Source File: NotificationActivity.java    From Twire with GNU General Public License v3.0 5 votes vote down vote up
private void showSingleReverseTransitionAnimation() {
    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.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);
    new Handler().postDelayed(whiteReversed::start, REVEAL_ANIMATION_DELAY);
}
 
Example 6
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 7
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 8
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 9
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 10
Source File: FabToolbar.java    From fab-toolbar with MIT License 5 votes vote down vote up
private void animateCircle(float startRadius, float endRadius, SupportAnimator.AnimatorListener listener) {
	int cx = (button.getLeft() + button.getRight()) / 2;
	int cy = (button.getTop() + button.getBottom()) / 2;

	SupportAnimator animator =
			ViewAnimationUtils.createCircularReveal(container, cx, cy, startRadius, endRadius);
	animator.setInterpolator(new AccelerateDecelerateInterpolator());
	animator.setDuration(animationDuration);
	if (listener != null) {
		animator.addListener(listener);
	}
	animator.start();
}
 
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 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 12
Source File: ConfirmSetupActivity.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);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        mTransitionViewWhite.isAttachedToWindow();
    }

    final SupportAnimator blueTransitionAnimation =
            ViewAnimationUtils.createCircularReveal(mTransitionViewWhite, cx, cy, 0, finalRadius);
    blueTransitionAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    blueTransitionAnimation.setDuration(REVEAL_ANIMATION_DURATION);
    blueTransitionAnimation.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            //mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            mTransitionViewWhite.setVisibility(View.VISIBLE);
            mTransitionViewWhite.bringToFront();
            mContinueFABShadow.bringToFront();
            mContinueFAB.bringToFront();
        }

        @Override
        public void onAnimationEnd() {
            //mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null);
        }

        @Override
        public void onAnimationCancel() {

        }

        @Override
        public void onAnimationRepeat() {

        }
    });

    new Handler().postDelayed(blueTransitionAnimation::start, REVEAL_ANIMATION_DELAY);

    return blueTransitionAnimation;
}
 
Example 13
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 14
Source File: NotificationActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 4 votes vote down vote up
private SupportAnimator showSingleReverseTransitionAnimation() {
	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.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);
	return whiteReversed;
}
 
Example 15
Source File: NotificationActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 4 votes vote down vote up
/** 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;
	}
 
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: 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 18
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 19
Source File: WelcomeActivity.java    From Twire with GNU General Public License v3.0 4 votes vote down vote up
@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(whiteReversed::start, REVEAL_ANIMATION_DELAY_DURATION);
        hasTransitioned = false;
    }
}
 
Example 20
Source File: NotificationActivity.java    From Twire with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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;
}