@Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    MenuInflater mi = new MenuInflater(getActivity());
    mi.inflate(R.menu.main, menu);
    MenuItem log = menu.findItem(R.id.logs);
    log.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            showAllLogs();
            return true;
          }
        });

    MenuItem settings = menu.findItem(R.id.settings);
    settings.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          void openSettingsNative(final MenuItem item) {
            setContent(createSettingsNativeFragment(), true, getString(R.string.settings));
          }

          @Override
          public boolean onMenuItemClick(final MenuItem item) {
            if (getActivity() instanceof FragmentActivity) {
              setContent(new SettingsFragment(), true, getString(R.string.settings));
            } else {
              openSettingsNative(item);
            }
            return true;
          }
        });
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    menu.clear();
    MenuItem item1 = menu.add("Add New Category");
    item1.setIcon(R.drawable.add_icon);
    item1.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    item1.setOnMenuItemClickListener(
        new MenuItem.OnMenuItemClickListener() {

          @Override
          public boolean onMenuItemClick(MenuItem item) {
            Intent localIntent =
                new Intent(IdiomsCategoryListActivity.this, AddCategoryActivity.class);
            localIntent.putExtra("langname", langName);
            IdiomsCategoryListActivity.this.pendingIntent = localIntent;
            IdiomsCategoryListActivity.this.launchPendingIntent();
            IdiomsCategoryListActivity.this.finish();
            return true;
          }
        });
    MenuItem item2 = menu.add("Delete " + langName);
    item2.setIcon(R.drawable.delete_icon);
    item2.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    item2.setOnMenuItemClickListener(
        new MenuItem.OnMenuItemClickListener() {

          @Override
          public boolean onMenuItemClick(MenuItem item) {
            AlertDialog.Builder alertDialogBuilder =
                new AlertDialog.Builder(IdiomsCategoryListActivity.this);
            alertDialogBuilder.setTitle("Delete Language");

            // set dialog message
            alertDialogBuilder
                .setMessage("Are you sure to delete " + langName)
                .setCancelable(false)
                .setPositiveButton(
                    "Yes",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {
                        DataTask task = new DataTask();
                        task.execute();
                      }
                    })
                .setNegativeButton(
                    "No",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                      }
                    });
            AlertDialog alertDialog = alertDialogBuilder.create();

            alertDialog.show();

            return true;
          }
        });
    return super.onCreateOptionsMenu(menu);
  }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.layout_apps_list) {
      final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
      Application app = listApps.get(info.position);
      if (app.getName() == null) {
        menu.setHeaderTitle("Unknown application");
      } else {
        menu.setHeaderTitle(app.getName());
      }
      MenuItem menuItem = menu.add(Menu.NONE, MENUITEM_DETAILS, MENUITEM_DETAILS, "Details");
      menuItem.setOnMenuItemClickListener(
          new OnMenuItemClickListener() {

            @Override
            public boolean onMenuItemClick(MenuItem item) {
              editApplication(info.position);
              return true;
            }
          });
      menuItem = menu.add(Menu.NONE, MENUITEM_DELETE, MENUITEM_DELETE, "Delete");
      menuItem.setOnMenuItemClickListener(
          new OnMenuItemClickListener() {

            @Override
            public boolean onMenuItemClick(MenuItem item) {
              deleteApplication(info.position);
              return true;
            }
          });
    }
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    Drawable tintedRefresh = ContextCompat.getDrawable(this, R.drawable.btn_toolbar_reload);
    int tintColor = ContextCompat.getColor(this, R.color.light_normal_color);
    tintedRefresh.setColorFilter(tintColor, PorterDuff.Mode.SRC_IN);

    MenuItem refreshItem = menu.add(R.string.physical_web_refresh);
    refreshItem.setIcon(tintedRefresh);
    refreshItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    refreshItem.setOnMenuItemClickListener(
        new MenuItem.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            startRefresh(true, false);
            return true;
          }
        });

    MenuItem closeItem = menu.add(R.string.close);
    closeItem.setIcon(R.drawable.btn_close);
    closeItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    closeItem.setOnMenuItemClickListener(
        new MenuItem.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            finish();
            return true;
          }
        });

    return true;
  }
  @Override
  public void buildContextMenu(ContextMenu menu, XbmcRequester requester) {

    //		intent.putExtra("FOLDER", getFilePath());
    //
    //		intent.putExtra("MEDIA_TYPE", getPlaylistId());
    //
    //		intent.putExtra("TYPE", getType());
    //
    MenuItem playItem = menu.add(R.string.play);
    Intent intent = new Intent();
    intent.putExtra("WHERECLAUSE", "idEpisode = " + idEpisode);
    intent.putExtra("EXEC_MODE", execModeEnum.Play);
    playItem.setIntent(intent);
    playItem.setOnMenuItemClickListener(new playVideoSelectionMenuItemClickListener());
    //
    playItem = menu.add(R.string.enqueue);
    Intent intent2 = new Intent();
    intent2.putExtra("EXEC_MODE", execModeEnum.Enqueue);
    intent2.putExtra("WHERECLAUSE", "idEpisode = " + idEpisode);

    playItem.setIntent(intent2);
    playItem.setOnMenuItemClickListener(new playVideoSelectionMenuItemClickListener());

    playItem = menu.add(R.string.clear_playlist);
    playItem.setOnMenuItemClickListener(new ClearPlaylistMenuItemClickListener());
  }
  @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;
  }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {

    MenuItem llamar = menu.add("Llamar");

    llamar.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {

          @Override
          public boolean onMenuItemClick(MenuItem item) {
            Intent irParaTelefono = new Intent(Intent.ACTION_CALL);
            Uri llamarA = Uri.parse("tel:" + alumno.getTelefono());
            irParaTelefono.setData(llamarA);

            startActivity(irParaTelefono);
            return false;
          }
        });

    menu.add("Enviar un SMS");

    MenuItem site = menu.add("Navegar a");

    site.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {

          @Override
          public boolean onMenuItemClick(MenuItem item) {
            Intent irParaSite = new Intent(Intent.ACTION_VIEW);
            Uri localSite = Uri.parse("http://" + alumno.getSite());
            irParaSite.setData(localSite);

            startActivity(irParaSite);
            return false;
          }
        });

    MenuItem eliminar = menu.add("Eliminar");
    eliminar.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {

          @Override
          public boolean onMenuItemClick(MenuItem item) {
            AlumnoDAO dao = new AlumnoDAO(ListaAllumnos.this);
            dao.eliminar(alumno);

            dao.close();

            cargarLista();

            return false;
          }
        });

    menu.add("Ver en el mapa");
    menu.add("Enviar un email");

    super.onCreateContextMenu(menu, v, menuInfo);
  }
  /** Set up the menu items */
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem mi = menu.add(R.string.lbl_menu_edit);
    mi.setIcon(android.R.drawable.ic_menu_agenda);
    mi.setOnMenuItemClickListener(lMenuEditClicked);

    mi = menu.add(R.string.lbl_menu_report);
    mi.setIcon(android.R.drawable.ic_menu_report_image);
    mi.setOnMenuItemClickListener(lMenuReportsClicked);
    return super.onCreateOptionsMenu(menu);
  }
示例#9
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    // don't offer menus when creating shortcut
    if (makingShortcut) return true;

    // add host, ssh keys, about
    sortcolor = menu.add(R.string.list_menu_sortcolor);
    sortcolor.setIcon(android.R.drawable.ic_menu_share);
    sortcolor.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
            sortedByColor = true;
            updateList();
            return true;
          }
        });

    sortlast = menu.add(R.string.list_menu_sortname);
    sortlast.setIcon(android.R.drawable.ic_menu_share);
    sortlast.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
            sortedByColor = false;
            updateList();
            return true;
          }
        });

    MenuItem keys = menu.add(R.string.list_menu_pubkeys);
    keys.setIcon(android.R.drawable.ic_lock_lock);
    keys.setIntent(new Intent(HostListActivity.this, PubkeyListActivity.class));

    MenuItem colors = menu.add("Colors");
    colors.setIcon(android.R.drawable.ic_menu_slideshow);
    colors.setIntent(new Intent(HostListActivity.this, ColorsActivity.class));

    MenuItem settings = menu.add(R.string.list_menu_settings);
    settings.setIcon(android.R.drawable.ic_menu_preferences);
    settings.setIntent(new Intent(HostListActivity.this, SettingsActivity.class));

    MenuItem help = menu.add(R.string.title_help);
    help.setIcon(android.R.drawable.ic_menu_help);
    help.setIntent(new Intent(HostListActivity.this, HelpActivity.class));

    return true;
  }
示例#10
0
 /*
  * (non-Javadoc)
  * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)
  */
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   getMenuInflater().inflate(R.menu.activity_posts, menu);
   final MenuItem newPostItem = menu.findItem(R.id.new_post);
   newPostItem.setOnMenuItemClickListener(this);
   return true;
 }
示例#11
0
  /**
   * Shows "call via" menu allowing user to selected from multiple providers.
   *
   * @param context the android context
   * @param v the View that will contain the popup menu.
   * @param destination target callee name.
   */
  private static void showCallViaMenu(final Context context, View v, final String destination) {
    PopupMenu popup = new PopupMenu(context, v);

    Menu menu = popup.getMenu();

    Iterator<ProtocolProviderService> registeredProviders =
        AccountUtils.getRegisteredProviders().iterator();

    while (registeredProviders.hasNext()) {
      final ProtocolProviderService provider = registeredProviders.next();
      String accountAddress = provider.getAccountID().getAccountAddress();

      MenuItem menuItem = menu.add(Menu.NONE, Menu.NONE, Menu.NONE, accountAddress);

      menuItem.setOnMenuItemClickListener(
          new MenuItem.OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
              createCall(context, destination, provider);

              return false;
            }
          });
    }

    popup.show();
  }
示例#12
0
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   MenuInflater inflater = mCoolReader.getMenuInflater();
   menu.clear();
   inflater.inflate(
       mList.isShortcutMode()
           ? R.menu.cr3_bookmark_shortcut_context_menu
           : R.menu.cr3_bookmark_context_menu,
       menu);
   AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfo;
   if (mi != null) selectedItem = mi.position;
   Bookmark bm = mList.getSelectedBookmark();
   menu.setHeaderTitle(getContext().getString(R.string.context_menu_title_bookmark));
   for (int i = 0; i < menu.size(); i++) {
     MenuItem menuItem = menu.getItem(i);
     if (menuItem.getItemId() == R.id.bookmark_shortcut_goto
         || menuItem.getItemId() == R.id.bookmark_edit
         || menuItem.getItemId() == R.id.bookmark_delete) menuItem.setEnabled(bm != null);
     if (menuItem.getItemId() == R.id.bookmark_edit)
       menuItem.setEnabled(
           bm != null
               && (bm.getType() == Bookmark.TYPE_COMMENT
                   || bm.getType() == Bookmark.TYPE_CORRECTION));
     menuItem.setOnMenuItemClickListener(
         new OnMenuItemClickListener() {
           public boolean onMenuItemClick(MenuItem item) {
             onContextItemSelected(item);
             return true;
           }
         });
   }
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Safe to hold on to
    mMenu = menu;

    if (!mParams.shouldShowMenu) return false;

    MenuItem item;
    for (int i = 0; i < mParams.numItems; i++) {
      if ((item = onAddMenuItem(menu, i)) == null) {
        // Add a default item for this position if the subclasses
        // haven't
        CharSequence givenTitle = mParams.itemTitles.get(i);
        item = menu.add(0, 0, 0, (givenTitle != null) ? givenTitle : ("Item " + i));
      }

      if (item != null) {
        mItems[i] = item;

        if (mParams.listenForClicks) {
          item.setOnMenuItemClickListener(this);
        }
      }
    }

    return true;
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.frag1act1, menu);
    MenuItem menucart = menu.findItem(R.id.menu_cart);
    menucart.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {

          @Override
          public boolean onMenuItemClick(MenuItem arg0) {
            Intent inten = new Intent(getBaseContext(), ShoppingCartActivity.class);
            startActivity(inten);
            return false;
          }
        });
    /*
    		MenuItem menuSettings = menu.findItem(R.id.menu_settings);
    		menuSettings.setOnMenuItemClickListener(new OnMenuItemClickListener() {
    			@Override
    			public boolean onMenuItemClick(MenuItem item) {
    				// TODO Auto-generated method stub
    				// Do something here
    				Toast.makeText(getApplicationContext(), "Nothing here!",
    						Toast.LENGTH_LONG).show();
    				return false;
    			}
    		});
    */
    return true;
  }
  @Override
  public void onCreateOptionsMenu(final Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    // inflater.inflate(R.menu.menu_main, menu);

    try {
      menu.add(1, 99, 1, "help")
          .setIcon(R.drawable.help_icon)
          .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

      final MenuItem action_help = menu.findItem(R.id.action_help);
      menu.findItem(R.id.action_help).setVisible(true);
      action_help.setOnMenuItemClickListener(
          new MenuItem.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
              menu.findItem(R.id.action_help).setVisible(false);
              return false;
            }
          });

    } catch (Exception e) {

    }
  }
