/** * Updates this floating toolbar to reflect recent position and view updates. NOTE: This method is * a no-op if the toolbar isn't showing. */ public FloatingToolbar updateLayout() { if (mPopup.isShowing()) { // show() performs all the logic we need here. show(); } return this; }
/** Shows this floating toolbar. */ public FloatingToolbar show() { List<MenuItem> menuItems = getVisibleAndEnabledMenuItems(mMenu); if (!isCurrentlyShowing(menuItems) || mWidthChanged) { mPopup.dismiss(); mPopup.layoutMenuItems(menuItems, mMenuItemClickListener, mSuggestedWidth); mShowingTitles = getMenuItemTitles(menuItems); } refreshCoordinates(); mPopup.setOverflowDirection(mOverflowDirection); mPopup.updateCoordinates(mCoordinates.x, mCoordinates.y); if (!mPopup.isShowing()) { mPopup.show(mCoordinates.x, mCoordinates.y); } mWidthChanged = false; return this; }
/** Returns {@code true} if this toolbar is currently showing. {@code false} otherwise. */ public boolean isShowing() { return mPopup.isShowing(); }