コード例 #1
0
  private void fadeViews() {
    if (mFadeType == FADE_NONE) return;

    final float scrollFactor = mController.getScrollFactor();
    if ((mFadeType & FADE_LEFT) > 0 || mFadeType == FADE_BOTH) {
      final int fadeFactor = 0xff - (int) ((1f - scrollFactor) * mFadeMax);
      mLeftPaneLayout.setFadeFactor(fadeFactor);
    }
    if ((mFadeType & FADE_RIGHT) > 0 || mFadeType == FADE_BOTH) {
      final int fadeFactor = 0xff - (int) (scrollFactor * mFadeMax);
      mFadingRightPaneContainer.setFadeFactor(fadeFactor);
    }
  }
コード例 #2
0
  @Override
  protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
    final int width = MeasureSpec.getSize(widthMeasureSpec);

    final int childrenCount = getChildCount();
    for (int i = 0; i < childrenCount; ++i) {
      final View v = getChildAt(i);
      if (v == mLeftPaneLayout) {
        // setting size of actions according to spacing parameters
        mLeftPaneLayout.measure(
            MeasureSpec.makeMeasureSpec(width - mRightSpacing, MeasureSpec.EXACTLY),
            heightMeasureSpec);
      } else if (v == mRightPaneLayout) {
        final int shadowWidth = isShadowVisible() ? mShadowWidth : 0;
        final int contentWidth = MeasureSpec.getSize(widthMeasureSpec) - mLeftSpacing + shadowWidth;
        v.measure(
            MeasureSpec.makeMeasureSpec(contentWidth, MeasureSpec.EXACTLY), heightMeasureSpec);
      } else {
        v.measure(widthMeasureSpec, heightMeasureSpec);
      }
    }

    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  }