View Issue Details

IDProjectCategoryView StatusLast Update
0000582MantisDroid[All Projects] Taskpublic2013-08-16 07:38
Reportere7andy Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status acknowledgedResolutionopen 
Product Version 
Target VersionfuturelogFixed in Version 
Summary0000582: Add issue context menu
DescriptionLong click on issue in issue list should bring up a context menu with shortcut functions.
TagsNo tags attached.

Activities

e7andy

2013-08-16 07:38

administrator   ~0000151

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);
        }

Issue History

Date Modified Username Field Change
2013-08-15 14:13 e7andy New Issue
2013-08-15 14:13 e7andy Status new => acknowledged
2013-08-16 07:38 e7andy Note Added: 0000151