@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.histinstr: adapter.ssort(Common.SORT_TYPE_INSTR); adapter.notifyDataSetChanged(); break; case R.id.histprice: adapter.ssort(Common.SORT_TYPE_PRICE); adapter.notifyDataSetChanged(); break; case R.id.histstatus: adapter.ssort(Common.SORT_TYPE_STATUS); adapter.notifyDataSetChanged(); break; case R.id.histdate: adapter.ssort(Common.SORT_TYPE_DATE); adapter.notifyDataSetChanged(); break; } return true; }
public void refresh() { // if(Common.FIRSTLOAD_FINISHED) { // Log.i(TAG, "History count = " + Common.getAllHistory().size()); adapter.setItems(Common.getAllHistory()); // adapter.ssort(); adapter.notifyDataSetChanged(); // } refresh1(); }
@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; }
public void refresh1() { switch (Common.historyFilter) { case 1: // list.setTextFilterEnabled(true); adapter.getFilter().filter("transit"); break; case 2: // list.setTextFilterEnabled(true); adapter.getFilter().filter("deal"); break; default: // list.setTextFilterEnabled(false); adapter.getFilter().filter(""); break; } // adapter.getFilter().filter("transit"); }
@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); }