{"action":"created","comment":{"url":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/comments/35770195","id":35770195,"diff_hunk":"@@ -0,0 +1,144 @@\n+package com.wan.yalandan.app;\n+\n+import android.app.DownloadManager;\n+import android.content.BroadcastReceiver;\n+import android.content.Context;\n+import android.content.Intent;\n+import android.content.IntentFilter;\n+import android.database.Cursor;\n+import android.net.Uri;\n+import android.os.Environment;\n+import android.util.Log;\n+\n+import java.io.*;\n+import java.util.UUID;\n+\n+\n+public class DownloadFileProcess {\n+\n+    Context ctx;\n+    private long enqueue;\n+    private DownloadManager dm;\n+    private INewInterface mainClass; //for callback\n+    private DownloadStatusReceiver receiver;\n+\n+    public DownloadFileProcess(INewInterface mClass, Context _ctx) {\n+        ctx = _ctx;\n+        mainClass = mClass;\n+        receiver = new DownloadStatusReceiver(_ctx);\n+        ctx.registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));\n+    }\n+\n+    public String getWordUriFromApi(String word) {\n+        /*\n+          if(word in DB)\n+           return word's Uri from DB\n+         */\n+        //else\n+        {\n+            String filename = String.valueOf(UUID.randomUUID());\n+\n+            dm = (DownloadManager) ctx.getSystemService(ctx.DOWNLOAD_SERVICE);\n+            DownloadManager.Request request = new\n+                    DownloadManager.Request(Uri.parse(\"http://www.dictionaryapi.com/api/v1/references/thesaurus/xml/test?key=19cb0d77-2780-4cb1-8015-207cc06d9913&word=\" + word/*book\"*/));\n+\n+            request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOCUMENTS, filename);\n+            enqueue = dm.enqueue(request);\n+        }\n+        return \"\";\n+    }\n+\n+    public void file_CreateAndAddData(String path, String filemane, String data) {\n+\n+        File file = new File(path, filemane);\n+        FileOutputStream fos;\n+\n+        byte[] veri = data.getBytes();\n+        try {\n+            fos = new FileOutputStream(file);\n+            fos.write(veri);\n+            fos.flush();\n+            fos.close();\n+            Log.i(\"file_Create Method\", \"File was created succesfully\");\n+        } catch (FileNotFoundException e) {\n+            Log.e(\"file_Create Method\", \"File was not found\");\n+        } catch (IOException e) {\n+            Log.e(\"file_Create Method\", \"There is an exception in file_Create Method\");\n+        }\n+    }\n+\n+    String readFile(String PathAndfileName) throws IOException {\n+\n+        BufferedReader bufferedReader = new BufferedReader(new FileReader(new\n+                File(/* getApplicationInfo().dataDir + \"/xmls/\" +  fileName*/ PathAndfileName)));\n+        String read;\n+        StringBuilder builder = new StringBuilder(\"\");\n+\n+        while ((read = bufferedReader.readLine()) != null) {\n+            builder.append(read);\n+        }\n+        Log.d(\"Output\", builder.toString());","path":"app/src/main/java/com/wan/yalandan/app/DownloadFileProcess.java","position":80,"original_position":80,"commit_id":"dcb26ba9cfaa6b8ec556f48b635a5be58e5cb1ad","original_commit_id":"dcb26ba9cfaa6b8ec556f48b635a5be58e5cb1ad","user":{"login":"Deliganli","id":3858209,"avatar_url":"https://avatars.githubusercontent.com/u/3858209?v=3","gravatar_id":"","url":"https://api.github.com/users/Deliganli","html_url":"https://github.com/Deliganli","followers_url":"https://api.github.com/users/Deliganli/followers","following_url":"https://api.github.com/users/Deliganli/following{/other_user}","gists_url":"https://api.github.com/users/Deliganli/gists{/gist_id}","starred_url":"https://api.github.com/users/Deliganli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deliganli/subscriptions","organizations_url":"https://api.github.com/users/Deliganli/orgs","repos_url":"https://api.github.com/users/Deliganli/repos","events_url":"https://api.github.com/users/Deliganli/events{/privacy}","received_events_url":"https://api.github.com/users/Deliganli/received_events","type":"User","site_admin":false},"body":"remove log","created_at":"2015-07-29T15:05:42Z","updated_at":"2015-07-29T15:05:42Z","html_url":"https://github.com/PrancingPony/Dictionary/pull/12#discussion_r35770195","pull_request_url":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/comments/35770195"},"html":{"href":"https://github.com/PrancingPony/Dictionary/pull/12#discussion_r35770195"},"pull_request":{"href":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/12","id":41132535,"html_url":"https://github.com/PrancingPony/Dictionary/pull/12","diff_url":"https://github.com/PrancingPony/Dictionary/pull/12.diff","patch_url":"https://github.com/PrancingPony/Dictionary/pull/12.patch","issue_url":"https://api.github.com/repos/PrancingPony/Dictionary/issues/12","number":12,"state":"open","locked":false,"title":"2","user":{"login":"oguzhangedik","id":13450393,"avatar_url":"https://avatars.githubusercontent.com/u/13450393?v=3","gravatar_id":"","url":"https://api.github.com/users/oguzhangedik","html_url":"https://github.com/oguzhangedik","followers_url":"https://api.github.com/users/oguzhangedik/followers","following_url":"https://api.github.com/users/oguzhangedik/following{/other_user}","gists_url":"https://api.github.com/users/oguzhangedik/gists{/gist_id}","starred_url":"https://api.github.com/users/oguzhangedik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oguzhangedik/subscriptions","organizations_url":"https://api.github.com/users/oguzhangedik/orgs","repos_url":"https://api.github.com/users/oguzhangedik/repos","events_url":"https://api.github.com/users/oguzhangedik/events{/privacy}","received_events_url":"https://api.github.com/users/oguzhangedik/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-29T14:55:06Z","updated_at":"2015-07-29T15:05:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/12/commits","review_comments_url":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/12/comments","review_comment_url":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PrancingPony/Dictionary/issues/12/comments","statuses_url":"https://api.github.com/repos/PrancingPony/Dictionary/statuses/dcb26ba9cfaa6b8ec556f48b635a5be58e5cb1ad","head":{"label":"PrancingPony:2","ref":"2","sha":"dcb26ba9cfaa6b8ec556f48b635a5be58e5cb1ad","user":{"login":"PrancingPony","id":12482824,"avatar_url":"https://avatars.githubusercontent.com/u/12482824?v=3","gravatar_id":"","url":"https://api.github.com/users/PrancingPony","html_url":"https://github.com/PrancingPony","followers_url":"https://api.github.com/users/PrancingPony/followers","following_url":"https://api.github.com/users/PrancingPony/following{/other_user}","gists_url":"https://api.github.com/users/PrancingPony/gists{/gist_id}","starred_url":"https://api.github.com/users/PrancingPony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrancingPony/subscriptions","organizations_url":"https://api.github.com/users/PrancingPony/orgs","repos_url":"https://api.github.com/users/PrancingPony/repos","events_url":"https://api.github.com/users/PrancingPony/events{/privacy}","received_events_url":"https://api.github.com/users/PrancingPony/received_events","type":"Organization","site_admin":false},"repo":{"id":39772383,"name":"Dictionary","full_name":"PrancingPony/Dictionary","owner":{"login":"PrancingPony","id":12482824,"avatar_url":"https://avatars.githubusercontent.com/u/12482824?v=3","gravatar_id":"","url":"https://api.github.com/users/PrancingPony","html_url":"https://github.com/PrancingPony","followers_url":"https://api.github.com/users/PrancingPony/followers","following_url":"https://api.github.com/users/PrancingPony/following{/other_user}","gists_url":"https://api.github.com/users/PrancingPony/gists{/gist_id}","starred_url":"https://api.github.com/users/PrancingPony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrancingPony/subscriptions","organizations_url":"https://api.github.com/users/PrancingPony/orgs","repos_url":"https://api.github.com/users/PrancingPony/repos","events_url":"https://api.github.com/users/PrancingPony/events{/privacy}","received_events_url":"https://api.github.com/users/PrancingPony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PrancingPony/Dictionary","description":"","fork":false,"url":"https://api.github.com/repos/PrancingPony/Dictionary","forks_url":"https://api.github.com/repos/PrancingPony/Dictionary/forks","keys_url":"https://api.github.com/repos/PrancingPony/Dictionary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PrancingPony/Dictionary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PrancingPony/Dictionary/teams","hooks_url":"https://api.github.com/repos/PrancingPony/Dictionary/hooks","issue_events_url":"https://api.github.com/repos/PrancingPony/Dictionary/issues/events{/number}","events_url":"https://api.github.com/repos/PrancingPony/Dictionary/events","assignees_url":"https://api.github.com/repos/PrancingPony/Dictionary/assignees{/user}","branches_url":"https://api.github.com/repos/PrancingPony/Dictionary/branches{/branch}","tags_url":"https://api.github.com/repos/PrancingPony/Dictionary/tags","blobs_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/refs{/sha}","trees_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PrancingPony/Dictionary/statuses/{sha}","languages_url":"https://api.github.com/repos/PrancingPony/Dictionary/languages","stargazers_url":"https://api.github.com/repos/PrancingPony/Dictionary/stargazers","contributors_url":"https://api.github.com/repos/PrancingPony/Dictionary/contributors","subscribers_url":"https://api.github.com/repos/PrancingPony/Dictionary/subscribers","subscription_url":"https://api.github.com/repos/PrancingPony/Dictionary/subscription","commits_url":"https://api.github.com/repos/PrancingPony/Dictionary/commits{/sha}","git_commits_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/commits{/sha}","comments_url":"https://api.github.com/repos/PrancingPony/Dictionary/comments{/number}","issue_comment_url":"https://api.github.com/repos/PrancingPony/Dictionary/issues/comments{/number}","contents_url":"https://api.github.com/repos/PrancingPony/Dictionary/contents/{+path}","compare_url":"https://api.github.com/repos/PrancingPony/Dictionary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PrancingPony/Dictionary/merges","archive_url":"https://api.github.com/repos/PrancingPony/Dictionary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PrancingPony/Dictionary/downloads","issues_url":"https://api.github.com/repos/PrancingPony/Dictionary/issues{/number}","pulls_url":"https://api.github.com/repos/PrancingPony/Dictionary/pulls{/number}","milestones_url":"https://api.github.com/repos/PrancingPony/Dictionary/milestones{/number}","notifications_url":"https://api.github.com/repos/PrancingPony/Dictionary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PrancingPony/Dictionary/labels{/name}","releases_url":"https://api.github.com/repos/PrancingPony/Dictionary/releases{/id}","created_at":"2015-07-27T12:06:42Z","updated_at":"2015-07-27T12:14:14Z","pushed_at":"2015-07-29T14:55:07Z","git_url":"git://github.com/PrancingPony/Dictionary.git","ssh_url":"git@github.com:PrancingPony/Dictionary.git","clone_url":"https://github.com/PrancingPony/Dictionary.git","svn_url":"https://github.com/PrancingPony/Dictionary","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"base":{"label":"PrancingPony:master","ref":"master","sha":"ba04e395e09d025c441f8960a6be1102c8a7930c","user":{"login":"PrancingPony","id":12482824,"avatar_url":"https://avatars.githubusercontent.com/u/12482824?v=3","gravatar_id":"","url":"https://api.github.com/users/PrancingPony","html_url":"https://github.com/PrancingPony","followers_url":"https://api.github.com/users/PrancingPony/followers","following_url":"https://api.github.com/users/PrancingPony/following{/other_user}","gists_url":"https://api.github.com/users/PrancingPony/gists{/gist_id}","starred_url":"https://api.github.com/users/PrancingPony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrancingPony/subscriptions","organizations_url":"https://api.github.com/users/PrancingPony/orgs","repos_url":"https://api.github.com/users/PrancingPony/repos","events_url":"https://api.github.com/users/PrancingPony/events{/privacy}","received_events_url":"https://api.github.com/users/PrancingPony/received_events","type":"Organization","site_admin":false},"repo":{"id":39772383,"name":"Dictionary","full_name":"PrancingPony/Dictionary","owner":{"login":"PrancingPony","id":12482824,"avatar_url":"https://avatars.githubusercontent.com/u/12482824?v=3","gravatar_id":"","url":"https://api.github.com/users/PrancingPony","html_url":"https://github.com/PrancingPony","followers_url":"https://api.github.com/users/PrancingPony/followers","following_url":"https://api.github.com/users/PrancingPony/following{/other_user}","gists_url":"https://api.github.com/users/PrancingPony/gists{/gist_id}","starred_url":"https://api.github.com/users/PrancingPony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrancingPony/subscriptions","organizations_url":"https://api.github.com/users/PrancingPony/orgs","repos_url":"https://api.github.com/users/PrancingPony/repos","events_url":"https://api.github.com/users/PrancingPony/events{/privacy}","received_events_url":"https://api.github.com/users/PrancingPony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PrancingPony/Dictionary","description":"","fork":false,"url":"https://api.github.com/repos/PrancingPony/Dictionary","forks_url":"https://api.github.com/repos/PrancingPony/Dictionary/forks","keys_url":"https://api.github.com/repos/PrancingPony/Dictionary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PrancingPony/Dictionary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PrancingPony/Dictionary/teams","hooks_url":"https://api.github.com/repos/PrancingPony/Dictionary/hooks","issue_events_url":"https://api.github.com/repos/PrancingPony/Dictionary/issues/events{/number}","events_url":"https://api.github.com/repos/PrancingPony/Dictionary/events","assignees_url":"https://api.github.com/repos/PrancingPony/Dictionary/assignees{/user}","branches_url":"https://api.github.com/repos/PrancingPony/Dictionary/branches{/branch}","tags_url":"https://api.github.com/repos/PrancingPony/Dictionary/tags","blobs_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/refs{/sha}","trees_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PrancingPony/Dictionary/statuses/{sha}","languages_url":"https://api.github.com/repos/PrancingPony/Dictionary/languages","stargazers_url":"https://api.github.com/repos/PrancingPony/Dictionary/stargazers","contributors_url":"https://api.github.com/repos/PrancingPony/Dictionary/contributors","subscribers_url":"https://api.github.com/repos/PrancingPony/Dictionary/subscribers","subscription_url":"https://api.github.com/repos/PrancingPony/Dictionary/subscription","commits_url":"https://api.github.com/repos/PrancingPony/Dictionary/commits{/sha}","git_commits_url":"https://api.github.com/repos/PrancingPony/Dictionary/git/commits{/sha}","comments_url":"https://api.github.com/repos/PrancingPony/Dictionary/comments{/number}","issue_comment_url":"https://api.github.com/repos/PrancingPony/Dictionary/issues/comments{/number}","contents_url":"https://api.github.com/repos/PrancingPony/Dictionary/contents/{+path}","compare_url":"https://api.github.com/repos/PrancingPony/Dictionary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PrancingPony/Dictionary/merges","archive_url":"https://api.github.com/repos/PrancingPony/Dictionary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PrancingPony/Dictionary/downloads","issues_url":"https://api.github.com/repos/PrancingPony/Dictionary/issues{/number}","pulls_url":"https://api.github.com/repos/PrancingPony/Dictionary/pulls{/number}","milestones_url":"https://api.github.com/repos/PrancingPony/Dictionary/milestones{/number}","notifications_url":"https://api.github.com/repos/PrancingPony/Dictionary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PrancingPony/Dictionary/labels{/name}","releases_url":"https://api.github.com/repos/PrancingPony/Dictionary/releases{/id}","created_at":"2015-07-27T12:06:42Z","updated_at":"2015-07-27T12:14:14Z","pushed_at":"2015-07-29T14:55:07Z","git_url":"git://github.com/PrancingPony/Dictionary.git","ssh_url":"git@github.com:PrancingPony/Dictionary.git","clone_url":"https://github.com/PrancingPony/Dictionary.git","svn_url":"https://github.com/PrancingPony/Dictionary","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/12"},"html":{"href":"https://github.com/PrancingPony/Dictionary/pull/12"},"issue":{"href":"https://api.github.com/repos/PrancingPony/Dictionary/issues/12"},"comments":{"href":"https://api.github.com/repos/PrancingPony/Dictionary/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PrancingPony/Dictionary/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/PrancingPony/Dictionary/statuses/dcb26ba9cfaa6b8ec556f48b635a5be58e5cb1ad"}}}}