private void addAreas ( ) { if ( areas != null ) { removeAllViews ( ) ; scrollView = null ; topDivider = null ; bottomDivider = null ; Area previousArea = null ; boolean canAddTopDivider = false ; for ( Map . Entry < Area , View > entry : areas . entrySet ( ) ) { Area area = entry . getKey ( ) ; View view = entry . getValue ( ) ; if ( scrollableArea . isScrollable ( area ) ) { if ( topDivider == null && canAddTopDivider && ! scrollableArea . isScrollable ( previousArea ) ) { topDivider = addDivider ( ) ; } inflateScrollView ( scrollableArea ) ; ViewGroup scrollContainer = scrollView . getChildCount ( ) > 0 ? ( ViewGroup ) scrollView . getChildAt ( 0 ) : scrollView ; view . getViewTreeObserver ( ) . addOnGlobalLayoutListener ( createScrollViewChildLayoutListener ( ) ) ; scrollContainer . addView ( view ) ; } else { if ( bottomDivider == null && previousArea != null && scrollableArea . getBottomScrollableArea ( ) != null && scrollableArea . getBottomScrollableArea ( ) . getIndex ( ) < area . getIndex ( ) && view . getVisibility ( ) == View . VISIBLE && area != Area . BUTTON_BAR ) { bottomDivider = addDivider ( ) ; } addView ( view ) ; } canAddTopDivider |= area != Area . HEADER && view . getVisibility ( ) == View . VISIBLE ; previousArea = area ; } adaptAreaPadding ( ) ; findListView ( ) ; } }
Adds the areas which are contained by the dialog to the root view .