Esempio n. 1
0
  private void dispatchPresenterUpdate(boolean cleared) {
    if (mPresenters.isEmpty()) return;

    stopDispatchingItemsChanged();
    for (WeakReference<MenuPresenter> ref : mPresenters) {
      final MenuPresenter presenter = ref.get();
      if (presenter == null) {
        mPresenters.remove(ref);
      } else {
        presenter.updateMenuView(cleared);
      }
    }
    startDispatchingItemsChanged();
  }
Esempio n. 2
0
  public boolean collapseItemActionView(MenuItemImpl item) {
    if (mPresenters.isEmpty() || mExpandedItem != item) return false;

    boolean collapsed = false;

    stopDispatchingItemsChanged();
    for (WeakReference<MenuPresenter> ref : mPresenters) {
      final MenuPresenter presenter = ref.get();
      if (presenter == null) {
        mPresenters.remove(ref);
      } else if ((collapsed = presenter.collapseItemActionView(this, item))) {
        break;
      }
    }
    startDispatchingItemsChanged();

    if (collapsed) {
      mExpandedItem = null;
    }
    return collapsed;
  }