private boolean updateSuggestionsSectionHeight ( List < ? extends SearchSuggestion > newSearchSuggestions , boolean withAnim ) { final int cardTopBottomShadowPadding = Util . dpToPx ( CARD_VIEW_CORNERS_AND_TOP_BOTTOM_SHADOW_HEIGHT ) ; final int cardRadiusSize = Util . dpToPx ( CARD_VIEW_TOP_BOTTOM_SHADOW_HEIGHT ) ; int visibleSuggestionHeight = calculateSuggestionItemsHeight ( newSearchSuggestions , mSuggestionListContainer . getHeight ( ) ) ; int diff = mSuggestionListContainer . getHeight ( ) - visibleSuggestionHeight ; int addedTranslationYForShadowOffsets = ( diff <= cardTopBottomShadowPadding ) ? - ( cardTopBottomShadowPadding - diff ) : diff < ( mSuggestionListContainer . getHeight ( ) - cardTopBottomShadowPadding ) ? cardRadiusSize : 0 ; final float newTranslationY = - mSuggestionListContainer . getHeight ( ) + visibleSuggestionHeight + addedTranslationYForShadowOffsets ; //todo go over final float fullyInvisibleTranslationY = - mSuggestionListContainer . getHeight ( ) + cardRadiusSize ; ViewCompat . animate ( mSuggestionListContainer ) . cancel ( ) ; if ( withAnim ) { ViewCompat . animate ( mSuggestionListContainer ) . setInterpolator ( SUGGEST_ITEM_ADD_ANIM_INTERPOLATOR ) . setDuration ( mSuggestionSectionAnimDuration ) . translationY ( newTranslationY ) . setUpdateListener ( new ViewPropertyAnimatorUpdateListener ( ) { @ Override public void onAnimationUpdate ( View view ) { if ( mOnSuggestionsListHeightChanged != null ) { float newSuggestionsHeight = Math . abs ( view . getTranslationY ( ) - fullyInvisibleTranslationY ) ; mOnSuggestionsListHeightChanged . onSuggestionsListHeightChanged ( newSuggestionsHeight ) ; } } } ) . setListener ( new ViewPropertyAnimatorListenerAdapter ( ) { @ Override public void onAnimationCancel ( View view ) { mSuggestionListContainer . setTranslationY ( newTranslationY ) ; } } ) . start ( ) ; } else { mSuggestionListContainer . setTranslationY ( newTranslationY ) ; if ( mOnSuggestionsListHeightChanged != null ) { float newSuggestionsHeight = Math . abs ( mSuggestionListContainer . getTranslationY ( ) - fullyInvisibleTranslationY ) ; mOnSuggestionsListHeightChanged . onSuggestionsListHeightChanged ( newSuggestionsHeight ) ; } } return mSuggestionListContainer . getHeight ( ) == visibleSuggestionHeight ; }
returns true if the suggestion items occupy the full RecyclerView s height false otherwise