com.mikepenz.materialdrawer.Drawer.getOnDrawerItemClickListener()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中com.mikepenz.materialdrawer.Drawer.getOnDrawerItemClickListener()方法的一些代码示例,展示了Drawer.getOnDrawerItemClickListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawer.getOnDrawerItemClickListener()方法的具体详情如下:
包路径:com.mikepenz.materialdrawer.Drawer
类名称:Drawer
方法名:getOnDrawerItemClickListener

Drawer.getOnDrawerItemClickListener介绍

[英]method to get the OnDrawerItemClickListener
[中]方法获取OnDrawerItemClickListener

代码示例

代码示例来源:origin: mikepenz/MaterialDrawer

originalOnDrawerItemClickListener = getOnDrawerItemClickListener();
originalOnDrawerItemLongClickListener = getOnDrawerItemLongClickListener();
originalDrawerState = getAdapter().saveInstanceState(new Bundle());

代码示例来源:origin: mikepenz/MaterialDrawer

} else if (mDrawer.getOnDrawerItemClickListener() != null) {
  mDrawer.getOnDrawerItemClickListener().onItemClick(v, position, DrawerUtils.getDrawerItem(getDrawerItems(), item.getIdentifier()));

代码示例来源:origin: FreedomZZQ/YouJoin-Android

@Override
  public void onClick(View v, int position, IDrawerItem item) {
    int type = getMiniDrawerType(item);
    if (type == ITEM) {
      //fire the onClickListener also if the specific drawerItem is not Selectable
      if (item.isSelectable()) {
        //make sure we are on the original drawerItemList
        if (mAccountHeader != null && mAccountHeader.isSelectionListShown()) {
          mAccountHeader.toggleSelectionList(v.getContext());
        }
        //set the selection
        mDrawer.setSelection(item, true);
      } else if (mDrawer.getOnDrawerItemClickListener() != null) {
        //get the original `DrawerItem` from the Drawer as this one will contain all information
        mDrawer.getOnDrawerItemClickListener().onItemClick(v, position, DrawerUtils.getDrawerItem(getDrawerItems(), item.getIdentifier()));
      }
    } else if (type == PROFILE) {
      if (mAccountHeader != null && !mAccountHeader.isSelectionListShown()) {
        mAccountHeader.toggleSelectionList(v.getContext());
      }
      if (mCrossFader != null) {
        mCrossFader.crossfade();
      }
    }
  }
});

代码示例来源:origin: FreedomZZQ/YouJoin-Android

/**
 * method to switch the drawer content to new elements
 *
 * @param onDrawerItemClickListener
 * @param drawerItems
 * @param drawerSelection
 */
public void switchDrawerContent(@NonNull OnDrawerItemClickListener onDrawerItemClickListener, OnDrawerItemLongClickListener onDrawerItemLongClickListener, @NonNull ArrayList<IDrawerItem> drawerItems, int drawerSelection) {
  //just allow a single switched drawer
  if (!switchedDrawerContent()) {
    //save out previous values
    originalOnDrawerItemClickListener = getOnDrawerItemClickListener();
    originalOnDrawerItemLongClickListener = getOnDrawerItemLongClickListener();
    originalDrawerItems = getDrawerItems();
    originalDrawerSelection = getCurrentSelectedPosition();
  }
  //set the new items
  setOnDrawerItemClickListener(onDrawerItemClickListener);
  setOnDrawerItemLongClickListener(onDrawerItemLongClickListener);
  setItems(drawerItems, true);
  setSelectionAtPosition(drawerSelection, false);
  //hide stickyFooter and it's shadow
  if (getStickyFooter() != null) {
    getStickyFooter().setVisibility(View.GONE);
  }
  if (getStickyFooterShadow() != null) {
    getStickyFooterShadow().setVisibility(View.GONE);
  }
}

相关文章