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


Java Menu.removeItem方法代码示例

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


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

示例1: onPrepareActionMode

import android.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
    if(loaderId == INCOMPLETE_LOADER_ID || loaderId == EXPIRED_LOADER_ID){
        // remove edit action
        menu.removeItem(R.id.action_edit);
    }
    if (loaderId == DELETED_LOADER_ID){
        menu.removeItem(R.id.action_empty_bin);
    }
    return true;
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:12,代码来源:ToduleListFragment.java

示例2: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (pager == null) return;
    inflater.inflate(R.menu.menu_main, menu);
    if (isPlaylistPage()) {
        menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title);
    }
    Fragment currentFragment = getCurrentFragment();
    if (currentFragment instanceof AbsLibraryPagerRecyclerViewCustomGridSizeFragment && currentFragment.isAdded()) {
        AbsLibraryPagerRecyclerViewCustomGridSizeFragment absLibraryRecyclerViewCustomGridSizeFragment = (AbsLibraryPagerRecyclerViewCustomGridSizeFragment) currentFragment;

        menu.findItem(R.id.action_colored_footers).setChecked(absLibraryRecyclerViewCustomGridSizeFragment.usePalette());
        menu.findItem(R.id.action_colored_footers).setEnabled(absLibraryRecyclerViewCustomGridSizeFragment.canUsePalette());
    } else {
        menu.removeItem(R.id.action_colored_footers);
    }
    Activity activity = getActivity();
    if (activity == null) return;
    ToolbarContentTintHelper.handleOnCreateOptionsMenu(getActivity(), toolbar, menu, ATHToolbarActivity.getToolbarBackgroundColor(toolbar));
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:22,代码来源:LibraryFragment.java

示例3: onPrepareOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    if (prefs.getBoolean("manage_system", false)) {
        menu.findItem(R.id.menu_app_user).setChecked(prefs.getBoolean("show_user", true));
        menu.findItem(R.id.menu_app_system).setChecked(prefs.getBoolean("show_system", false));
    } else {
        Menu submenu = menu.findItem(R.id.menu_filter).getSubMenu();
        submenu.removeItem(R.id.menu_app_user);
        submenu.removeItem(R.id.menu_app_system);
    }

    menu.findItem(R.id.menu_app_nointernet).setChecked(prefs.getBoolean("show_nointernet", true));
    menu.findItem(R.id.menu_app_disabled).setChecked(prefs.getBoolean("show_disabled", true));

    String sort = prefs.getString("sort", "name");
    if ("uid".equals(sort))
        menu.findItem(R.id.menu_sort_uid).setChecked(true);
    else
        menu.findItem(R.id.menu_sort_name).setChecked(true);

    menu.findItem(R.id.menu_lockdown).setChecked(prefs.getBoolean("lockdown", false));

    return super.onPrepareOptionsMenu(menu);
}
 
开发者ID:miankai,项目名称:MKAPP,代码行数:27,代码来源:ActivityMain.java

示例4: onPrepareOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
    public void onPrepareOptionsMenu(Menu menu) {
        super.onPrepareOptionsMenu(menu);

        /* Remove some menu items if book doesn't exist or it doesn't contain any notes. */

        if (mBook == null || mListAdapter.getCount() == 0) {
            menu.removeItem(R.id.books_options_menu_item_cycle_visibility);
        }

        if (mBook == null) {
            menu.removeItem(R.id.books_options_menu_book_preface);
        }

//        /* Toggle paste item visibility. */
//        item = menu.findItem(R.id.books_options_menu_item_paste);
//        if (item != null && mShelf != null) {
//            item.setVisible(mShelf.haveCutNotes());
//        }
    }
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:21,代码来源:BookFragment.java

