Skip to content

Conversation

@florina-muntenescu
Copy link
Collaborator

No description provided.

)
adapter.addLoadStateListener { loadType, loadState ->
Log.d("SearchRepositoriesActivity", "adapter load: type = $loadType state = $loadState")
if (loadType == LoadType.REFRESH) {

Choose a reason for hiding this comment

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

I think it may be clearer if you put the entire body of this behind a "LoadType == Refresh" check.

That also makes the Toast only happen when it's a refresh error, instead of all

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually wanted to happen always.
In the initial code, whenever there is an error we show the toast.

@florina-muntenescu florina-muntenescu force-pushed the step1_mergeadapter branch 2 times, most recently from 96f10ce to 740b32c Compare March 16, 2020 14:54
} else {
binding.emptyList.visibility = View.GONE
binding.list.visibility = View.VISIBLE
private fun search(query: String) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be nice if we could represent this as a Flow<String> and then we could just do collectLatest / mapLatest on it !!

@florina-muntenescu florina-muntenescu deleted the step2_paging3.0 branch June 10, 2020 17:51
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.

3 participants