-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement asynchronous PTR functionality. #9
Implement asynchronous PTR functionality. #9
Conversation
This allows users to be able to PTR in the application to see if there has been any new data since they have last checked the news. This currently has the data layer mocked out, and mimics a network call by delaying a response for 200L. ISSUE #1
@NonNull | ||
@Override | ||
public List<Category> getAllCategories() { | ||
return Arrays.asList( | ||
BUSINESS, | ||
TECHNOLOGY, | ||
POLITICS, | ||
SPORTS | ||
SPORTS, | ||
WORLD |
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.
Thanks for the bug-fix 💯 Next time, lets keep our PR's as to the point as possible to we can better track what changes are being made. For this PR it's fine though!
Thanks again 😄
// DiffUtil is a utility provided by the android support libraries to calculate the | ||
// diff between two lists for us. Thankfully, it also works seamlessly with a recyclerview | ||
// adapter as you will see below. | ||
final DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new DiffUtil.Callback() { |
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 should be fine for the MVP, but we will need to create a task to calculate the Diff on the background thread. If we calculate the diff on the main thread, it will definitely lock up the UI for larger lists.
Looks good for this PR though!
This allows users to be able to PTR in the application to see if there
has been any new data since they have last checked the news. This
currently has the data layer mocked out, and mimics a network call by
delaying a response for 200L.
ISSUE #1