當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。