Commit 83fc98a8 authored by Nihar Thakkar's avatar Nihar Thakkar
Browse files

Check for more apps only if full 1st page is loaded

parent 2862c4ae
......@@ -23,7 +23,6 @@ import io.eelo.appinstaller.applicationmanager.ApplicationManagerServiceConnecti
import io.eelo.appinstaller.categories.category.viewmodel.CategoryViewModel
import io.eelo.appinstaller.categories.model.Category
import io.eelo.appinstaller.common.ApplicationListAdapter
import io.eelo.appinstaller.utils.Common
import io.eelo.appinstaller.utils.Constants
import io.eelo.appinstaller.utils.Constants.CATEGORY_KEY
import kotlinx.android.synthetic.main.activity_category.*
......@@ -102,7 +101,8 @@ class CategoryActivity : AppCompatActivity(), ApplicationManagerServiceConnectio
// Bind to the screen error
categoryViewModel.getScreenError().observe(this, Observer {
if (it != null) {
if (!isLoadingMoreApplications) {
if (!isLoadingMoreApplications &&
applicationList.size >= Constants.RESULTS_PER_PAGE) {
errorDescription.text = getString(it.description)
errorContainer.visibility = View.VISIBLE
progressBar.visibility = View.GONE
......
......@@ -25,7 +25,7 @@ import io.eelo.appinstaller.application.model.Application
import io.eelo.appinstaller.applicationmanager.ApplicationManager
import io.eelo.appinstaller.common.ApplicationListAdapter
import io.eelo.appinstaller.search.viewModel.SearchViewModel
import io.eelo.appinstaller.utils.Common
import io.eelo.appinstaller.utils.Constants
import io.eelo.appinstaller.utils.Constants.SUGGESTION_KEY
class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.OnSuggestionListener {
......@@ -90,7 +90,8 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On
loadMoreContainer.visibility = View.GONE
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if (!recyclerView.canScrollVertically(1)) {
if (!recyclerView.canScrollVertically(1) &&
applicationList.size >= Constants.RESULTS_PER_PAGE) {
loadMoreContainer.visibility = View.VISIBLE
recyclerView.scrollToPosition(applicationList.size - 1)
if (!isLoadingMoreApplications) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment