// ---------- public void refreshView() { if (adapter == null) { adapter = new PolyTodoItemArrayAdapter(this, 0, polyTodoItems); listView.setAdapter(adapter); } else { adapter.notifyDataSetChanged(); } // for (MenuItem item : disabledMenuItems) { // item.setEnabled(true); // } }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.action_insert: // TODO: Add function // If an item is not selected, add last. // If an item is selected, insert next the item. // View selectedView = adapter.getSelectedView(); // adapter.getPosition(selectedView.getContext()); // if (selectedView == null) { // polyMainList.addTodoList(selectedView); // } return true; case R.id.action_add: // TODO: Ask user which list the new item is added to. // show chooser to select list // item.setEnabled(false); // disabledMenuItems.add(item); String listId = polyMergedList.getPolyTodoListId(0); // test polyMergedList.addTodoItem(listId); setPolyTodoItems(polyMergedList.getGlobalTodoItems()); adapter.notifyDataSetChanged(); // TODO: work??? return true; // case R.id.action_remove: // // TODO: Remove function // return true; case R.id.action_list_01: return startListActivity(0); case R.id.action_list_02: return startListActivity(1); // case R.id.action_settings: // return true; } return super.onOptionsItemSelected(item); }