Skip to content

Fix eternal loading progress #719 #697 - #814

Open
QArtur99 wants to merge 6 commits into
nickbutcher:mainfrom
QArtur99:master
Open

Fix eternal loading progress #719 #697#814
QArtur99 wants to merge 6 commits into
nickbutcher:mainfrom
QArtur99:master

Conversation

@QArtur99

Copy link
Copy Markdown
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
Copy Markdown
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) {

Copy link
Copy Markdown

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)

Copy link
Copy Markdown

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