本文整理匯總了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;
}