本文整理汇总了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));
}
}
}
}
}
示例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();
}
示例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;
}
示例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;
}