Changes the height of the layout for the buttons, according if the buttons are visible or not.
181303
private void updateButtonsLayout() {
		// Get the buttons layout.
		LinearLayout root = this.chooser.getRootLayout();
		LinearLayout buttonsLayout = (LinearLayout) root.findViewById(R.id.linearLayoutButtons);

		// Verify if the 'Add' button is visible or not.
		View addButton = root.findViewById(R.id.buttonAdd);
		addButton.setVisibility(this.canCreateFiles? View.VISIBLE : View.INVISIBLE);
		addButton.getLayoutParams().width = this.canCreateFiles? ViewGroup.LayoutParams.MATCH_PARENT : 0;

		// Verify if the 'Ok' button is visible or not.
		View okButton = root.findViewById(R.id.buttonOk);
		okButton.setVisibility(this.folderMode? View.VISIBLE : View.INVISIBLE);
		okButton.getLayoutParams().width = this.folderMode? ViewGroup.LayoutParams.MATCH_PARENT : 0;
		
		// If both buttons are invisible, hide the layout.
		ViewGroup.LayoutParams params = buttonsLayout.getLayoutParams();
		if(this.canCreateFiles || this.folderMode) {
			// Show the layout.
			params.height = ViewGroup.LayoutParams.WRAP_CONTENT;

			// If only the 'Ok' button is visible, put him first. Otherwise, put 'Add' first.
			buttonsLayout.removeAllViews();
			if(this.folderMode && !this.canCreateFiles) {
				buttonsLayout.addView(okButton);
				buttonsLayout.addView(addButton);
			} else {
				buttonsLayout.addView(addButton);			
				buttonsLayout.addView(okButton);
			}
		} else {
			// Hide the layout.
			params.height = 0;
		}
	}
771313
public void adaptHeightToChildren() {
        DividableGridAdapter adapter = (DividableGridAdapter) getAdapter();

        if (adapter != null) {
            int height = getPaddingTop() + getPaddingBottom();

            for (int i = 0; i < adapter.getCount(); i += adapter.getColumnCount()) {
                AbstractItem item = adapter.getItem(i);

                if (item instanceof Divider) {
                    height += getResources().getDimensionPixelSize(
                            TextUtils.isEmpty(item.getTitle()) ?
                                    R.dimen.bottom_sheet_divider_height :
                                    R.dimen.bottom_sheet_divider_title_height);
                } else {
                    height += getResources().getDimensionPixelSize(
                            adapter.getStyle() == BottomSheet.Style.GRID ?
                                    R.dimen.bottom_sheet_grid_item_size :
                                    R.dimen.bottom_sheet_list_item_height);
                }
            }

            ViewGroup.LayoutParams params = getLayoutParams();
            params.height = height;
            setLayoutParams(params);
            requestLayout();
        }
    }
969455
def set_button_visible(self, visible):
        
        self.button.setVisible(visible)
        left, top, right, bottom = self.getTextMargins()
        if visible:
            right = self._margin + self._spacing
        else:
            right = 0
        self.setTextMargins(left, top, right, bottom)
796566
def adjustSize(self):
        
        widget = self.centralWidget()
        if widget is None:
            super(XPopupWidget, self).adjustSize()
            return
        
        widget.adjustSize()
        hint = widget.minimumSizeHint()
        size = widget.minimumSize()
        
        width  = max(size.width(),  hint.width())
        height = max(size.height(), hint.height())
        
        width += 20
        height += 20
        
        if self._buttonBoxVisible:
            height += self.buttonBox().height() + 10
            
        if self._titleBarVisible:
            height += max(self._dialogButton.height(),
                          self._closeButton.height()) + 10
        
        curr_w = self.width()
        curr_h = self.height()
        
        # determine if we need to move based on our anchor
        anchor = self.anchor()
        if anchor & (self.Anchor.LeftBottom | self.Anchor.RightBottom | \
                       self.Anchor.BottomLeft | self.Anchor.BottomCenter | \
                       self.Anchor.BottomRight):
            delta_y = height - curr_h
        
        elif anchor & (self.Anchor.LeftCenter | self.Anchor.RightCenter):
            delta_y = (height - curr_h) / 2
        
        else:
            delta_y = 0
        
        if anchor & (self.Anchor.RightTop | self.Anchor.RightCenter | \
                       self.Anchor.RightTop | self.Anchor.TopRight):
            delta_x = width - curr_w
        
        elif anchor & (self.Anchor.TopCenter | self.Anchor.BottomCenter):
            delta_x = (width - curr_w) / 2
        
        else:
            delta_x = 0
        
        self.setMinimumSize(width, height)
        self.resize(width, height)
        
        pos = self.pos()
        pos.setX(pos.x() - delta_x)
        pos.setY(pos.y() - delta_y)
        
        self.move(pos)
1322215
protected void setHeight() {

        if (m_categoryField.getValuesSet() > 0) {
            m_height = (m_categoryField.getValuesSet() * 26) + 4;

            if (m_height > MAX_HEIGHT) {
                m_height = MAX_HEIGHT;
                m_categoryField.getScrollPanel().setResizable(true);
            } else {
                m_categoryField.getScrollPanel().setResizable(false);
            }
        } else {
            m_height = DEFAULT_HEIGHT;

            m_categoryField.getScrollPanel().setResizable(false);
        }

        m_categoryField.setHeight(m_height);

    }
64736
protected void setButtonVisibility() {

        Component tab = m_tab.getSelectedTab();
        int pos = m_tab.getTabPosition(m_tab.getTab(tab));
        //TODO: check if necessary (when it was finally known which tabs web ou users should see..
        int maxPos = m_isWebOU ? 3 : 3; //has to be changed if number of tabs is changed for web OU user
        m_next.setVisible(pos < maxPos);
        m_ok.setVisible(pos == maxPos);
    }
453540
private void adaptButtonBar() {
        if (buttonBarContainer != null) {
            inflateButtonBar();
            adaptPositiveButton();
            adaptNegativeButton();
            adaptNeutralButton();
            adaptButtonTextColor();
            adaptButtonTypeface();
            adaptButtonBarContainerVisibility();
            adaptButtonBarDividerVisibility();
        }
    }
211719
public void toggleButton(final boolean visible) {
        if (isFabShowing != visible) {
            isFabShowing = visible;
            int height = fab.getHeight();
            if (height == 0) {
                ViewTreeObserver vto = fab.getViewTreeObserver();
                if (vto.isAlive()) {
                    vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
                        @Override
                        public boolean onPreDraw() {
                            ViewTreeObserver currentVto = fab.getViewTreeObserver();
                            if (currentVto.isAlive()) {
                                currentVto.removeOnPreDrawListener(this);
                            }
                            toggleButton(visible);
                            return true;
                        }
                    });
                    return;
                }
            }
            int translationY = visible ? 0 : height;
            fab.animate().setInterpolator(interpolator)
                    .setDuration(350)
                    .translationY(translationY);

            // On pre-Honeycomb a translated view is still clickable, so we need to disable clicks manually
            fab.setClickable(visible);
        }
    }
175375
private void setViewsVisibility() {

		if (mSeekBar != null) {
			mSeekBar.setVisibility(View.VISIBLE);
		}

		if (mPlaybackTime != null) {
			mPlaybackTime.setVisibility(View.VISIBLE);
		}

		if (mRunTime != null) {
			mRunTime.setVisibility(View.VISIBLE);
		}

		if (mTotalTime != null) {
			mTotalTime.setVisibility(View.VISIBLE);
		}

		if (mPlayButton != null) {
			mPlayButton.setVisibility(View.VISIBLE);
		}

		if (mPauseButton != null) {
			mPauseButton.setVisibility(View.VISIBLE);
		}
	}
723198
private void adjustVisibleColumns() {

        if (m_table.isColumnCollapsingAllowed()) {
            if ((m_model.hasDefaultValues()) || m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
                m_table.setColumnCollapsed(TableProperty.DEFAULT, false);
            } else {
                m_table.setColumnCollapsed(TableProperty.DEFAULT, true);
            }

            if (((m_model.getEditMode().equals(EditMode.MASTER) || m_model.hasDescriptionValues()))
                || m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
                m_table.setColumnCollapsed(TableProperty.DESCRIPTION, false);
            } else {
                m_table.setColumnCollapsed(TableProperty.DESCRIPTION, true);
            }
        }
    }
425012
private void adaptButtonBarVisibility() {
        if (buttonBarContainer != null) {
            buttonBarContainer.setVisibility(buttonBarShown ? View.VISIBLE : View.GONE);
        }
    }
