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

The following examples show how to use io.codetail.animation.SupportAnimator#setInterpolator() . 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 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 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 appearRed() {
    mRed.setVisibility(View.VISIBLE);

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

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, 0, mRed.getWidth() / 2);
    animator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd() {
            upRed();
        }
    });
    animator.setInterpolator(ACCELERATE);
    animator.start();
}
 
Example 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: 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 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: 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 8
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 9
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 10
Source File: LoginActivity.java    From Twire 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(() -> {
        Log.d(LOG_TAG, "Navigating to NotificationActivity");
        navigateToNotificationActivity();
    }, REVEAL_ANIMATION_DELAY + REVEAL_ANIMATION_DURATION);
}
 
Example 11
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 12
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 13
Source File: ConfirmSetupActivity.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);

	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(new Runnable() {
		@Override
		public void run() {
			blueTransitionAnimation.start();
		}
	}, REVEAL_ANIMATION_DELAY);

	return blueTransitionAnimation;
}
 
Example 14
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;
}
 
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: 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 17
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 18
Source File: WelcomeActivity.java    From Pocket-Plays-for-Twitch 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(new Runnable() {
			@Override
			public void run() {
				whiteReversed.start();
			}
		}, REVEAL_ANIMATION_DELAY_DURATION);
		hasTransitioned = false;
	}
}
 
Example 19
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 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;
}