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
3bc0432e
Commit
3bc0432e
authored
Jan 20, 2019
by
Nihar Thakkar
Browse files
Don't allow apps without a "LAUNCHER" activity to be opened
parent
564224fb
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/io/eelo/appinstaller/application/ApplicationActivity.kt
View file @
3bc0432e
...
...
@@ -28,6 +28,7 @@ import io.eelo.appinstaller.application.model.data.FullData
import
io.eelo.appinstaller.applicationmanager.ApplicationManager
import
io.eelo.appinstaller.applicationmanager.ApplicationManagerServiceConnection
import
io.eelo.appinstaller.applicationmanager.ApplicationManagerServiceConnectionCallback
import
io.eelo.appinstaller.utils.Common
import
io.eelo.appinstaller.utils.Common.toMiB
import
io.eelo.appinstaller.utils.Constants
import
io.eelo.appinstaller.utils.Constants.APPLICATION_DESCRIPTION_KEY
...
...
@@ -440,6 +441,14 @@ class ApplicationActivity : AppCompatActivity(), ApplicationStateListener,
Execute
({},
{
app_install
.
text
=
resources
.
getString
(
state
.
installButtonTextId
)
when
(
state
)
{
State
.
INSTALLED
->
{
app_install
.
setBackgroundResource
(
R
.
drawable
.
app_install_border
)
app_install
.
setTextColor
(
resources
.
getColor
(
android
.
R
.
color
.
primary_text_dark
))
app_install
.
isEnabled
=
Common
.
appHasLaunchActivity
(
this
,
application
.
packageName
)
app_size
.
visibility
=
View
.
VISIBLE
app_download_container
.
visibility
=
View
.
GONE
}
State
.
DOWNLOADING
->
{
app_install
.
setBackgroundResource
(
R
.
drawable
.
app_install_border_simple
)
app_install
.
setTextColor
(
resources
.
getColor
(
android
.
R
.
color
.
primary_text_light
))
...
...
app/src/main/java/io/eelo/appinstaller/application/ApplicationViewHolder.kt
View file @
3bc0432e
...
...
@@ -78,6 +78,10 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
Execute
({},
{
installButton
.
text
=
activity
.
getString
(
state
.
installButtonTextId
)
when
(
state
)
{
State
.
INSTALLED
->
{
installButton
.
isEnabled
=
Common
.
appHasLaunchActivity
(
activity
,
application
!!
.
packageName
)
}
State
.
INSTALLING
->
{
installButton
.
isEnabled
=
false
}
...
...
app/src/main/java/io/eelo/appinstaller/application/SmallApplicationViewHolder.kt
View file @
3bc0432e
...
...
@@ -61,6 +61,10 @@ class SmallApplicationViewHolder(private val activity: Activity, private val vie
Execute
({},
{
installButton
.
text
=
activity
.
getString
(
state
.
installButtonTextId
)
when
(
state
)
{
State
.
INSTALLED
->
{
installButton
.
isEnabled
=
Common
.
appHasLaunchActivity
(
activity
,
application
!!
.
packageName
)
}
State
.
INSTALLING
->
{
installButton
.
isEnabled
=
false
}
...
...
app/src/main/java/io/eelo/appinstaller/utils/Common.kt
View file @
3bc0432e
...
...
@@ -58,4 +58,8 @@ object Common {
}
return
false
}
fun
appHasLaunchActivity
(
context
:
Context
,
packageName
:
String
):
Boolean
{
return
(
context
.
packageManager
.
getLaunchIntentForPackage
(
packageName
)
!=
null
)
}
}
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