private void adaptAreaPadding() {
        if (areas != null) {
            boolean paddingTopApplied = false;
            Area previousArea = null;
            View previousView = null;
            int scrollViewPaddingTop = 0;
            int scrollViewMarginBottom = 0;
            Iterator<Map.Entry<Area, View>> iterator = areas.entrySet().iterator();

            while (iterator.hasNext()) {
                Map.Entry<Area, View> entry = iterator.next();
                Area area = entry.getKey();
                View view = entry.getValue();

                applyDialogPaddingLeft(area, view);
                applyDialogPaddingRight(area, view);

                if (!paddingTopApplied) {
                    paddingTopApplied = applyDialogPaddingTop(area, view);
                }

                if (!iterator.hasNext()) {
                    applyDialogPaddingBottom(area, view);
                }

                if (previousArea != null) {
                    if (area == Area.BUTTON_BAR) {
                        applyDialogPaddingBottom(previousArea, previousView);
                    }

                    Pair<Integer, Integer> pair = addViewSpacing(previousArea, previousView, area);
                    scrollViewPaddingTop += pair.first != null ? pair.first : 0;
                    scrollViewMarginBottom += pair.second != null ? pair.second : 0;
                }

                previousArea = area;
                previousView = view;
            }

            if (scrollView != null) {
                LinearLayout.LayoutParams layoutParams =
                        (LayoutParams) scrollView.getLayoutParams();
                layoutParams.bottomMargin = scrollViewMarginBottom;
                scrollView.setPadding(scrollView.getPaddingLeft(),
                        scrollView.getPaddingTop() + scrollViewPaddingTop,
                        scrollView.getPaddingRight(), scrollView.getPaddingBottom());
            }
        }
    }
private void adaptAreaPadding ( ) { if ( areas != null ) { boolean paddingTopApplied = false ; Area previousArea = null ; View previousView = null ; int scrollViewPaddingTop = 0 ; int scrollViewMarginBottom = 0 ; Iterator < Map . Entry < Area , View > > iterator = areas . entrySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { Map . Entry < Area , View > entry = iterator . next ( ) ; Area area = entry . getKey ( ) ; View view = entry . getValue ( ) ; applyDialogPaddingLeft ( area , view ) ; applyDialogPaddingRight ( area , view ) ; if ( ! paddingTopApplied ) { paddingTopApplied = applyDialogPaddingTop ( area , view ) ; } if ( ! iterator . hasNext ( ) ) { applyDialogPaddingBottom ( area , view ) ; } if ( previousArea != null ) { if ( area == Area . BUTTON_BAR ) { applyDialogPaddingBottom ( previousArea , previousView ) ; } Pair < Integer , Integer > pair = addViewSpacing ( previousArea , previousView , area ) ; scrollViewPaddingTop += pair . first != null ? pair . first : 0 ; scrollViewMarginBottom += pair . second != null ? pair . second : 0 ; } previousArea = area ; previousView = view ; } if ( scrollView != null ) { LinearLayout . LayoutParams layoutParams = ( LayoutParams ) scrollView . getLayoutParams ( ) ; layoutParams . bottomMargin = scrollViewMarginBottom ; scrollView . setPadding ( scrollView . getPaddingLeft ( ) , scrollView . getPaddingTop ( ) + scrollViewPaddingTop , scrollView . getPaddingRight ( ) , scrollView . getPaddingBottom ( ) ) ; } } }
Adapts the padding of the areas, which are contained by the dialog.