Example #1
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   // Inflate the menu; this adds items to the action bar if it is present.
   // getMenuInflater().inflate(R.menu.rutas, menu);
   MenuItem menu3 = menu.add(Menu.NONE, MENU1, 3, "Alta Ruta");
   menu3.setAlphabeticShortcut('c');
   MenuItem menuPrincipal = menu.add(Menu.NONE, MENU2, 3, "MenĂº");
   menuPrincipal.setAlphabeticShortcut('m');
   return true;
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    MenuItem item =
        menu.add(Menu.NONE, Menu.NONE, MenuHelper.POSITION_SLIDESHOW, R.string.slide_show);
    item.setOnMenuItemClickListener(
        new MenuItem.OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
            setMode(MODE_SLIDESHOW);
            mLastSlideShowImage = mCurrentPosition;
            loadNextImage(mCurrentPosition, 0, true);
            return true;
          }
        });
    item.setIcon(android.R.drawable.ic_menu_slideshow);

    mImageMenuRunnable =
        MenuHelper.addImageMenuItems(
            menu,
            MenuHelper.INCLUDE_ALL,
            ViewImage.this,
            mHandler,
            mDeletePhotoRunnable,
            new MenuHelper.MenuInvoker() {
              public void run(final MenuHelper.MenuCallback cb) {
                if (mPaused) return;
                setMode(MODE_NORMAL);

                IImage image = mAllImages.getImageAt(mCurrentPosition);
                Uri uri = image.fullSizeImageUri();
                cb.run(uri, image);

                // We might have deleted all images in the callback, so
                // call setImage() only if we still have some images.
                if (mAllImages.getCount() > 0) {
                  mImageView.clear();
                  setImage(mCurrentPosition, false);
                }
              }
            });

    item =
        menu.add(
            Menu.NONE, Menu.NONE, MenuHelper.POSITION_GALLERY_SETTING, R.string.camerasettings);
    item.setOnMenuItemClickListener(
        new MenuItem.OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
            Intent preferences = new Intent();
            preferences.setClass(ViewImage.this, GallerySettings.class);
            startActivity(preferences);
            return true;
          }
        });
    item.setAlphabeticShortcut('p');
    item.setIcon(android.R.drawable.ic_menu_preferences);

    return true;
  }
Example #3
0
 // creates menu option
 private void CreateMenu(Menu menu) {
   menu.setQwertyMode(true);
   MenuItem mu1 = menu.add(0, 0, 0, "Logout"); // send item id to 0 if Add isclicked
   {
     mu1.setAlphabeticShortcut('a');
     // mu1.setIcon(R.drawable.ic_launcher);
   }
 }
 private void CreateMenu(Menu menu) {
   MenuItem mnu1 = menu.add(0, 0, 0, "Opcion 1");
   {
     mnu1.setAlphabeticShortcut('a');
     mnu1.setIcon(R.drawable.ic_launcher);
   }
   MenuItem mnu2 = menu.add(0, 1, 1, "Opcion 2");
   {
     mnu2.setAlphabeticShortcut('b');
     mnu2.setIcon(R.drawable.ic_launcher);
   }
   MenuItem mnu3 = menu.add(0, 2, 2, "Opcion 3");
   {
     mnu3.setAlphabeticShortcut('c');
     mnu3.setIcon(R.drawable.ic_launcher);
   }
   MenuItem mnu4 = menu.add(0, 3, 3, "Opcion 4");
   {
     mnu4.setAlphabeticShortcut('d');
   }
   MenuItem mnu5 = menu.add(0, 4, 4, "Opcion 5");
   {
     mnu4.setAlphabeticShortcut('d');
   }
   MenuItem mnu6 = menu.add(0, 5, 5, "Opcion 6");
   {
     mnu4.setAlphabeticShortcut('d');
   }
   MenuItem mnu7 = menu.add(0, 6, 6, "Opcion 7");
   {
     mnu4.setAlphabeticShortcut('d');
   }
 }
  private void CreateMenu(Menu menu) {
    MenuItem menu1 = menu.add(0, 0, 0, "Menu1");
    menu1.setAlphabeticShortcut('a');
    menu1.setIcon(R.mipmap.ic_launcher);

    MenuItem menu2 = menu.add(0, 1, 1, "Menu2");
    menu2.setAlphabeticShortcut('a');
    menu2.setIcon(R.mipmap.ic_launcher);

    MenuItem menu3 = menu.add(0, 2, 2, "Menu3");
    menu3.setAlphabeticShortcut('a');
    menu3.setIcon(R.mipmap.ic_launcher);

    MenuItem menu4 = menu.add(0, 3, 3, "Menu4");
    menu4.setAlphabeticShortcut('a');
    menu4.setIcon(R.mipmap.ic_launcher);

    MenuItem menu5 = menu.add(0, 4, 4, "Menu5");
    menu5.setAlphabeticShortcut('a');
    menu5.setIcon(R.mipmap.ic_launcher);
  }
 @Override
 public MenuItem setAlphabeticShortcut(char alphaChar) {
   mNativeItem.setAlphabeticShortcut(alphaChar);
   return this;
 }
