android.support.v4.view.animation.FastOutLinearInInterpolator Java Examples

The following examples show how to use android.support.v4.view.animation.FastOutLinearInInterpolator. 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: PaymentRequestUI.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #2
Source File: RadialTransformationActivity.java    From CircularReveal with MIT License 6 votes vote down vote up
@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;
}
 
Example #3
Source File: DrawerGradientActivity.java    From android-transition with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #4
Source File: HeaderView.java    From MyBlogDemo with Apache License 2.0 6 votes vote down vote up
/**
 * 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("");


}
 
Example #5
Source File: PaymentRequestUI.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #6
Source File: EditorDialog.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #7
Source File: SkittleContainer.java    From Skittles with MIT License 6 votes vote down vote up
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;
  }
}
 
Example #8
Source File: SegmentedButtonGroup.java    From SegmentedButton with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #9
Source File: PaymentRequestUI.java    From delion with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #10
Source File: QuizActivity.java    From android-topeka with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #11
Source File: BottomSheetLayout.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
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();
}
 
Example #12
Source File: RightViewHideShowAnimation.java    From v9porn with MIT License 5 votes vote down vote up
public RightViewHideShowAnimation(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 startX = toVisible ? getHideShowDelta(view) : 0;
    int endX = toVisible ? 0 : getHideShowDelta(view);
    TranslateAnimation translateAnimation = new TranslateAnimation(startX, endX, 0, 0);
    translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
    translateAnimation.setDuration(duration);


    //Adds the animations to the set
    addAnimation(alphaAnimation);
    addAnimation(translateAnimation);

    setAnimationListener(new Listener());
}
 
Example #13
Source File: MainActivity.java    From CircularReveal with MIT License 5 votes vote down vote up
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();
}
 
Example #14
Source File: CircleView.java    From AcDisplay with GNU General Public License v2.0 5 votes vote down vote up
private void startAnimatorBy(float from, float to, int duration) {
    cancelAndClearAnimator();
    // Animate the circle
    mAnimator = ObjectAnimator.ofFloat(this, RADIUS_PROPERTY, from, to);
    mAnimator.setInterpolator(new FastOutLinearInInterpolator());
    mAnimator.setDuration(duration);
    mAnimator.start();
}
 
Example #15
Source File: MainActivity.java    From music_player with Open Software License 3.0 5 votes vote down vote up
private void changeVisibility() {
    View music_info_cardView = findViewById(R.id.music_info_cardView);
    View control_layout = findViewById(R.id.control_layout);
    View seekbar_layout = findViewById(R.id.seekbar_layout);
    View lrcView = findViewById(R.id.other_lrc_view);
    View gradient = findViewById(R.id.gradient);
    View gradient_bottom = findViewById(R.id.gradient_bottom);
    View gradient_top = findViewById(R.id.gradient_top);
    TransitionManager.beginDelayedTransition(transitionsContainer, new TransitionSet().addTransition(new Fade()).setInterpolator(visible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator()));
    if (music_info_cardView.getVisibility() == VISIBLE) {
        music_info_cardView.setVisibility(GONE);
        control_layout.setVisibility(GONE);
        seekbar_layout.setVisibility(GONE);
        lrcView.setVisibility(VISIBLE);
        gradient.setVisibility(VISIBLE);
        gradient_bottom.setVisibility(VISIBLE);
        gradient_top.setVisibility(VISIBLE);
    } else {
        music_info_cardView.setVisibility(VISIBLE);
        control_layout.setVisibility(VISIBLE);
        seekbar_layout.setVisibility(VISIBLE);
        lrcView.setVisibility(GONE);
        gradient.setVisibility(GONE);
        gradient_bottom.setVisibility(GONE);
        gradient_top.setVisibility(GONE);
    }
    visible = !visible;
}
 
Example #16
Source File: ContainersLayout.java    From MaterialMasterDetail with Apache License 2.0 5 votes vote down vote up
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();
        }
    });
}
 
Example #17
Source File: TopViewHideShowAnimation.java    From ExoMedia with Apache License 2.0 5 votes vote down vote up
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());
}
 
Example #18
Source File: BottomViewHideShowAnimation.java    From ExoMedia with Apache License 2.0 5 votes vote down vote up
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());
}
 
Example #19
Source File: BottomSheetLayout.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
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();
}
 
Example #20
Source File: QuizFragment.java    From android-topeka with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #21
Source File: Utils.java    From ExpandableLayout with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example #22
Source File: FooterLayout.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
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();
}
 
Example #23
Source File: RadioRealButtonGroup.java    From RadioRealButton with Apache License 2.0 5 votes vote down vote up
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();
    }
}
 
Example #24
Source File: RightViewHideShowAnimation.java    From v9porn with MIT License 5 votes vote down vote up
public RightViewHideShowAnimation(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 startX = toVisible ? getHideShowDelta(view) : 0;
    int endX = toVisible ? 0 : getHideShowDelta(view);
    TranslateAnimation translateAnimation = new TranslateAnimation(startX, endX, 0, 0);
    translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
    translateAnimation.setDuration(duration);


    //Adds the animations to the set
    addAnimation(alphaAnimation);
    addAnimation(translateAnimation);

    setAnimationListener(new Listener());
}
 
Example #25
Source File: FooterLayout.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
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();
}
 
Example #26
Source File: MainActivity.java    From floatingMenu with Apache License 2.0 5 votes vote down vote up
private void initUi() {
    fab_1 = (FloatingMenuButton) findViewById(R.id.fab_1);
    fab_1.setStartAngle(0)
            .setEndAngle(360)
            .setRadius(200)
            .setAnimationType(AnimationType.EXPAND)
            .setMovementStyle(MovementStyle.STICKED_TO_SIDES);

    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)
            .setTransparentAfterMilliseconds(0)
            .setAnimationType(AnimationType.RADIAL)
            .setMovementStyle(MovementStyle.FREE);

    fab_2.getAnimationHandler()
            .setOpeningAnimationDuration(500)
            .setClosingAnimationDuration(200)
            .setLagBetweenItems(0)
            .setOpeningInterpolator(new FastOutSlowInInterpolator())
            .setClosingInterpolator(new FastOutLinearInInterpolator())
            .shouldFade(true)
            .shouldScale(true)
            .shouldRotate(false);

}
 
Example #27
Source File: AnimationHelper.java    From FABRevealMenu-master with Apache License 2.0 4 votes vote down vote up
public AnimationHelper(ViewHelper viewHelper) {
    this.viewHelper = viewHelper;
    fabAnimInterpolator = new AccelerateDecelerateInterpolator();
    revealAnimInterpolator = new FastOutLinearInInterpolator();
}