private boolean startListActivity(int num) { try { Intent intent = new Intent(this, PolyListActivity.class); intent.putExtra(List_ID, polyMergedList.getPolyTodoListId(num)); startActivity(intent); overridePendingTransition(R.anim.abc_slide_in_bottom, 0); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); return false; // ??? } return 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); }