Example #7
0
  public boolean bindNativeOverflow(
      android.view.Menu menu,
      android.view.MenuItem.OnMenuItemClickListener listener,
      HashMap<android.view.MenuItem, MenuItemImpl> map) {
    final List<MenuItemImpl> nonActionItems = getNonActionItems();
    if (nonActionItems == null || nonActionItems.size() == 0) {
      return false;
    }

    boolean visible = false;
    menu.clear();
    for (MenuItemImpl nonActionItem : nonActionItems) {
      if (!nonActionItem.isVisible()) {
        continue;
      }
      visible = true;

      android.view.MenuItem nativeItem;
      if (nonActionItem.hasSubMenu()) {
        android.view.SubMenu nativeSub =
            menu.addSubMenu(
                nonActionItem.getGroupId(),
                nonActionItem.getItemId(),
                nonActionItem.getOrder(),
                nonActionItem.getTitle());

        SubMenuBuilder subMenu = (SubMenuBuilder) nonActionItem.getSubMenu();
        for (MenuItemImpl subItem : subMenu.getVisibleItems()) {
          android.view.MenuItem nativeSubItem =
              nativeSub.add(
                  subItem.getGroupId(),
                  subItem.getItemId(),
                  subItem.getOrder(),
                  subItem.getTitle());

          nativeSubItem.setIcon(subItem.getIcon());
          nativeSubItem.setOnMenuItemClickListener(listener);
          nativeSubItem.setEnabled(subItem.isEnabled());
          nativeSubItem.setIntent(subItem.getIntent());
          nativeSubItem.setNumericShortcut(subItem.getNumericShortcut());
          nativeSubItem.setAlphabeticShortcut(subItem.getAlphabeticShortcut());
          nativeSubItem.setTitleCondensed(subItem.getTitleCondensed());
          nativeSubItem.setCheckable(subItem.isCheckable());
          nativeSubItem.setChecked(subItem.isChecked());

          if (subItem.isExclusiveCheckable()) {
            nativeSub.setGroupCheckable(subItem.getGroupId(), true, true);
          }

          map.put(nativeSubItem, subItem);
        }

        nativeItem = nativeSub.getItem();
      } else {
        nativeItem =
            menu.add(
                nonActionItem.getGroupId(),
                nonActionItem.getItemId(),
                nonActionItem.getOrder(),
                nonActionItem.getTitle());
      }
      nativeItem.setIcon(nonActionItem.getIcon());
      nativeItem.setOnMenuItemClickListener(listener);
      nativeItem.setEnabled(nonActionItem.isEnabled());
      nativeItem.setIntent(nonActionItem.getIntent());
      nativeItem.setNumericShortcut(nonActionItem.getNumericShortcut());
      nativeItem.setAlphabeticShortcut(nonActionItem.getAlphabeticShortcut());
      nativeItem.setTitleCondensed(nonActionItem.getTitleCondensed());
      nativeItem.setCheckable(nonActionItem.isCheckable());
      nativeItem.setChecked(nonActionItem.isChecked());

      if (nonActionItem.isExclusiveCheckable()) {
        menu.setGroupCheckable(nonActionItem.getGroupId(), true, true);
      }

      map.put(nativeItem, nonActionItem);
    }
    return visible;
  }
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuItem menu1 = menu.add(Menu.NONE, MENU1, 3, "Finalizar venta");
   menu1.setAlphabeticShortcut('f');
   return true;
 }