示例#16
0
  @Override
  public boolean onCreateOptionsMenu(android.view.Menu menu) {
    super.onCreateOptionsMenu(menu);
    try {
      if (processBA.subExists("activity_actionbarhomeclick")) {
        Class.forName("android.app.ActionBar")
            .getMethod("setHomeButtonEnabled", boolean.class)
            .invoke(getClass().getMethod("getActionBar").invoke(this), true);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (menuItems == null) return false;
    for (B4AMenuItem bmi : menuItems) {
      android.view.MenuItem mi = menu.add(bmi.title);
      if (bmi.drawable != null) mi.setIcon(bmi.drawable);
      if (android.os.Build.VERSION.SDK_INT >= 11) {
        try {
          if (bmi.addToBar) {
            android.view.MenuItem.class.getMethod("setShowAsAction", int.class).invoke(mi, 1);
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      mi.setOnMenuItemClickListener(
          new B4AMenuItemsClickListener(bmi.eventName.toLowerCase(BA.cul)));
    }

    return true;
  }
示例#17
0
 @Override
 public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener) {
   mMenuItemClickListener = menuItemClickListener;
   // Register ourselves as the listener to proxy
   mNativeItem.setOnMenuItemClickListener(this);
   return this;
 }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_edit_dict, menu);

    MenuItem item = menu.findItem(R.id.menu_item_delete);
    item.setOnMenuItemClickListener(this);
  }
示例#19
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   MenuItem item = menu.add(0, LICENSE, 0, "Sobre");
   item.setOnMenuItemClickListener(new MenuSobreItem());
   return true;
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_show_route_map, menu);
    MenuItem item = menu.findItem(R.id.satellite);
    item.setVisible(map.getMapType() == GoogleMap.MAP_TYPE_NORMAL);
    item.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
            invalidateOptionsMenu();
            return true;
          }
        });
    item = menu.findItem(R.id.map);
    item.setVisible(map.getMapType() != GoogleMap.MAP_TYPE_NORMAL);
    item.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
            invalidateOptionsMenu();
            return true;
          }
        });
    item = menu.findItem(R.id.settings_for_place);
    item.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            showSettingDialog();
            return true;
          }
        });
    item = menu.findItem(R.id.delete_route);
    item.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            showDeleteRouteDialog();
            return true;
          }
        });

    return true;
  }
示例#21
0
 private void addSettingItem(Menu menu) {
   mMenu = menu.add(Menu.NONE, PopupWindowBuilder.ID_MENU_SETTING, 100, "");
   mMenu.setIcon(R.mipmap.ic_menu_more);
   mMenu.setOnMenuItemClickListener(this);
   // mMenu.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
   MenuItemCompat.setShowAsAction(mMenu, MenuItem.SHOW_AS_ACTION_ALWAYS);
   mMenu.setVisible(isMenuVisible);
 }
示例#22
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   final MenuItem item =
       menu.add(0, 1, Menu.NONE, myResource.getResource("menu").getResource("search").getValue());
   item.setOnMenuItemClickListener(this);
   item.setIcon(R.drawable.ic_menu_search);
   return true;
 }
示例#23
0
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem item;
    super.onCreateOptionsMenu(menu);

    // add(groupid, itemid, order e title)
    // add(title)
    item = menu.add("Done");
    item.setOnMenuItemClickListener(
        new MenuItem.OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
            done();
            return true;
          }
        });
    // item.setIcon(R.drawable.<?>);

    if (getId() != -1) {
      // add(groupid, itemid, order e title)
      // add(title)
      item = menu.add("Delete");
      item.setOnMenuItemClickListener(
          new MenuItem.OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
              delete();
              return true;
            }
          });
      // item.setIcon(R.drawable.<?>);
    }

    // add(groupid, itemid, order e title)
    // add(title)
    item = menu.add("Cancel");
    item.setOnMenuItemClickListener(
        new MenuItem.OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
            cancel();
            return true;
          }
        });
    // item.setIcon(R.drawable.<?>);

    return true;
  }
示例#24
0
 public void setMenuItem(MenuItem menuItem) {
   menuItem.setOnMenuItemClickListener(
       new MenuItem.OnMenuItemClickListener() {
         @Override
         public boolean onMenuItemClick(MenuItem item) {
           showSearch();
           return true;
         }
       });
 }
 public void initializeItem(
     ContextMenu menu,
     int id,
     TGActionProcessorListener actionProcessor,
     boolean enabled,
     boolean checked) {
   MenuItem menuItem = menu.findItem(id);
   menuItem.setOnMenuItemClickListener(actionProcessor);
   menuItem.setEnabled(enabled);
   menuItem.setChecked(checked);
 }
  public boolean onCreateOptionsMenu(Menu menu) {

    MenuItem sortByFront = menu.add("Sort by name");
    MenuItem sortByStrength = menu.add("Sort by correctness");
    MenuItem sortByTimeCreated = menu.add("Sort by date");

    sortByFront.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
            deck.sortByFront();
            backend.save(deck);
            cards = deck.getCards();
            listView.setAdapter(new ArrayAdapter<Cards>(ViewDecks.this, R.layout.card, cards));
            return true;
          }
        });

    sortByStrength.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
            deck.sortByStrength();
            backend.save(deck);
            cards = deck.getCards();
            listView.setAdapter(new ArrayAdapter<Cards>(ViewDecks.this, R.layout.card, cards));
            return true;
          }
        });

    sortByTimeCreated.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
            deck.sortByCalendar();
            backend.save(deck);
            cards = deck.getCards();
            listView.setAdapter(new ArrayAdapter<Cards>(ViewDecks.this, R.layout.card, cards));
            return true;
          }
        });

    return true;
  }
示例#27
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {

    // page 01 TODO: make an wire-frame icon for each page representing what
    // that page offers.
    MenuItem itemPageOne = menu.add("Status");
    itemPageOne.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            mvFlipper.setvFlipperPage(0);
            return false;
          }
        });

    // page 02 TODO: make an wire-frame icon for each page representing what
    // that page offers.
    MenuItem itemPageTwo = menu.add("Chart");
    itemPageTwo.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            mvFlipper.setvFlipperPage(1);
            return false;
          }
        });

    // page 01 TODO: make an wire-frame icon for each page representing what
    // that page offers.
    MenuItem itemPageThree = menu.add("Page-3");
    itemPageThree.setOnMenuItemClickListener(
        new OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            mvFlipper.setvFlipperPage(2);
            return false;
          }
        });

    return super.onCreateOptionsMenu(menu);
  }
 @Override
 public void onClick(View view) {
   final PopupMenu popupMenu = new PopupMenu(DialtactsActivity.this, view);
   final Menu menu = popupMenu.getMenu();
   popupMenu.inflate(R.menu.dialtacts_search_options);
   final MenuItem filterOptionMenuItem = menu.findItem(R.id.filter_option);
   filterOptionMenuItem.setOnMenuItemClickListener(mFilterOptionsMenuItemClickListener);
   final MenuItem addContactOptionMenuItem = menu.findItem(R.id.add_contact);
   addContactOptionMenuItem.setIntent(
       new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI));
   popupMenu.show();
 }
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuItem item = menu.add("Change password");
   item.setOnMenuItemClickListener(
       new MenuItem.OnMenuItemClickListener() {
         @Override
         public boolean onMenuItemClick(MenuItem item) {
           changePass();
           return true;
         }
       });
   return true;
 }
示例#30
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuItem buy = menu.add(R.string.buy_desksms);
   buy.setOnMenuItemClickListener(
       new OnMenuItemClickListener() {
         @Override
         public boolean onMenuItemClick(MenuItem item) {
           startBuy();
           return true;
         }
       });
   return super.onCreateOptionsMenu(menu);
 }