Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
App Lounge
Commits
2862c4ae
Commit
2862c4ae
authored
Jan 20, 2019
by
Nihar Thakkar
Browse files
Improve "more apps" error handling
parent
e8ecd39c
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/io/eelo/appinstaller/categories/category/CategoryActivity.kt
View file @
2862c4ae
...
...
@@ -102,14 +102,17 @@ class CategoryActivity : AppCompatActivity(), ApplicationManagerServiceConnectio
// Bind to the screen error
categoryViewModel
.
getScreenError
().
observe
(
this
,
Observer
{
if
(
it
!=
null
)
{
errorDescription
.
text
=
getString
(
it
.
description
)
errorContainer
.
visibility
=
View
.
VISIBLE
progressBar
.
visibility
=
View
.
GONE
loadMoreContainer
.
visibility
=
View
.
GONE
if
(!
isLoadingMoreApplications
)
{
errorDescription
.
text
=
getString
(
it
.
description
)
errorContainer
.
visibility
=
View
.
VISIBLE
progressBar
.
visibility
=
View
.
GONE
loadMoreContainer
.
visibility
=
View
.
GONE
}
else
{
isLoadingMoreApplications
=
false
}
}
else
{
errorContainer
.
visibility
=
View
.
GONE
}
isLoadingMoreApplications
=
false
})
applicationManagerServiceConnection
.
bindService
(
this
)
...
...
app/src/main/java/io/eelo/appinstaller/categories/category/model/CategoryModel.kt
View file @
2862c4ae
...
...
@@ -40,20 +40,12 @@ class CategoryModel : CategoryModelInterface {
categoryApplicationsList
.
value
=
result
}
}
else
{
if
(
page
==
1
)
{
screenError
.
value
=
error
}
else
{
screenError
.
value
=
null
}
screenError
.
value
=
error
}
})
page
++
}
else
{
if
(
page
==
1
)
{
screenError
.
value
=
Error
.
NO_INTERNET
}
else
{
screenError
.
value
=
null
}
screenError
.
value
=
Error
.
NO_INTERNET
}
}
...
...
@@ -70,10 +62,10 @@ class CategoryModel : CategoryModelInterface {
}
}
}
if
(
listApplications
!=
null
)
{
return
listApplications
!!
.
getApplications
(
applicationManager
,
context
)
return
if
(
listApplications
!=
null
)
{
listApplications
!!
.
getApplications
(
applicationManager
,
context
)
}
else
{
return
null
null
}
}
...
...
app/src/main/java/io/eelo/appinstaller/search/SearchFragment.kt
View file @
2862c4ae
...
...
@@ -130,14 +130,17 @@ class SearchFragment : Fragment(), SearchView.OnQueryTextListener, SearchView.On
// Bind to the screen error
searchViewModel
.
getScreenError
().
observe
(
this
,
Observer
{
if
(
it
!=
null
)
{
errorDescription
.
text
=
activity
!!
.
getString
(
it
.
description
)
errorContainer
.
visibility
=
View
.
VISIBLE
progressBar
.
visibility
=
View
.
GONE
loadMoreContainer
.
visibility
=
View
.
GONE
if
(!
isLoadingMoreApplications
)
{
errorDescription
.
text
=
activity
!!
.
getString
(
it
.
description
)
errorContainer
.
visibility
=
View
.
VISIBLE
progressBar
.
visibility
=
View
.
GONE
loadMoreContainer
.
visibility
=
View
.
GONE
}
else
{
isLoadingMoreApplications
=
false
}
}
else
{
errorContainer
.
visibility
=
View
.
GONE
}
isLoadingMoreApplications
=
false
})
// Handle suggestion clicks
...
...
app/src/main/java/io/eelo/appinstaller/search/model/SearchModel.kt
View file @
2862c4ae
...
...
@@ -47,11 +47,7 @@ class SearchModel : SearchModelInterface {
SearchElement
(
searchQuery
,
pageNumber
,
applicationManager
!!
,
this
)
.
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
,
context
)
}
else
{
if
(
pageNumber
==
1
)
{
screenError
.
value
=
Error
.
NO_INTERNET
}
else
{
screenError
.
value
=
null
}
screenError
.
value
=
Error
.
NO_INTERNET
}
}
...
...
@@ -64,17 +60,11 @@ class SearchModel : SearchModelInterface {
}
else
{
this
.
applicationList
.
value
=
applicationList
}
if
(
applicationList
.
isEmpty
()
&&
pageNumber
==
1
)
{
if
(
applicationList
.
isEmpty
())
{
screenError
.
value
=
Error
.
NO_RESULTS
}
else
{
screenError
.
value
=
null
}
}
else
{
if
(
pageNumber
==
1
)
{
screenError
.
value
=
error
}
else
{
screenError
.
value
=
null
}
screenError
.
value
=
error
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment