{"action":"created","issue":{"url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/224","repository_url":"https://api.github.com/repos/mikepenz/FastAdapter","labels_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/224/labels{/name}","comments_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/224/comments","events_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/224/events","html_url":"https://github.com/mikepenz/FastAdapter/pull/224","id":179492128,"number":224,"title":"new EndlessRecyclerOnTopScrollListener","user":{"login":"meNESS","id":7955356,"avatar_url":"https://avatars.githubusercontent.com/u/7955356?v=3","gravatar_id":"","url":"https://api.github.com/users/meNESS","html_url":"https://github.com/meNESS","followers_url":"https://api.github.com/users/meNESS/followers","following_url":"https://api.github.com/users/meNESS/following{/other_user}","gists_url":"https://api.github.com/users/meNESS/gists{/gist_id}","starred_url":"https://api.github.com/users/meNESS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meNESS/subscriptions","organizations_url":"https://api.github.com/users/meNESS/orgs","repos_url":"https://api.github.com/users/meNESS/repos","events_url":"https://api.github.com/users/meNESS/events{/privacy}","received_events_url":"https://api.github.com/users/meNESS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-27T13:24:57Z","updated_at":"2016-09-27T15:42:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mikepenz/FastAdapter/pulls/224","html_url":"https://github.com/mikepenz/FastAdapter/pull/224","diff_url":"https://github.com/mikepenz/FastAdapter/pull/224.diff","patch_url":"https://github.com/mikepenz/FastAdapter/pull/224.patch"},"body":"Hi Mike,\r\n\r\nWith this `EndlessRecyclerOnTopScrollListener` users may load more data while scrolling top on their `RecyclerView`s.\r\n\r\n**Features**\r\n- Automatically finding good visible threshold\r\n- `onLoadMore()` when need to load more data\r\n- `onNoMore()` when there's no data to be loaded, user may wants to send a request to the server for asking more data (not required for loading data from local DB)\r\n\r\n**Sample**\r\n```java\r\nRecyclerView rv = (RecyclerView) findViewById(R.id.rv);\r\nLinearLayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());\r\nfinal FastItemAdapter<SampleItem> adapter = new FastItemAdapter<>();\r\n\r\nrv.setHasFixedSize(true);\r\nlayoutManager.setStackFromEnd(true);\r\nrv.setLayoutManager(layoutManager);\r\nrv.setAdapter(adapter);\r\n\r\nfor (int i = 0; i < 100; i++) {\r\n\tadapter.add(new SampleItem().setName(\"default loaded data > \" + i));\r\n}\r\n\r\nrv.addOnScrollListener(new EndlessRecyclerOnTopScrollListener(adapter, 190) {\r\n\t@Override\r\n\tpublic void onLoadMore(final int page) {\r\n\t\tif (page == 10) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tnew Handler().postDelayed(new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\tfor (int i = 0; i < 10; i++) {\r\n\t\t\t\t\t// add new data to position 0\r\n\t\t\t\t\tadapter.add(0, new SampleItem().setName(\"loaded from local, page \" + page + \" > \" + i));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}, 1000);\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void onNoMore() {\r\n\t\tLog.i(SampleActivity.class.getSimpleName(), \"load data from server\");\r\n\t}\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/comments/249905172","html_url":"https://github.com/mikepenz/FastAdapter/pull/224#issuecomment-249905172","issue_url":"https://api.github.com/repos/mikepenz/FastAdapter/issues/224","id":249905172,"user":{"login":"FabianTerhorst","id":3597376,"avatar_url":"https://avatars.githubusercontent.com/u/3597376?v=3","gravatar_id":"","url":"https://api.github.com/users/FabianTerhorst","html_url":"https://github.com/FabianTerhorst","followers_url":"https://api.github.com/users/FabianTerhorst/followers","following_url":"https://api.github.com/users/FabianTerhorst/following{/other_user}","gists_url":"https://api.github.com/users/FabianTerhorst/gists{/gist_id}","starred_url":"https://api.github.com/users/FabianTerhorst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FabianTerhorst/subscriptions","organizations_url":"https://api.github.com/users/FabianTerhorst/orgs","repos_url":"https://api.github.com/users/FabianTerhorst/repos","events_url":"https://api.github.com/users/FabianTerhorst/events{/privacy}","received_events_url":"https://api.github.com/users/FabianTerhorst/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T15:42:55Z","updated_at":"2016-09-27T15:42:55Z","body":"It should be possible to use this without using the FastItemAdapter."}}
{"actor":{"display_login":"FabianTerhorst"}}