{"action":"created","comment":{"url":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/comments/241875341","pull_request_review_id":185265696,"id":241875341,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MTg3NTM0MQ==","diff_hunk":"@@ -87,31 +96,260 @@ public void onCancelled(@NonNull DatabaseError databaseError) {\n         });\n     }\n \n+    //LISTVIEW LISTENERS FOR UPDATING ITEMS\n+    void listViewListener(ListView listView, final List<? extends Info> typeList, final String category, final Context context) {\n+        final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);\n+        final LayoutInflater inflater = LayoutInflater.from(context);\n+        listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {\n+            @Override\n+            public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {\n+                String oldInfo = typeList.get(i).getAndroidInfo();\n+                if (category == \"Condition\" || category == \"Allergy\" || category == \"Substance\") {\n+                    showUpdateInfoString(oldInfo, category, inflater,dialogBuilder);\n+                }\n+                if (category == \"Surgery\") {\n+                    showUpdateSurgery(oldInfo, category, inflater,dialogBuilder);\n+                }\n+                if (category == \"DrugReaction\") {\n+                    showUpdateDrugReaction(oldInfo, category, inflater,dialogBuilder);\n+                }\n+                if (category == \"Drug\") {\n+                    showUpdateDrug(oldInfo, category, inflater,dialogBuilder);\n+                }\n+                return false;\n+            }\n+        });\n+    }\n+\n+    void showUpdateInfoString(final String oldInfo, final String category, LayoutInflater inflater, AlertDialog.Builder dialogBuilder) {\n+\n+        final View dialogView = inflater.inflate(R.layout.activity_patient_info_update,null);\n+\n+        dialogBuilder.setView(dialogView);\n+\n+        final EditText editTextName = (EditText) dialogView.findViewById(R.id.patientInfoUpdateEditView);\n+        final Button buttonUpdate = (Button) dialogView.findViewById(R.id.buttonPatientInfoUpdate);\n+        final Button buttonDelete = (Button) dialogView.findViewById(R.id.buttonPatientInfoDelete);\n+\n+        dialogBuilder.setTitle(String.format(\"Updating %s\",category.toLowerCase()));\n+\n+        final AlertDialog alertDialog = dialogBuilder.create();\n+        //final String info = editTextName.getText().toString().trim();\n+        alertDialog.show();\n+\n+\n+        /*if (!isSingleField) {\n+            buttonUpdate.setVisibility(View.INVISIBLE);\n+        }\n+        else {*/\n+        buttonUpdate.setOnClickListener(new View.OnClickListener() {\n+            @Override\n+            public void onClick(View view) {\n+                String info = editTextName.getText().toString().trim();\n+                if (TextUtils.isDigitsOnly(info)) {\n+                    editTextName.setError(\"Information required\");\n+                    return;\n+                }\n+                deleteItem(oldInfo, category);\n+                addItemToDatabase(info, category, new InfoString(info));\n+                //patientInfoDatabaseService.updateCondition(oldInfo.getInfo(),category);\n+\n+                alertDialog.dismiss();\n+            }\n+        });\n+        //}\n+\n+        buttonDelete.setOnClickListener(new View.OnClickListener() {\n+            @Override\n+            public void onClick(View view) {\n+                deleteItem(oldInfo,category);\n+                alertDialog.dismiss();\n+            }\n+        });\n+\n+    }\n+\n+\n+    void showUpdateSurgery(final String oldInfo, final String category,LayoutInflater inflater, AlertDialog.Builder dialogBuilder) {\n+\n+        final View dialogView = inflater.inflate(R.layout.activity_patient_info_update_surgery,null);\n+\n+        dialogBuilder.setView(dialogView);\n+\n+        final EditText surgeryUpdateType = (EditText) dialogView.findViewById(R.id.patientInfoUpdateSurgeryType);\n+        final EditText surgeryUpdateYear = (EditText) dialogView.findViewById(R.id.patientInfoUpdateSurgeryYear);\n+        final Button buttonUpdate = (Button) dialogView.findViewById(R.id.buttonPatientInfoUpdateSurgery);\n+        final Button buttonDelete = (Button) dialogView.findViewById(R.id.buttonPatientInfoDeleteSurgery);\n+\n+        dialogBuilder.setTitle(\"Updating surgery\");\n+\n+        final AlertDialog alertDialog = dialogBuilder.create();\n+        //final Surgery chir = new Surgery(getTextFromField(surgeryUpdateType), getTextFromField(surgeryUpdateYear));\n+        alertDialog.show();\n+\n+        buttonUpdate.setOnClickListener(new View.OnClickListener() {\n+            @Override\n+            public void onClick(View view) {\n+                //TODO: check not null\n+                Surgery chir = new Surgery(PatientInfo.getTextFromField(surgeryUpdateType), PatientInfo.getTextFromField(surgeryUpdateYear));\n+\n+                deleteItem(oldInfo, category);\n+                addItemToDatabase(chir.getAndroidInfo(), category, chir);\n+\n+                alertDialog.dismiss();\n+            }\n+        });\n+\n+\n+        buttonDelete.setOnClickListener(new View.OnClickListener() {\n+            @Override\n+            public void onClick(View view) {\n+                deleteItem(oldInfo,category);\n+                alertDialog.dismiss();\n+            }\n+        });\n+\n+\n+    }\n+\n+    void showUpdateDrugReaction(final String oldInfo, final String category,LayoutInflater inflater, AlertDialog.Builder dialogBuilder) {","path":"app/src/main/java/ch/epfl/sweng/vanjel/patientInfo/PatientInfoDatabaseService.java","position":147,"original_position":147,"commit_id":"2e001addb34e5805e97971c5f2f021e21b3e2368","original_commit_id":"2e001addb34e5805e97971c5f2f021e21b3e2368","user":{"login":"codeclimate[bot]","id":36754821,"node_id":"MDM6Qm90MzY3NTQ4MjE=","avatar_url":"https://avatars0.githubusercontent.com/in/9403?v=4","gravatar_id":"","url":"https://api.github.com/users/codeclimate%5Bbot%5D","html_url":"https://github.com/apps/codeclimate","followers_url":"https://api.github.com/users/codeclimate%5Bbot%5D/followers","following_url":"https://api.github.com/users/codeclimate%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/codeclimate%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/codeclimate%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeclimate%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/codeclimate%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/codeclimate%5Bbot%5D/repos","events_url":"https://api.github.com/users/codeclimate%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/codeclimate%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"Similar blocks of code found in 2 locations. Consider refactoring.","created_at":"2018-12-14T20:07:10Z","updated_at":"2018-12-14T20:07:11Z","html_url":"https://github.com/ElCabrino/SDPProject/pull/117#discussion_r241875341","pull_request_url":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/117","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/comments/241875341"},"html":{"href":"https://github.com/ElCabrino/SDPProject/pull/117#discussion_r241875341"},"pull_request":{"href":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/117"}}},"pull_request":{"url":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/117","id":238207760,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4MjA3NzYw","html_url":"https://github.com/ElCabrino/SDPProject/pull/117","diff_url":"https://github.com/ElCabrino/SDPProject/pull/117.diff","patch_url":"https://github.com/ElCabrino/SDPProject/pull/117.patch","issue_url":"https://api.github.com/repos/ElCabrino/SDPProject/issues/117","number":117,"state":"open","locked":false,"title":"Patient info update","user":{"login":"Snxdd","id":33453111,"node_id":"MDQ6VXNlcjMzNDUzMTEx","avatar_url":"https://avatars2.githubusercontent.com/u/33453111?v=4","gravatar_id":"","url":"https://api.github.com/users/Snxdd","html_url":"https://github.com/Snxdd","followers_url":"https://api.github.com/users/Snxdd/followers","following_url":"https://api.github.com/users/Snxdd/following{/other_user}","gists_url":"https://api.github.com/users/Snxdd/gists{/gist_id}","starred_url":"https://api.github.com/users/Snxdd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Snxdd/subscriptions","organizations_url":"https://api.github.com/users/Snxdd/orgs","repos_url":"https://api.github.com/users/Snxdd/repos","events_url":"https://api.github.com/users/Snxdd/events{/privacy}","received_events_url":"https://api.github.com/users/Snxdd/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-12T22:43:37Z","updated_at":"2018-12-14T20:07:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9be0b2763cd80f0535efd94b7488bd779d57956f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/117/commits","review_comments_url":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/117/comments","review_comment_url":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ElCabrino/SDPProject/issues/117/comments","statuses_url":"https://api.github.com/repos/ElCabrino/SDPProject/statuses/2e001addb34e5805e97971c5f2f021e21b3e2368","head":{"label":"ElCabrino:PatientInfoUpdate","ref":"PatientInfoUpdate","sha":"2e001addb34e5805e97971c5f2f021e21b3e2368","user":{"login":"ElCabrino","id":26007153,"node_id":"MDQ6VXNlcjI2MDA3MTUz","avatar_url":"https://avatars2.githubusercontent.com/u/26007153?v=4","gravatar_id":"","url":"https://api.github.com/users/ElCabrino","html_url":"https://github.com/ElCabrino","followers_url":"https://api.github.com/users/ElCabrino/followers","following_url":"https://api.github.com/users/ElCabrino/following{/other_user}","gists_url":"https://api.github.com/users/ElCabrino/gists{/gist_id}","starred_url":"https://api.github.com/users/ElCabrino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElCabrino/subscriptions","organizations_url":"https://api.github.com/users/ElCabrino/orgs","repos_url":"https://api.github.com/users/ElCabrino/repos","events_url":"https://api.github.com/users/ElCabrino/events{/privacy}","received_events_url":"https://api.github.com/users/ElCabrino/received_events","type":"User","site_admin":false},"repo":{"id":150409157,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA0MDkxNTc=","name":"SDPProject","full_name":"ElCabrino/SDPProject","private":false,"owner":{"login":"ElCabrino","id":26007153,"node_id":"MDQ6VXNlcjI2MDA3MTUz","avatar_url":"https://avatars2.githubusercontent.com/u/26007153?v=4","gravatar_id":"","url":"https://api.github.com/users/ElCabrino","html_url":"https://github.com/ElCabrino","followers_url":"https://api.github.com/users/ElCabrino/followers","following_url":"https://api.github.com/users/ElCabrino/following{/other_user}","gists_url":"https://api.github.com/users/ElCabrino/gists{/gist_id}","starred_url":"https://api.github.com/users/ElCabrino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElCabrino/subscriptions","organizations_url":"https://api.github.com/users/ElCabrino/orgs","repos_url":"https://api.github.com/users/ElCabrino/repos","events_url":"https://api.github.com/users/ElCabrino/events{/privacy}","received_events_url":"https://api.github.com/users/ElCabrino/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ElCabrino/SDPProject","description":null,"fork":false,"url":"https://api.github.com/repos/ElCabrino/SDPProject","forks_url":"https://api.github.com/repos/ElCabrino/SDPProject/forks","keys_url":"https://api.github.com/repos/ElCabrino/SDPProject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ElCabrino/SDPProject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ElCabrino/SDPProject/teams","hooks_url":"https://api.github.com/repos/ElCabrino/SDPProject/hooks","issue_events_url":"https://api.github.com/repos/ElCabrino/SDPProject/issues/events{/number}","events_url":"https://api.github.com/repos/ElCabrino/SDPProject/events","assignees_url":"https://api.github.com/repos/ElCabrino/SDPProject/assignees{/user}","branches_url":"https://api.github.com/repos/ElCabrino/SDPProject/branches{/branch}","tags_url":"https://api.github.com/repos/ElCabrino/SDPProject/tags","blobs_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/refs{/sha}","trees_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ElCabrino/SDPProject/statuses/{sha}","languages_url":"https://api.github.com/repos/ElCabrino/SDPProject/languages","stargazers_url":"https://api.github.com/repos/ElCabrino/SDPProject/stargazers","contributors_url":"https://api.github.com/repos/ElCabrino/SDPProject/contributors","subscribers_url":"https://api.github.com/repos/ElCabrino/SDPProject/subscribers","subscription_url":"https://api.github.com/repos/ElCabrino/SDPProject/subscription","commits_url":"https://api.github.com/repos/ElCabrino/SDPProject/commits{/sha}","git_commits_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/commits{/sha}","comments_url":"https://api.github.com/repos/ElCabrino/SDPProject/comments{/number}","issue_comment_url":"https://api.github.com/repos/ElCabrino/SDPProject/issues/comments{/number}","contents_url":"https://api.github.com/repos/ElCabrino/SDPProject/contents/{+path}","compare_url":"https://api.github.com/repos/ElCabrino/SDPProject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ElCabrino/SDPProject/merges","archive_url":"https://api.github.com/repos/ElCabrino/SDPProject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ElCabrino/SDPProject/downloads","issues_url":"https://api.github.com/repos/ElCabrino/SDPProject/issues{/number}","pulls_url":"https://api.github.com/repos/ElCabrino/SDPProject/pulls{/number}","milestones_url":"https://api.github.com/repos/ElCabrino/SDPProject/milestones{/number}","notifications_url":"https://api.github.com/repos/ElCabrino/SDPProject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ElCabrino/SDPProject/labels{/name}","releases_url":"https://api.github.com/repos/ElCabrino/SDPProject/releases{/id}","deployments_url":"https://api.github.com/repos/ElCabrino/SDPProject/deployments","created_at":"2018-09-26T10:27:57Z","updated_at":"2018-12-14T15:01:24Z","pushed_at":"2018-12-14T19:28:59Z","git_url":"git://github.com/ElCabrino/SDPProject.git","ssh_url":"git@github.com:ElCabrino/SDPProject.git","clone_url":"https://github.com/ElCabrino/SDPProject.git","svn_url":"https://github.com/ElCabrino/SDPProject","homepage":null,"size":2903,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":10,"license":null,"forks":1,"open_issues":10,"watchers":3,"default_branch":"master"}},"base":{"label":"ElCabrino:master","ref":"master","sha":"418a7c4efb9f05ba476b186e519b771ba294aed2","user":{"login":"ElCabrino","id":26007153,"node_id":"MDQ6VXNlcjI2MDA3MTUz","avatar_url":"https://avatars2.githubusercontent.com/u/26007153?v=4","gravatar_id":"","url":"https://api.github.com/users/ElCabrino","html_url":"https://github.com/ElCabrino","followers_url":"https://api.github.com/users/ElCabrino/followers","following_url":"https://api.github.com/users/ElCabrino/following{/other_user}","gists_url":"https://api.github.com/users/ElCabrino/gists{/gist_id}","starred_url":"https://api.github.com/users/ElCabrino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElCabrino/subscriptions","organizations_url":"https://api.github.com/users/ElCabrino/orgs","repos_url":"https://api.github.com/users/ElCabrino/repos","events_url":"https://api.github.com/users/ElCabrino/events{/privacy}","received_events_url":"https://api.github.com/users/ElCabrino/received_events","type":"User","site_admin":false},"repo":{"id":150409157,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA0MDkxNTc=","name":"SDPProject","full_name":"ElCabrino/SDPProject","private":false,"owner":{"login":"ElCabrino","id":26007153,"node_id":"MDQ6VXNlcjI2MDA3MTUz","avatar_url":"https://avatars2.githubusercontent.com/u/26007153?v=4","gravatar_id":"","url":"https://api.github.com/users/ElCabrino","html_url":"https://github.com/ElCabrino","followers_url":"https://api.github.com/users/ElCabrino/followers","following_url":"https://api.github.com/users/ElCabrino/following{/other_user}","gists_url":"https://api.github.com/users/ElCabrino/gists{/gist_id}","starred_url":"https://api.github.com/users/ElCabrino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElCabrino/subscriptions","organizations_url":"https://api.github.com/users/ElCabrino/orgs","repos_url":"https://api.github.com/users/ElCabrino/repos","events_url":"https://api.github.com/users/ElCabrino/events{/privacy}","received_events_url":"https://api.github.com/users/ElCabrino/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ElCabrino/SDPProject","description":null,"fork":false,"url":"https://api.github.com/repos/ElCabrino/SDPProject","forks_url":"https://api.github.com/repos/ElCabrino/SDPProject/forks","keys_url":"https://api.github.com/repos/ElCabrino/SDPProject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ElCabrino/SDPProject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ElCabrino/SDPProject/teams","hooks_url":"https://api.github.com/repos/ElCabrino/SDPProject/hooks","issue_events_url":"https://api.github.com/repos/ElCabrino/SDPProject/issues/events{/number}","events_url":"https://api.github.com/repos/ElCabrino/SDPProject/events","assignees_url":"https://api.github.com/repos/ElCabrino/SDPProject/assignees{/user}","branches_url":"https://api.github.com/repos/ElCabrino/SDPProject/branches{/branch}","tags_url":"https://api.github.com/repos/ElCabrino/SDPProject/tags","blobs_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/refs{/sha}","trees_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ElCabrino/SDPProject/statuses/{sha}","languages_url":"https://api.github.com/repos/ElCabrino/SDPProject/languages","stargazers_url":"https://api.github.com/repos/ElCabrino/SDPProject/stargazers","contributors_url":"https://api.github.com/repos/ElCabrino/SDPProject/contributors","subscribers_url":"https://api.github.com/repos/ElCabrino/SDPProject/subscribers","subscription_url":"https://api.github.com/repos/ElCabrino/SDPProject/subscription","commits_url":"https://api.github.com/repos/ElCabrino/SDPProject/commits{/sha}","git_commits_url":"https://api.github.com/repos/ElCabrino/SDPProject/git/commits{/sha}","comments_url":"https://api.github.com/repos/ElCabrino/SDPProject/comments{/number}","issue_comment_url":"https://api.github.com/repos/ElCabrino/SDPProject/issues/comments{/number}","contents_url":"https://api.github.com/repos/ElCabrino/SDPProject/contents/{+path}","compare_url":"https://api.github.com/repos/ElCabrino/SDPProject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ElCabrino/SDPProject/merges","archive_url":"https://api.github.com/repos/ElCabrino/SDPProject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ElCabrino/SDPProject/downloads","issues_url":"https://api.github.com/repos/ElCabrino/SDPProject/issues{/number}","pulls_url":"https://api.github.com/repos/ElCabrino/SDPProject/pulls{/number}","milestones_url":"https://api.github.com/repos/ElCabrino/SDPProject/milestones{/number}","notifications_url":"https://api.github.com/repos/ElCabrino/SDPProject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ElCabrino/SDPProject/labels{/name}","releases_url":"https://api.github.com/repos/ElCabrino/SDPProject/releases{/id}","deployments_url":"https://api.github.com/repos/ElCabrino/SDPProject/deployments","created_at":"2018-09-26T10:27:57Z","updated_at":"2018-12-14T15:01:24Z","pushed_at":"2018-12-14T19:28:59Z","git_url":"git://github.com/ElCabrino/SDPProject.git","ssh_url":"git@github.com:ElCabrino/SDPProject.git","clone_url":"https://github.com/ElCabrino/SDPProject.git","svn_url":"https://github.com/ElCabrino/SDPProject","homepage":null,"size":2903,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":10,"license":null,"forks":1,"open_issues":10,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/117"},"html":{"href":"https://github.com/ElCabrino/SDPProject/pull/117"},"issue":{"href":"https://api.github.com/repos/ElCabrino/SDPProject/issues/117"},"comments":{"href":"https://api.github.com/repos/ElCabrino/SDPProject/issues/117/comments"},"review_comments":{"href":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/117/comments"},"review_comment":{"href":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ElCabrino/SDPProject/pulls/117/commits"},"statuses":{"href":"https://api.github.com/repos/ElCabrino/SDPProject/statuses/2e001addb34e5805e97971c5f2f021e21b3e2368"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"codeclimate"}}