本文整理匯總了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;
}