private void contractAnimationEnd() {
    mFab.setAlpha(1f);
    mFabExpandLayout.setAlpha(0f);

    mAnimatingFab = false;
    mFabExpandLayout.setVisibility(View.INVISIBLE);
    mFabExpandLayout.setAlpha(1f);
  }
  public void expandFab() {
    mFabType = FAB_EXPAND;
    mAnimatingFab = true;

    // Center point on the screen of the FAB.
    int x = (int) (centerX(mFab));
    int y = (int) (centerY(mFab));

    // Start and end radius of the sheet expand animation.
    float startRadius = getFabSizePx() / 2;
    float endRadius = calculateStartRadius(x, y);

    mFabExpandLayout.setAlpha(0f);
    mFabExpandLayout.setVisibility(View.VISIBLE);

    mFab.setVisibility(View.INVISIBLE);
    mFab.setTranslationX(0f);
    mFab.setTranslationY(0f);

    mFab.setAlpha(1f);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
      expandPreLollipop(x, y, startRadius, endRadius);
    } else {
      expandLollipop(x, y, startRadius, endRadius);
    }
  }
Exemple #3
0
  private void searchBarAnimation(
      final LinearLayout fadeoutElement, final LinearLayout fadeInElement) {

    fadeoutElement.setAlpha(1);
    fadeoutElement
        .animate()
        .setDuration(1000)
        .alpha(0)
        .setListener(
            new AnimatorListenerAdapter() {
              @Override
              public void onAnimationEnd(Animator animation) {
                fadeoutElement.setVisibility(View.GONE);
                fadeInElement.setVisibility(View.VISIBLE);
                fadeInElement.setAlpha(0);
                fadeInElement
                    .animate()
                    .setDuration(1000)
                    .alpha(1)
                    .setListener(
                        new AnimatorListenerAdapter() {
                          @Override
                          public void onAnimationEnd(Animator animation) {
                            fadeInElement.setVisibility(View.VISIBLE);
                          }
                        });
              }
            });
  }