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