Example #1
0
  @Override
  public boolean onContextItemSelected(MenuItem item) {

    if (item.getItemId() == CONTEXTMENU_TRANSIT) {

      History it = ((History) adapter.getItems().get(selectedRowId));
      adapter.getFilter().filter("." + it.getOrdSerial() + ".");
    }

    if (item.getItemId() == CONTEXTMENU_DELETE) {

      History it = ((History) adapter.getItems().get(selectedRowId));
      Common.delOrder(this, it);
    }
    return true;
  }
Example #2
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {

    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;

    selectedRowId = (int) info.id;
    Log.i(TAG, "Selected " + selectedRowId);

    History item = ((History) adapter.getItems().get(selectedRowId));
    if (item.getOperationType().equals("Deal")) return;

    menu.setHeaderTitle(R.string.MenuTitle);
    menu.add(0, CONTEXTMENU_TRANSIT, 0, R.string.Transit);

    if (!item.canBeDeleted()) return;

    menu.add(0, CONTEXTMENU_DELETE, 1, R.string.Delete);

    super.onCreateContextMenu(menu, v, menuInfo);
  }