java类android.support.v4.view.animation.FastOutLinearInInterpolator的实例源码

PaymentRequestUI.java 文件源码 项目:chromium-for-android-56-debug-video 阅读 19 收藏 0 点赞 0 评论 0
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();
}
AnimationController.java 文件源码 项目:Sunstrike 阅读 20 收藏 0 点赞 0 评论 0
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);
}
SegmentedButtonGroup.java 文件源码 项目:SegmentedButton 阅读 37 收藏 0 点赞 0 评论 0
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();
    }
}
DetectType4CommandAdapter.java 文件源码 项目:TappyBLE 阅读 22 收藏 0 点赞 0 评论 0
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;
}
ExpandAnimationUtil.java 文件源码 项目:Colombo 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 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);
}
PaymentRequestUI.java 文件源码 项目:AndroidChromium 阅读 24 收藏 0 点赞 0 评论 0
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();
}
QuizActivity.java 文件源码 项目:android-topeka 阅读 22 收藏 0 点赞 0 评论 0
@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);
}
RadialTransformationActivity.java 文件源码 项目:CircleReveal 阅读 21 收藏 0 点赞 0 评论 0
@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;
}
MotionSpecTest.java 文件源码 项目:material-components-android 阅读 31 收藏 0 点赞 0 评论 0
@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());
}
PostAJobAnimatedView.java 文件源码 项目:android-complex-animation 阅读 27 收藏 0 点赞 0 评论 0
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();
}
MessageActivity.java 文件源码 项目:TransitionAnimator 阅读 29 收藏 0 点赞 0 评论 0
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);
}
InfoTooltipView.java 文件源码 项目:anime-android-go-99 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 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();
}
SkittleContainer.java 文件源码 项目:Skittles 阅读 22 收藏 0 点赞 0 评论 0
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;
  }
}
EditorDialog.java 文件源码 项目:365browser 阅读 28 收藏 0 点赞 0 评论 0
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();
}
PaymentRequestUI.java 文件源码 项目:365browser 阅读 25 收藏 0 点赞 0 评论 0
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();
}
HeaderView.java 文件源码 项目:MyBlogDemo 阅读 30 收藏 0 点赞 0 评论 0
/**
 * 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("");


}
SkittleLayout.java 文件源码 项目:binea_project_for_android 阅读 21 收藏 0 点赞 0 评论 0
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();
        }
    }
SkittleContainer.java 文件源码 项目:binea_project_for_android 阅读 21 收藏 0 点赞 0 评论 0
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;
    }

}
MapActivity.java 文件源码 项目:mvhs-app 阅读 25 收藏 0 点赞 0 评论 0
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);
}
DrawerGradientActivity.java 文件源码 项目:android-transition 阅读 25 收藏 0 点赞 0 评论 0
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);
}
CurrentSessionTimerFragment.java 文件源码 项目:plusTimer 阅读 100 收藏 0 点赞 0 评论 0
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();
}
ContainersLayout.java 文件源码 项目:MaterialMasterDetail 阅读 19 收藏 0 点赞 0 评论 0
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();
        }
    });
}
Utils.java 文件源码 项目:Farmacias 阅读 28 收藏 0 点赞 0 评论 0
/**
 * 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();
    }
}
BottomSheetLayout.java 文件源码 项目:Expert-Android-Programming 阅读 22 收藏 0 点赞 0 评论 0
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();
}
BottomSheetLayout.java 文件源码 项目:Expert-Android-Programming 阅读 22 收藏 0 点赞 0 评论 0
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();
}
FooterLayout.java 文件源码 项目:Expert-Android-Programming 阅读 21 收藏 0 点赞 0 评论 0
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();
}
FooterLayout.java 文件源码 项目:Expert-Android-Programming 阅读 21 收藏 0 点赞 0 评论 0
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();
}
MainActivity.java 文件源码 项目:floatingMenu 阅读 18 收藏 0 点赞 0 评论 0
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)
    ;

}
AnimationController.java 文件源码 项目:Sunstrike 阅读 26 收藏 0 点赞 0 评论 0
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));
    }
}
Utils.java 文件源码 项目:Tab_Navigator 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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();
  }
}


问题


面经


文章

微信
公众号

扫码关注公众号