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


Java MenuItem.isVisible方法代码示例

本文整理汇总了Java中android.view.MenuItem.isVisible方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.isVisible方法的具体用法?Java MenuItem.isVisible怎么用?Java MenuItem.isVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.MenuItem的用法示例。


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

示例1: showMenu

import android.view.MenuItem; //导入方法依赖的package包/类
private void showMenu(Menu menu) {
  if (currentMenu == menu) {
    // no need to re-draw
    return;
  }

  menuLayout.removeAllViews();
  final int count = menu.size();
  for (int i=0; i<count; i++) {
    final MenuItem item = menu.getItem(i);
    if (item.isVisible()) {
      final View view = getMenuItemView(item);
      menuLayout.addView(view);
    }
  }

  currentMenu = menu;
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:19,代码来源:AyahToolBar.java

示例2: onSubMenuSelected

import android.view.MenuItem; //导入方法依赖的package包/类
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
    if (subMenu.hasVisibleItems()) {
        MenuPopupHelper subPopup = new MenuPopupHelper(this.mContext, subMenu, this.mAnchorView);
        subPopup.setCallback(this.mPresenterCallback);
        boolean preserveIconSpacing = false;
        int count = subMenu.size();
        for (int i = 0; i < count; i++) {
            MenuItem childItem = subMenu.getItem(i);
            if (childItem.isVisible() && childItem.getIcon() != null) {
                preserveIconSpacing = true;
                break;
            }
        }
        subPopup.setForceShowIcon(preserveIconSpacing);
        if (subPopup.tryShow()) {
            if (this.mPresenterCallback != null) {
                this.mPresenterCallback.onOpenSubMenu(subMenu);
            }
            return true;
        }
    }
    return false;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:MenuPopupHelper.java

示例3: ActionButtonSubmenu

import android.view.MenuItem; //导入方法依赖的package包/类
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) {
    super(context, subMenu, null, false, R.attr.actionOverflowMenuStyle);
    this.mSubMenu = subMenu;
    if (!((MenuItemImpl) subMenu.getItem()).isActionButton()) {
        setAnchorView(ActionMenuPresenter.this.mOverflowButton == null ? (View) ActionMenuPresenter.this.mMenuView : ActionMenuPresenter.this.mOverflowButton);
    }
    setCallback(ActionMenuPresenter.this.mPopupPresenterCallback);
    boolean preserveIconSpacing = false;
    int count = subMenu.size();
    for (int i = 0; i < count; i++) {
        MenuItem childItem = subMenu.getItem(i);
        if (childItem.isVisible() && childItem.getIcon() != null) {
            preserveIconSpacing = true;
            break;
        }
    }
    setForceShowIcon(preserveIconSpacing);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:ActionMenuPresenter.java

示例4: addMenuItems

import android.view.MenuItem; //导入方法依赖的package包/类
private void addMenuItems() {
    ViewCompat.setAlpha(menuItemsLayout, 1f);
    for (int i = 0; i < navigationMenu.size(); i++) {
        MenuItem menuItem = navigationMenu.getItem(i);
        if (menuItem.isVisible()) {
            menuItemsLayout.addView(createFabMenuItem(menuItem));
        }
    }
    animateFabMenuItemsIn();
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:11,代码来源:FabSpeedDial.java

示例5: disableEnableMenuItem

import android.view.MenuItem; //导入方法依赖的package包/类
private void disableEnableMenuItem(
        Menu menu, int id, boolean visible, boolean enabled, boolean managed) {
    for (int i = 0; i < menu.size(); ++i) {
        MenuItem item = menu.getItem(i);
        if (item.getItemId() == id && item.isVisible()) {
            item.setVisible(visible);
            item.setEnabled(enabled);
            if (managed) {
                item.setIcon(ManagedPreferencesUtils.getManagedByEnterpriseIconId());
            } else {
                item.setIcon(null);
            }
        }
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:AppMenuPropertiesDelegate.java

示例6: refreshMenus

import android.view.MenuItem; //导入方法依赖的package包/类
private void refreshMenus() {
    menuContainer.removeAllViews();
    for (int i = 0; i < menu.size(); i++) {
        MenuItem menuItem = menu.getItem(i);
        if (menuItem.isVisible()) {
            View itemView = createItemView(i, menuItem);
            menuContainer.addView(itemView);
        }
    }
}
 
开发者ID:kobakei,项目名称:MaterialFabSpeedDial,代码行数:11,代码来源:FabSpeedDial.java

示例7: toggleMenuItemVisibility

import android.view.MenuItem; //导入方法依赖的package包/类
private void toggleMenuItemVisibility(final MenuItem item, final boolean visible) {
    if (visible) {
        if (!item.isVisible()) {
            item.setVisible(true);
        }
    } else if (item.isVisible()) {
        item.setVisible(false);
    }
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:10,代码来源:MainActivity.java

示例8: onPrepareOptionsMenu

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    boolean hasChanges = false;
    if (getCurrentFragment() instanceof ChatFragment) {
        ChatFragment fragment = ((ChatFragment) getCurrentFragment());
        ServerConnectionApi api = ((ServerConnectionApi) fragment.getConnectionInfo().getApiInstance());
        boolean connected = fragment.getConnectionInfo().isConnected();
        boolean wasConnected = !menu.findItem(R.id.action_reconnect).isVisible();
        if (connected != wasConnected) {
            if (connected) {
                menu.findItem(R.id.action_reconnect).setVisible(false);
                menu.findItem(R.id.action_close).setVisible(false);
                menu.findItem(R.id.action_disconnect).setVisible(true);
                menu.findItem(R.id.action_disconnect_and_close).setVisible(true);
            } else {
                menu.findItem(R.id.action_reconnect).setVisible(true);
                menu.findItem(R.id.action_close).setVisible(true);
                menu.findItem(R.id.action_disconnect).setVisible(false);
                menu.findItem(R.id.action_disconnect_and_close).setVisible(false);
            }
            hasChanges = true;
        }
        if (fragment.getSendMessageHelper().hasSendMessageTextSelection() !=
                menu.findItem(R.id.action_format).isVisible()) {
            menu.findItem(R.id.action_format).setVisible(fragment.getSendMessageHelper()
                    .hasSendMessageTextSelection());
            hasChanges = true;
        }
        MenuItem partItem = menu.findItem(R.id.action_part_channel);
        if (fragment.getCurrentChannel() == null) {
            if (partItem.isVisible())
                hasChanges = true;
            partItem.setVisible(false);
        } else if (fragment.getCurrentChannel().length() > 0 && !api.getServerConnectionData()
                .getSupportList().getSupportedChannelTypes().contains(fragment.getCurrentChannel().charAt(0))) {
            if (partItem.isVisible() || !partItem.getTitle().equals(getString(R.string.action_close_direct)))
                hasChanges = true;
            partItem.setVisible(true);
            partItem.setTitle(R.string.action_close_direct);
        } else {
            if (partItem.isVisible() || !partItem.getTitle().equals(getString(R.string.action_part_channel)))
                hasChanges = true;
            partItem.setVisible(true);
            partItem.setTitle(R.string.action_part_channel);
        }
    }
    return super.onPrepareOptionsMenu(menu) | hasChanges;
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:49,代码来源:MainActivity.java

示例9: createAdapterItems

import android.view.MenuItem; //导入方法依赖的package包/类
private List<BottomSheetItem> createAdapterItems(int dividerBackground, int titleTextColor,
                                                 int itemTextColor, int itemBackground,
                                                 int tintColor) {
    List<BottomSheetItem> items = new ArrayList<>();
    mTitles = 0;

    boolean addedSubMenu = false;

    for (int i = 0; i < mMenu.size(); i++) {
        MenuItem item = mMenu.getItem(i);

        if (item.isVisible()) {
            if (item.hasSubMenu()) {
                SubMenu subMenu = item.getSubMenu();

                if (i != 0 && addedSubMenu) {
                    if (mMode == BottomSheetBuilder.MODE_GRID) {
                        throw new IllegalArgumentException("MODE_GRID can't have submenus." +
                                " Use MODE_LIST instead");
                    }
                    items.add(new BottomSheetDivider(dividerBackground));
                }

                CharSequence title = item.getTitle();
                if (title != null && !title.equals("")) {
                    items.add(new BottomSheetHeader(title.toString(), titleTextColor));
                    mTitles++;
                }

                for (int j = 0; j < subMenu.size(); j++) {
                    MenuItem subItem = subMenu.getItem(j);
                    if (subItem.isVisible()) {
                        items.add(new BottomSheetMenuItem(subItem,itemTextColor, itemBackground, tintColor));
                        addedSubMenu = true;
                    }
                }
            } else {
                items.add(new BottomSheetMenuItem(item, itemTextColor, itemBackground, tintColor));
            }
        }
    }
    return items;
}
 
开发者ID:yuhodev,项目名称:login,代码行数:44,代码来源:BottomSheetAdapterBuilder.java

示例10: onPrepareOptionsMenu

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
    final MenuItem itemUpdate = menu.findItem(R.id.action_update);
    final MenuItem itemSortEntries = menu.findItem(R.id.action_sort_entries);
    final MenuItem itemExportAsOPML = menu.findItem(R.id.action_opml_export);
    final MenuItem itemFilter = menu.findItem(R.id.action_filter_by_categories);
    final MenuItem itemSearch = menu.findItem(R.id.action_search);
    final MenuItem itemSettings = menu.findItem(R.id.action_settings);
    final MenuItem itemFilterSubs = menu.findItem(R.id.action_filter_subscriptions_by_category);

    final boolean isSearchViewNotExpanded = !isSearchViewExpanded();

    if (isNotInInitialSetup()) {
        if (getLoadCurrentFeedFragment().isAdded()) {
            toggleMenuItemVisibility(itemSearch, false);
            toggleMenuItemVisibility(itemSortEntries, false);
            toggleMenuItemVisibility(itemFilterSubs, false);
            toggleMenuItemVisibility(itemExportAsOPML, false);
        } else if (getCurrentFeedFragment().isAdded()) {
            toggleMenuItemVisibility(itemSortEntries, false);
            toggleMenuItemVisibility(itemFilterSubs, false);
            toggleMenuItemVisibility(itemExportAsOPML, false);

            if (isSearchViewNotExpanded) {
                toggleMenuItemVisibility(itemUpdate, true);
                toggleMenuItemVisibility(itemSearch, true);
            }

            if (CurrentFeed.isRSSFeed() && CurrentFeed.isCategoriesAvailable() &&
                    isSearchViewNotExpanded) {
                toggleMenuItemVisibility(itemFilter, true);
            }
        } else if (getFeedSubscriptionsFragment().isAdded()) {
            toggleMenuItemVisibility(itemUpdate, false);
            toggleMenuItemVisibility(itemSortEntries, false);
            toggleMenuItemVisibility(itemFilter, false);

            if (isSearchViewNotExpanded) {
                toggleMenuItemVisibility(itemFilterSubs, true);
                toggleMenuItemVisibility(itemExportAsOPML, true);
                toggleMenuItemVisibility(itemSearch, true);
            }
        } else if (getSavedEntriesFragment().isAdded()) {
            toggleMenuItemVisibility(itemUpdate, false);
            toggleMenuItemVisibility(itemFilter, false);
            toggleMenuItemVisibility(itemFilterSubs, false);
            toggleMenuItemVisibility(itemExportAsOPML, false);

            if (isSearchViewNotExpanded) {
                toggleMenuItemVisibility(itemSortEntries, true);
                toggleMenuItemVisibility(itemSearch, true);
            }

            final MenuItem itemSortOrderAsc =
                    menu.findItem(R.id.action_sort_order_ascending);
            final MenuItem itemSortOrderDesc =
                    menu.findItem(R.id.action_sort_order_descending);

            if (getSavedEntriesFragment().getSortOrder() == SORT_ORDER_DESCENDING) {
                itemSortOrderDesc.setEnabled(false);

                if (!itemSortOrderAsc.isVisible()) {
                    itemSortOrderAsc.setVisible(true);
                }
            } else {
                itemSortOrderAsc.setEnabled(false);

                if (!itemSortOrderDesc.isVisible()) {
                    itemSortOrderDesc.setVisible(true);
                }
            }
        }

        if (isSearchViewNotExpanded) {
            toggleMenuItemVisibility(itemSettings, true);
        }
    }

    return true;
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:81,代码来源:MainActivity.java


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