{"action":"created","comment":{"url":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/comments/67483836","id":67483836,"diff_hunk":"@@ -3,47 +3,121 @@\n import net.boondockradio.grepos.R;\n import net.boondockradio.grepos.dto.Repository;\n \n+import android.support.v7.widget.LinearLayoutManager;\n import android.support.v7.widget.RecyclerView;\n import android.view.LayoutInflater;\n import android.view.View;\n import android.view.ViewGroup;\n+import android.widget.ProgressBar;\n import android.widget.TextView;\n \n import java.util.List;\n \n-public class RepositoryAdpter extends RecyclerView.Adapter<RepositoryAdpter.ItemViewHolder> {\n+public class RepositoryAdpter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {\n+    private final int VIEW_ITEM = 1;\n+    private final int VIEW_PROGRESS = 0;\n+\n+    private final int LOAD_MORE_THRESHOLD = 2;\n \n     private List<Repository> mRepositoryItems;\n+    private RecyclerView mRecyclerView;\n+\n+    private OnLoadMoreListener onLoadMoreListener;\n+    private int total = 0;\n+    private int last = 0;\n+    private boolean isLoading = false;\n \n-    public RepositoryAdpter(List<Repository> repositoryItems) {\n+    public RepositoryAdpter(List<Repository> repositoryItems, RecyclerView recyclerView) {\n         mRepositoryItems = repositoryItems;\n+        mRecyclerView = recyclerView;\n+\n+        final LinearLayoutManager layoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager();\n+        mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {\n+            @Override\n+            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {\n+                total = layoutManager.getItemCount();\n+                last = layoutManager.findLastVisibleItemPosition();\n+\n+                if (dy < 0) {\n+                    return;\n+                }\n+\n+                if (!isLoading && last + LOAD_MORE_THRESHOLD >= total) {\n+                    onLoadMoreListener.onLoadMore();","path":"grepos/app/src/main/java/net/boondockradio/grepos/adapter/RepositoryAdpter.java","position":46,"original_position":46,"commit_id":"296c9d01b1c6b6716d7ae9e813270db727a2ce92","original_commit_id":"296c9d01b1c6b6716d7ae9e813270db727a2ce92","user":{"login":"eoinfogarty","id":1642378,"avatar_url":"https://avatars.githubusercontent.com/u/1642378?v=3","gravatar_id":"","url":"https://api.github.com/users/eoinfogarty","html_url":"https://github.com/eoinfogarty","followers_url":"https://api.github.com/users/eoinfogarty/followers","following_url":"https://api.github.com/users/eoinfogarty/following{/other_user}","gists_url":"https://api.github.com/users/eoinfogarty/gists{/gist_id}","starred_url":"https://api.github.com/users/eoinfogarty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eoinfogarty/subscriptions","organizations_url":"https://api.github.com/users/eoinfogarty/orgs","repos_url":"https://api.github.com/users/eoinfogarty/repos","events_url":"https://api.github.com/users/eoinfogarty/events{/privacy}","received_events_url":"https://api.github.com/users/eoinfogarty/received_events","type":"User","site_admin":false},"body":"Also having the scroll listener in the activity means we dont need a callback","created_at":"2016-06-17T09:34:20Z","updated_at":"2016-06-17T09:34:20Z","html_url":"https://github.com/nbhd/welcome-to-android/pull/16#discussion_r67483836","pull_request_url":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/comments/67483836"},"html":{"href":"https://github.com/nbhd/welcome-to-android/pull/16#discussion_r67483836"},"pull_request":{"href":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/16","id":74211340,"html_url":"https://github.com/nbhd/welcome-to-android/pull/16","diff_url":"https://github.com/nbhd/welcome-to-android/pull/16.diff","patch_url":"https://github.com/nbhd/welcome-to-android/pull/16.patch","issue_url":"https://api.github.com/repos/nbhd/welcome-to-android/issues/16","number":16,"state":"open","locked":false,"title":"Retrofit v2 (infinite scroll)","user":{"login":"nbhd","id":1421602,"avatar_url":"https://avatars.githubusercontent.com/u/1421602?v=3","gravatar_id":"","url":"https://api.github.com/users/nbhd","html_url":"https://github.com/nbhd","followers_url":"https://api.github.com/users/nbhd/followers","following_url":"https://api.github.com/users/nbhd/following{/other_user}","gists_url":"https://api.github.com/users/nbhd/gists{/gist_id}","starred_url":"https://api.github.com/users/nbhd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbhd/subscriptions","organizations_url":"https://api.github.com/users/nbhd/orgs","repos_url":"https://api.github.com/users/nbhd/repos","events_url":"https://api.github.com/users/nbhd/events{/privacy}","received_events_url":"https://api.github.com/users/nbhd/received_events","type":"User","site_admin":false},"body":"https://github.com/nbhd/welcome-to-android/issues/15\r\n\r\n- [ ] @shaunkawano \r\n- [ ] @eoinfogarty \r\n- [ ] @shaunkawano ","created_at":"2016-06-17T09:12:59Z","updated_at":"2016-06-17T09:34:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae4c2f7f9b88308e7458dae3a5dc1d9418769c3a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/16/commits","review_comments_url":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/16/comments","review_comment_url":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nbhd/welcome-to-android/issues/16/comments","statuses_url":"https://api.github.com/repos/nbhd/welcome-to-android/statuses/296c9d01b1c6b6716d7ae9e813270db727a2ce92","head":{"label":"nbhd:retrofit-v2","ref":"retrofit-v2","sha":"296c9d01b1c6b6716d7ae9e813270db727a2ce92","user":{"login":"nbhd","id":1421602,"avatar_url":"https://avatars.githubusercontent.com/u/1421602?v=3","gravatar_id":"","url":"https://api.github.com/users/nbhd","html_url":"https://github.com/nbhd","followers_url":"https://api.github.com/users/nbhd/followers","following_url":"https://api.github.com/users/nbhd/following{/other_user}","gists_url":"https://api.github.com/users/nbhd/gists{/gist_id}","starred_url":"https://api.github.com/users/nbhd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbhd/subscriptions","organizations_url":"https://api.github.com/users/nbhd/orgs","repos_url":"https://api.github.com/users/nbhd/repos","events_url":"https://api.github.com/users/nbhd/events{/privacy}","received_events_url":"https://api.github.com/users/nbhd/received_events","type":"User","site_admin":false},"repo":{"id":60766066,"name":"welcome-to-android","full_name":"nbhd/welcome-to-android","owner":{"login":"nbhd","id":1421602,"avatar_url":"https://avatars.githubusercontent.com/u/1421602?v=3","gravatar_id":"","url":"https://api.github.com/users/nbhd","html_url":"https://github.com/nbhd","followers_url":"https://api.github.com/users/nbhd/followers","following_url":"https://api.github.com/users/nbhd/following{/other_user}","gists_url":"https://api.github.com/users/nbhd/gists{/gist_id}","starred_url":"https://api.github.com/users/nbhd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbhd/subscriptions","organizations_url":"https://api.github.com/users/nbhd/orgs","repos_url":"https://api.github.com/users/nbhd/repos","events_url":"https://api.github.com/users/nbhd/events{/privacy}","received_events_url":"https://api.github.com/users/nbhd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nbhd/welcome-to-android","description":"","fork":false,"url":"https://api.github.com/repos/nbhd/welcome-to-android","forks_url":"https://api.github.com/repos/nbhd/welcome-to-android/forks","keys_url":"https://api.github.com/repos/nbhd/welcome-to-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nbhd/welcome-to-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nbhd/welcome-to-android/teams","hooks_url":"https://api.github.com/repos/nbhd/welcome-to-android/hooks","issue_events_url":"https://api.github.com/repos/nbhd/welcome-to-android/issues/events{/number}","events_url":"https://api.github.com/repos/nbhd/welcome-to-android/events","assignees_url":"https://api.github.com/repos/nbhd/welcome-to-android/assignees{/user}","branches_url":"https://api.github.com/repos/nbhd/welcome-to-android/branches{/branch}","tags_url":"https://api.github.com/repos/nbhd/welcome-to-android/tags","blobs_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nbhd/welcome-to-android/statuses/{sha}","languages_url":"https://api.github.com/repos/nbhd/welcome-to-android/languages","stargazers_url":"https://api.github.com/repos/nbhd/welcome-to-android/stargazers","contributors_url":"https://api.github.com/repos/nbhd/welcome-to-android/contributors","subscribers_url":"https://api.github.com/repos/nbhd/welcome-to-android/subscribers","subscription_url":"https://api.github.com/repos/nbhd/welcome-to-android/subscription","commits_url":"https://api.github.com/repos/nbhd/welcome-to-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/nbhd/welcome-to-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/nbhd/welcome-to-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/nbhd/welcome-to-android/contents/{+path}","compare_url":"https://api.github.com/repos/nbhd/welcome-to-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nbhd/welcome-to-android/merges","archive_url":"https://api.github.com/repos/nbhd/welcome-to-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nbhd/welcome-to-android/downloads","issues_url":"https://api.github.com/repos/nbhd/welcome-to-android/issues{/number}","pulls_url":"https://api.github.com/repos/nbhd/welcome-to-android/pulls{/number}","milestones_url":"https://api.github.com/repos/nbhd/welcome-to-android/milestones{/number}","notifications_url":"https://api.github.com/repos/nbhd/welcome-to-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nbhd/welcome-to-android/labels{/name}","releases_url":"https://api.github.com/repos/nbhd/welcome-to-android/releases{/id}","deployments_url":"https://api.github.com/repos/nbhd/welcome-to-android/deployments","created_at":"2016-06-09T10:19:20Z","updated_at":"2016-06-13T10:47:42Z","pushed_at":"2016-06-17T09:12:59Z","git_url":"git://github.com/nbhd/welcome-to-android.git","ssh_url":"git@github.com:nbhd/welcome-to-android.git","clone_url":"https://github.com/nbhd/welcome-to-android.git","svn_url":"https://github.com/nbhd/welcome-to-android","homepage":null,"size":1055,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":5,"default_branch":"master"}},"base":{"label":"nbhd:master","ref":"master","sha":"b12c909077460379835e201adf9db0109417d830","user":{"login":"nbhd","id":1421602,"avatar_url":"https://avatars.githubusercontent.com/u/1421602?v=3","gravatar_id":"","url":"https://api.github.com/users/nbhd","html_url":"https://github.com/nbhd","followers_url":"https://api.github.com/users/nbhd/followers","following_url":"https://api.github.com/users/nbhd/following{/other_user}","gists_url":"https://api.github.com/users/nbhd/gists{/gist_id}","starred_url":"https://api.github.com/users/nbhd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbhd/subscriptions","organizations_url":"https://api.github.com/users/nbhd/orgs","repos_url":"https://api.github.com/users/nbhd/repos","events_url":"https://api.github.com/users/nbhd/events{/privacy}","received_events_url":"https://api.github.com/users/nbhd/received_events","type":"User","site_admin":false},"repo":{"id":60766066,"name":"welcome-to-android","full_name":"nbhd/welcome-to-android","owner":{"login":"nbhd","id":1421602,"avatar_url":"https://avatars.githubusercontent.com/u/1421602?v=3","gravatar_id":"","url":"https://api.github.com/users/nbhd","html_url":"https://github.com/nbhd","followers_url":"https://api.github.com/users/nbhd/followers","following_url":"https://api.github.com/users/nbhd/following{/other_user}","gists_url":"https://api.github.com/users/nbhd/gists{/gist_id}","starred_url":"https://api.github.com/users/nbhd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbhd/subscriptions","organizations_url":"https://api.github.com/users/nbhd/orgs","repos_url":"https://api.github.com/users/nbhd/repos","events_url":"https://api.github.com/users/nbhd/events{/privacy}","received_events_url":"https://api.github.com/users/nbhd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nbhd/welcome-to-android","description":"","fork":false,"url":"https://api.github.com/repos/nbhd/welcome-to-android","forks_url":"https://api.github.com/repos/nbhd/welcome-to-android/forks","keys_url":"https://api.github.com/repos/nbhd/welcome-to-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nbhd/welcome-to-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nbhd/welcome-to-android/teams","hooks_url":"https://api.github.com/repos/nbhd/welcome-to-android/hooks","issue_events_url":"https://api.github.com/repos/nbhd/welcome-to-android/issues/events{/number}","events_url":"https://api.github.com/repos/nbhd/welcome-to-android/events","assignees_url":"https://api.github.com/repos/nbhd/welcome-to-android/assignees{/user}","branches_url":"https://api.github.com/repos/nbhd/welcome-to-android/branches{/branch}","tags_url":"https://api.github.com/repos/nbhd/welcome-to-android/tags","blobs_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nbhd/welcome-to-android/statuses/{sha}","languages_url":"https://api.github.com/repos/nbhd/welcome-to-android/languages","stargazers_url":"https://api.github.com/repos/nbhd/welcome-to-android/stargazers","contributors_url":"https://api.github.com/repos/nbhd/welcome-to-android/contributors","subscribers_url":"https://api.github.com/repos/nbhd/welcome-to-android/subscribers","subscription_url":"https://api.github.com/repos/nbhd/welcome-to-android/subscription","commits_url":"https://api.github.com/repos/nbhd/welcome-to-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/nbhd/welcome-to-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/nbhd/welcome-to-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/nbhd/welcome-to-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/nbhd/welcome-to-android/contents/{+path}","compare_url":"https://api.github.com/repos/nbhd/welcome-to-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nbhd/welcome-to-android/merges","archive_url":"https://api.github.com/repos/nbhd/welcome-to-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nbhd/welcome-to-android/downloads","issues_url":"https://api.github.com/repos/nbhd/welcome-to-android/issues{/number}","pulls_url":"https://api.github.com/repos/nbhd/welcome-to-android/pulls{/number}","milestones_url":"https://api.github.com/repos/nbhd/welcome-to-android/milestones{/number}","notifications_url":"https://api.github.com/repos/nbhd/welcome-to-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nbhd/welcome-to-android/labels{/name}","releases_url":"https://api.github.com/repos/nbhd/welcome-to-android/releases{/id}","deployments_url":"https://api.github.com/repos/nbhd/welcome-to-android/deployments","created_at":"2016-06-09T10:19:20Z","updated_at":"2016-06-13T10:47:42Z","pushed_at":"2016-06-17T09:12:59Z","git_url":"git://github.com/nbhd/welcome-to-android.git","ssh_url":"git@github.com:nbhd/welcome-to-android.git","clone_url":"https://github.com/nbhd/welcome-to-android.git","svn_url":"https://github.com/nbhd/welcome-to-android","homepage":null,"size":1055,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/16"},"html":{"href":"https://github.com/nbhd/welcome-to-android/pull/16"},"issue":{"href":"https://api.github.com/repos/nbhd/welcome-to-android/issues/16"},"comments":{"href":"https://api.github.com/repos/nbhd/welcome-to-android/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nbhd/welcome-to-android/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/nbhd/welcome-to-android/statuses/296c9d01b1c6b6716d7ae9e813270db727a2ce92"}}}}
{"actor":{"display_login":"eoinfogarty"}}