-
Notifications
You must be signed in to change notification settings - Fork 271
Step 2 - Migrate to Paging 3.0 #47
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
Conversation
app/src/main/java/com/example/android/codelabs/paging/data/GithubPagingSource.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/example/android/codelabs/paging/ui/ReposAdapter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/example/android/codelabs/paging/ui/ReposAdapter.kt
Outdated
Show resolved
Hide resolved
| ) | ||
| adapter.addLoadStateListener { loadType, loadState -> | ||
| Log.d("SearchRepositoriesActivity", "adapter load: type = $loadType state = $loadState") | ||
| if (loadType == LoadType.REFRESH) { |
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.
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
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.
I actually wanted to happen always.
In the initial code, whenever there is an error we show the toast.
96f10ce to
740b32c
Compare
4bedb47 to
e018324
Compare
cfe2e49 to
78ec14e
Compare
…button for new queries
…oving unnecessary code from ReposAdapter
dd95eec to
93a42bf
Compare
| } else { | ||
| binding.emptyList.visibility = View.GONE | ||
| binding.list.visibility = View.VISIBLE | ||
| private fun search(query: String) { |
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.
Would be nice if we could represent this as a Flow<String> and then we could just do collectLatest / mapLatest on it !!
No description provided.