本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}