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


Java IDrawerItem.isSelectable方法代碼示例

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


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

示例1: 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();
            }
        }
        //update everything
        setSelection(selectedDrawerItem.getIdentifier());

        return false;
    } else {
        return true;
    }
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:24,代碼來源:MiniDrawer.java

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

示例3: onItemClick

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public boolean onItemClick(final View view, int position, final IDrawerItem drawerItem) {
    final boolean isCurrentSelectedProfile;
    if (drawerItem != null && drawerItem instanceof IProfile && drawerItem.isSelectable()) {
        isCurrentSelectedProfile = switchProfiles((IProfile) drawerItem);
    } else {
        isCurrentSelectedProfile = false;
    }

    if (mResetDrawerOnProfileListClick) {
        mDrawer.setOnDrawerItemClickListener(null);
    }

    //wrap the onSelection call and the reset stuff within a handler to prevent lag
    if (mResetDrawerOnProfileListClick && mDrawer != null && view != null && view.getContext() != null) {
        resetDrawerContent(view.getContext());
    }

    //notify the MiniDrawer about the clicked profile (only if one exists and is hooked to the Drawer
    if (mDrawer != null && mDrawer.getDrawerBuilder() != null && mDrawer.getDrawerBuilder().mMiniDrawer != null) {
        mDrawer.getDrawerBuilder().mMiniDrawer.onProfileClick();
    }

    boolean consumed = false;
    if (drawerItem != null && drawerItem instanceof IProfile) {
        if (mOnAccountHeaderListener != null) {
            consumed = mOnAccountHeaderListener.onProfileChanged(view, (IProfile) drawerItem, isCurrentSelectedProfile);
        }
    }

    //if a custom behavior was chosen via the CloseDrawerOnProfileListClick then use this. else react on the result of the onProfileChanged listener
    if (mCloseDrawerOnProfileListClick != null) {
        return !mCloseDrawerOnProfileListClick;
    } else {
        return consumed;
    }
}
 
開發者ID:FreedomZZQ,項目名稱:YouJoin-Android,代碼行數:38,代碼來源:AccountHeaderBuilder.java

示例4: onItemClick

import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public boolean onItemClick(final View view, int position, final IDrawerItem drawerItem) {
    final boolean isCurrentSelectedProfile;
    if (drawerItem != null && drawerItem instanceof IProfile && drawerItem.isSelectable()) {
        isCurrentSelectedProfile = switchProfiles((IProfile) drawerItem);
    } else {
        isCurrentSelectedProfile = false;
    }

    if (mResetDrawerOnProfileListClick) {
        mDrawer.setOnDrawerItemClickListener(null);
    }

    //wrap the onSelection call and the reset stuff within a handler to prevent lag
    if (mResetDrawerOnProfileListClick && mDrawer != null && view != null && view.getContext() != null) {
        resetDrawerContent(view.getContext());
    }

    //notify the MiniDrawer about the clicked profile (only if one exists and is hooked to the Drawer
    if (mDrawer != null && mDrawer.getDrawerBuilder() != null && mDrawer.getDrawerBuilder().mMiniDrawer != null) {
        mDrawer.getDrawerBuilder().mMiniDrawer.onProfileClick();
    }

    boolean consumed = false;
    if (drawerItem != null && drawerItem instanceof IProfile) {
        if (mOnAccountHeaderListener != null) {
            consumed = mOnAccountHeaderListener.onProfileChanged(view, (IProfile) drawerItem, isCurrentSelectedProfile);
        }
    }

    //if a custom behavior was chosen via the CloseDrawerOnProfileListClick then use this. else react on the result of the onProfileChanged listener
    if (mCloseDrawerOnProfileListClick != null) {
        consumed = consumed && !mCloseDrawerOnProfileListClick;
    }

    //totally custom handling of the drawer behavior as otherwise the selection of the profile list is set to the Drawer
    if (mDrawer != null && !consumed) {
        //close the drawer after click
        mDrawer.mDrawerBuilder.closeDrawerDelayed();
    }

    //consume the event to prevent setting the clicked item as selected in the already switched item list
    return true;
}
 
開發者ID:LeMinhAn,項目名稱:MaterialDrawer,代碼行數:45,代碼來源:AccountHeaderBuilder.java


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