{"action":"created","comment":{"url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/comments/32215240","id":32215240,"diff_hunk":"@@ -0,0 +1,125 @@\n+package com.example.admin.personallibrarycatalogue;\n+\n+import android.content.Intent;\n+import android.support.v4.app.Fragment;\n+import android.os.Bundle;\n+import android.support.v7.internal.widget.AdapterViewCompat;\n+import android.view.ContextMenu;\n+import android.view.LayoutInflater;\n+import android.view.MenuInflater;\n+import android.view.MenuItem;\n+import android.view.View;\n+import android.view.ViewGroup;\n+import android.widget.Adapter;\n+import android.widget.AdapterView;\n+import android.widget.EditText;\n+import android.widget.ListView;\n+\n+import com.example.admin.personallibrarycatalogue.data.Book;\n+import com.example.admin.personallibrarycatalogue.data.LibraryDatabaseHelper;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+import java.util.Objects;\n+\n+\n+/**\n+ * A placeholder fragment containing a simple view.\n+ */\n+public class BooksListActivityFragment extends Fragment {\n+\n+    private final static String ID = \"id\";\n+    private ListView listView_;\n+    private BooksListAdapter booksListAdapter_;\n+    private LibraryDatabaseHelper helper_;\n+\n+    public BooksListActivityFragment() {\n+    }\n+\n+    @Override\n+    public View onCreateView(final LayoutInflater inflater, ViewGroup container,\n+                             Bundle savedInstanceState) {\n+        View rootView = inflater.inflate(R.layout.fragment_books_list, container, false);\n+\n+        helper_ = new LibraryDatabaseHelper(getActivity());\n+\n+        List<Book> booksList = new ArrayList<Book>();\n+        booksList = helper_.getAllBooks();\n+\n+        listView_ = (ListView) rootView.findViewById(R.id.books_list_view);\n+        booksListAdapter_ = new BooksListAdapter(this.getActivity(), booksList);\n+        listView_.setAdapter(booksListAdapter_);\n+\n+        // Set ContextMenu for listView\n+        registerForContextMenu(listView_);\n+\n+        listView_.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n+            @Override\n+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n+                changeBook(parent, position);\n+            }\n+        });\n+\n+        return rootView;\n+    }\n+\n+    @Override\n+    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n+        super.onCreateContextMenu(menu, v, menuInfo);\n+        MenuInflater inflater = getActivity().getMenuInflater();\n+        menu.setHeaderTitle(R.string.Menu);\n+        inflater.inflate(R.menu.context_menu, menu);\n+    }\n+\n+    @Override\n+    public boolean onContextItemSelected(MenuItem item) {\n+        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();\n+\n+        switch (item.getItemId()) {\n+            case R.id.edit_book:\n+                changeBook(listView_, info.position);\n+                break;\n+\n+            case R.id.delete_book:\n+                deleteBook(listView_, info.position);\n+                booksListAdapter_.notifyDataSetChanged();\n+                break;\n+\n+            default:\n+                return super.onContextItemSelected(item);\n+        }\n+        return true;\n+    }\n+\n+    /**\n+     * Set up activity for changing some information about book (title, author etc.)\n+     *\n+     * @param parent   AdapterView (could be a ListView, GridView, Spinner)\n+     * @param position Clicked item position\n+     */\n+    public void changeBook(AdapterView<?> parent, int position) {\n+        Book book = (Book) parent.getItemAtPosition(position);\n+        String author = book.getAuthor();\n+        String title = book.getTitle();\n+\n+        Intent intent = new Intent();\n+        intent.setClass(getActivity(), AddBookActivity.class);\n+\n+        int returned_id = helper_.getId(title, author);","path":"app/src/main/java/com/example/admin/personallibrarycatalogue/BooksListActivityFragment.java","position":108,"original_position":108,"commit_id":"2e1f936a77bc592a88e29bcfeb8856df6e0c21f2","original_commit_id":"2e1f936a77bc592a88e29bcfeb8856df6e0c21f2","user":{"login":"oxied","id":1070647,"avatar_url":"https://avatars.githubusercontent.com/u/1070647?v=3","gravatar_id":"","url":"https://api.github.com/users/oxied","html_url":"https://github.com/oxied","followers_url":"https://api.github.com/users/oxied/followers","following_url":"https://api.github.com/users/oxied/following{/other_user}","gists_url":"https://api.github.com/users/oxied/gists{/gist_id}","starred_url":"https://api.github.com/users/oxied/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oxied/subscriptions","organizations_url":"https://api.github.com/users/oxied/orgs","repos_url":"https://api.github.com/users/oxied/repos","events_url":"https://api.github.com/users/oxied/events{/privacy}","received_events_url":"https://api.github.com/users/oxied/received_events","type":"User","site_admin":false},"body":"Rename ```returned_id```1 to match name convention.","created_at":"2015-06-11T12:32:21Z","updated_at":"2015-06-11T12:32:21Z","html_url":"https://github.com/MikhailSkiyAtWork/Lab_55/pull/1#discussion_r32215240","pull_request_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/comments/32215240"},"html":{"href":"https://github.com/MikhailSkiyAtWork/Lab_55/pull/1#discussion_r32215240"},"pull_request":{"href":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/1","id":36730698,"html_url":"https://github.com/MikhailSkiyAtWork/Lab_55/pull/1","diff_url":"https://github.com/MikhailSkiyAtWork/Lab_55/pull/1.diff","patch_url":"https://github.com/MikhailSkiyAtWork/Lab_55/pull/1.patch","issue_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues/1","number":1,"state":"open","locked":false,"title":"Lab_55. Initial database development ","user":{"login":"MikhailSkiyAtWork","id":12441949,"avatar_url":"https://avatars.githubusercontent.com/u/12441949?v=3","gravatar_id":"","url":"https://api.github.com/users/MikhailSkiyAtWork","html_url":"https://github.com/MikhailSkiyAtWork","followers_url":"https://api.github.com/users/MikhailSkiyAtWork/followers","following_url":"https://api.github.com/users/MikhailSkiyAtWork/following{/other_user}","gists_url":"https://api.github.com/users/MikhailSkiyAtWork/gists{/gist_id}","starred_url":"https://api.github.com/users/MikhailSkiyAtWork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikhailSkiyAtWork/subscriptions","organizations_url":"https://api.github.com/users/MikhailSkiyAtWork/orgs","repos_url":"https://api.github.com/users/MikhailSkiyAtWork/repos","events_url":"https://api.github.com/users/MikhailSkiyAtWork/events{/privacy}","received_events_url":"https://api.github.com/users/MikhailSkiyAtWork/received_events","type":"User","site_admin":false},"body":"http://redmine.weezlabs.com:8100/redmine/boards/8/topics/55 ","created_at":"2015-06-02T13:55:02Z","updated_at":"2015-06-11T12:32:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83e81c10ac1385aafc6cee0dd1708b1ee7993329","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/1/commits","review_comments_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/1/comments","review_comment_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues/1/comments","statuses_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/statuses/2e1f936a77bc592a88e29bcfeb8856df6e0c21f2","head":{"label":"MikhailSkiyAtWork:initial_database_development","ref":"initial_database_development","sha":"2e1f936a77bc592a88e29bcfeb8856df6e0c21f2","user":{"login":"MikhailSkiyAtWork","id":12441949,"avatar_url":"https://avatars.githubusercontent.com/u/12441949?v=3","gravatar_id":"","url":"https://api.github.com/users/MikhailSkiyAtWork","html_url":"https://github.com/MikhailSkiyAtWork","followers_url":"https://api.github.com/users/MikhailSkiyAtWork/followers","following_url":"https://api.github.com/users/MikhailSkiyAtWork/following{/other_user}","gists_url":"https://api.github.com/users/MikhailSkiyAtWork/gists{/gist_id}","starred_url":"https://api.github.com/users/MikhailSkiyAtWork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikhailSkiyAtWork/subscriptions","organizations_url":"https://api.github.com/users/MikhailSkiyAtWork/orgs","repos_url":"https://api.github.com/users/MikhailSkiyAtWork/repos","events_url":"https://api.github.com/users/MikhailSkiyAtWork/events{/privacy}","received_events_url":"https://api.github.com/users/MikhailSkiyAtWork/received_events","type":"User","site_admin":false},"repo":{"id":36225075,"name":"Lab_55","full_name":"MikhailSkiyAtWork/Lab_55","owner":{"login":"MikhailSkiyAtWork","id":12441949,"avatar_url":"https://avatars.githubusercontent.com/u/12441949?v=3","gravatar_id":"","url":"https://api.github.com/users/MikhailSkiyAtWork","html_url":"https://github.com/MikhailSkiyAtWork","followers_url":"https://api.github.com/users/MikhailSkiyAtWork/followers","following_url":"https://api.github.com/users/MikhailSkiyAtWork/following{/other_user}","gists_url":"https://api.github.com/users/MikhailSkiyAtWork/gists{/gist_id}","starred_url":"https://api.github.com/users/MikhailSkiyAtWork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikhailSkiyAtWork/subscriptions","organizations_url":"https://api.github.com/users/MikhailSkiyAtWork/orgs","repos_url":"https://api.github.com/users/MikhailSkiyAtWork/repos","events_url":"https://api.github.com/users/MikhailSkiyAtWork/events{/privacy}","received_events_url":"https://api.github.com/users/MikhailSkiyAtWork/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MikhailSkiyAtWork/Lab_55","description":"Application which allow user keep list of books, with edit and delete functions  http://redmine.weezlabs.com:8100/redmine/boards/8/topics/55","fork":false,"url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55","forks_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/forks","keys_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/teams","hooks_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/hooks","issue_events_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues/events{/number}","events_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/events","assignees_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/assignees{/user}","branches_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/branches{/branch}","tags_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/tags","blobs_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/refs{/sha}","trees_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/statuses/{sha}","languages_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/languages","stargazers_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/stargazers","contributors_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/contributors","subscribers_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/subscribers","subscription_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/subscription","commits_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/commits{/sha}","git_commits_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/commits{/sha}","comments_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/comments{/number}","issue_comment_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues/comments{/number}","contents_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/contents/{+path}","compare_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/merges","archive_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/downloads","issues_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues{/number}","pulls_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls{/number}","milestones_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/milestones{/number}","notifications_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/labels{/name}","releases_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/releases{/id}","created_at":"2015-05-25T10:32:23Z","updated_at":"2015-05-25T10:32:23Z","pushed_at":"2015-06-09T14:19:23Z","git_url":"git://github.com/MikhailSkiyAtWork/Lab_55.git","ssh_url":"git@github.com:MikhailSkiyAtWork/Lab_55.git","clone_url":"https://github.com/MikhailSkiyAtWork/Lab_55.git","svn_url":"https://github.com/MikhailSkiyAtWork/Lab_55","homepage":null,"size":624,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"MikhailSkiyAtWork:master","ref":"master","sha":"46effe4e8b00cb0ce96355b100fa632a1dbfb5d0","user":{"login":"MikhailSkiyAtWork","id":12441949,"avatar_url":"https://avatars.githubusercontent.com/u/12441949?v=3","gravatar_id":"","url":"https://api.github.com/users/MikhailSkiyAtWork","html_url":"https://github.com/MikhailSkiyAtWork","followers_url":"https://api.github.com/users/MikhailSkiyAtWork/followers","following_url":"https://api.github.com/users/MikhailSkiyAtWork/following{/other_user}","gists_url":"https://api.github.com/users/MikhailSkiyAtWork/gists{/gist_id}","starred_url":"https://api.github.com/users/MikhailSkiyAtWork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikhailSkiyAtWork/subscriptions","organizations_url":"https://api.github.com/users/MikhailSkiyAtWork/orgs","repos_url":"https://api.github.com/users/MikhailSkiyAtWork/repos","events_url":"https://api.github.com/users/MikhailSkiyAtWork/events{/privacy}","received_events_url":"https://api.github.com/users/MikhailSkiyAtWork/received_events","type":"User","site_admin":false},"repo":{"id":36225075,"name":"Lab_55","full_name":"MikhailSkiyAtWork/Lab_55","owner":{"login":"MikhailSkiyAtWork","id":12441949,"avatar_url":"https://avatars.githubusercontent.com/u/12441949?v=3","gravatar_id":"","url":"https://api.github.com/users/MikhailSkiyAtWork","html_url":"https://github.com/MikhailSkiyAtWork","followers_url":"https://api.github.com/users/MikhailSkiyAtWork/followers","following_url":"https://api.github.com/users/MikhailSkiyAtWork/following{/other_user}","gists_url":"https://api.github.com/users/MikhailSkiyAtWork/gists{/gist_id}","starred_url":"https://api.github.com/users/MikhailSkiyAtWork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikhailSkiyAtWork/subscriptions","organizations_url":"https://api.github.com/users/MikhailSkiyAtWork/orgs","repos_url":"https://api.github.com/users/MikhailSkiyAtWork/repos","events_url":"https://api.github.com/users/MikhailSkiyAtWork/events{/privacy}","received_events_url":"https://api.github.com/users/MikhailSkiyAtWork/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MikhailSkiyAtWork/Lab_55","description":"Application which allow user keep list of books, with edit and delete functions  http://redmine.weezlabs.com:8100/redmine/boards/8/topics/55","fork":false,"url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55","forks_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/forks","keys_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/teams","hooks_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/hooks","issue_events_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues/events{/number}","events_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/events","assignees_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/assignees{/user}","branches_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/branches{/branch}","tags_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/tags","blobs_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/refs{/sha}","trees_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/statuses/{sha}","languages_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/languages","stargazers_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/stargazers","contributors_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/contributors","subscribers_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/subscribers","subscription_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/subscription","commits_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/commits{/sha}","git_commits_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/git/commits{/sha}","comments_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/comments{/number}","issue_comment_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues/comments{/number}","contents_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/contents/{+path}","compare_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/merges","archive_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/downloads","issues_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues{/number}","pulls_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls{/number}","milestones_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/milestones{/number}","notifications_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/labels{/name}","releases_url":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/releases{/id}","created_at":"2015-05-25T10:32:23Z","updated_at":"2015-05-25T10:32:23Z","pushed_at":"2015-06-09T14:19:23Z","git_url":"git://github.com/MikhailSkiyAtWork/Lab_55.git","ssh_url":"git@github.com:MikhailSkiyAtWork/Lab_55.git","clone_url":"https://github.com/MikhailSkiyAtWork/Lab_55.git","svn_url":"https://github.com/MikhailSkiyAtWork/Lab_55","homepage":null,"size":624,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/1"},"html":{"href":"https://github.com/MikhailSkiyAtWork/Lab_55/pull/1"},"issue":{"href":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues/1"},"comments":{"href":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/MikhailSkiyAtWork/Lab_55/statuses/2e1f936a77bc592a88e29bcfeb8856df6e0c21f2"}}}}