-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Feature - Realtime Database Pagination #1603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature - Realtime Database Pagination #1603
Conversation
Implementation of Paging for Firebase Database
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a first round of comments. In general this looks pretty good but I think we should make the logic almost exactly identical to the Firestore version, rather than having smaller differences througout.
See if you can go through each file, compare it to the Firestore version, and make them as similar as posisble.
app/src/main/java/com/firebase/uidemo/database/realtime/FirebaseDbPagingActivity.java
Show resolved
Hide resolved
app/src/main/java/com/firebase/uidemo/database/realtime/FirebaseDbPagingActivity.java
Outdated
Show resolved
Hide resolved
app/src/main/java/com/firebase/uidemo/database/realtime/FirebaseDbPagingActivity.java
Outdated
Show resolved
Hide resolved
* managing our own thread pool or requiring the user to pass us an executor. | ||
*/ | ||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
public class FirebaseDataSource<T> extends PageKeyedDataSource<String, T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the Firestore implementation, we have the DataSource deal only in snapshots rather than putting in Class<T>
. I think it's simpler that way and also I would like for this code to be as similar to the Firestore code as possible to enable future maintenance.
database/src/main/java/com/firebase/ui/database/paging/FirebaseDataSource.java
Outdated
Show resolved
Hide resolved
database/src/main/java/com/firebase/ui/database/paging/FirebaseDataSource.java
Outdated
Show resolved
Hide resolved
database/src/main/java/com/firebase/ui/database/paging/FirebaseDataSource.java
Outdated
Show resolved
Hide resolved
database/src/main/java/com/firebase/ui/database/paging/FirebaseDataSource.java
Outdated
Show resolved
Hide resolved
Thank you @samtstern |
Implemented exactly as Firestore version
@samtstern I have updated code as you suggested. |
@PatilShreyas on first glance this looks great! Thank you for such a well-formed PR. I will hopefully have time to do a final thorough review later today. |
Thank You! |
Fixed some code and minor changes.
…se#1601 Added functionalities : 1. retry() : Retry the loading of data in RecyclerView after failure. 2. refresh() : Reload data in RecyclerView by clearing recent loaded data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks 99% good! Some really small comments and then I am happy to merge this.
database/src/main/java/com/firebase/ui/database/paging/DatabasePagingOptions.java
Outdated
Show resolved
Hide resolved
database/src/main/java/com/firebase/ui/database/paging/FirebaseDataSource.java
Outdated
Show resolved
Hide resolved
database/src/main/java/com/firebase/ui/database/paging/FirebaseDataSource.java
Show resolved
Hide resolved
@samtstern I have fixed the code as your suggestions. |
@PatilShreyas thanks for this! Here's my plan:
|
@samtstern Okay! |
Here, I have implemented FirebaseRecyclerPagingAdapter that supports Pagination of Firebase Database with RecyclerView as issue #1601