Beispiel #1
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   SubMenu sub = menu.addSubMenu("Theme");
   sub.add(0, R.style.Theme_Sherlock, 0, "Default");
   sub.add(0, R.style.Theme_Sherlock_Light, 0, "Light");
   sub.add(0, R.style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
   sub.getItem()
       .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
   return true;
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   SubMenu subMenu = menu.addSubMenu(R.string.setting_import);
   subMenu.add(0, ORDER_DEFAULT, 0, getString(R.string.sort_default));
   subMenu.add(0, ORDER_ABC, 0, getString(R.string.sort_abc));
   subMenu.add(0, ORDER_TYPE, 0, getString(R.string.sort_type));
   subMenu.add(0, ORDER_SIZE, 0, getString(R.string.sort_size));
   subMenu
       .getItem()
       .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
   return true;
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    SubMenu s = menu.addSubMenu(0, MORE_ID, 0, R.string.default_buttons_other_actions);
    s.add(0, RELOAD_ID, 0, R.string.update_downlod_list);
    s.add(0, FILTER_EXISTING_REGIONS, 0, R.string.filter_existing_indexes);
    s.add(0, SELECT_ALL_ID, 0, R.string.select_all);
    s.add(0, DESELECT_ALL_ID, 0, R.string.deselect_all);

    s.setIcon(
        isLightActionBar()
            ? R.drawable.abs__ic_menu_moreoverflow_holo_light
            : R.drawable.abs__ic_menu_moreoverflow_holo_dark);
    s.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    return super.onCreateOptionsMenu(menu);
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {

    menu.add("Search")
        .setIcon(R.drawable.ic_action_search)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    SubMenu subMenu1 = menu.addSubMenu("Action Item");
    subMenu1.add("My Topics");
    subMenu1.add("Review");
    subMenu1.add("Config");

    MenuItem subMenu1Item = subMenu1.getItem();
    subMenu1Item.setIcon(R.drawable.ic_action_options);
    subMenu1Item.setShowAsAction(
        MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    return super.onCreateOptionsMenu(menu);
  }
  /** {@inheritDoc} */
  @Override
  public void onPrepareSubMenu(SubMenu subMenu) {
    // Clear since the order of items may change.
    subMenu.clear();

    ActivityChooserModel dataModel = ActivityChooserModel.get(mContext, mShareHistoryFileName);
    PackageManager packageManager = mContext.getPackageManager();

    final int expandedActivityCount = dataModel.getActivityCount();
    final int collapsedActivityCount = Math.min(expandedActivityCount, mMaxShownActivityCount);

    // Populate the sub-menu with a sub set of the activities.
    for (int i = 0; i < collapsedActivityCount; i++) {
      ResolveInfo activity = dataModel.getActivity(i);
      subMenu
          .add(0, i, i, activity.loadLabel(packageManager))
          .setIcon(activity.loadIcon(packageManager))
          .setOnMenuItemClickListener(mOnMenuItemClickListener);
    }

    if (collapsedActivityCount < expandedActivityCount) {
      // Add a sub-menu for showing all activities as a list item.
      SubMenu expandedSubMenu =
          subMenu.addSubMenu(
              Menu.NONE,
              collapsedActivityCount,
              collapsedActivityCount,
              mContext.getString(R.string.abs__activity_chooser_view_see_all));
      for (int i = 0; i < expandedActivityCount; i++) {
        ResolveInfo activity = dataModel.getActivity(i);
        expandedSubMenu
            .add(0, i, i, activity.loadLabel(packageManager))
            .setIcon(activity.loadIcon(packageManager))
            .setOnMenuItemClickListener(mOnMenuItemClickListener);
      }
    }
  }
  @Override
  public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    getSherlockActivity().getSupportMenuInflater().inflate(R.menu.gripmenu, menu);
    SubMenu submenu = menu.getItem(0).getSubMenu();
    submenu.clear();

    if (category == null) {
      category =
          (getArguments() != null) ? getArguments().getString(SearchFragment.ARG_CATEGORY) : null;
    }

    if (getArguments() == null
        || !getArguments().containsKey(SearchFragment.ARG_LIST)
            && !getArguments().containsKey(SearchFragment.ARG_QUERY)) {
      submenu.add(Menu.CATEGORY_SYSTEM, R.id.submenu_search, Menu.NONE, R.string.search_txt);
    }

    submenu.add(Menu.CATEGORY_SYSTEM, R.id.map_view, Menu.NONE, R.string.map_view);

    if (category != null) {
      String addString =
          getString(
              R.string.add_poi_in_cat,
              getString(
                  CategoryHelper.getCategoryDescriptorByCategoryFiltered(
                          CategoryHelper.CATEGORY_TYPE_POIS, category)
                      .description));

      submenu.add(Menu.CATEGORY_SYSTEM, R.id.menu_item_addpoi, Menu.NONE, addString);
    }

    // NotificationsSherlockFragmentDT.onPrepareOptionsMenuNotifications(menu);

    super.onPrepareOptionsMenu(menu);
  }
Beispiel #7
0
  public boolean onCreateOptionsMenu(Menu menu) {

    SubMenu my_events_submenu = menu.addSubMenu("New Account");
    my_events_submenu.add("DropBox").setIcon(R.drawable.dropbox_icon);
    my_events_submenu.add("Google Drive").setIcon(R.drawable.google_drive_icon);
    my_events_submenu.add("One Drive").setIcon(R.drawable.skydrive_icon);
    my_events_submenu.add("Ftp Account").setIcon(R.drawable.ftp_icon);
    my_events_submenu.add("WebDav");

    MenuItem subMenu1Item = my_events_submenu.getItem();
    subMenu1Item.setShowAsAction(
        MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    SubMenu my_account_submenu = menu.addSubMenu("Set Password");
    my_account_submenu.add("My Profile");
    my_account_submenu.add("Settings");
    my_account_submenu.add("Log Out");

    return true;
  }