final int getMinimumHeightForVisibleOverlappingContent(AppBarLayout bar) { int topInset = 0; int minHeight = ViewCompat.getMinimumHeight(bar); if (minHeight != 0) { return minHeight * 2 + topInset; } else { int childCount = bar.getChildCount(); return childCount >= 1 ? ViewCompat.getMinimumHeight(bar.getChildAt(childCount - 1)) * 2 + topInset : 0; } }
/** * Returns the amount of visible height in pixels used to define when to trigger a scrim * visibility change. * * @see #setScrimVisibleHeightTrigger(int) */ public int getScrimVisibleHeightTrigger() { if (mScrimVisibleHeightTrigger >= 0) { // If we have one explicitly set, return it return mScrimVisibleHeightTrigger; } // Otherwise we'll use the default computed value final int insetTop = mLastInsets != null ? mLastInsets.getSystemWindowInsetTop() : 0; final int minHeight = ViewCompat.getMinimumHeight(this); if (minHeight > 0) { // If we have a minHeight set, lets use 2 * minHeight (capped at our height) return Math.min((minHeight * 2) + insetTop, getHeight()); } // If we reach here then we don't have a min height set. Instead we'll take a // guess at 1/3 of our height being visible return getHeight() / 3; }
/** * Returns the amount of visible height in pixels used to define when to trigger a scrim * visibility change. * */ public int getScrimVisibleHeightTrigger() { if (mScrimVisibleHeightTrigger >= 0) { // If we have one explictly set, return it return mScrimVisibleHeightTrigger; } // Otherwise we'll use the default computed value final int insetTop = mLastInsets != null ? mLastInsets.getSystemWindowInsetTop() : 0; final int minHeight = ViewCompat.getMinimumHeight(this); if (minHeight > 0) { // If we have a minHeight set, lets use 2 * minHeight (capped at our height) return Math.min((minHeight * 2) + insetTop, getHeight()); } // If we reach here then we don't have a min height set. Instead we'll take a // guess at 1/3 of our height being visible return getHeight() / 3; }
/** * Returns the amount of visible height in pixels used to define when to trigger a scrim * visibility change. * * @see #setScrimVisibleHeightTrigger(int) */ public int getScrimVisibleHeightTrigger() { if (mScrimVisibleHeightTrigger >= 0) { // If we have one explicitly set, return it return mScrimVisibleHeightTrigger; } // Otherwise we'll use the default computed value final int insetTop = mLastInsets != null ? mLastInsets.getSystemWindowInsetTop() : 0; final int minHeight = ViewCompat.getMinimumHeight(this); if (minHeight > 0) { // If we have a minHeight set, lets use 2 * minHeight (capped at our height) return Math.min((minHeight * 2) + insetTop, getHeight()); } // If we reach here then we don't have a min height set. Instead we'll take a // guess at 1/3 of our height being visible return getHeight() / 3; }
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { int scrollArea = parent.getHeight() - bottomSheetBehavior.getPeekHeight(); float scrollPosition = (parent.getHeight() - dependency.getY() - bottomSheetBehavior.getPeekHeight()) / scrollArea; animateToolbarShiftIn(scrollArea, scrollPosition, ViewCompat.getMinimumHeight(toolbar), child); if(notifyScrollListener) { presenter.onImageStreamScrolled(parent.getHeight(), scrollArea, scrollPosition); } return true; }
int minimumHeight = ViewCompat.getMinimumHeight(child); if (measuredHeight > minimumHeight) { mHasMultiLineItems = true;
final int expandRange = getHeight() - ViewCompat.getMinimumHeight(GpCollapsingToolbar.this) - insetTop;
final int expandRange = getHeight() - ViewCompat.getMinimumHeight( CollapsingToolbarLayout.this) - insetTop; mCollapsingTextHelper.setExpansionFraction(
@Override public void onOffsetChanged(AppBarLayout layout, int verticalOffset) { mCurrentOffset = verticalOffset; final int insetTop = mLastInsets != null ? mLastInsets.getSystemWindowInsetTop() : 0; for (int i = 0, z = getChildCount(); i < z; i++) { final View child = getChildAt(i); final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final ViewOffsetHelper offsetHelper = getViewOffsetHelper(child); switch (lp.mCollapseMode) { case CollapsingTitleBarLayout.LayoutParams.COLLAPSE_MODE_PIN: offsetHelper.setTopAndBottomOffset(constrain(-verticalOffset, 0, getMaxOffsetForPinChild(child))); break; case CollapsingTitleBarLayout.LayoutParams.COLLAPSE_MODE_PARALLAX: offsetHelper.setTopAndBottomOffset( Math.round(-verticalOffset * lp.mParallaxMult)); break; } } // Show or hide the scrims if needed updateScrimVisibility(); if (mStatusBarScrim != null && insetTop > 0) { ViewCompat.postInvalidateOnAnimation(CollapsingTitleBarLayout.this); } // Update the collapsing text's fraction final int expandRange = getHeight() - ViewCompat.getMinimumHeight( CollapsingTitleBarLayout.this) - insetTop; mCollapsingTextHelper.setExpansionFraction( Math.abs(verticalOffset) / (float) expandRange); } }
} else { final int indicatorHeight = selectedDot.getMeasuredHeight(); final int minHeight = ViewCompat.getMinimumHeight(this); height = Math.max(minHeight, indicatorHeight + heightPadding);
} else { final int indicatorHeight = startDot.getMeasuredHeight(); final int minHeight = ViewCompat.getMinimumHeight(this); height = Math.max(minHeight, indicatorHeight + heightPadding);
final int expandRange = mCollapsingToolbar.getHeight() - ViewCompat.getMinimumHeight( mCollapsingToolbar) - insetTop; final float expansionFraction = Math.abs(mLastVerticalOffset) / (float) expandRange;
final int expandRange = getHeight() - ViewCompat.getMinimumHeight(CollapsibleToolbarHelper.this) - insetTop; ((CollapsibleTextLayout) child).setScrollOffsetFraction(Math.abs(verticalOffset) / (float) expandRange);