当前位置: 首页>>代码示例>>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;未经允许,请勿转载。