Skip to content
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

Merged

Conversation

niccorder
Copy link
Owner

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

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
@niccorder niccorder added the enhancement New feature or request label Jul 2, 2018
@niccorder niccorder self-assigned this Jul 2, 2018
@niccorder niccorder added this to In progress in Facebook News – MVP via automation Jul 2, 2018
@NonNull
@Override
public List<Category> getAllCategories() {
return Arrays.asList(
BUSINESS,
TECHNOLOGY,
POLITICS,
SPORTS
SPORTS,
WORLD
Copy link
Owner Author

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() {
Copy link
Owner Author

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!

@niccorder niccorder merged commit 9be3e9c into niccorder/feature/refresh-articles Jul 2, 2018
Facebook News – MVP automation moved this from In progress to Done Jul 2, 2018
@niccorder niccorder deleted the niccorder/ptr-implementation branch July 2, 2018 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant