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

add support for get currently being displayed data #317

Merged
merged 4 commits into from
Oct 16, 2017

Conversation

pcqpcq
Copy link
Contributor

@pcqpcq pcqpcq commented Oct 14, 2017

see also: #314 .

with two methods:

public List<T> getCurrentList();

public PagedList<T> getPagedList()

* @return The pagedList currently being displayed.
*/
public PagedList<T> getPagedList() {
return this.pagedList == null ? (PagedList<T>) Collections.<T>emptyList() : this.pagedList;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't just cast the list to a PagedList, that will crash. I think we need to return null in this case, it isn't possible to create our own empty paged list

Copy link
Contributor Author

@pcqpcq pcqpcq Oct 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, null check here is unnecessary.

Copy link
Contributor

@elihart elihart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments, thanks for putting this up!

@@ -177,6 +177,24 @@ public void setList(@Nullable PagedList<T> list) {
updatePagedListSnapshot();
}

/**
* Returns the list currently being displayed by the EpoxyController.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you note that this is either a snapshot of the paged list or the list set with setList?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! you are right, this is inaccurate

* @return The list currently being displayed.
*/
public List<T> getCurrentList() {
return this.list == null ? Collections.<T>emptyList() : this.list;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list is never null, you can return it directly

Copy link
Contributor Author

@pcqpcq pcqpcq Oct 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Null check here is unnecessary too.

@pcqpcq
Copy link
Contributor Author

pcqpcq commented Oct 16, 2017

It's my negligence, I've update the code.

Sorry for reply until 2 days later.

sorry for this again
@elihart
Copy link
Contributor

elihart commented Oct 16, 2017

Great, thanks!

@elihart elihart merged commit da02c19 into airbnb:master Oct 16, 2017
@pcqpcq pcqpcq deleted the patch-1 branch October 17, 2017 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants