-
Notifications
You must be signed in to change notification settings - Fork 733
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
Conversation
* @return The pagedList currently being displayed. | ||
*/ | ||
public PagedList<T> getPagedList() { | ||
return this.pagedList == null ? (PagedList<T>) Collections.<T>emptyList() : this.pagedList; |
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.
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
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.
Yes, null check here is unnecessary.
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.
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. |
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.
can you note that this is either a snapshot of the paged list or the list set with setList
?
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.
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; |
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.
list
is never null, you can return it directly
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.
Null check here is unnecessary too.
It's my negligence, I've update the code. Sorry for reply until 2 days later. |
sorry for this again
Great, thanks! |
see also: #314 .
with two methods: