{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/comments/93840061","pull_request_review_id":14373761,"id":93840061,"diff_hunk":"@@ -0,0 +1,77 @@\n+package data.local;\n+\n+import android.content.ContentValues;\n+import android.content.Context;\n+import android.database.Cursor;\n+import android.database.SQLException;\n+import android.database.sqlite.SQLiteDatabase;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import data.model.DataModel;\n+\n+/**\n+ * Created by Nhahv on 12/26/2016.\n+ * <.\n+ */\n+public class SQLiteCommon extends SQLiteHelper {\n+    public static final int TYPE_TABLE_SONGS = 1;\n+    public static final int TYPE_TABLE_SHORT_STORIES = 2;\n+    public static String[] mAllColumn =\n+        {SQLiteHelper.FIELD_NAME, SQLiteHelper.FIELD_IMAGE_URL, SQLiteHelper.FIELD_PATH_RENDER,\n+            SQLiteHelper.FIELD_URL_MP4};\n+    private SQLiteDatabase mSqLiteDatabase;\n+\n+    public SQLiteCommon(Context context) {\n+        super(context);\n+    }\n+\n+    public void openSQLite() throws SQLException {\n+        mSqLiteDatabase = getWritableDatabase();\n+    }\n+\n+\n+    public void saveListDataModel(List<DataModel> dataModels, int type) {\n+        deleteDataModel(type);\n+        for (DataModel dataModel : dataModels) {\n+            saveDataModel(dataModel, type);\n+        }\n+    }\n+\n+    public boolean saveDataModel(DataModel dataModel, int type) {\n+        ContentValues values = new ContentValues();\n+        values.put(SQLiteHelper.FIELD_NAME, dataModel.getName());\n+        values.put(SQLiteHelper.FIELD_IMAGE_URL, dataModel.getImageUrl());\n+        values.put(SQLiteHelper.FIELD_PATH_RENDER, dataModel.getPathRender());\n+        values.put(SQLiteHelper.FIELD_URL_MP4, dataModel.getUrlMp4());\n+        String table = getTableName(type);\n+        return mSqLiteDatabase.insert(table, null, values) > 0;\n+    }\n+\n+    public boolean deleteDataModel(int type) {\n+        String table = (type == TYPE_TABLE_SONGS) ? SQLiteHelper.TABLE_SONGS : SQLiteHelper\n+            .TABLE_SHORT_STORIES;\n+        return mSqLiteDatabase.delete(table, null, null) > 0;\n+    }\n+\n+    public List<DataModel> getListDataModel(int type) {\n+        List<DataModel> listDataModel = new ArrayList<>();\n+        String table = getTableName(type);\n+        Cursor cursor = mSqLiteDatabase.query(table, mAllColumn, null, null, null, null, null);\n+        if (cursor == null || (!cursor.moveToFirst())) return listDataModel;\n+        cursor.moveToFirst();","path":"app/src/main/java/data/local/SQLiteCommon.java","position":63,"original_position":63,"commit_id":"1073ef941209b54ccfe154389b17fa02d0a4c169","original_commit_id":"1073ef941209b54ccfe154389b17fa02d0a4c169","user":{"login":"DoanVanToan","id":21195010,"avatar_url":"https://avatars.githubusercontent.com/u/21195010?v=3","gravatar_id":"","url":"https://api.github.com/users/DoanVanToan","html_url":"https://github.com/DoanVanToan","followers_url":"https://api.github.com/users/DoanVanToan/followers","following_url":"https://api.github.com/users/DoanVanToan/following{/other_user}","gists_url":"https://api.github.com/users/DoanVanToan/gists{/gist_id}","starred_url":"https://api.github.com/users/DoanVanToan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoanVanToan/subscriptions","organizations_url":"https://api.github.com/users/DoanVanToan/orgs","repos_url":"https://api.github.com/users/DoanVanToan/repos","events_url":"https://api.github.com/users/DoanVanToan/events{/privacy}","received_events_url":"https://api.github.com/users/DoanVanToan/received_events","type":"User","site_admin":false},"body":"Hàm này có tác dụng gì?","created_at":"2016-12-26T03:34:58Z","updated_at":"2016-12-26T03:47:17Z","html_url":"https://github.com/framgia/EnglishForKid_3/pull/6#discussion_r93840061","pull_request_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/comments/93840061"},"html":{"href":"https://github.com/framgia/EnglishForKid_3/pull/6#discussion_r93840061"},"pull_request":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/6","id":99205788,"html_url":"https://github.com/framgia/EnglishForKid_3/pull/6","diff_url":"https://github.com/framgia/EnglishForKid_3/pull/6.diff","patch_url":"https://github.com/framgia/EnglishForKid_3/pull/6.patch","issue_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/6","number":6,"state":"open","locked":false,"title":"Task/93647","user":{"login":"nhahv0902","id":14172027,"avatar_url":"https://avatars.githubusercontent.com/u/14172027?v=3","gravatar_id":"","url":"https://api.github.com/users/nhahv0902","html_url":"https://github.com/nhahv0902","followers_url":"https://api.github.com/users/nhahv0902/followers","following_url":"https://api.github.com/users/nhahv0902/following{/other_user}","gists_url":"https://api.github.com/users/nhahv0902/gists{/gist_id}","starred_url":"https://api.github.com/users/nhahv0902/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhahv0902/subscriptions","organizations_url":"https://api.github.com/users/nhahv0902/orgs","repos_url":"https://api.github.com/users/nhahv0902/repos","events_url":"https://api.github.com/users/nhahv0902/events{/privacy}","received_events_url":"https://api.github.com/users/nhahv0902/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-23T06:03:30Z","updated_at":"2016-12-26T03:47:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7d76cfc5da10242b0a2f569fc311fe822e404e89","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/6/commits","review_comments_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/6/comments","review_comment_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/6/comments","statuses_url":"https://api.github.com/repos/framgia/EnglishForKid_3/statuses/1073ef941209b54ccfe154389b17fa02d0a4c169","head":{"label":"nhahv0902:task/93647","ref":"task/93647","sha":"1073ef941209b54ccfe154389b17fa02d0a4c169","user":{"login":"nhahv0902","id":14172027,"avatar_url":"https://avatars.githubusercontent.com/u/14172027?v=3","gravatar_id":"","url":"https://api.github.com/users/nhahv0902","html_url":"https://github.com/nhahv0902","followers_url":"https://api.github.com/users/nhahv0902/followers","following_url":"https://api.github.com/users/nhahv0902/following{/other_user}","gists_url":"https://api.github.com/users/nhahv0902/gists{/gist_id}","starred_url":"https://api.github.com/users/nhahv0902/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhahv0902/subscriptions","organizations_url":"https://api.github.com/users/nhahv0902/orgs","repos_url":"https://api.github.com/users/nhahv0902/repos","events_url":"https://api.github.com/users/nhahv0902/events{/privacy}","received_events_url":"https://api.github.com/users/nhahv0902/received_events","type":"User","site_admin":false},"repo":{"id":76914031,"name":"EnglishForKid_3","full_name":"nhahv0902/EnglishForKid_3","owner":{"login":"nhahv0902","id":14172027,"avatar_url":"https://avatars.githubusercontent.com/u/14172027?v=3","gravatar_id":"","url":"https://api.github.com/users/nhahv0902","html_url":"https://github.com/nhahv0902","followers_url":"https://api.github.com/users/nhahv0902/followers","following_url":"https://api.github.com/users/nhahv0902/following{/other_user}","gists_url":"https://api.github.com/users/nhahv0902/gists{/gist_id}","starred_url":"https://api.github.com/users/nhahv0902/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhahv0902/subscriptions","organizations_url":"https://api.github.com/users/nhahv0902/orgs","repos_url":"https://api.github.com/users/nhahv0902/repos","events_url":"https://api.github.com/users/nhahv0902/events{/privacy}","received_events_url":"https://api.github.com/users/nhahv0902/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nhahv0902/EnglishForKid_3","description":"EnglishForKid (Training)","fork":true,"url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3","forks_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/forks","keys_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/teams","hooks_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/hooks","issue_events_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/issues/events{/number}","events_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/events","assignees_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/assignees{/user}","branches_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/branches{/branch}","tags_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/tags","blobs_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/refs{/sha}","trees_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/statuses/{sha}","languages_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/languages","stargazers_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/stargazers","contributors_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/contributors","subscribers_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/subscribers","subscription_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/subscription","commits_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/commits{/sha}","git_commits_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/git/commits{/sha}","comments_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/comments{/number}","issue_comment_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/issues/comments{/number}","contents_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/contents/{+path}","compare_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/merges","archive_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/downloads","issues_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/issues{/number}","pulls_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/pulls{/number}","milestones_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/milestones{/number}","notifications_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/labels{/name}","releases_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/releases{/id}","deployments_url":"https://api.github.com/repos/nhahv0902/EnglishForKid_3/deployments","created_at":"2016-12-20T02:08:24Z","updated_at":"2016-12-20T01:10:10Z","pushed_at":"2016-12-26T03:17:49Z","git_url":"git://github.com/nhahv0902/EnglishForKid_3.git","ssh_url":"git@github.com:nhahv0902/EnglishForKid_3.git","clone_url":"https://github.com/nhahv0902/EnglishForKid_3.git","svn_url":"https://github.com/nhahv0902/EnglishForKid_3","homepage":null,"size":192,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"framgia:develop","ref":"develop","sha":"b3644c0806388ba5dbd56ad4200a0d8536757607","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":76910528,"name":"EnglishForKid_3","full_name":"framgia/EnglishForKid_3","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/EnglishForKid_3","description":"EnglishForKid (Training)","fork":false,"url":"https://api.github.com/repos/framgia/EnglishForKid_3","forks_url":"https://api.github.com/repos/framgia/EnglishForKid_3/forks","keys_url":"https://api.github.com/repos/framgia/EnglishForKid_3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/EnglishForKid_3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/EnglishForKid_3/teams","hooks_url":"https://api.github.com/repos/framgia/EnglishForKid_3/hooks","issue_events_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/EnglishForKid_3/events","assignees_url":"https://api.github.com/repos/framgia/EnglishForKid_3/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/EnglishForKid_3/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/EnglishForKid_3/tags","blobs_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/EnglishForKid_3/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/EnglishForKid_3/languages","stargazers_url":"https://api.github.com/repos/framgia/EnglishForKid_3/stargazers","contributors_url":"https://api.github.com/repos/framgia/EnglishForKid_3/contributors","subscribers_url":"https://api.github.com/repos/framgia/EnglishForKid_3/subscribers","subscription_url":"https://api.github.com/repos/framgia/EnglishForKid_3/subscription","commits_url":"https://api.github.com/repos/framgia/EnglishForKid_3/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/EnglishForKid_3/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/EnglishForKid_3/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/EnglishForKid_3/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/EnglishForKid_3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/EnglishForKid_3/merges","archive_url":"https://api.github.com/repos/framgia/EnglishForKid_3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/EnglishForKid_3/downloads","issues_url":"https://api.github.com/repos/framgia/EnglishForKid_3/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/EnglishForKid_3/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/EnglishForKid_3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/EnglishForKid_3/labels{/name}","releases_url":"https://api.github.com/repos/framgia/EnglishForKid_3/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/EnglishForKid_3/deployments","created_at":"2016-12-20T01:10:10Z","updated_at":"2016-12-21T02:20:54Z","pushed_at":"2016-12-26T03:17:50Z","git_url":"git://github.com/framgia/EnglishForKid_3.git","ssh_url":"git@github.com:framgia/EnglishForKid_3.git","clone_url":"https://github.com/framgia/EnglishForKid_3.git","svn_url":"https://github.com/framgia/EnglishForKid_3","homepage":null,"size":146,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/6"},"html":{"href":"https://github.com/framgia/EnglishForKid_3/pull/6"},"issue":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/6"},"comments":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/EnglishForKid_3/statuses/1073ef941209b54ccfe154389b17fa02d0a4c169"}}}}
{"actor":{"display_login":"DoanVanToan"}}