View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000582 | MantisDroid | Task | public | 2013-08-15 14:13 | 2013-08-16 07:38 |
Reporter | e7andy | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | acknowledged | Resolution | open | ||
Target Version | futurelog | ||||
Summary | 0000582: Add issue context menu | ||||
Description | Long click on issue in issue list should bring up a context menu with shortcut functions. | ||||
Tags | No tags attached. | ||||
|
Code from IssuesFragment: private MantisDroid getMantisDroid() { return (MantisDroid) getActivity().getApplicationContext(); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = this.getActivity().getMenuInflater(); inflater.inflate(R.menu.issue_context, menu); if (getMantisDroid().isGeneralAuthSystemInitialized()) { try { if (getMantisDroid().isAuthorized(FunctionEnum.ISSUE_UPDATE, 0)) { MenuItem changeStatusToMenuItem = menu.findItem(R.id.issue_context_menu_update_status); if (changeStatusToMenuItem != null) { changeStatusToMenuItem.setVisible(true); } MenuItem assignToMenuItem = menu.findItem(R.id.issue_context_menu_assign_to); if (assignToMenuItem != null) { assignToMenuItem.setVisible(true); } MenuItem updateVersionsMenuItem = menu.findItem(R.id.issue_context_menu_update_versions); if (updateVersionsMenuItem != null) { updateVersionsMenuItem.setVisible(true); } } if (getMantisDroid().isAuthorized(FunctionEnum.ISSUE_DELETE, 0)) { MenuItem deleteIssueMenuItem = menu.findItem(R.id.issue_context_menu_delete_issue); if (deleteIssueMenuItem != null) { deleteIssueMenuItem.setVisible(true); } } if (getMantisDroid().isAuthorized(FunctionEnum.ISSUE_NOTE_CREATE, 0)) { MenuItem addNoteMenuItem = menu.findItem(R.id.issue_context_menu_add_note); if (addNoteMenuItem != null) { addNoteMenuItem.setVisible(true); } } if (getMantisDroid().isAuthorized(FunctionEnum.ISSUE_ATTACHMENT_CREATE, 0)) { MenuItem uploadFileMenuItem = menu.findItem(R.id.issue_context_menu_upload_file); if (uploadFileMenuItem != null) { uploadFileMenuItem.setVisible(true); } } } catch (NoConnectionException e) { ActivityUtils.handleNoConnection(getActivity(), false); } } } @Override public boolean onContextItemSelected(MenuItem item) { boolean result = false; AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); Issue issue = getAdapter().getItem(info.position); int itemId = item.getItemId(); if (itemId == R.id.issue_context_menu_add_note) { // addNoteToIssue(issue); result = true; } else if (itemId == R.id.issue_context_menu_update_status) { // updateIssueStatus(); result = true; } else if (itemId == R.id.issue_context_menu_assign_to) { // assignIssueTo(); result = true; } else if (itemId == R.id.issue_context_menu_update_versions) { // updateIssueVersions(); result = true; } else if (itemId == R.id.issue_context_menu_delete_issue) { // deleteIssue(); result = true; } else if (itemId == R.id.issue_context_menu_upload_file) { // showFileChooser(); result = true; } else { return super.onContextItemSelected(item); } return result; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { registerForContextMenu(getListView()); super.onViewCreated(view, savedInstanceState); } |