com.mikepenz.materialdrawer.Drawer.getDrawerItems()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中com.mikepenz.materialdrawer.Drawer.getDrawerItems()方法的一些代码示例,展示了Drawer.getDrawerItems()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawer.getDrawerItems()方法的具体详情如下:
包路径:com.mikepenz.materialdrawer.Drawer
类名称:Drawer
方法名:getDrawerItems

Drawer.getDrawerItems介绍

[英]get all drawerItems of the current drawer
[中]获取当前抽屉的所有抽屉属性

代码示例

代码示例来源:origin: mikepenz/MaterialDrawer

/**
 * returns the found drawerItem by the given tag
 *
 * @param tag
 * @return
 */
public IDrawerItem getDrawerItem(Object tag) {
  return DrawerUtils.getDrawerItem(getDrawerItems(), tag);
}

代码示例来源:origin: mikepenz/MaterialDrawer

/**
 * returns always the original drawerItems and not the switched content
 *
 * @return
 */
private List<IDrawerItem> getDrawerItems() {
  return mDrawer.getOriginalDrawerItems() != null ? mDrawer.getOriginalDrawerItems() : mDrawer.getDrawerItems();
}

代码示例来源:origin: mikepenz/MaterialDrawer

originalDrawerState = getAdapter().saveInstanceState(new Bundle());
mDrawerBuilder.mExpandableExtension.collapse(false);
originalDrawerItems = getDrawerItems();

代码示例来源:origin: FreedomZZQ/YouJoin-Android

/**
 * init the cache with an initialized drawer
 *
 * @param drawer
 */
public void init(Drawer drawer) {
  if (drawer.getDrawerItems() != null) {
    init(drawer.getRecyclerView(), drawer.getDrawerItems().toArray(new IDrawerItem[drawer.getDrawerItems().size()]));
  }
}

代码示例来源:origin: FreedomZZQ/YouJoin-Android

/**
 * returns the found drawerItem by the given tag
 *
 * @param tag
 * @return
 */
public IDrawerItem getDrawerItem(Object tag) {
  return DrawerUtils.getDrawerItem(getDrawerItems(), tag);
}

代码示例来源:origin: FreedomZZQ/YouJoin-Android

/**
   * returns always the original drawerItems and not the switched content
   *
   * @return
   */
  private ArrayList<IDrawerItem> getDrawerItems() {
    return mDrawer.getOriginalDrawerItems() != null ? mDrawer.getOriginalDrawerItems() : mDrawer.getDrawerItems();
  }
}

代码示例来源:origin: schaal/ocreader

public void updateUnreadCount(Realm realm, boolean showOnlyUnread) {
  if(showOnlyUnread) {
    reload(realm, true);
  } else {
    for (IDrawerItem drawerItem : drawer.getDrawerItems()) {
      if (drawerItem instanceof Badgeable && drawerItem.getTag() instanceof TreeItem) {
        Badgeable badgeable = (Badgeable) drawerItem;
        Integer count = ((TreeItem) drawerItem.getTag()).getCount(realm);
        if (count <= 0) {
          updateBadge(badgeable, null);
        } else {
          updateBadge(badgeable, String.valueOf(count));
        }
      }
    }
  }
}

代码示例来源:origin: FreedomZZQ/YouJoin-Android

/**
 * method to switch the drawer content to new elements
 *
 * @param onDrawerItemClickListener
 * @param drawerItems
 * @param drawerSelection
 */
public void switchDrawerContent(@NonNull OnDrawerItemClickListener onDrawerItemClickListener, OnDrawerItemLongClickListener onDrawerItemLongClickListener, @NonNull ArrayList<IDrawerItem> drawerItems, int drawerSelection) {
  //just allow a single switched drawer
  if (!switchedDrawerContent()) {
    //save out previous values
    originalOnDrawerItemClickListener = getOnDrawerItemClickListener();
    originalOnDrawerItemLongClickListener = getOnDrawerItemLongClickListener();
    originalDrawerItems = getDrawerItems();
    originalDrawerSelection = getCurrentSelectedPosition();
  }
  //set the new items
  setOnDrawerItemClickListener(onDrawerItemClickListener);
  setOnDrawerItemLongClickListener(onDrawerItemLongClickListener);
  setItems(drawerItems, true);
  setSelectionAtPosition(drawerSelection, false);
  //hide stickyFooter and it's shadow
  if (getStickyFooter() != null) {
    getStickyFooter().setVisibility(View.GONE);
  }
  if (getStickyFooterShadow() != null) {
    getStickyFooterShadow().setVisibility(View.GONE);
  }
}

相关文章