示例5: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
/**
 * Initialize options menu
 *
 * @param menu Menu
 * @return Boolean
 */
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    getMenuInflater().inflate(R.menu.settings, menu);

    Chat activeChat = appController.getCurrentActiveChat();
    Activity currentActivity = appController.getCurrentActivity();
    String currentActivityClass = "";

    if (currentActivity != null) {
        currentActivityClass = appController.getCurrentActivity().getLocalClassName();
    }

    boolean isChat = currentActivityClass.equals("ui.ChatActivity");
    boolean isPublicChat = isChat && activeChat.isPublicChat();

    if (!isChat) {
        menu.removeItem(R.id.leave_chat_room);
    }

    if (!isPublicChat) {
        menu.removeItem(R.id.list_travelers);
    }

    return super.onCreateOptionsMenu(menu);
}
 
开发者ID:trvlrch,项目名称:trvlr-android,代码行数:32,代码来源:BaseDrawerActivity.java

示例6: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (mPresenter.getIssue() != null) {
        getMenuInflater().inflate(R.menu.menu_issue_detail, menu);
        boolean isCanToggle = AppData.INSTANCE.getLoggedUser().getLogin()
                .equals(mPresenter.getIssue().getUser().getLogin()) ||
                AppData.INSTANCE.getLoggedUser().getLogin()
                        .equals(mPresenter.getIssue().getRepoAuthorName());
        boolean isOpen = mPresenter.getIssue().getState().equals(Issue.IssueState.open);
        if (isCanToggle) {
            MenuItem item = menu.findItem(R.id.action_issue_toggle);
            item.setTitle(isOpen ? R.string.close : R.string.reopen);
        } else {
            menu.removeItem(R.id.action_issue_toggle);
        }
    }
    return true;
}
 
开发者ID:ThirtyDegreesRay,项目名称:OpenHub,代码行数:19,代码来源:IssueDetailActivity.java

示例7: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.menu_main, menu);
    if (isPlaylistPage()) {
        menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title);
    }
    Fragment currentFragment = getCurrentFragment();
    if (currentFragment instanceof AbsLibraryPagerRecyclerViewCustomGridSizeFragment && currentFragment.isAdded()) {
        AbsLibraryPagerRecyclerViewCustomGridSizeFragment absLibraryRecyclerViewCustomGridSizeFragment = (AbsLibraryPagerRecyclerViewCustomGridSizeFragment) currentFragment;

        MenuItem gridSizeItem = menu.findItem(R.id.action_grid_size);
        if (Util.isLandscape(getResources())) {
            gridSizeItem.setTitle(R.string.action_grid_size_land);
        }
        setUpGridSizeMenu(absLibraryRecyclerViewCustomGridSizeFragment, gridSizeItem.getSubMenu());

        menu.findItem(R.id.action_colored_footers).setChecked(absLibraryRecyclerViewCustomGridSizeFragment.usePalette());
        menu.findItem(R.id.action_colored_footers).setEnabled(absLibraryRecyclerViewCustomGridSizeFragment.canUsePalette());
    } else {
        menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title);
        menu.removeItem(R.id.action_grid_size);
        menu.removeItem(R.id.action_colored_footers);
    }
    colorToolbar();
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:27,代码来源:LibraryFragment.java

示例8: adjustMenuIcons