1041593
function (aButtons) {
			var iButtonsEnabled = this._getNumberOfEnabledButtons(aButtons);
			if (iButtonsEnabled !== 0) {
				this._hideDisabledButtons(aButtons);
			}

			this._iButtonsVisible = this._hideButtonsInOverflow(aButtons);
			if (this._iButtonsVisible === this.getMaxButtonsDisplayed() && this._iButtonsVisible !== aButtons.length) {
				this._replaceLastVisibleButtonWithOverflowButton(aButtons);
			} else if (iButtonsEnabled < aButtons.length - 1 && iButtonsEnabled !== 0) {
				this.addOverflowButton();
			}

			iButtonsEnabled = null;
		}
940067
private void adaptRootView() {
        if (rootView != null) {
            if (getStyle() == Style.LIST) {
                int paddingTop = getContext().getResources()
                        .getDimensionPixelSize(R.dimen.bottom_sheet_list_padding_top);
                rootView.setPadding(0, paddingTop, 0, 0);
            } else {
                int paddingTop = getContext().getResources()
                        .getDimensionPixelSize(R.dimen.bottom_sheet_grid_padding_top);
                rootView.setPadding(0, paddingTop, 0, 0);
            }
        }
    }
900054
private void setViewLayoutParams() {
        // Some extra margin to center other buttons in the center of the main button
        final int EXTRA_MARGIN = (int) (sWidth * (mainButtonSize - otherButtonSize) / 2);


        Log.d(TAG, "otherButton: " + otherButtonSize);
        Log.d(TAG, "mainButton: " + mainButtonSize);

        RelativeLayout.LayoutParams rParams = (LayoutParams) mCloseBtn.getLayoutParams();
        rParams.width = (int) (sWidth * otherButtonSize);
        rParams.height = (int) (sWidth * otherButtonSize);
        rParams.setMargins(0, 0, 0, (int) (sHeight * bottomPadding + EXTRA_MARGIN));

        rParams = (LayoutParams) mMidContainer.getLayoutParams();
        rParams.setMargins(0, 0, 0, (int) (sHeight * bottomPadding + EXTRA_MARGIN));
        rParams = (LayoutParams) mRightContainer.getLayoutParams();
        rParams.setMargins(0, 0, 0, (int) (sHeight * bottomPadding + EXTRA_MARGIN));
        rParams = (LayoutParams) mLeftContainer.getLayoutParams();
        rParams.setMargins(0, 0, 0, (int) (sHeight * bottomPadding + EXTRA_MARGIN));

        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mMidBtn.getLayoutParams();
        params.width = (int) (sWidth * otherButtonSize );
        params.height = (int) (sWidth * otherButtonSize );

        params = (LinearLayout.LayoutParams) mRightBtn.getLayoutParams();
        params.width = (int) (sWidth * otherButtonSize );
        params.height = (int) (sWidth * otherButtonSize);

        params = (LinearLayout.LayoutParams) mLeftBtn.getLayoutParams();
        params.width = (int) (sWidth * otherButtonSize );
        params.height = (int) (sWidth * otherButtonSize );
    }
1330771
public void updateLayout() {

        // TODO: we should not do this kind of things...
        if (!isAttached()) {
            return;
        }
        int floatBoxWidth = getFloatBoxWidth();
        m_primary.getElement().getStyle().setMarginLeft(floatBoxWidth, Unit.PX);
        updateVerticalMargin();
    }
1365133
private void adaptButtonBarContainerVisibility() {
        if (buttonBarContainer != null) {
            if (TextUtils.isEmpty(positiveButtonText) && TextUtils.isEmpty(neutralButtonText) &&
                    TextUtils.isEmpty(negativeButtonText)) {
                buttonBarContainer.setVisibility(View.GONE);
            } else {
                buttonBarContainer.setVisibility(View.VISIBLE);
            }
        }
    }
789601
function updateScrollButtonVisibility(hideAll) {
		if (hideAll && this._topScrollButton && this._bottomScrollButton) {
			this._topScrollButton.style.display = "none";
			this._bottomScrollButton.style.display = "none";	
		}
		else if (!hideAll) {
			if (this._dropdownNode.scrollTop > 0) {
				this._topScrollButton.style.display = "block";
			} 
			else {
				this._topScrollButton.style.display = "none";
			}	
			if (this._dropdownNode.scrollHeight > this._dropdownNode.scrollTop + this._dropdownNode.offsetHeight) {
				this._bottomScrollButton.style.display = "block";
			}	 
			else {
				this._bottomScrollButton.style.display = "none";
			}
		}
	}