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


Java IDrawerItem.getIdentifier方法代碼示例

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


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

示例1: onDrawerItemClickListener

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
private boolean onDrawerItemClickListener(View view, int position, IDrawerItem drawerItem) {
    int id = (int) drawerItem.getIdentifier();
    switch (id) {
        case 1:
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.fragmentContainer, ItemsFragment.newInstance())
                    .commit();
            drawer.closeDrawer();
            break;
        case 2:
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.fragmentContainer, BottomSheetFragment.newInstance())
                    .commit();
            drawer.closeDrawer();
            break;
    }
    return true;
}
 
開發者ID:sathishmscict,項目名稱:ChipsLayoutManager,代碼行數:19,代碼來源:MainActivity.java

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

示例3: onCheckedChanged

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {

    switch ((int) drawerItem.getIdentifier()) {
        case 1:
            addSubscription(NetworkWrapper.get()
                    .setShopStatus(isChecked ? 1 : 0)
                    .compose(bindToLifecycle())
                    .subscribe(message -> {
                        MainActivity.this.shopStatus.withName("營業狀態:" + (isChecked ? "開" : "關"));
                        AppManager.getShopInfo().setStatus(isChecked ? 1 : 0);
                        result.updateItem(MainActivity.this.shopStatus);
                        setIntentService(isChecked);
                    }, throwable -> Snackbar.make(binding.pager, throwable.getMessage(), Snackbar.LENGTH_SHORT).show()));
            break;
    }
}
 
開發者ID:RunziiMo,項目名稱:grooo,代碼行數:18,代碼來源:MainActivity.java

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

示例5: onItemClick

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * call this method to trigger the onItemClick on the MiniDrawer
 *
 * @param selectedDrawerItem
 * @return
 */
