{"action":"created","comment":{"url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/comments/48372160","id":48372160,"diff_hunk":"@@ -0,0 +1,161 @@\n+package fr.free.nrw.commons.upload;\n+\n+import android.content.Context;\n+import android.util.Log;\n+\n+import com.android.volley.Cache;\n+import com.android.volley.NetworkResponse;\n+import com.android.volley.Request;\n+import com.android.volley.RequestQueue;\n+import com.android.volley.Response;\n+import com.android.volley.VolleyError;\n+import com.android.volley.toolbox.HttpHeaderParser;\n+import com.android.volley.toolbox.JsonRequest;\n+import com.android.volley.toolbox.Volley;\n+\n+import com.google.gson.Gson;\n+import com.google.gson.GsonBuilder;\n+\n+\n+import java.io.UnsupportedEncodingException;\n+\n+public class MwVolleyApi {\n+\n+    private static RequestQueue REQUEST_QUEUE;\n+    private static final Gson GSON = new GsonBuilder().create();\n+    private Context context;\n+\n+    public MwVolleyApi(Context context) {\n+        this.context = context;\n+    }\n+    public void request(String apiUrl) {\n+        JsonRequest<QueryResponse> request = new QueryRequest(apiUrl,\n+                new LogResponseListener<QueryResponse>(), new LogResponseErrorListener());\n+        getQueue().add(request);\n+    }\n+\n+    private RequestQueue getQueue() {\n+        return getQueue(context);\n+    }\n+\n+    private static RequestQueue getQueue(Context context) {\n+        if (REQUEST_QUEUE == null) {\n+            REQUEST_QUEUE = Volley.newRequestQueue(context.getApplicationContext());\n+        }\n+        return REQUEST_QUEUE;\n+    }\n+\n+    private static class LogResponseListener<T> implements Response.Listener<T> {\n+        private static final String TAG = LogResponseListener.class.getName();\n+\n+        @Override\n+        public void onResponse(T response) {\n+            Log.d(TAG, response.toString());\n+        }\n+    }\n+\n+    private static class LogResponseErrorListener implements Response.ErrorListener {\n+        private static final String TAG = LogResponseErrorListener.class.getName();\n+\n+        @Override\n+        public void onErrorResponse(VolleyError error) {\n+            Log.e(TAG, error.toString());\n+        }\n+    }\n+\n+    private static class QueryRequest extends JsonRequest<QueryResponse> {","path":"commons/src/main/java/fr/free/nrw/commons/upload/MwVolleyApi.java","position":66,"original_position":66,"commit_id":"3797d0d5cd790d1358a73287a490c2664878c015","original_commit_id":"3797d0d5cd790d1358a73287a490c2664878c015","user":{"login":"niedzielski","id":1071806,"avatar_url":"https://avatars.githubusercontent.com/u/1071806?v=3","gravatar_id":"","url":"https://api.github.com/users/niedzielski","html_url":"https://github.com/niedzielski","followers_url":"https://api.github.com/users/niedzielski/followers","following_url":"https://api.github.com/users/niedzielski/following{/other_user}","gists_url":"https://api.github.com/users/niedzielski/gists{/gist_id}","starred_url":"https://api.github.com/users/niedzielski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niedzielski/subscriptions","organizations_url":"https://api.github.com/users/niedzielski/orgs","repos_url":"https://api.github.com/users/niedzielski/repos","events_url":"https://api.github.com/users/niedzielski/events{/privacy}","received_events_url":"https://api.github.com/users/niedzielski/received_events","type":"User","site_admin":false},"body":"If a class is in its own file, it doesn't have a reference to any outer class because there isn't one.","created_at":"2015-12-23T19:18:48Z","updated_at":"2015-12-23T19:18:48Z","html_url":"https://github.com/nicolas-raoul/apps-android-commons/pull/33#discussion_r48372160","pull_request_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/comments/48372160"},"html":{"href":"https://github.com/nicolas-raoul/apps-android-commons/pull/33#discussion_r48372160"},"pull_request":{"href":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/33","id":54440524,"html_url":"https://github.com/nicolas-raoul/apps-android-commons/pull/33","diff_url":"https://github.com/nicolas-raoul/apps-android-commons/pull/33.diff","patch_url":"https://github.com/nicolas-raoul/apps-android-commons/pull/33.patch","issue_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/issues/33","number":33,"state":"closed","locked":false,"title":"Implemented calls to API to extract categories","user":{"login":"misaochan","id":3611199,"avatar_url":"https://avatars.githubusercontent.com/u/3611199?v=3","gravatar_id":"","url":"https://api.github.com/users/misaochan","html_url":"https://github.com/misaochan","followers_url":"https://api.github.com/users/misaochan/followers","following_url":"https://api.github.com/users/misaochan/following{/other_user}","gists_url":"https://api.github.com/users/misaochan/gists{/gist_id}","starred_url":"https://api.github.com/users/misaochan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/misaochan/subscriptions","organizations_url":"https://api.github.com/users/misaochan/orgs","repos_url":"https://api.github.com/users/misaochan/repos","events_url":"https://api.github.com/users/misaochan/events{/privacy}","received_events_url":"https://api.github.com/users/misaochan/received_events","type":"User","site_admin":false},"body":"Using Volley for asynchronous networking and JSON/GSON","created_at":"2015-12-23T05:01:45Z","updated_at":"2015-12-23T19:18:48Z","closed_at":"2015-12-23T06:27:30Z","merged_at":"2015-12-23T06:27:30Z","merge_commit_sha":"b7580f8942480ce9c9edbf112baca4ec9f090f8e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/33/commits","review_comments_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/33/comments","review_comment_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/issues/33/comments","statuses_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/statuses/3797d0d5cd790d1358a73287a490c2664878c015","head":{"label":"misaochan:api-calls","ref":"api-calls","sha":"3797d0d5cd790d1358a73287a490c2664878c015","user":{"login":"misaochan","id":3611199,"avatar_url":"https://avatars.githubusercontent.com/u/3611199?v=3","gravatar_id":"","url":"https://api.github.com/users/misaochan","html_url":"https://github.com/misaochan","followers_url":"https://api.github.com/users/misaochan/followers","following_url":"https://api.github.com/users/misaochan/following{/other_user}","gists_url":"https://api.github.com/users/misaochan/gists{/gist_id}","starred_url":"https://api.github.com/users/misaochan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/misaochan/subscriptions","organizations_url":"https://api.github.com/users/misaochan/orgs","repos_url":"https://api.github.com/users/misaochan/repos","events_url":"https://api.github.com/users/misaochan/events{/privacy}","received_events_url":"https://api.github.com/users/misaochan/received_events","type":"User","site_admin":false},"repo":{"id":43427766,"name":"apps-android-commons","full_name":"misaochan/apps-android-commons","owner":{"login":"misaochan","id":3611199,"avatar_url":"https://avatars.githubusercontent.com/u/3611199?v=3","gravatar_id":"","url":"https://api.github.com/users/misaochan","html_url":"https://github.com/misaochan","followers_url":"https://api.github.com/users/misaochan/followers","following_url":"https://api.github.com/users/misaochan/following{/other_user}","gists_url":"https://api.github.com/users/misaochan/gists{/gist_id}","starred_url":"https://api.github.com/users/misaochan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/misaochan/subscriptions","organizations_url":"https://api.github.com/users/misaochan/orgs","repos_url":"https://api.github.com/users/misaochan/repos","events_url":"https://api.github.com/users/misaochan/events{/privacy}","received_events_url":"https://api.github.com/users/misaochan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/misaochan/apps-android-commons","description":"Upload pictures from Android to Wikimedia Commons. Looking for volunteers! Come say hi at https://groups.google.com/d/forum/commons-app-android and install at https://play.google.com/store/apps/details?id=fr.free.nrw.commons","fork":true,"url":"https://api.github.com/repos/misaochan/apps-android-commons","forks_url":"https://api.github.com/repos/misaochan/apps-android-commons/forks","keys_url":"https://api.github.com/repos/misaochan/apps-android-commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/misaochan/apps-android-commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/misaochan/apps-android-commons/teams","hooks_url":"https://api.github.com/repos/misaochan/apps-android-commons/hooks","issue_events_url":"https://api.github.com/repos/misaochan/apps-android-commons/issues/events{/number}","events_url":"https://api.github.com/repos/misaochan/apps-android-commons/events","assignees_url":"https://api.github.com/repos/misaochan/apps-android-commons/assignees{/user}","branches_url":"https://api.github.com/repos/misaochan/apps-android-commons/branches{/branch}","tags_url":"https://api.github.com/repos/misaochan/apps-android-commons/tags","blobs_url":"https://api.github.com/repos/misaochan/apps-android-commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/misaochan/apps-android-commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/misaochan/apps-android-commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/misaochan/apps-android-commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/misaochan/apps-android-commons/statuses/{sha}","languages_url":"https://api.github.com/repos/misaochan/apps-android-commons/languages","stargazers_url":"https://api.github.com/repos/misaochan/apps-android-commons/stargazers","contributors_url":"https://api.github.com/repos/misaochan/apps-android-commons/contributors","subscribers_url":"https://api.github.com/repos/misaochan/apps-android-commons/subscribers","subscription_url":"https://api.github.com/repos/misaochan/apps-android-commons/subscription","commits_url":"https://api.github.com/repos/misaochan/apps-android-commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/misaochan/apps-android-commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/misaochan/apps-android-commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/misaochan/apps-android-commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/misaochan/apps-android-commons/contents/{+path}","compare_url":"https://api.github.com/repos/misaochan/apps-android-commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/misaochan/apps-android-commons/merges","archive_url":"https://api.github.com/repos/misaochan/apps-android-commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/misaochan/apps-android-commons/downloads","issues_url":"https://api.github.com/repos/misaochan/apps-android-commons/issues{/number}","pulls_url":"https://api.github.com/repos/misaochan/apps-android-commons/pulls{/number}","milestones_url":"https://api.github.com/repos/misaochan/apps-android-commons/milestones{/number}","notifications_url":"https://api.github.com/repos/misaochan/apps-android-commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/misaochan/apps-android-commons/labels{/name}","releases_url":"https://api.github.com/repos/misaochan/apps-android-commons/releases{/id}","created_at":"2015-09-30T10:51:23Z","updated_at":"2015-12-14T16:50:35Z","pushed_at":"2015-12-23T09:16:10Z","git_url":"git://github.com/misaochan/apps-android-commons.git","ssh_url":"git@github.com:misaochan/apps-android-commons.git","clone_url":"https://github.com/misaochan/apps-android-commons.git","svn_url":"https://github.com/misaochan/apps-android-commons","homepage":"","size":25315,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":4,"default_branch":"master"}},"base":{"label":"nicolas-raoul:master","ref":"master","sha":"31f78b4b6b1427fc99349b82a87159dac4cb99d0","user":{"login":"nicolas-raoul","id":99590,"avatar_url":"https://avatars.githubusercontent.com/u/99590?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas-raoul","html_url":"https://github.com/nicolas-raoul","followers_url":"https://api.github.com/users/nicolas-raoul/followers","following_url":"https://api.github.com/users/nicolas-raoul/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-raoul/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-raoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-raoul/subscriptions","organizations_url":"https://api.github.com/users/nicolas-raoul/orgs","repos_url":"https://api.github.com/users/nicolas-raoul/repos","events_url":"https://api.github.com/users/nicolas-raoul/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-raoul/received_events","type":"User","site_admin":false},"repo":{"id":42032884,"name":"apps-android-commons","full_name":"nicolas-raoul/apps-android-commons","owner":{"login":"nicolas-raoul","id":99590,"avatar_url":"https://avatars.githubusercontent.com/u/99590?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas-raoul","html_url":"https://github.com/nicolas-raoul","followers_url":"https://api.github.com/users/nicolas-raoul/followers","following_url":"https://api.github.com/users/nicolas-raoul/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-raoul/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-raoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-raoul/subscriptions","organizations_url":"https://api.github.com/users/nicolas-raoul/orgs","repos_url":"https://api.github.com/users/nicolas-raoul/repos","events_url":"https://api.github.com/users/nicolas-raoul/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-raoul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nicolas-raoul/apps-android-commons","description":"Upload pictures from Android to Wikimedia Commons. Looking for volunteers! Come say hi at https://groups.google.com/d/forum/commons-app-android and install at https://play.google.com/store/apps/details?id=fr.free.nrw.commons","fork":true,"url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons","forks_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/forks","keys_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/teams","hooks_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/hooks","issue_events_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/issues/events{/number}","events_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/events","assignees_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/assignees{/user}","branches_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/branches{/branch}","tags_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/tags","blobs_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/statuses/{sha}","languages_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/languages","stargazers_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/stargazers","contributors_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/contributors","subscribers_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/subscribers","subscription_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/subscription","commits_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/contents/{+path}","compare_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/merges","archive_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/downloads","issues_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/issues{/number}","pulls_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls{/number}","milestones_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/milestones{/number}","notifications_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/labels{/name}","releases_url":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/releases{/id}","created_at":"2015-09-07T05:23:27Z","updated_at":"2015-11-21T12:09:14Z","pushed_at":"2015-12-23T09:22:21Z","git_url":"git://github.com/nicolas-raoul/apps-android-commons.git","ssh_url":"git@github.com:nicolas-raoul/apps-android-commons.git","clone_url":"https://github.com/nicolas-raoul/apps-android-commons.git","svn_url":"https://github.com/nicolas-raoul/apps-android-commons","homepage":"","size":25327,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":16,"forks":3,"open_issues":16,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/33"},"html":{"href":"https://github.com/nicolas-raoul/apps-android-commons/pull/33"},"issue":{"href":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/issues/33"},"comments":{"href":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/nicolas-raoul/apps-android-commons/statuses/3797d0d5cd790d1358a73287a490c2664878c015"}}}}