Пример #1
0
 public void setContentHeight(int height) {
   mContentHeight = height;
   if (mMenuView != null) {
     mMenuView.setMaxItemHeight(mContentHeight);
   }
   requestLayout();
 }
Пример #2
0
 public void animateToVisibility(int visibility) {
   if (mVisibilityAnim != null) {
     mVisibilityAnim.cancel();
   }
   if (visibility == VISIBLE) {
     if (getVisibility() != VISIBLE) {
       setAlpha(0);
       if (mSplitView != null && mMenuView != null) {
         mMenuView.setAlpha(0);
       }
     }
     ObjectAnimator anim = ObjectAnimator.ofFloat(this, "alpha", 1);
     anim.setDuration(FADE_DURATION);
     anim.setInterpolator(sAlphaInterpolator);
     if (mSplitView != null && mMenuView != null) {
       AnimatorSet set = new AnimatorSet();
       ObjectAnimator splitAnim = ObjectAnimator.ofFloat(mMenuView, "alpha", 1);
       splitAnim.setDuration(FADE_DURATION);
       set.addListener(mVisAnimListener.withFinalVisibility(visibility));
       set.play(anim).with(splitAnim);
       set.start();
     } else {
       anim.addListener(mVisAnimListener.withFinalVisibility(visibility));
       anim.start();
     }
   } else {
     ObjectAnimator anim = ObjectAnimator.ofFloat(this, "alpha", 0);
     anim.setDuration(FADE_DURATION);
     anim.setInterpolator(sAlphaInterpolator);
     if (mSplitView != null && mMenuView != null) {
       AnimatorSet set = new AnimatorSet();
       ObjectAnimator splitAnim = ObjectAnimator.ofFloat(mMenuView, "alpha", 0);
       splitAnim.setDuration(FADE_DURATION);
       set.addListener(mVisAnimListener.withFinalVisibility(visibility));
       set.play(anim).with(splitAnim);
       set.start();
     } else {
       anim.addListener(mVisAnimListener.withFinalVisibility(visibility));
       anim.start();
     }
   }
 }