當前位置: 首頁>>代碼示例>>Java>>正文


Java IDrawerItem.withSetSelected方法代碼示例

本文整理匯總了Java中com.mikepenz.materialdrawer.model.interfaces.IDrawerItem.withSetSelected方法的典型用法代碼示例。如果您正苦於以下問題:Java IDrawerItem.withSetSelected方法的具體用法?Java IDrawerItem.withSetSelected怎麽用?Java IDrawerItem.withSetSelected使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.mikepenz.materialdrawer.model.interfaces.IDrawerItem的用法示例。


在下文中一共展示了IDrawerItem.withSetSelected方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: populateProfile

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * Populate profile
 * @param department
 */
public void populateProfile( Department department){
    this.accountHeader.clear();
    for ( User user : department.getColaborators() ){
        addProfile( user );
    }

    this.currentDepartment = department;
    if( currentMenu != null && ((Fragment)currentMenu.getMainFrag()).isResumed() )
        this.currentMenu.getMainFrag().onDepartmentChange(department);
    else if(currentMenu != null ) {
        ( (Fragment)this.currentMenu.getMainFrag()).getArguments()
                .putString( Department.INSTANCE, currentDepartment.getKey() );
    }

    for( IDrawerItem item : this.departamentoContainer.getSubItems() ){
        if( item.getIdentifier() == department.getIdentifier() ){
            item.withSetSelected( true );
            this.departamentoContainer.withSetSelected( true );
        }
    }
}
 
開發者ID:tec-ustp,項目名稱:SIIEScanner,代碼行數:26,代碼來源:MainBuildView.java

示例2: 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

示例3: handleSelection

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * handles the selection on click and deselects previous selected items
 *
 * @param v
 * @param pos
 */
public void handleSelection(View v, int pos) {
    //deselect the previous item
    if (previousSelection > -1) {
        IDrawerItem prev = getItem(previousSelection);
        if (prev != null) {
            prev.withSetSelected(false);
        }
        notifyItemChanged(previousSelection);
    } else {
        //if there was no previous selection we have to iterate over all so we can deselect the previous item
        for (int i = 0; i < getItemCount(); i++) {
            if (getItem(i).isSelected()) {
                getItem(i).withSetSelected(false);
                notifyItemChanged(i);
                break;
            }
        }
    }

    //highlight the new item
    if (pos > -1) {
        IDrawerItem cur = getItem(pos);
        if (cur != null) {
            cur.withSetSelected(true);
        }
        notifyItemChanged(pos);

        if (v != null) {
            v.setSelected(true);
            v.invalidate();
        }
    }
    previousSelection = pos;
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:41,代碼來源:BaseDrawerAdapter.java

示例4: setSelection

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * set the selection of the MiniDrawer
 *
 * @param identifier the identifier of the item which should be selected (-1 for none)
 */
public void setSelection(int identifier) {
    for (IDrawerItem drawerItem : mDrawerAdapter.getDrawerItems()) {
        drawerItem.withSetSelected(drawerItem.getIdentifier() == identifier);
    }
    mDrawerAdapter.notifyDataSetChanged();
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:12,代碼來源:MiniDrawer.java


注:本文中的com.mikepenz.materialdrawer.model.interfaces.IDrawerItem.withSetSelected方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。