PrimaryDrawerItem pdi = new PrimaryDrawerItem() .withName(font.getFontName()) .withBadge("" + font.getIcons().size()) .withDescription(TextUtils.isEmpty(font.getAuthor()) ? font.getVersion() : font.getVersion() + " - " + font.getAuthor()) .withBadgeStyle(
.withSavedInstance(savedInstanceState) .addDrawerItems( new PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home).withBadge("99").withIdentifier(1), new PrimaryDrawerItem().withName(R.string.drawer_item_free_play).withIcon(FontAwesome.Icon.faw_gamepad), new PrimaryDrawerItem().withName(R.string.drawer_item_custom).withIcon(FontAwesome.Icon.faw_eye).withBadge("6").withIdentifier(2), new SectionDrawerItem().withName(R.string.drawer_item_section_header), new SecondaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog),
new PrimaryDrawerItem().withName(R.string.drawer_item_action_bar_drawer).withIcon(FontAwesome.Icon.faw_home).withBadge("22").withBadgeStyle(new BadgeStyle(Color.RED, Color.RED)).withIdentifier(2), new PrimaryDrawerItem().withName(R.string.drawer_item_multi_drawer).withIcon(FontAwesome.Icon.faw_gamepad).withIdentifier(3), new PrimaryDrawerItem().withName(R.string.drawer_item_non_translucent_status_drawer).withIcon(FontAwesome.Icon.faw_eye).withIdentifier(4),
@Override public TreeItemDrawerItem withBadge(int badge) { StringHolder newBadge; if(badge != 0) newBadge = new StringHolder(String.valueOf(badge)); else newBadge = new StringHolder(""); return (TreeItemDrawerItem) super.withBadge(newBadge); } }
new PrimaryDrawerItem().withName(R.string.drawer_item_action_bar_drawer).withIcon(FontAwesome.Icon.faw_home).withBadge("22").withBadgeStyle(new BadgeStyle(Color.RED, Color.RED)).withIdentifier(2).withSelectable(false), new PrimaryDrawerItem().withName(R.string.drawer_item_multi_drawer).withIcon(FontAwesome.Icon.faw_gamepad).withIdentifier(3), new PrimaryDrawerItem().withName(R.string.drawer_item_non_translucent_status_drawer).withIcon(FontAwesome.Icon.faw_eye).withIdentifier(4),
@Override protected List<IDrawerItem> reloadDrawerItems(Realm realm, boolean showOnlyUnread) { List<Feed> feeds = state.getStartDrawerItem().getFeeds(realm, showOnlyUnread); List<IDrawerItem> drawerItems = new ArrayList<>((feeds != null ? feeds.size() : 0) + 1); if (state.isFeedSelected()) return drawerItems; drawerItems.add(new SectionDrawerItem() .withDivider(false) .withName(state.getStartDrawerItem().getName())); if (feeds != null) { for (Feed feed : feeds) { PrimaryDrawerItem drawerItem = new TreeItemDrawerItem(feed); drawerItem.withIdentifier(feed.getId()); drawerItem.withBadge(feed.getUnreadCount()); drawerItem.withSetSelected(state.getEndDrawerItem() != null && state.getEndDrawerItem().getId() == feed.getId()); drawerItems.add(drawerItem); } } return drawerItems; }
new PrimaryDrawerItem().withName(R.string.drawer_item_action_bar_drawer).withIcon(FontAwesome.Icon.faw_home).withBadge("22").withBadgeStyle(new BadgeStyle(Color.RED, Color.RED)).withIdentifier(2).withSelectable(false), new PrimaryDrawerItem().withName(R.string.drawer_item_multi_drawer).withIcon(FontAwesome.Icon.faw_gamepad).withIdentifier(3), new PrimaryDrawerItem().withName(R.string.drawer_item_non_translucent_status_drawer).withIcon(FontAwesome.Icon.faw_eye).withIdentifier(4),
private IDrawerItem getDrawerItem(Realm realm, TreeItem item) { boolean shouldSelect; PrimaryDrawerItem drawerItem = new TreeItemDrawerItem(item); if (item instanceof Feed) { shouldSelect = state.isFeedSelected(); } else { shouldSelect = !state.isFeedSelected(); } shouldSelect = shouldSelect && state.getStartDrawerItem().getId() == item.getId(); drawerItem.withBadge(item.getCount(realm)); return drawerItem.withSetSelected(shouldSelect); } }