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

Fix eternal loading progress #719 #697 #814

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

QArtur99
Copy link
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Fix eternal refreshing and empty state in HomeActivity
Fix eternal refreshing in Search
Feat placeholder when data are not available same like for no filters

💡 Motivation and Context

When only "Product Hunt" filter was selected and no data was available from the response, the progress was showing infinitely, also function onLoadMore in InfiniteScrollListener was refreshing infinitely when data was not available.
#719

if searched data was not available, LiveData didn't trigger because data loading function didn't assign an empty list to searchResult
#697

💚 How did you test it?

Manually

📝 Checklist

  • I ran ./gradlew spotlessApply before submitting the PR
  • I reviewed submitted code
  • I added tests to verify changes
  • All tests passing

🔮 Next steps

📸 Screenshots / GIFs

719

Edit

image

@keyboardsurfer
Copy link
Collaborator

Thanks for opening this.
Please make sure the conflicts are resolved as well.

}
}

private fun setNoFiltersEmptyTextVisibility(visibility: Int) {
noFiltersEmptyText.visibility = visibility
private fun setEmptyStateVisibility(progressBar: Int, noData: Int, noFilter: Int) {

Choose a reason for hiding this comment

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

@QArtur99 Please use default value for params. this will avoid setEmptyStateVisibility(View.GONE, View.GONE, View.GONE) it will become a simple call setEmptyStateVisibility() and as most of the params value is View.GONE we will not have to pass that again.
Thanks

loading.visibility = View.VISIBLE
setNoFiltersEmptyTextVisibility(View.GONE)
if (filtersAdapter.getEnabledFilterCount() > 0) {
setEmptyStateVisibility(View.GONE, View.VISIBLE, View.GONE)

Choose a reason for hiding this comment

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

@QArtur99 Please consider creating extension function for view i.e fun View.visible() = visibility == View.VISIBLE and fun View.gone() = visibility == View.GONE this will be more readable.
Thanks

@codingjeremy codingjeremy changed the base branch from master to main September 29, 2020 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants