use of com.ramotion.paperonboarding.listeners.AnimatorEndListener in project paper-onboarding-android by Ramotion.
the class PaperOnboardingEngine method createBGAnimatorSet.
/**
* @param color new background color for new
* @return animator set with background color circular reveal animation
*/
protected AnimatorSet createBGAnimatorSet(final int color) {
final View bgColorView = new ImageView(mAppContext);
bgColorView.setLayoutParams(new RelativeLayout.LayoutParams(mRootLayout.getWidth(), mRootLayout.getHeight()));
bgColorView.setBackgroundColor(color);
mBackgroundContainer.addView(bgColorView);
int[] pos = calculateCurrentCenterCoordinatesOfPagerElement(mActiveElementIndex);
float finalRadius = mRootLayout.getWidth() > mRootLayout.getHeight() ? mRootLayout.getWidth() : mRootLayout.getHeight();
AnimatorSet bgAnimSet = new AnimatorSet();
Animator fadeIn = ObjectAnimator.ofFloat(bgColorView, "alpha", 0, 1);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Animator circularReveal = ViewAnimationUtils.createCircularReveal(bgColorView, pos[0], pos[1], 0, finalRadius);
circularReveal.setInterpolator(new AccelerateInterpolator());
bgAnimSet.playTogether(circularReveal, fadeIn);
} else {
bgAnimSet.playTogether(fadeIn);
}
bgAnimSet.setDuration(ANIM_BACKGROUND_TIME);
bgAnimSet.addListener(new AnimatorEndListener() {
@Override
public void onAnimationEnd(Animator animation) {
mRootLayout.setBackgroundColor(color);
bgColorView.setVisibility(View.GONE);
mBackgroundContainer.removeView(bgColorView);
}
});
return bgAnimSet;
}
use of com.ramotion.paperonboarding.listeners.AnimatorEndListener in project paper-onboarding-android by Ramotion.
the class PaperOnboardingEngine method createContentIconShowAnimation.
/**
* @param currentContentIcon currently displayed view with icon
* @param newContentIcon newly created and prepared view to display
* @return animator set with this animation
*/
protected AnimatorSet createContentIconShowAnimation(final View currentContentIcon, final View newContentIcon) {
int positionDeltaPx = dpToPixels(CONTENT_ICON_POS_DELTA_Y_DP);
AnimatorSet animations = new AnimatorSet();
Animator currentContentMoveUp = ObjectAnimator.ofFloat(currentContentIcon, "y", 0, -positionDeltaPx);
currentContentMoveUp.setDuration(ANIM_CONTENT_ICON_HIDE_TIME);
currentContentMoveUp.addListener(new AnimatorEndListener() {
@Override
public void onAnimationEnd(Animator animation) {
mContentIconContainer.removeView(currentContentIcon);
}
});
Animator currentContentFadeOut = ObjectAnimator.ofFloat(currentContentIcon, "alpha", 1, 0);
currentContentFadeOut.setDuration(ANIM_CONTENT_ICON_HIDE_TIME);
animations.playTogether(currentContentMoveUp, currentContentFadeOut);
Animator newContentMoveUp = ObjectAnimator.ofFloat(newContentIcon, "y", positionDeltaPx, 0);
newContentMoveUp.setDuration(ANIM_CONTENT_ICON_SHOW_TIME);
Animator newContentFadeIn = ObjectAnimator.ofFloat(newContentIcon, "alpha", 0, 1);
newContentFadeIn.setDuration(ANIM_CONTENT_ICON_SHOW_TIME);
animations.playTogether(newContentMoveUp, newContentFadeIn);
animations.setInterpolator(new DecelerateInterpolator());
return animations;
}
use of com.ramotion.paperonboarding.listeners.AnimatorEndListener in project paper-onboarding-android by Ramotion.
the class PaperOnboardingEngine method createContentTextShowAnimation.
/**
* @param currentContentText currently displayed view with text
* @param newContentText newly created and prepared view to display
* @return animator set with this animation
*/
private AnimatorSet createContentTextShowAnimation(final View currentContentText, final View newContentText) {
int positionDeltaPx = dpToPixels(CONTENT_TEXT_POS_DELTA_Y_DP);
AnimatorSet animations = new AnimatorSet();
Animator currentContentMoveUp = ObjectAnimator.ofFloat(currentContentText, "y", 0, -positionDeltaPx);
currentContentMoveUp.setDuration(ANIM_CONTENT_TEXT_HIDE_TIME);
currentContentMoveUp.addListener(new AnimatorEndListener() {
@Override
public void onAnimationEnd(Animator animation) {
mContentTextContainer.removeView(currentContentText);
}
});
Animator currentContentFadeOut = ObjectAnimator.ofFloat(currentContentText, "alpha", 1, 0);
currentContentFadeOut.setDuration(ANIM_CONTENT_TEXT_HIDE_TIME);
animations.playTogether(currentContentMoveUp, currentContentFadeOut);
Animator newContentMoveUp = ObjectAnimator.ofFloat(newContentText, "y", positionDeltaPx, 0);
newContentMoveUp.setDuration(ANIM_CONTENT_TEXT_SHOW_TIME);
Animator newContentFadeIn = ObjectAnimator.ofFloat(newContentText, "alpha", 0, 1);
newContentFadeIn.setDuration(ANIM_CONTENT_TEXT_SHOW_TIME);
animations.playTogether(newContentMoveUp, newContentFadeIn);
animations.setInterpolator(new DecelerateInterpolator());
return animations;
}
Aggregations