当前位置: 首页>>代码示例>>Java>>正文


Java CardHeader.NO_POPUP_MENU属性代码示例

本文整理汇总了Java中it.gmariotti.cardslib.library.internal.CardHeader.NO_POPUP_MENU属性的典型用法代码示例。如果您正苦于以下问题:Java CardHeader.NO_POPUP_MENU属性的具体用法?Java CardHeader.NO_POPUP_MENU怎么用?Java CardHeader.NO_POPUP_MENU使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在it.gmariotti.cardslib.library.internal.CardHeader的用法示例。


在下文中一共展示了CardHeader.NO_POPUP_MENU属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _buildPopupMenu

/**
 * Build the menu
 * @return
 */
private PopupMenu _buildPopupMenu(){

    PopupMenu popup = new PopupMenu(getContext(), mImageButtonOverflow);
    if (mCardHeader.getPopupMenu()> CardHeader.NO_POPUP_MENU){
        MenuInflater inflater = popup.getMenuInflater();
        inflater.inflate(mCardHeader.getPopupMenu(), popup.getMenu());
    }
    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            if (mCardHeader.getPopupMenuListener() != null) {
                // This individual card has it unique menu
                mCardHeader.getPopupMenuListener().onMenuItemClick(mCardHeader.getParentCard(), item);
            }
            return false;
        }
    });

    return popup;
}
 
开发者ID:Daniele-Comi,项目名称:System-Monitor,代码行数:24,代码来源:CardHeaderView.java

示例2: addPopup

/**
 * Adds Popup menu
 */
protected void addPopup() {

    //To prevent recycle
    mPopupMenu = null;

    if (mImageButtonOverflow != null) {

        // allow dynamic customization on popup menu
        boolean prepareMenu = mCardHeader.getPopupMenu() > CardHeader.NO_POPUP_MENU ? true : false;
        if (mCardHeader.getPopupMenuPrepareListener() != null) {

            //Build the popupMenu
            mPopupMenu = _buildPopupMenu();

            //Dynamic customization
            prepareMenu = mCardHeader.getPopupMenuPrepareListener().onPreparePopupMenu(mCardHeader.getParentCard(), mPopupMenu);

            //Check if the menu has visible items
            if (mPopupMenu.getMenu()==null || !mPopupMenu.getMenu().hasVisibleItems())
                prepareMenu = false;
        }

        if (prepareMenu) {
            //Add a PopupMenu and its listener
            mImageButtonOverflow.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mPopupMenu==null){
                        //It is null if the PopupMenuPrepareListener is null
                        //PopupMenu is built inside onClick() method to avoid building the menu when it is not necessary
                        mPopupMenu = _buildPopupMenu();
                    }
                    if (mPopupMenu!=null)
                        mPopupMenu.show();
                }
            });
        } else {
            if (mCardHeader.getCustomOverflowAnimation()==null) {
                mImageButtonOverflow.setVisibility(GONE);
            }
        }

    } else {
        if (mImageButtonOverflow != null)
            mImageButtonOverflow.setVisibility(GONE);
    }
}
 
开发者ID:Daniele-Comi,项目名称:System-Monitor,代码行数:50,代码来源:CardHeaderView.java

示例3: addPopup

/**
 * Adds Popup menu
 */
protected void addPopup() {

    //To prevent recycle
    mPopupMenu = null;

    if (mImageButtonOverflow != null) {

        // allow dynamic customization on popup menu
        boolean prepareMenu = mCardHeader.getPopupMenu() > CardHeader.NO_POPUP_MENU ? true : false;
        if (mCardHeader.getPopupMenuPrepareListener() != null) {

            //Build the popupMenu
            mPopupMenu = _buildPopupMenu();

            //Dynamic customization
            prepareMenu = mCardHeader.getPopupMenuPrepareListener().onPreparePopupMenu(mCardHeader.getParentCard(), mPopupMenu);

            //Check if the menu has visible items
            if (mPopupMenu.getMenu()==null || !mPopupMenu.getMenu().hasVisibleItems())
                prepareMenu = false;
        }

        if (prepareMenu) {
            //Add a PopupMenu and its listener
            mImageButtonOverflow.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mPopupMenu==null){
                        //It is null if the PopupMenuPrepareListener is null
                        //PopupMenu is built inside onClick() method to avoid building the menu when it is not necessary
                        mPopupMenu = _buildPopupMenu();
                    }
                    if (mPopupMenu!=null)
                        mPopupMenu.show();
                }
            });
        } else {
            mImageButtonOverflow.setVisibility(GONE);
        }

    } else {
        if (mImageButtonOverflow != null)
            mImageButtonOverflow.setVisibility(GONE);
    }
}
 
开发者ID:tajchert,项目名称:CEEHack,代码行数:48,代码来源:CardHeaderView.java


注:本文中的it.gmariotti.cardslib.library.internal.CardHeader.NO_POPUP_MENU属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。