{"action":"created","comment":{"url":"https://api.github.com/repos/opendatakit/collect/pulls/comments/173626267","pull_request_review_id":102854969,"id":173626267,"diff_hunk":"@@ -352,6 +287,68 @@ private void getFiles() {\n         getFileTask.execute(toDownload);\n     }\n \n+    @Override\n+    protected void updateAdapter() {\n+        CharSequence charSequence = getFilterText();\n+        filteredList.clear();\n+\n+        if (charSequence.length() > 0) {\n+            for (DriveListItem item : driveList) {\n+                if (item.getName().toLowerCase(Locale.US).contains(charSequence.toString().toLowerCase(Locale.US))) {\n+                    filteredList.add(item);\n+                }\n+            }\n+        } else {\n+            filteredList.addAll(driveList);\n+        }\n+\n+        sortList();\n+        if (adapter == null) {\n+            adapter = new FileArrayAdapter(this, filteredList);\n+            listView.setAdapter(adapter);\n+        } else {\n+            adapter.notifyDataSetChanged();\n+        }\n+\n+        adapter.notifyDataSetChanged();\n+        checkPreviouslyCheckedItems();\n+    }\n+\n+    @Override\n+    protected void checkPreviouslyCheckedItems() {\n+        listView.clearChoices();\n+        for (int i = 0; i < listView.getCount(); i++) {\n+            DriveListItem item = (DriveListItem) listView.getAdapter().getItem(i);\n+            if (toDownload.contains(item)) {\n+                listView.setItemChecked(i, true);\n+            }\n+        }\n+    }\n+\n+    private void sortList() {\n+        Collections.sort(filteredList, new Comparator<DriveListItem>() {\n+            @Override\n+            public int compare(DriveListItem lhs, DriveListItem rhs) {\n+                if (lhs.getType() != rhs.getType()) {\n+                    if (lhs.getType() == DriveListItem.DIR) {\n+                        return -1;\n+                    } else {\n+                        return 1;\n+                    }\n+                } else if (getSortingOrder().equals(SORT_BY_NAME_ASC)) {","path":"collect_app/src/main/java/org/odk/collect/android/activities/GoogleDriveActivity.java","position":266,"original_position":266,"commit_id":"c1eb41ccc832f783bdbd2afbfb44ac8dcbed5623","original_commit_id":"c1eb41ccc832f783bdbd2afbfb44ac8dcbed5623","user":{"login":"shobhitagarwal1612","id":8918023,"avatar_url":"https://avatars1.githubusercontent.com/u/8918023?v=4","gravatar_id":"","url":"https://api.github.com/users/shobhitagarwal1612","html_url":"https://github.com/shobhitagarwal1612","followers_url":"https://api.github.com/users/shobhitagarwal1612/followers","following_url":"https://api.github.com/users/shobhitagarwal1612/following{/other_user}","gists_url":"https://api.github.com/users/shobhitagarwal1612/gists{/gist_id}","starred_url":"https://api.github.com/users/shobhitagarwal1612/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shobhitagarwal1612/subscriptions","organizations_url":"https://api.github.com/users/shobhitagarwal1612/orgs","repos_url":"https://api.github.com/users/shobhitagarwal1612/repos","events_url":"https://api.github.com/users/shobhitagarwal1612/events{/privacy}","received_events_url":"https://api.github.com/users/shobhitagarwal1612/received_events","type":"User","site_admin":false},"body":"Or maybe something like this:\r\n\r\n```\r\nif (lhs.getType() != rhs.getType()) {\r\n                    return lhs.getType() == DriveListItem.DIR ? -1 : 1;\r\n                } else {\r\n                    int compareName = lhs.getName().compareToIgnoreCase(rhs.getName());\r\n                    return getSortingOrder().equals(SORT_BY_NAME_ASC) ? compareName : -compareName;\r\n                }\r\n```","created_at":"2018-03-10T16:09:21Z","updated_at":"2018-03-10T16:09:21Z","html_url":"https://github.com/opendatakit/collect/pull/1970#discussion_r173626267","pull_request_url":"https://api.github.com/repos/opendatakit/collect/pulls/1970","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/comments/173626267"},"html":{"href":"https://github.com/opendatakit/collect/pull/1970#discussion_r173626267"},"pull_request":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/1970"}},"in_reply_to_id":173626071},"pull_request":{"url":"https://api.github.com/repos/opendatakit/collect/pulls/1970","id":172915895,"html_url":"https://github.com/opendatakit/collect/pull/1970","diff_url":"https://github.com/opendatakit/collect/pull/1970.diff","patch_url":"https://github.com/opendatakit/collect/pull/1970.patch","issue_url":"https://api.github.com/repos/opendatakit/collect/issues/1970","number":1970,"state":"open","locked":false,"title":"Google drive dynamic search bar","user":{"login":"lakshyagupta21","id":18495162,"avatar_url":"https://avatars2.githubusercontent.com/u/18495162?v=4","gravatar_id":"","url":"https://api.github.com/users/lakshyagupta21","html_url":"https://github.com/lakshyagupta21","followers_url":"https://api.github.com/users/lakshyagupta21/followers","following_url":"https://api.github.com/users/lakshyagupta21/following{/other_user}","gists_url":"https://api.github.com/users/lakshyagupta21/gists{/gist_id}","starred_url":"https://api.github.com/users/lakshyagupta21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lakshyagupta21/subscriptions","organizations_url":"https://api.github.com/users/lakshyagupta21/orgs","repos_url":"https://api.github.com/users/lakshyagupta21/repos","events_url":"https://api.github.com/users/lakshyagupta21/events{/privacy}","received_events_url":"https://api.github.com/users/lakshyagupta21/received_events","type":"User","site_admin":false},"body":"Closes #1944 \r\n\r\n#### What has been done to verify that this works as intended?\r\nTested on physical device Android 7.1\r\n#### Why is this the best possible solution? Were any other approaches considered?\r\nSearch works in the same way when we use Aggregate Server. And search field is removed from the layout file so that the UI of both GoogleDrive and Aggregate looks similar.\r\n#### Are there any risks to merging this code? If so, what are they?\r\nNo\r\n#### Do we need any specific form for testing your changes? If so, please attach one.\r\nNo\r\n\r\n![ezgif com-video-to-gif](https://user-images.githubusercontent.com/18495162/36986082-ed08029e-20be-11e8-9a81-0de661ca4dc1.gif)\r\n\r\n","created_at":"2018-03-05T16:23:24Z","updated_at":"2018-03-10T16:09:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc5132d7a7b9bbc22db6f3dbeaa7a82554b19f11","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":688526012,"url":"https://api.github.com/repos/opendatakit/collect/labels/reviewed","name":"reviewed","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/opendatakit/collect/pulls/1970/commits","review_comments_url":"https://api.github.com/repos/opendatakit/collect/pulls/1970/comments","review_comment_url":"https://api.github.com/repos/opendatakit/collect/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opendatakit/collect/issues/1970/comments","statuses_url":"https://api.github.com/repos/opendatakit/collect/statuses/c1eb41ccc832f783bdbd2afbfb44ac8dcbed5623","head":{"label":"lakshyagupta21:COLLECT-1944","ref":"COLLECT-1944","sha":"c1eb41ccc832f783bdbd2afbfb44ac8dcbed5623","user":{"login":"lakshyagupta21","id":18495162,"avatar_url":"https://avatars2.githubusercontent.com/u/18495162?v=4","gravatar_id":"","url":"https://api.github.com/users/lakshyagupta21","html_url":"https://github.com/lakshyagupta21","followers_url":"https://api.github.com/users/lakshyagupta21/followers","following_url":"https://api.github.com/users/lakshyagupta21/following{/other_user}","gists_url":"https://api.github.com/users/lakshyagupta21/gists{/gist_id}","starred_url":"https://api.github.com/users/lakshyagupta21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lakshyagupta21/subscriptions","organizations_url":"https://api.github.com/users/lakshyagupta21/orgs","repos_url":"https://api.github.com/users/lakshyagupta21/repos","events_url":"https://api.github.com/users/lakshyagupta21/events{/privacy}","received_events_url":"https://api.github.com/users/lakshyagupta21/received_events","type":"User","site_admin":false},"repo":{"id":83434279,"name":"collect","full_name":"lakshyagupta21/collect","owner":{"login":"lakshyagupta21","id":18495162,"avatar_url":"https://avatars2.githubusercontent.com/u/18495162?v=4","gravatar_id":"","url":"https://api.github.com/users/lakshyagupta21","html_url":"https://github.com/lakshyagupta21","followers_url":"https://api.github.com/users/lakshyagupta21/followers","following_url":"https://api.github.com/users/lakshyagupta21/following{/other_user}","gists_url":"https://api.github.com/users/lakshyagupta21/gists{/gist_id}","starred_url":"https://api.github.com/users/lakshyagupta21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lakshyagupta21/subscriptions","organizations_url":"https://api.github.com/users/lakshyagupta21/orgs","repos_url":"https://api.github.com/users/lakshyagupta21/repos","events_url":"https://api.github.com/users/lakshyagupta21/events{/privacy}","received_events_url":"https://api.github.com/users/lakshyagupta21/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lakshyagupta21/collect","description":"ODK Collect is an Android app for filling out forms. It's been used to collect billions of data points in challenging environments around the world. Contribute and make the world a better place! ✨📋✨","fork":true,"url":"https://api.github.com/repos/lakshyagupta21/collect","forks_url":"https://api.github.com/repos/lakshyagupta21/collect/forks","keys_url":"https://api.github.com/repos/lakshyagupta21/collect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lakshyagupta21/collect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lakshyagupta21/collect/teams","hooks_url":"https://api.github.com/repos/lakshyagupta21/collect/hooks","issue_events_url":"https://api.github.com/repos/lakshyagupta21/collect/issues/events{/number}","events_url":"https://api.github.com/repos/lakshyagupta21/collect/events","assignees_url":"https://api.github.com/repos/lakshyagupta21/collect/assignees{/user}","branches_url":"https://api.github.com/repos/lakshyagupta21/collect/branches{/branch}","tags_url":"https://api.github.com/repos/lakshyagupta21/collect/tags","blobs_url":"https://api.github.com/repos/lakshyagupta21/collect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lakshyagupta21/collect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lakshyagupta21/collect/git/refs{/sha}","trees_url":"https://api.github.com/repos/lakshyagupta21/collect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lakshyagupta21/collect/statuses/{sha}","languages_url":"https://api.github.com/repos/lakshyagupta21/collect/languages","stargazers_url":"https://api.github.com/repos/lakshyagupta21/collect/stargazers","contributors_url":"https://api.github.com/repos/lakshyagupta21/collect/contributors","subscribers_url":"https://api.github.com/repos/lakshyagupta21/collect/subscribers","subscription_url":"https://api.github.com/repos/lakshyagupta21/collect/subscription","commits_url":"https://api.github.com/repos/lakshyagupta21/collect/commits{/sha}","git_commits_url":"https://api.github.com/repos/lakshyagupta21/collect/git/commits{/sha}","comments_url":"https://api.github.com/repos/lakshyagupta21/collect/comments{/number}","issue_comment_url":"https://api.github.com/repos/lakshyagupta21/collect/issues/comments{/number}","contents_url":"https://api.github.com/repos/lakshyagupta21/collect/contents/{+path}","compare_url":"https://api.github.com/repos/lakshyagupta21/collect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lakshyagupta21/collect/merges","archive_url":"https://api.github.com/repos/lakshyagupta21/collect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lakshyagupta21/collect/downloads","issues_url":"https://api.github.com/repos/lakshyagupta21/collect/issues{/number}","pulls_url":"https://api.github.com/repos/lakshyagupta21/collect/pulls{/number}","milestones_url":"https://api.github.com/repos/lakshyagupta21/collect/milestones{/number}","notifications_url":"https://api.github.com/repos/lakshyagupta21/collect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lakshyagupta21/collect/labels{/name}","releases_url":"https://api.github.com/repos/lakshyagupta21/collect/releases{/id}","deployments_url":"https://api.github.com/repos/lakshyagupta21/collect/deployments","created_at":"2017-02-28T13:15:07Z","updated_at":"2017-02-28T13:15:10Z","pushed_at":"2018-03-10T04:19:47Z","git_url":"git://github.com/lakshyagupta21/collect.git","ssh_url":"git@github.com:lakshyagupta21/collect.git","clone_url":"https://github.com/lakshyagupta21/collect.git","svn_url":"https://github.com/lakshyagupta21/collect","homepage":"https://github.com/opendatakit/collect","size":36877,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opendatakit:master","ref":"master","sha":"de7def21e5e3cfdbafd3dbba208c336b9eeaa164","user":{"login":"opendatakit","id":6222985,"avatar_url":"https://avatars0.githubusercontent.com/u/6222985?v=4","gravatar_id":"","url":"https://api.github.com/users/opendatakit","html_url":"https://github.com/opendatakit","followers_url":"https://api.github.com/users/opendatakit/followers","following_url":"https://api.github.com/users/opendatakit/following{/other_user}","gists_url":"https://api.github.com/users/opendatakit/gists{/gist_id}","starred_url":"https://api.github.com/users/opendatakit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opendatakit/subscriptions","organizations_url":"https://api.github.com/users/opendatakit/orgs","repos_url":"https://api.github.com/users/opendatakit/repos","events_url":"https://api.github.com/users/opendatakit/events{/privacy}","received_events_url":"https://api.github.com/users/opendatakit/received_events","type":"Organization","site_admin":false},"repo":{"id":40213809,"name":"collect","full_name":"opendatakit/collect","owner":{"login":"opendatakit","id":6222985,"avatar_url":"https://avatars0.githubusercontent.com/u/6222985?v=4","gravatar_id":"","url":"https://api.github.com/users/opendatakit","html_url":"https://github.com/opendatakit","followers_url":"https://api.github.com/users/opendatakit/followers","following_url":"https://api.github.com/users/opendatakit/following{/other_user}","gists_url":"https://api.github.com/users/opendatakit/gists{/gist_id}","starred_url":"https://api.github.com/users/opendatakit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opendatakit/subscriptions","organizations_url":"https://api.github.com/users/opendatakit/orgs","repos_url":"https://api.github.com/users/opendatakit/repos","events_url":"https://api.github.com/users/opendatakit/events{/privacy}","received_events_url":"https://api.github.com/users/opendatakit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opendatakit/collect","description":"ODK Collect is an Android app for filling out forms. It's been used to collect billions of data points in challenging environments around the world. Contribute and make the world a better place! ✨📋✨","fork":false,"url":"https://api.github.com/repos/opendatakit/collect","forks_url":"https://api.github.com/repos/opendatakit/collect/forks","keys_url":"https://api.github.com/repos/opendatakit/collect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opendatakit/collect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opendatakit/collect/teams","hooks_url":"https://api.github.com/repos/opendatakit/collect/hooks","issue_events_url":"https://api.github.com/repos/opendatakit/collect/issues/events{/number}","events_url":"https://api.github.com/repos/opendatakit/collect/events","assignees_url":"https://api.github.com/repos/opendatakit/collect/assignees{/user}","branches_url":"https://api.github.com/repos/opendatakit/collect/branches{/branch}","tags_url":"https://api.github.com/repos/opendatakit/collect/tags","blobs_url":"https://api.github.com/repos/opendatakit/collect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opendatakit/collect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opendatakit/collect/git/refs{/sha}","trees_url":"https://api.github.com/repos/opendatakit/collect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opendatakit/collect/statuses/{sha}","languages_url":"https://api.github.com/repos/opendatakit/collect/languages","stargazers_url":"https://api.github.com/repos/opendatakit/collect/stargazers","contributors_url":"https://api.github.com/repos/opendatakit/collect/contributors","subscribers_url":"https://api.github.com/repos/opendatakit/collect/subscribers","subscription_url":"https://api.github.com/repos/opendatakit/collect/subscription","commits_url":"https://api.github.com/repos/opendatakit/collect/commits{/sha}","git_commits_url":"https://api.github.com/repos/opendatakit/collect/git/commits{/sha}","comments_url":"https://api.github.com/repos/opendatakit/collect/comments{/number}","issue_comment_url":"https://api.github.com/repos/opendatakit/collect/issues/comments{/number}","contents_url":"https://api.github.com/repos/opendatakit/collect/contents/{+path}","compare_url":"https://api.github.com/repos/opendatakit/collect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opendatakit/collect/merges","archive_url":"https://api.github.com/repos/opendatakit/collect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opendatakit/collect/downloads","issues_url":"https://api.github.com/repos/opendatakit/collect/issues{/number}","pulls_url":"https://api.github.com/repos/opendatakit/collect/pulls{/number}","milestones_url":"https://api.github.com/repos/opendatakit/collect/milestones{/number}","notifications_url":"https://api.github.com/repos/opendatakit/collect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opendatakit/collect/labels{/name}","releases_url":"https://api.github.com/repos/opendatakit/collect/releases{/id}","deployments_url":"https://api.github.com/repos/opendatakit/collect/deployments","created_at":"2015-08-04T23:21:33Z","updated_at":"2018-03-07T20:07:47Z","pushed_at":"2018-03-10T11:17:59Z","git_url":"git://github.com/opendatakit/collect.git","ssh_url":"git@github.com:opendatakit/collect.git","clone_url":"https://github.com/opendatakit/collect.git","svn_url":"https://github.com/opendatakit/collect","homepage":"https://opendatakit.org/use/collect/","size":36988,"stargazers_count":199,"watchers_count":199,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":548,"mirror_url":null,"archived":false,"open_issues_count":222,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":548,"open_issues":222,"watchers":199,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/1970"},"html":{"href":"https://github.com/opendatakit/collect/pull/1970"},"issue":{"href":"https://api.github.com/repos/opendatakit/collect/issues/1970"},"comments":{"href":"https://api.github.com/repos/opendatakit/collect/issues/1970/comments"},"review_comments":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/1970/comments"},"review_comment":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opendatakit/collect/pulls/1970/commits"},"statuses":{"href":"https://api.github.com/repos/opendatakit/collect/statuses/c1eb41ccc832f783bdbd2afbfb44ac8dcbed5623"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"shobhitagarwal1612"}}