public DisappearingAnimator(boolean removeDialog) { mIsDialogClosing = removeDialog; Animator sheetFader = ObjectAnimator.ofFloat( mRequestView, View.ALPHA, mRequestView.getAlpha(), 0f); Animator sheetTranslator = ObjectAnimator.ofFloat( mRequestView, View.TRANSLATION_Y, 0f, mAnimatorTranslation); AnimatorSet current = new AnimatorSet(); current.setDuration(DIALOG_EXIT_ANIMATION_MS); current.setInterpolator(new FastOutLinearInInterpolator()); if (mIsDialogClosing) { Animator scrimFader = ObjectAnimator.ofInt(mFullContainer.getBackground(), AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 127, 0); current.playTogether(sheetFader, sheetTranslator, scrimFader); } else { current.playTogether(sheetFader, sheetTranslator); } mSheetAnimator = current; mSheetAnimator.addListener(this); mSheetAnimator.start(); }
private void startAnimationExpand(int position, float startZ, float startY, float scaleX, float scaleY) { transitionAnimHiddenView = new TransitionAnimation(hiddenViews.get(position)); transitionAnimHiddenView.setInterpolator(new FastOutLinearInInterpolator()); transitionAnimHiddenView.startAnimation(startZ, 0, TransitionAnimation.AnimationType.TRANSLATION_Z); transitionAnimHiddenView.startAnimation(startY, 0, TransitionAnimation.AnimationType.TRANSLATION_Y); transitionAnimHiddenView.startAnimation(scaleX, valueHandler.getMaxScale(), TransitionAnimation.AnimationType.SCALE_X); transitionAnimHiddenView.startAnimation(scaleY, valueHandler.getMaxScale(), TransitionAnimation.AnimationType.SCALE_Y); }
private void initInterpolations() { ArrayList<Class> interpolatorList = new ArrayList<Class>() {{ add(FastOutSlowInInterpolator.class); add(BounceInterpolator.class); add(LinearInterpolator.class); add(DecelerateInterpolator.class); add(CycleInterpolator.class); add(AnticipateInterpolator.class); add(AccelerateDecelerateInterpolator.class); add(AccelerateInterpolator.class); add(AnticipateOvershootInterpolator.class); add(FastOutLinearInInterpolator.class); add(LinearOutSlowInInterpolator.class); add(OvershootInterpolator.class); }}; try { interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance(); } catch (Exception e) { e.printStackTrace(); } }
private ValueAnimator createBaseAfiAnimator(int current, int desired, float velocity, final View afiView) { int difference = Math.abs(desired - current); long duration = (long) (difference / velocity); final ValueAnimator valueAnimator = ValueAnimator.ofInt(current, desired); valueAnimator.setDuration(duration); valueAnimator.setInterpolator(new FastOutLinearInInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { afiView.getLayoutParams().height = (int) animation.getAnimatedValue(); afiView.requestLayout(); } }); return valueAnimator; }
/** * Collapse any view with a cool animation * * @param v */ public static void collapse(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; //a.setDuration((int)(initialHeight / v.getContext().getResources().getDisplayMetrics().density)); a.setDuration(300); a.setInterpolator(new FastOutLinearInInterpolator()); v.startAnimation(a); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void prepareCircularReveal(View startView, FrameLayout targetView) { int centerX = (startView.getLeft() + startView.getRight()) / 2; // Subtract the start view's height to adjust for relative coordinates on screen. int centerY = (startView.getTop() + startView.getBottom()) / 2 - startView.getHeight(); float endRadius = (float) Math.hypot(centerX, centerY); mCircularReveal = ViewAnimationUtils.createCircularReveal( targetView, centerX, centerY, startView.getWidth(), endRadius); mCircularReveal.setInterpolator(new FastOutLinearInInterpolator()); mCircularReveal.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mIcon.setVisibility(View.GONE); mCircularReveal.removeListener(this); } }); // Adding a color animation from the FAB's color to transparent creates a dissolve like // effect to the circular reveal. int accentColor = ContextCompat.getColor(this, mCategory.getTheme().getAccentColor()); mColorChange = ObjectAnimator.ofInt(targetView, ViewUtils.FOREGROUND_COLOR, accentColor, Color.TRANSPARENT); mColorChange.setEvaluator(new ArgbEvaluator()); mColorChange.setInterpolator(mInterpolator); }
@Override public boolean onSingleTapUp(MotionEvent e) { View nextView = getNext(); nextView.bringToFront(); nextView.setVisibility(View.VISIBLE); final float finalRadius = (float) Math.hypot(nextView.getWidth() / 2f, nextView.getHeight() / 2f) + hypo( nextView, e); Animator revealAnimator = ViewAnimationUtils.createCircularReveal(nextView, (int) e.getX(), (int) e.getY(), 0, finalRadius, View.LAYER_TYPE_HARDWARE); revealAnimator.setDuration(MainActivity.SLOW_DURATION); revealAnimator.setInterpolator(new FastOutLinearInInterpolator()); revealAnimator.start(); return true; }
@Test public void validateSetOfObjectAnimatorAlphaMotionTiming() { MotionSpec spec = MotionSpec.createFromResource( activityTestRule.getActivity(), R.animator.valid_set_of_object_animator_motion_spec); MotionTiming alpha = spec.getTiming("alpha"); assertEquals(3, alpha.getDelay()); assertEquals(5, alpha.getDuration()); if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { assertThat(alpha.getInterpolator(), instanceOf(PathInterpolator.class)); } else { assertThat(alpha.getInterpolator(), instanceOf(FastOutLinearInInterpolator.class)); } assertEquals(7, alpha.getRepeatCount()); assertEquals(ValueAnimator.RESTART, alpha.getRepeatMode()); }
private void launchCirclesAnimation() { circleTwo.setScaleX(0f); circleTwo.setScaleY(0f); circleThree.setScaleX(0f); circleThree.setScaleY(0f); ObjectAnimator animator = getCircleAnimation(circleOne, CIRCLE_ANIMATION_TIME); animator.setRepeatMode(ValueAnimator.RESTART); animator.setRepeatCount(ValueAnimator.INFINITE); animator.setInterpolator(new FastOutLinearInInterpolator()); animator.start(); ObjectAnimator animator2 = getCircleAnimation(circleTwo, CIRCLE_ANIMATION_TIME); animator2.setStartDelay(CIRCLE_ANIMATION_DELAY_ONE); animator2.setRepeatMode(ValueAnimator.RESTART); animator2.setRepeatCount(ValueAnimator.INFINITE); animator.setInterpolator(new BounceInterpolator()); animator2.start(); ObjectAnimator animator3 = getCircleAnimation(circleThree, CIRCLE_ANIMATION_TIME); animator3.setStartDelay(CIRCLE_ANIMATION_DELAY_TWO); animator3.setRepeatMode(ValueAnimator.RESTART); animator3.setRepeatCount(ValueAnimator.INFINITE); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator3.start(); }
public void executeTransition() { postponeEnterTransition(); final View decorView = getWindow().getDecorView(); getWindow().getDecorView().getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { decorView.getViewTreeObserver().removeOnPreDrawListener(this); supportStartPostponedEnterTransition(); return true; } }); MyTransition transition = new MyTransition(); transition.setPositionDuration(300); transition.setSizeDuration(300); transition.setPositionInterpolator(new FastOutLinearInInterpolator()); transition.setSizeInterpolator(new FastOutSlowInInterpolator()); transition.addTarget("message"); getWindow().setSharedElementEnterTransition(transition); }
/** * Animates the tooltip into view with a simple slide and fade animation, * then schedules the tooltip to automatically dismiss itself. * * @param onDismissListener A functor to call if the tooltip is dismissed without user intervention. */ private void animateInText(final @NonNull OnDismissListener onDismissListener) { final int overlap = getResources().getDimensionPixelSize(R.dimen.view_info_tooltip_overlap); animatorFor(text, animatorContext) .withInterpolator(new FastOutLinearInInterpolator()) .slideYAndFade(overlap, 0f, 0f, 1f) .addOnAnimationCompleted(new OnAnimationCompleted() { @Override public void onAnimationCompleted(boolean finished) { postDelayed(new Runnable() { @Override public void run() { if (Anime.isAnimating(text) || !isShown()) { return; } onDismissListener.onInfoTooltipDismissed(); dismiss(false); } }, VISIBLE_DURATION); } }) .start(); }
private void updateFabTranslationForSnackbar(CoordinatorLayout parent, SkittleContainer container, View snackbar) { float translationY = this.getFabTranslationYForSnackbar(parent, container); if ((translationY == -snackbar.getHeight())) { ViewCompat.animate(container) .translationY(-translationY) .setInterpolator(new FastOutLinearInInterpolator()) .setListener(null); } else if (translationY != this.mTranslationY) { ViewCompat.animate(container).cancel(); if (Math.abs(translationY - this.mTranslationY) == (float) snackbar.getHeight()) { ViewCompat.animate(container) .translationY(translationY) .setInterpolator(new FastOutLinearInInterpolator()) .setListener(null); } else { ViewCompat.setTranslationY(container, translationY); } this.mTranslationY = translationY; } }
private void dismissDialog() { if (mDialogInOutAnimator != null || !isShowing()) return; Animator dropDown = ObjectAnimator.ofFloat(mLayout, View.TRANSLATION_Y, 0f, mLayout.getHeight()); Animator fadeOut = ObjectAnimator.ofFloat(mLayout, View.ALPHA, mLayout.getAlpha(), 0f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(dropDown, fadeOut); mDialogInOutAnimator = animatorSet; mDialogInOutAnimator.setDuration(DIALOG_EXIT_ANIMATION_MS); mDialogInOutAnimator.setInterpolator(new FastOutLinearInInterpolator()); mDialogInOutAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mDialogInOutAnimator = null; dismiss(); } }); mDialogInOutAnimator.start(); }
/** * header view 完成更新后恢复初始状态 */ public void onHeaderRefreshComplete() { mHeaderState = PULL_TO_REFRESH; upAnimator = ValueAnimator.ofInt(getHeaderTopMargin(), -mHeaderViewHeight); upAnimator.setDuration(100); upAnimator.setInterpolator(new FastOutLinearInInterpolator()); upAnimator.start(); upAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { int value = (int) animation.getAnimatedValue(); setHeaderTopMargin(value); } }); mHeaderImageView.setVisibility(View.VISIBLE); mHeaderImageView.setImageResource(android.R.drawable.arrow_down_float); mHeaderTextView.setText(R.string.pull_to_refresh_pull_label); mHeaderProgressBar.setVisibility(View.GONE); if (mOnHeaderRefreshListener != null) { mOnHeaderRefreshListener.onHeaderRefreshFinished(); } // mHeaderUpdateTextView.setText(""); }
private void toggleSkittles(View child, int index) { int duration = 200; FastOutLinearInInterpolator interpolator = new FastOutLinearInInterpolator(); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(child, PropertyValuesHolder.ofFloat("Y", child.getY() + child.getMeasuredHeight() / 2, child.getY()), PropertyValuesHolder.ofFloat("alpha", 0, 1)) .setDuration(duration); animator.setInterpolator(interpolator); if (flag == 0) { animator.setStartDelay((skittleContainer.getChildCount() - index) * 15); Log.d("Skittle Layout", "Animation"); animator.start(); } else { animator.setStartDelay(index * 15); animator.addListener(this); animator.reverse(); } }
private void updateFabTranslationForSnackbar(CoordinatorLayout parent, SkittleContainer container, View snackbar) { float translationY = this.getFabTranslationYForSnackbar(parent, container); if ((translationY == -snackbar.getHeight())) { ViewCompat.animate(container).translationY(-translationY).setInterpolator(new FastOutLinearInInterpolator()).setListener(null); } else if (translationY != this.mTranslationY) { ViewCompat.animate(container).cancel(); if (Math.abs(translationY - this.mTranslationY) == (float) snackbar.getHeight()) { ViewCompat.animate(container).translationY(translationY).setInterpolator(new FastOutLinearInInterpolator()).setListener(null); } else { ViewCompat.setTranslationY(container, translationY); } this.mTranslationY = translationY; } }
private void hideList() { final FrameLayout layout = (FrameLayout) findViewById(R.id.activity_map_list_fragment_container); ObjectAnimator animator = new ObjectAnimator(); animator.setProperty(View.Y); animator.setTarget(layout); animator.setFloatValues(layout.getMeasuredHeight()); animator.setDuration(250); animator.setInterpolator(new FastOutLinearInInterpolator()); animator.start(); ObjectAnimator animator2 = new ObjectAnimator(); animator2.setProperty(View.ALPHA); animator2.setFloatValues(0f); animator2.setTarget(findViewById(R.id.activity_map_searchbox_background)); animator2.setDuration(250); animator2.setInterpolator(new LinearOutSlowInInterpolator()); animator2.start(); mListShowing = false; mSearchView.setDrawerIconState(true, true); }
public void updateTransition(View v) { mDrawerListenerAdapter.removeAllTransitions(); ViewTransitionBuilder builder = ViewTransitionBuilder.transit(mGradient).translationX(-mGradient.getWidth(), 0); switch (v.getId()) { case R.id.interpolator_default: break; case R.id.interpolator_linear: builder.interpolator(new LinearInterpolator()); break; case R.id.interpolator_accelerate: builder.interpolator(new AccelerateInterpolator()); break; case R.id.interpolator_decelerate: builder.interpolator(new DecelerateInterpolator()); break; case R.id.interpolator_fastout: builder.interpolator(new FastOutLinearInInterpolator()); break; case R.id.interpolator_anticipate: builder.interpolator(new AnticipateInterpolator()); break; } mDrawerListenerAdapter.addTransition(builder); }
void playLastBarExitAnimation() { if (mLastBarAnimationSet != null) { mLastBarAnimationSet.cancel(); } mLastDeleteButton.setEnabled(false); mLastDnfButton.setEnabled(false); mLastPlusTwoButton.setEnabled(false); ObjectAnimator exit = ObjectAnimator.ofFloat(mLastBarLinearLayout, View.TRANSLATION_Y, 0f); exit.setDuration(125); exit.setInterpolator(new FastOutLinearInInterpolator()); mLastBarAnimationSet = new AnimatorSet(); mLastBarAnimationSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); if (mLastBarLinearLayout.getTranslationY() == 0f) { mLastBarLinearLayout.setVisibility(View.GONE); } } }); mLastBarAnimationSet.play(exit); mLastBarAnimationSet.start(); }
private void animateOutFrameDetails() { ViewUtils.onLaidOut(frameDetails, new Runnable() { @Override public void run() { if (!frameDetails.isShown()) { return; } ObjectAnimator alpha = ObjectAnimator.ofFloat(frameDetails, View.ALPHA, 1f, 0f); ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, 0f, frameDetails.getHeight() * 0.3f); AnimatorSet set = new AnimatorSet(); set.playTogether(alpha, translate); set.setDuration(ANIM_DURATION); set.setInterpolator(new FastOutLinearInInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); frameDetails.setAlpha(1f); frameDetails.setTranslationY(0); frameDetails.setVisibility(View.GONE); } }); set.start(); } }); }
/** * Creates interpolator. * * @param interpolatorType * @return */ public static TimeInterpolator createInterpolator(@IntRange(from = 0, to = 10) final int interpolatorType) { switch (interpolatorType) { case ACCELERATE_DECELERATE_INTERPOLATOR: return new AccelerateDecelerateInterpolator(); case ACCELERATE_INTERPOLATOR: return new AccelerateInterpolator(); case ANTICIPATE_INTERPOLATOR: return new AnticipateInterpolator(); case ANTICIPATE_OVERSHOOT_INTERPOLATOR: return new AnticipateOvershootInterpolator(); case BOUNCE_INTERPOLATOR: return new BounceInterpolator(); case DECELERATE_INTERPOLATOR: return new DecelerateInterpolator(); case FAST_OUT_LINEAR_IN_INTERPOLATOR: return new FastOutLinearInInterpolator(); case FAST_OUT_SLOW_IN_INTERPOLATOR: return new FastOutSlowInInterpolator(); case LINEAR_INTERPOLATOR: return new LinearInterpolator(); case LINEAR_OUT_SLOW_IN_INTERPOLATOR: return new LinearOutSlowInInterpolator(); case OVERSHOOT_INTERPOLATOR: return new OvershootInterpolator(); default: return new LinearInterpolator(); } }
public void slideInFab() { if (mAnimatingFab) { return; } if (isFabExpanded()) { contractFab(); return; } ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) mFab.getLayoutParams(); float dy = mFab.getHeight() + lp.bottomMargin; if (mFab.getTranslationY() != dy) { return; } mAnimatingFab = true; mFab.setVisibility(View.VISIBLE); mFab.animate() .setStartDelay(0) .setDuration(200) .setInterpolator(new FastOutLinearInInterpolator()) .translationY(0f) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { super.onAnimationEnd(animation); mAnimatingFab = false; } }) .start(); }
public void slideOutFab() { if (mAnimatingFab) { return; } if (isFabExpanded()) { contractFab(); return; } ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) mFab.getLayoutParams(); if (mFab.getTranslationY() != 0f) { return; } mAnimatingFab = true; mFab.animate() .setStartDelay(0) .setDuration(200) .setInterpolator(new FastOutLinearInInterpolator()) .translationY(mFab.getHeight() + lp.bottomMargin) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { super.onAnimationEnd(animation); mAnimatingFab = false; mFab.setVisibility(View.INVISIBLE); } }) .start(); }
private void initUi(){ fab_1 = (FloatingMenuButton) findViewById(R.id.fab_1); fab_1.setStartAngle(0) .setEndAngle(360) .setAnimationType(AnimationType.EXPAND) .setAnchored(false); fab_1.getAnimationHandler() .setOpeningAnimationDuration(500) .setClosingAnimationDuration(200) .setLagBetweenItems(0) .setOpeningInterpolator(new FastOutSlowInInterpolator()) .setClosingInterpolator(new FastOutLinearInInterpolator()) .shouldFade(true) .shouldScale(true) .shouldRotate(false) ; fab_2 = (FloatingMenuButton) findViewById(R.id.fab_2); fab_2.setStartAngle(0) .setEndAngle(360) .setAnimationType(AnimationType.RADIAL) .setAnchored(false); fab_2.getAnimationHandler() .setOpeningAnimationDuration(500) .setClosingAnimationDuration(200) .setLagBetweenItems(0) .setOpeningInterpolator(new FastOutSlowInInterpolator()) .setClosingInterpolator(new FastOutLinearInInterpolator()) .shouldFade(true) .shouldScale(true) .shouldRotate(false) ; }
void endAnimationExpand(int progress) { setTransitionFirstViewZ(valueHandler.getCurrentZFirstView(progress), valueHandler.getMinZ(), new FastOutLinearInInterpolator()); moveViews(valueHandler.getYMovingViews(progress), 0, new FastOutLinearInInterpolator()); for (int i = 0; i < hiddenViews.size(); i++) { startAnimationExpand(i, valueHandler.getCurrentZView(progress, i), valueHandler.getMaxHeightHiddenView(i) - valueHandler.getCurrentYViewProgress(progress, i), valueHandler.getScaleXView(progress, i), valueHandler.getScaleYView(progress, i)); } }
/** * Creates interpolator. * @return a timeinterpolator * @param interpolatorType a int value from 0 to 10 */ public static TimeInterpolator createInterpolator( @IntRange(from = 0, to = 10) final int interpolatorType) { switch (interpolatorType) { case ACCELERATE_DECELERATE_INTERPOLATOR: return new AccelerateDecelerateInterpolator(); case ACCELERATE_INTERPOLATOR: return new AccelerateInterpolator(); case ANTICIPATE_INTERPOLATOR: return new AnticipateInterpolator(); case ANTICIPATE_OVERSHOOT_INTERPOLATOR: return new AnticipateOvershootInterpolator(); case BOUNCE_INTERPOLATOR: return new BounceInterpolator(); case DECELERATE_INTERPOLATOR: return new DecelerateInterpolator(); case FAST_OUT_LINEAR_IN_INTERPOLATOR: return new FastOutLinearInInterpolator(); case FAST_OUT_SLOW_IN_INTERPOLATOR: return new FastOutSlowInInterpolator(); case LINEAR_INTERPOLATOR: return new LinearInterpolator(); case LINEAR_OUT_SLOW_IN_INTERPOLATOR: return new LinearOutSlowInInterpolator(); case OVERSHOOT_INTERPOLATOR: return new OvershootInterpolator(); default: return new LinearInterpolator(); } }
@SuppressWarnings("ConstantConditions") private void setAvatarDrawable(AvatarView avatarView) { Player player = PreferencesHelper.getPlayer(getActivity()); avatarView.setAvatar(player.getAvatar().getDrawableId()); ViewCompat.animate(avatarView) .setInterpolator(new FastOutLinearInInterpolator()) .setStartDelay(500) .scaleX(1) .scaleY(1) .start(); }
private void executeCardsSequentialAnimation() { final int length = cardsLine.getChildCount(); cardsLine.setVisibility(View.VISIBLE); final Animator[] animators = new Animator[length]; for (int i = 0; i < length; i++) { View target = cardsLine.getChildAt(i); final float x0 = 0;// i == 0 ? 0 : -10 * (1 + i * 0.2f); final float y0 = 10 * i; target.setTranslationX(x0); target.setTranslationY(y0); AnimatorPath path = new AnimatorPath(); path.moveTo(x0, y0); path.lineTo(0, 0); PathPoint[] points = new PathPoint[path.getPoints().size()]; path.getPoints().toArray(points); AnimatorSet set = new AnimatorSet(); set.play(ObjectAnimator.ofObject(target, PATH_POINT, new PathEvaluator(), points)) .with(ObjectAnimator.ofFloat(target, View.ALPHA, 0.8f, 1f)); animators[i] = set; animators[i].setStartDelay(15 * i); } final AnimatorSet sequential = new AnimatorSet(); sequential.playTogether(animators); sequential.setInterpolator(new FastOutLinearInInterpolator()); sequential.setDuration(FAST_DURATION); sequential.start(); }
private void startMoleCreateState() { LogExt.i(getClass(), "startMoleCreateState"); addMole.animate() .scaleX(0) .scaleY(0) .setDuration(150) .setInterpolator(new FastOutLinearInInterpolator()) .withEndAction(() -> { addMole.setVisibility(View.GONE); addMoleContainer.animate().setDuration(150).translationY(0); }); zoneImage.setCurrentState(ZoneView.STATE_MOLE_CREATE); addMoleTitle.setText(R.string.zone_add_mole_hint_highlight); addMoleAction.setText(R.string.save); addMoleAction.setOnClickListener(v -> { Observable.from(zoneImage.getCreated()) .map(emptyMole -> ((Database) StorageAccess.getInstance() .getAppDatabase()).createMole(BodyZoneActivity.this, emptyMole, zone)) .compose(ObservableUtils.applyDefault()) .subscribe(mole -> { LogExt.d(BodyZoneActivity.class, "Saved new mole: " + mole.moleName); }, error -> { throw new OnErrorNotImplementedException(error); }, this :: fetchZone); startMoleSelectionState(); }); addMoleCancel.setVisibility(View.VISIBLE); }
private void initInterpolations() { Class[] interpolations = { FastOutSlowInInterpolator.class, BounceInterpolator.class, LinearInterpolator.class, DecelerateInterpolator.class, CycleInterpolator.class, AnticipateInterpolator.class, AccelerateDecelerateInterpolator.class, AccelerateInterpolator.class, AnticipateOvershootInterpolator.class, FastOutLinearInInterpolator.class, LinearOutSlowInInterpolator.class, OvershootInterpolator.class}; try { interpolatorText = (Interpolator) interpolations[animateTextsEnter].newInstance(); interpolatorDrawablesEnter = (Interpolator) interpolations[animateDrawablesEnter].newInstance(); interpolatorSelector = (Interpolator) interpolations[animateSelector].newInstance(); interpolatorTextExit = (Interpolator) interpolations[animateTextsExit].newInstance(); interpolatorDrawablesExit = (Interpolator) interpolations[animateDrawablesExit].newInstance(); } catch (Exception e) { e.printStackTrace(); } }
public TopViewHideShowAnimation(View view, boolean toVisible, long duration) { super(false); this.toVisible = toVisible; this.animationView = view; //Creates the Alpha animation for the transition float startAlpha = toVisible ? 0 : 1; float endAlpha = toVisible ? 1 : 0; AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha); alphaAnimation.setDuration(duration); //Creates the Translate animation for the transition int startY = toVisible ? -view.getHeight() : 0; int endY = toVisible ? 0 : -view.getHeight(); TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, startY, endY); translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator()); translateAnimation.setDuration(duration); //Adds the animations to the set addAnimation(alphaAnimation); addAnimation(translateAnimation); setAnimationListener(new Listener()); }
public BottomViewHideShowAnimation(View view, boolean toVisible, long duration) { super(false); this.toVisible = toVisible; this.animationView = view; //Creates the Alpha animation for the transition float startAlpha = toVisible ? 0 : 1; float endAlpha = toVisible ? 1 : 0; AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha); alphaAnimation.setDuration(duration); //Creates the Translate animation for the transition int startY = toVisible ? getHideShowDelta(view) : 0; int endY = toVisible ? 0 : getHideShowDelta(view); TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, startY, endY); translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator()); translateAnimation.setDuration(duration); //Adds the animations to the set addAnimation(alphaAnimation); addAnimation(translateAnimation); setAnimationListener(new Listener()); }