import android.view.Menu; //导入方法依赖的package包/类
private void adjustMenuIcons(Menu menu, int itemIdAddRemove, int itemIdAdd,
                             int titleRes, int iconRes) {
    menu.removeItem(itemIdAddRemove);
    menu.add(0, itemIdAdd, Menu.NONE, titleRes)
            .setIcon(iconRes)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
 
开发者ID:Laaidback,项目名称:A.scribe,代码行数:8,代码来源:NoteActivity.java

示例9: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    if (!TimberUtils.hasEffectsPanel(BaseActivity.this)) {
        menu.removeItem(R.id.action_equalizer);
    }
    ATE.applyMenu(this, getATEKey(), menu);
    return true;
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:10,代码来源:BaseActivity.java

示例10: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.crop_image_menu, menu);

    if (!mOptions.allowRotation) {
        menu.removeItem(R.id.crop_image_menu_rotate_left);
        menu.removeItem(R.id.crop_image_menu_rotate_right);
    } else if (mOptions.allowCounterRotation) {
        menu.findItem(R.id.crop_image_menu_rotate_left).setVisible(true);
    }

    Drawable cropIcon = null;
    try {
        cropIcon = ContextCompat.getDrawable(this, R.drawable.crop_image_menu_crop);
        if (cropIcon != null) {
            menu.findItem(R.id.crop_image_menu_crop).setIcon(cropIcon);
        }
    } catch (Exception e) {
    }

    if (mOptions.activityMenuIconColor != 0) {
        updateMenuItemIconColor(menu, R.id.crop_image_menu_rotate_left, mOptions.activityMenuIconColor);
        updateMenuItemIconColor(menu, R.id.crop_image_menu_rotate_right, mOptions.activityMenuIconColor);
        if (cropIcon != null) {
            updateMenuItemIconColor(menu, R.id.crop_image_menu_crop, mOptions.activityMenuIconColor);
        }
    }

    return true;
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:31,代码来源:CropImageActivity.java

示例11: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_artist_detail, menu);
    menu.removeItem(R.id.action_sort_order);
    //setUpSortOrderMenu(sortOrder.getSubMenu());
    return true;
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:8,代码来源:ArtistDetailActivity.java

示例12: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
/**
 * Callback for options menu.
 */
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, menu, inflater);

    inflater.inflate(R.menu.close_done, menu);

    /* Remove search item. */
    menu.removeItem(R.id.activity_action_search);
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:13,代码来源:FilterFragment.java

示例13: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main_menu, menu);
    // If the device doesn't support camera, remove the camera menu item
    if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
        menu.removeItem(R.id.menu_camera);
    }
    return true;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:11,代码来源:MainActivity.java

示例14: onCreateOptionsMenu

import android.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_ops, menu);
    if (!supportAppops) {
        menu.removeItem(R.id.action_allow);
        menu.removeItem(R.id.action_ignore);
        menu.removeItem(R.id.action_reset);
        menu.removeItem(R.id.action_select_all);
        menu.removeItem(R.id.action_select_inverse);
    } else if (getSelectedSize() > 0) {
        if (opsFragment.canAllow()) {
            menu.findItem(R.id.action_allow).getIcon().setTint(mColorControlNormal);
        } else {
            menu.removeItem(R.id.action_allow);
        }
        if (opsFragment.canIgnore()) {
            menu.findItem(R.id.action_ignore).getIcon().setTint(mColorControlNormal);
        } else {
            menu.removeItem(R.id.action_ignore);
        }
        menu.removeItem(R.id.action_reset);
    } else {
        menu.removeItem(R.id.action_allow);
        menu.removeItem(R.id.action_ignore);
        menu.findItem(R.id.action_reset).getIcon().setTint(mColorControlNormal);
        menu.removeItem(R.id.action_select_inverse);
    }
    menu.findItem(R.id.action_sort).getIcon().setTint(mColorControlNormal);
    return true;
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:32,代码来源:BreventOps.java

示例15: updateMenu

import android.view.Menu; //导入方法依赖的package包/类
private void updateMenu(Menu menu) {
    if (supportsDualMode()) {
        menu.findItem(R.id.tile_dual).setChecked(dual);
    } else {
        menu.removeItem(R.id.tile_dual);
    }
    MenuItem miLocked = menu.findItem(R.id.tile_locked);
    MenuItem miLockedOnly = menu.findItem(R.id.tile_locked_only);
    MenuItem miSecured = menu.findItem(R.id.tile_secured);
    miLocked.setChecked(!locked);
    miLockedOnly.setChecked(lockedOnly);
    miLockedOnly.setEnabled(!locked);
    miSecured.setChecked(!secured && !"gb_tile_lock_screen".equals(key));
    miSecured.setEnabled(!locked && !"gb_tile_lock_screen".equals(key));
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:16,代码来源:TileOrderActivity.java


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