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


Java IDrawerItem.getTag方法代码示例

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


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

示例1: updateUnreadCount

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

示例2: onCheckedChanged

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
    PreferenceManager.getDefaultSharedPreferences(ListActivity.this)
            .edit()
            .putBoolean(Preferences.SHOW_ONLY_UNREAD.getKey(), isChecked)
            .apply();

    if(drawerItem instanceof Nameable && drawerItem.getTag() instanceof AllUnreadFolder) {
        final AllUnreadFolder unreadFolder = (AllUnreadFolder) drawerItem.getTag();

        unreadFolder.updateName(ListActivity.this, isShowOnlyUnread());
        ((Nameable) drawerItem).withName(unreadFolder.getName());
    }

    drawerManager.reloadAdapters(getRealm(), isShowOnlyUnread());
    reloadListFragment();
}
 
开发者ID:schaal,项目名称:ocreader,代码行数:18,代码来源:ListActivity.java

示例3: onItemClick

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //导入方法依赖的package包/类
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
    int id = (int) drawerItem.getIdentifier();
    switch (id) {
        case ID_LIVE:
            playLive();
            break;
        case ID_HISTORY:
            break;
        case ID_SETTING:
            launchSetting();
            break;
        default:
            History history = (History) drawerItem.getTag();
            switch (history.getType()) {
                case DIRECTORY:
                    break;
                case FILE:
                    playHistory(history);
                    break;
            }
            break;
    }

    return false;
}
 
开发者ID:xdtianyu,项目名称:LanCamera,代码行数:27,代码来源:MainActivity.java

示例4: reloadDrawerItems

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //导入方法依赖的package包/类
@Override
protected List<IDrawerItem> reloadDrawerItems(Realm realm, boolean showOnlyUnread) {
    List<IDrawerItem> drawerItems = new ArrayList<>();

    ((AbstractSwitchableDrawerItem)topDrawerItems.get(0)).withChecked(showOnlyUnread);
    drawerItems.addAll(topDrawerItems);

    for(IDrawerItem drawerItem: topDrawerItems) {
        if(drawerItem.getTag() instanceof TreeItem) {
            TreeItem item = (TreeItem) drawerItem.getTag();
            int count = item.getCount(realm);
            if(count > 0 && drawerItem instanceof Badgeable)
                ((Badgeable) drawerItem).withBadge(String.valueOf(count));
            if (state.getStartDrawerItem().getId() == item.getId()) {
                drawerItem.withSetSelected(true);
                break;
            }
        }
    }

    final List<TreeItem> treeItems = new ArrayList<>();
    treeItems.addAll(Folder.getAll(realm, showOnlyUnread));
    treeItems.addAll(Queries.getFeedsWithoutFolder(realm, showOnlyUnread));

    if(treeItems.isEmpty()) {
        drawerItems.add(
                new PrimaryDrawerItem()
                    .withEnabled(false)
                    .withName(R.string.no_folders_to_show)
        );
    } else {
        for (TreeItem treeItem : treeItems) {
            drawerItems.add(getDrawerItem(realm, treeItem));
        }
    }

    return drawerItems;
}
 
开发者ID:schaal,项目名称:ocreader,代码行数:39,代码来源:DrawerManager.java


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