当前位置: 首页>>代码示例>>Java>>正文


Java PrimaryDrawerItem.withBadge方法代码示例

本文整理汇总了Java中com.mikepenz.materialdrawer.model.PrimaryDrawerItem.withBadge方法的典型用法代码示例。如果您正苦于以下问题:Java PrimaryDrawerItem.withBadge方法的具体用法?Java PrimaryDrawerItem.withBadge怎么用?Java PrimaryDrawerItem.withBadge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mikepenz.materialdrawer.model.PrimaryDrawerItem的用法示例。


在下文中一共展示了PrimaryDrawerItem.withBadge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDrawerItem

import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; //导入方法依赖的package包/类
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);
}
 
开发者ID:schaal,项目名称:ocreader,代码行数:18,代码来源:DrawerManager.java

示例2: reloadDrawerItems

import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; //导入方法依赖的package包/类
@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;
}
 
开发者ID:schaal,项目名称:ocreader,代码行数:26,代码来源:DrawerManager.java

示例3: onResume

import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    startTimer();
    getData();
    ((CoreApplication) getApplication()).mainActivityInstance=this;
    checkLocationPermission();

    //DrawerItems
    PrimaryDrawerItem beaconItem = ((PrimaryDrawerItem)drawer.getDrawerItem(2));
    PrimaryDrawerItem geofenceItem = ((PrimaryDrawerItem)drawer.getDrawerItem(3));
    beaconItem.withBadge(AppPreferences.getBeaconDetectionState()? "On":"Off");
    geofenceItem.withBadge(AppPreferences.getGeofenceDetectionState()? "On":"Off");
    drawer.updateItem(beaconItem);
    drawer.updateItem(geofenceItem);
}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:17,代码来源:MainActivity.java

示例4: onPharmacyModeChanged

import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; //导入方法依赖的package包/类
public void onPharmacyModeChanged(boolean enabled) {
    PrimaryDrawerItem item = (PrimaryDrawerItem) drawer.getDrawerItem(PHARMACIES);
    BadgeStyle bs = new BadgeStyle();
    if (enabled) {
        addCalendarItem();
        Drawable bg = new IconicsDrawable(home)
                .icon(GoogleMaterial.Icon.gmd_check)
                .color(home.getResources().getColor(R.color.dark_grey_text))
                .sizeDp(18);
        bs.withBadgeBackground(bg);
    } else {
        drawer.removeItem(CALENDAR);
        bs.withBadgeBackground(new ColorDrawable(Color.TRANSPARENT));
    }
    item.withBadgeStyle(bs);
    item.withBadge(" ");
    drawer.updateItem(item);
}
 
开发者ID:citiususc,项目名称:calendula,代码行数:19,代码来源:LeftDrawerMgr.java


注:本文中的com.mikepenz.materialdrawer.model.PrimaryDrawerItem.withBadge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。