本文整理汇总了Java中com.mikepenz.materialdrawer.model.ExpandableDrawerItem类的典型用法代码示例。如果您正苦于以下问题:Java ExpandableDrawerItem类的具体用法?Java ExpandableDrawerItem怎么用?Java ExpandableDrawerItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExpandableDrawerItem类属于com.mikepenz.materialdrawer.model包,在下文中一共展示了ExpandableDrawerItem类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateProductItems
import com.mikepenz.materialdrawer.model.ExpandableDrawerItem; //导入依赖的package包/类
private void populateProductItems() {
boolean showDiscontinued = DoserApplication.getDoserPreferences().getShowDiscontinuedProducts();
for (Map.Entry<ExpandableDrawerItem, List<SecondaryDrawerItem>> entry : mProductItemGroups.entrySet()) {
ExpandableDrawerItem parent = entry.getKey();
List<SecondaryDrawerItem> children = entry.getValue();
if(parent.getSubItems() != null)
parent.getSubItems().clear();
for (IDrawerItem child : children) {
SeachemProduct product = (SeachemProduct) child.getTag();
if (product.isDiscontinued() && !showDiscontinued)
continue;
parent.withSubItems(child);
}
mDrawer.getAdapter().notifyAdapterSubItemsChanged(mDrawer.getPosition(parent));
}
}
示例2: showDefaultProduct
import com.mikepenz.materialdrawer.model.ExpandableDrawerItem; //导入依赖的package包/类
private void showDefaultProduct() {
SeachemProduct defaultProduct = DoserApplication.getDoserPreferences().getDefaultProduct();
if (defaultProduct != null) {
SeachemProductCategory category = SeachemManager.getProductCategory(defaultProduct);
ExpandableDrawerItem parent = mProductCategoryItems.get(category);
// first open parent item
parent.withIsExpanded(true);
mDrawer.updateItem(parent);
// now select + click child item
for (IDrawerItem item : parent.getSubItems()) {
String title = ((Nameable) item).getName().getText();
if (title != null && title.equals(defaultProduct.getName())) {
mDrawer.setSelection(item, true);
break;
}
}
} else {
setCurrentFragment(getString(R.string.app_name), new DefaultFragment());
}
}
示例3: onCreate
import com.mikepenz.materialdrawer.model.ExpandableDrawerItem; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
PrimaryDrawerItem liveItem = new PrimaryDrawerItem().withName(R.string.live)
.withIdentifier(ID_LIVE);
mHistoryItem = new ExpandableDrawerItem().withName(history)
.withSubItems(mHistoryItems)
.withIdentifier(ID_HISTORY);
PrimaryDrawerItem settingItem = new PrimaryDrawerItem().withName(R.string.setting)
.withIdentifier(ID_SETTING);
mDrawer = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.withRootView(R.id.container)
.withActionBarDrawerToggle(true)
.withActionBarDrawerToggleAnimated(true)
.addDrawerItems(liveItem)
.addDrawerItems(mHistoryItem)
.addDrawerItems(new DividerDrawerItem())
.addDrawerItems(settingItem)
.withOnDrawerItemClickListener(this)
.build();
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
player = new GiraffePlayer(this);
playLive();
prepareHistory();
}
示例4: getDynamicalDrawerItems
import com.mikepenz.materialdrawer.model.ExpandableDrawerItem; //导入依赖的package包/类
private IDrawerItem[] getDynamicalDrawerItems() {
List<IDrawerItem> drawerItemList = getMainDrawerItems();
for (KomicaMenuGroup group : KomicaManager.getInstance().getMenuGroupList()) {
drawerItemList.add(new DividerDrawerItem());
// drawerItemList.add(new SecondaryDrawerItem().withName(group.getTitle()).withTextColor(Color.RED));
List<IDrawerItem> memberList = new ArrayList<>();
List<Long> identifiers = new ArrayList<>();
for (KomicaMenuMember member : group.getMemberList()) {
if (!KomicaManager.getInstance().checkVisible(member.getTitle())) {
continue;
}
memberList.add(
getColorSetting(
new PrimaryDrawerItem().withIdentifier(member.getMemberId()).withName(member.getTitle())
)
);
identifiers.add((long) member.getMemberId());
}
drawerIdentifiers = new long[identifiers.size()];
for (int i = 0; i < identifiers.size(); i++) {
drawerIdentifiers[i] = identifiers.get(i);
}
ExpandableDrawerItem expandableDrawerItem =
new ExpandableDrawerItem().withArrowColorRes(R.color.colorPrimary)
.withName(group.getTitle())
.withTextColor(Color.RED)
.withSelectable(false).withSubItems(memberList);
drawerItemList.add(expandableDrawerItem);
}
IDrawerItem[] items = new IDrawerItem[drawerItemList.size()];
return drawerItemList.toArray(items);
}
示例5: setupDrawer
import com.mikepenz.materialdrawer.model.ExpandableDrawerItem; //导入依赖的package包/类
private void setupDrawer() {
Intent intent = getIntent();
long currentIdentifier = intent.getLongExtra(EXTRA_IDENTIFIER, 1);
Toolbar toolbar = getToolbar();
mDrawer = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.addDrawerItems(new PrimaryDrawerItem()
.withIdentifier(1)
.withName("Persons List")
)
.addDrawerItems(new ExpandableDrawerItem()
.withName("APIs")
.withSubItems(
new SecondaryDrawerItem()
.withIdentifier(3)
.withName("Location")
))
.addStickyDrawerItems(
new PrimaryDrawerItem()
.withIdentifier(2)
.withName("Profile")
)
.withSelectedItem(currentIdentifier)
.withOnDrawerItemClickListener(this)
.build();
}