當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。