{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fps_2/pulls/comments/61696336","id":61696336,"diff_hunk":"@@ -0,0 +1,99 @@\n+package com.framgia.project1.fps_2_project.data.remote;\n+\n+import android.content.ContentValues;\n+import android.content.Context;\n+import android.database.Cursor;\n+import android.database.sqlite.SQLiteDatabase;\n+\n+import com.framgia.project1.fps_2_project.data.local.DataBaseHelper;\n+import com.framgia.project1.fps_2_project.data.model.Constant;\n+import com.framgia.project1.fps_2_project.data.model.Image;\n+import com.framgia.project1.fps_2_project.data.model.Video;\n+\n+import java.sql.SQLDataException;\n+import java.sql.SQLException;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+/**\n+ * Created by nguyenxuantung on 20/04/2016.\n+ */\n+public class DataBaseRemote implements Constant {\n+    private SQLiteDatabase mDataBase;\n+    private DataBaseHelper mHelper;\n+\n+    public DataBaseRemote(Context context){\n+        mHelper= new DataBaseHelper(context);\n+    }\n+    public void openDataBase() throws SQLException{\n+        mDataBase= mHelper.getWritableDatabase();\n+    }\n+    public void closeDataBase() throws SQLException{\n+        mDataBase.close();\n+    }\n+    //insert data into table image\n+    public long insertImage(Image image) {\n+        long result = -1;\n+        ContentValues contentValues = new ContentValues();\n+        contentValues.put(COLUMN_IMAGE_NAME, image.getmImageName());\n+        contentValues.put(COLUMN_IMAGE_PATH, image.getmImagePath());\n+        contentValues.put(COLUMN_IMAGE_LIKE, image.getmImageLike());\n+        try {\n+            result = mDataBase.insertOrThrow(TABLE_IMAGE, null, contentValues);\n+        } catch (Exception e) {\n+            e.printStackTrace();\n+        }\n+        return result;\n+    }\n+    //get an image from list\n+    public Cursor searchImage(int id) {\n+        String query = COLUMN_ID+ \" = \" + id;\n+        Cursor cursor = null;\n+        cursor = mDataBase.query(true, TABLE_IMAGE, null, query, null, null, null, null, null);\n+        if (cursor != null) {\n+            cursor.moveToFirst();\n+        }\n+        return cursor;\n+    }\n+    // get list of image\n+    public List<Image> getImageTopList() {\n+        List<Image> ImageList = new ArrayList<>();\n+        String query = \"select * from \" + TABLE_IMAGE + \" ORDER BY \" + COLUMN_IMAGE_LIKE + \"DESC\";\n+        Cursor cursor = null;\n+        cursor = mDataBase.rawQuery(query, null);","path":"app/src/main/java/com/framgia/project1/fps_2_project/data/remote/DataBaseRemote.java","position":63,"original_position":63,"commit_id":"4023ab073a8d646088452e112e633b8ccb6ea9d1","original_commit_id":"4023ab073a8d646088452e112e633b8ccb6ea9d1","user":{"login":"b1acKr0se","id":8596158,"avatar_url":"https://avatars.githubusercontent.com/u/8596158?v=3","gravatar_id":"","url":"https://api.github.com/users/b1acKr0se","html_url":"https://github.com/b1acKr0se","followers_url":"https://api.github.com/users/b1acKr0se/followers","following_url":"https://api.github.com/users/b1acKr0se/following{/other_user}","gists_url":"https://api.github.com/users/b1acKr0se/gists{/gist_id}","starred_url":"https://api.github.com/users/b1acKr0se/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b1acKr0se/subscriptions","organizations_url":"https://api.github.com/users/b1acKr0se/orgs","repos_url":"https://api.github.com/users/b1acKr0se/repos","events_url":"https://api.github.com/users/b1acKr0se/events{/privacy}","received_events_url":"https://api.github.com/users/b1acKr0se/received_events","type":"User","site_admin":false},"body":"dùng hàm `query`","created_at":"2016-05-02T00:45:36Z","updated_at":"2016-05-02T00:45:36Z","html_url":"https://github.com/framgia/fps_2/pull/9#discussion_r61696336","pull_request_url":"https://api.github.com/repos/framgia/fps_2/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/framgia/fps_2/pulls/comments/61696336"},"html":{"href":"https://github.com/framgia/fps_2/pull/9#discussion_r61696336"},"pull_request":{"href":"https://api.github.com/repos/framgia/fps_2/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fps_2/pulls/9","id":68316787,"html_url":"https://github.com/framgia/fps_2/pull/9","diff_url":"https://github.com/framgia/fps_2/pull/9.diff","patch_url":"https://github.com/framgia/fps_2/pull/9.patch","issue_url":"https://api.github.com/repos/framgia/fps_2/issues/9","number":9,"state":"open","locked":false,"title":"create database and integrate facebook","user":{"login":"NguyenXuanTungB","id":17583033,"avatar_url":"https://avatars.githubusercontent.com/u/17583033?v=3","gravatar_id":"","url":"https://api.github.com/users/NguyenXuanTungB","html_url":"https://github.com/NguyenXuanTungB","followers_url":"https://api.github.com/users/NguyenXuanTungB/followers","following_url":"https://api.github.com/users/NguyenXuanTungB/following{/other_user}","gists_url":"https://api.github.com/users/NguyenXuanTungB/gists{/gist_id}","starred_url":"https://api.github.com/users/NguyenXuanTungB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NguyenXuanTungB/subscriptions","organizations_url":"https://api.github.com/users/NguyenXuanTungB/orgs","repos_url":"https://api.github.com/users/NguyenXuanTungB/repos","events_url":"https://api.github.com/users/NguyenXuanTungB/events{/privacy}","received_events_url":"https://api.github.com/users/NguyenXuanTungB/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-29T02:04:17Z","updated_at":"2016-05-02T00:45:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9a21241692a7b3762625be55fb4c3ccef7e69ed5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fps_2/pulls/9/commits","review_comments_url":"https://api.github.com/repos/framgia/fps_2/pulls/9/comments","review_comment_url":"https://api.github.com/repos/framgia/fps_2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/fps_2/issues/9/comments","statuses_url":"https://api.github.com/repos/framgia/fps_2/statuses/4023ab073a8d646088452e112e633b8ccb6ea9d1","head":{"label":"NguyenXuanTungB:create_database","ref":"create_database","sha":"4023ab073a8d646088452e112e633b8ccb6ea9d1","user":{"login":"NguyenXuanTungB","id":17583033,"avatar_url":"https://avatars.githubusercontent.com/u/17583033?v=3","gravatar_id":"","url":"https://api.github.com/users/NguyenXuanTungB","html_url":"https://github.com/NguyenXuanTungB","followers_url":"https://api.github.com/users/NguyenXuanTungB/followers","following_url":"https://api.github.com/users/NguyenXuanTungB/following{/other_user}","gists_url":"https://api.github.com/users/NguyenXuanTungB/gists{/gist_id}","starred_url":"https://api.github.com/users/NguyenXuanTungB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NguyenXuanTungB/subscriptions","organizations_url":"https://api.github.com/users/NguyenXuanTungB/orgs","repos_url":"https://api.github.com/users/NguyenXuanTungB/repos","events_url":"https://api.github.com/users/NguyenXuanTungB/events{/privacy}","received_events_url":"https://api.github.com/users/NguyenXuanTungB/received_events","type":"User","site_admin":false},"repo":{"id":55945561,"name":"fps_2","full_name":"NguyenXuanTungB/fps_2","owner":{"login":"NguyenXuanTungB","id":17583033,"avatar_url":"https://avatars.githubusercontent.com/u/17583033?v=3","gravatar_id":"","url":"https://api.github.com/users/NguyenXuanTungB","html_url":"https://github.com/NguyenXuanTungB","followers_url":"https://api.github.com/users/NguyenXuanTungB/followers","following_url":"https://api.github.com/users/NguyenXuanTungB/following{/other_user}","gists_url":"https://api.github.com/users/NguyenXuanTungB/gists{/gist_id}","starred_url":"https://api.github.com/users/NguyenXuanTungB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NguyenXuanTungB/subscriptions","organizations_url":"https://api.github.com/users/NguyenXuanTungB/orgs","repos_url":"https://api.github.com/users/NguyenXuanTungB/repos","events_url":"https://api.github.com/users/NguyenXuanTungB/events{/privacy}","received_events_url":"https://api.github.com/users/NguyenXuanTungB/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NguyenXuanTungB/fps_2","description":"Photo Sketch (training)","fork":true,"url":"https://api.github.com/repos/NguyenXuanTungB/fps_2","forks_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/forks","keys_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/teams","hooks_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/hooks","issue_events_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/issues/events{/number}","events_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/events","assignees_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/assignees{/user}","branches_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/branches{/branch}","tags_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/tags","blobs_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/git/refs{/sha}","trees_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/statuses/{sha}","languages_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/languages","stargazers_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/stargazers","contributors_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/contributors","subscribers_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/subscribers","subscription_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/subscription","commits_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/commits{/sha}","git_commits_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/git/commits{/sha}","comments_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/comments{/number}","issue_comment_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/issues/comments{/number}","contents_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/contents/{+path}","compare_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/merges","archive_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/downloads","issues_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/issues{/number}","pulls_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/pulls{/number}","milestones_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/milestones{/number}","notifications_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/labels{/name}","releases_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/releases{/id}","deployments_url":"https://api.github.com/repos/NguyenXuanTungB/fps_2/deployments","created_at":"2016-04-11T05:55:36Z","updated_at":"2016-04-11T03:54:44Z","pushed_at":"2016-04-29T03:21:35Z","git_url":"git://github.com/NguyenXuanTungB/fps_2.git","ssh_url":"git@github.com:NguyenXuanTungB/fps_2.git","clone_url":"https://github.com/NguyenXuanTungB/fps_2.git","svn_url":"https://github.com/NguyenXuanTungB/fps_2","homepage":null,"size":3469,"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":"51cb8fba0b7cc7feb91458ce157c70762eecdafc","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":55940134,"name":"fps_2","full_name":"framgia/fps_2","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/fps_2","description":"Photo Sketch (training)","fork":false,"url":"https://api.github.com/repos/framgia/fps_2","forks_url":"https://api.github.com/repos/framgia/fps_2/forks","keys_url":"https://api.github.com/repos/framgia/fps_2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fps_2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fps_2/teams","hooks_url":"https://api.github.com/repos/framgia/fps_2/hooks","issue_events_url":"https://api.github.com/repos/framgia/fps_2/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fps_2/events","assignees_url":"https://api.github.com/repos/framgia/fps_2/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fps_2/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fps_2/tags","blobs_url":"https://api.github.com/repos/framgia/fps_2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fps_2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fps_2/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fps_2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fps_2/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fps_2/languages","stargazers_url":"https://api.github.com/repos/framgia/fps_2/stargazers","contributors_url":"https://api.github.com/repos/framgia/fps_2/contributors","subscribers_url":"https://api.github.com/repos/framgia/fps_2/subscribers","subscription_url":"https://api.github.com/repos/framgia/fps_2/subscription","commits_url":"https://api.github.com/repos/framgia/fps_2/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fps_2/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fps_2/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fps_2/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/fps_2/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fps_2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fps_2/merges","archive_url":"https://api.github.com/repos/framgia/fps_2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fps_2/downloads","issues_url":"https://api.github.com/repos/framgia/fps_2/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fps_2/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fps_2/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fps_2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fps_2/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fps_2/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/fps_2/deployments","created_at":"2016-04-11T03:54:44Z","updated_at":"2016-04-11T03:54:44Z","pushed_at":"2016-04-29T14:58:41Z","git_url":"git://github.com/framgia/fps_2.git","ssh_url":"git@github.com:framgia/fps_2.git","clone_url":"https://github.com/framgia/fps_2.git","svn_url":"https://github.com/framgia/fps_2","homepage":null,"size":516,"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":6,"forks":2,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fps_2/pulls/9"},"html":{"href":"https://github.com/framgia/fps_2/pull/9"},"issue":{"href":"https://api.github.com/repos/framgia/fps_2/issues/9"},"comments":{"href":"https://api.github.com/repos/framgia/fps_2/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fps_2/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fps_2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/fps_2/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fps_2/statuses/4023ab073a8d646088452e112e633b8ccb6ea9d1"}}}}