private void toolbarAnimateHide() {
   tToolbar
       .animate()
       .translationY(-tToolbar.getHeight())
       .setInterpolator(new LinearInterpolator())
       .setDuration(180)
       .setListener(
           new AnimatorListenerAdapter() {
             @Override
             public void onAnimationEnd(Animator animation) {
               toolbarSetElevation(0);
             }
           });
 }
 private void toolbarAnimateShow(final int verticalOffset) {
   tToolbar
       .animate()
       .translationY(0)
       .setInterpolator(new LinearInterpolator())
       .setDuration(180)
       .setListener(
           new AnimatorListenerAdapter() {
             @Override
             public void onAnimationStart(Animator animation) {
               toolbarSetElevation(verticalOffset == 0 ? 0 : TOOLBAR_ELEVATION);
             }
           });
 }
  private void hideViews() {
    mToolbar
        .animate()
        .translationY(-mToolbar.getHeight())
        .setInterpolator(new AccelerateInterpolator(2));

    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mFabButton.getLayoutParams();
    int fabBottomMargin = lp.bottomMargin;
    mFabButton
        .animate()
        .translationY(mFabButton.getHeight() + fabBottomMargin)
        .setInterpolator(new AccelerateInterpolator(2))
        .start();
  }
Ejemplo n.º 4
0
    @Override
    protected void onPostExecute(Void v) {
      mPager.setAdapter(mPagerAdapter);
      mPagerAdapter.notifyDataSetChanged();
      mPager.setCurrentItem(sFavoriteIndex);

      if (PrefHelper.subtitleEnabled() && MainActivity.sCurrentFragment == R.id.nav_favorites) {
        mActionBar.setSubtitle(String.valueOf(sFavorites[sFavoriteIndex]));
      }

      Toolbar toolbar = ((MainActivity) getActivity()).toolbar;
      if (toolbar.getAlpha() == 0) {
        toolbar.setTranslationY(-300);
        toolbar.animate().setDuration(300).translationY(0).alpha(1);
        View view;
        for (int i = 0; i < toolbar.getChildCount(); i++) {
          view = toolbar.getChildAt(i);
          view.setTranslationY(-300);
          view.animate().setStartDelay(50 * (i + 1)).setDuration(70 * (i + 1)).translationY(0);
        }
      }
    }
 private void showViews() {
   mToolbar.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2));
   mFabButton.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
 }