public boolean onItemClick(IDrawerItem selectedDrawerItem) {
    //We only need to clear if the new item is selectable
    if (selectedDrawerItem.isSelectable()) {
        //crossfade if we are cross faded
        if (mCrossFader != null) {
            if (mCrossFader.isCrossfaded()) {
                mCrossFader.crossfade();
            }
        }

        //get the identifier
        int identifier = selectedDrawerItem.getIdentifier();

        //update everything
        setSelection(identifier);

        return false;
    } else {
        return true;
    }
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:28,代碼來源:MiniDrawer.java

示例6: onCheckedChanged

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {

    int id = (int) drawerItem.getIdentifier();
    switch (id) {

        case ID_TOGGLE_DONE:
            toggleDoneTab();
            break;

        case ID_TOGGLE_BIG_TEXT:
            if (isChecked) {
                HorizontalAdapter.setBigText(true);
                mTinyDB.putBoolean(getString(R.string.big_text_pref), true);
                DatabaseHelper.notifyAllLists();

            } else {
                HorizontalAdapter.setBigText(false);
                mTinyDB.putBoolean(getString(R.string.big_text_pref), false);
                DatabaseHelper.notifyAllLists();
            }
            break;

        case ID_DARK_THEME:
            changeDarkTheme(isChecked);
            break;
    }

}
 
開發者ID:IdeaTrackerPlus,項目名稱:IdeaTrackerPlus,代碼行數:30,代碼來源:MainActivity.java

示例7: onNavigationSelected

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
private void onNavigationSelected(IDrawerItem drawerItem) {
    switch (drawerItem.getIdentifier()) {
        case 1001:
            navigateToBookShelfFragment();
            break;
        case 1101:
            mNavigation.navigateToSettingsActivity(MainActivity.this);
            break;
        default:
            throw new IllegalArgumentException("Unknown NavigationDrawerItem position.");
    }
}
 
開發者ID:crysehillmes,項目名稱:smoothnovelreader,代碼行數:13,代碼來源:MainActivity.java

示例8: getCurrentSelection

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * get the current selected item identifier
 *
 * @return
 */
public long getCurrentSelection() {
    IDrawerItem drawerItem = mDrawerBuilder.getDrawerItem(getCurrentSelectedPosition());
    if (drawerItem != null) {
        return drawerItem.getIdentifier();
    }
    return -1;
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:13,代碼來源:Drawer.java

示例9: getDrawerItem

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * gets the drawerItem with the specific identifier from a drawerItem list
 *
 * @param drawerItems
 * @param identifier
 * @return
 */
public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, long identifier) {
    if (identifier >= 0) {
        for (IDrawerItem drawerItem : drawerItems) {
            if (drawerItem.getIdentifier() == identifier) {
                return drawerItem;
            }
        }
    }
    return null;
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:18,代碼來源:DrawerUtils.java

示例10: 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(long identifier) {
    int count = mAdapter.getItemCount();
    for (int i = 0; i < count; i++) {
        IDrawerItem item = mAdapter.getItem(i);
        if (item.getIdentifier() == identifier && !item.isSelected()) {
            mAdapter.deselect();
            mAdapter.select(i);
        }
    }
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:16,代碼來源:MiniDrawer.java

示例11: updateItem

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * update a MiniDrawerItem (after updating the main Drawer) via its identifier
 *
 * @param identifier the identifier of the item which was updated
 */
public void updateItem(long identifier) {
    if (mDrawer != null && mAdapter != null && mAdapter.getAdapterItems() != null && identifier != -1) {
        IDrawerItem drawerItem = DrawerUtils.getDrawerItem(getDrawerItems(), identifier);
        for (int i = 0; i < mAdapter.getAdapterItems().size(); i++) {
            if (mAdapter.getAdapterItems().get(i).getIdentifier() == drawerItem.getIdentifier()) {
                IDrawerItem miniDrawerItem = generateMiniDrawerItem(drawerItem);
                if (miniDrawerItem != null) {
                    mAdapter.set(i, miniDrawerItem);
                }
            }
        }
    }
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:19,代碼來源:MiniDrawer.java

示例12: getItemId

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public long getItemId(int position) {
    IDrawerItem item = getItem(position);
    if (item != null && item.getIdentifier() != -1) {
        return item.getIdentifier();
    }
    return super.getItemId(position);
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:9,代碼來源:BaseDrawerAdapter.java

示例13: getCurrentSelection

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * get the current selected item identifier
 *
 * @return
 */
public int getCurrentSelection() {
    IDrawerItem drawerItem = mDrawerBuilder.getDrawerItem(mDrawerBuilder.mCurrentSelection);
    if (drawerItem != null) {
        return drawerItem.getIdentifier();
    }
    return -1;
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:13,代碼來源:Drawer.java

示例14: getDrawerItem

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * gets the drawerItem with the specific identifier from a drawerItem list
 *
 * @param drawerItems
 * @param identifier
 * @return
 */
public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, int identifier) {
    if (identifier >= 0) {
        for (IDrawerItem drawerItem : drawerItems) {
            if (drawerItem.getIdentifier() == identifier) {
                return drawerItem;
            }
        }
    }
    return null;
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:18,代碼來源:DrawerUtils.java

示例15: updateItem

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
 * update a MiniDrawerItem (after updating the main Drawer) via its identifier
 *
 * @param identifier the identifier of the item which was updated
 */
public void updateItem(int identifier) {
    if (mDrawer != null && mDrawerAdapter != null && mDrawerAdapter.getDrawerItems() != null && identifier != -1) {
        IDrawerItem drawerItem = DrawerUtils.getDrawerItem(getDrawerItems(), identifier);
        for (int i = 0; i < mDrawerAdapter.getDrawerItems().size(); i++) {
            if (mDrawerAdapter.getDrawerItems().get(i).getIdentifier() == drawerItem.getIdentifier()) {
                IDrawerItem miniDrawerItem = generateMiniDrawerItem(drawerItem);
                if (miniDrawerItem != null) {
                    mDrawerAdapter.setDrawerItem(i, miniDrawerItem);
                }
            }
        }
    }
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:19,代碼來源:MiniDrawer.java


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