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