Comments (5)
Hi @palVikas9
can you share the paging module definition?
please expand on the scenario, what's the current behavior and your expected behavior
is it a bug or an API functionality addition - to be able to call the load page without scrolling?
Thanks
from oneadapter.
Hi @idanatz ,
Yeah, sure.
inner class PagingModuleImpl : PagingModule() { init { config { layoutResource = R.layout.layout_progress_bar visibleThreshold = 4 } onLoadMore { currentPage -> profileDetailViewModel.postPage = currentPage + 1 profileDetailViewModel.callGetUserPostAPI(selfUserId, profileDetailViewModel.postPage) } } }
It is a functionality that when I get the response from API call for page 1, then API call for the page 2 should be trigged by PagingModule of oneAdapter without scrolling of the recyclerview.
Right now, is there any existing way that we can do that ?`
from oneadapter.
You are right, it's a bug and will be fixed in the next version - the onLoad will be triggered automatically when the conditions for paging are met after each data submission.
Regarding a quick-fix,
I haven't found a way around it... since the RecyclerView is not scrollable in this usecase, the scroll listener is not being invoked in any programmatically way I tried.
But, you can try and trigger your logic manually when detecting this usecase by using the getVisibleItems() and verifing it's the same number as Items you got in your API response.
It's not the cleanest way and you won't get the currentPage param but from your description its safe to assume its happening in the first API response so it will be 1.
from oneadapter.
Thanks.
For the time being, I have added a workaround in my code.
If the condition for next api call is satisfied then it is called and in the loadmore, I call currentPage+2 instead of 1.
It is a lovely library to work with. Have made my life so much easier.
from oneadapter.
Thanks for the kind words!
a fix has been released with v2.1.1, check it out.
from oneadapter.
Related Issues (20)
- Support for StateRestorationPolicy HOT 4
- Scroll to first added element HOT 7
- Random crash in onCreate HOT 3
- use setItem, but the onBind method not be invoke HOT 12
- Question:Paging with Room Datasource HOT 2
- IndexOutOfBoundsException: Inconsistency detected HOT 2
- CalledFromWrongThreadException in 2.1.0 HOT 9
- Add drag & drop support
- Multiple ViewType HOT 9
- Preselected Items HOT 1
- Load more animation when submit empty list HOT 1
- It not a function to get the data from adapter. HOT 1
- Retry button HOT 2
- View Binding with Kotlin 1.6.0 not working HOT 5
- How do i filter the list ?
- You can't use interface as M : Diffable in intem module HOT 1
- select all
- Dynamic layout manager
- Multiple Selection Cancellation Issue When Item Is Not Visible
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oneadapter.