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
ba4ef9bb
Commit
ba4ef9bb
authored
Sep 04, 2020
by
narinder Rana
Committed by
Romain Hunault
Dec 08, 2020
Browse files
Use system accent color
parent
cef4f689
Changes
16
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/apps/MainActivity.kt
View file @
ba4ef9bb
...
...
@@ -19,15 +19,24 @@ package foundation.e.apps
//import androidx.fragment.app.ListFragment
import
android.annotation.SuppressLint
import
android.content.*
import
android.content.pm.PackageManager
import
android.content.res.ColorStateList
import
android.graphics.Color
import
android.os.Bundle
import
android.os.Handler
import
android.preference.PreferenceManager
import
android.util.TypedValue
import
android.view.MenuItem
import
android.widget.Toast
import
androidx.annotation.ColorInt
import
androidx.annotation.ColorRes
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.view.ContextThemeWrapper
import
androidx.core.content.ContextCompat
import
androidx.core.graphics.drawable.DrawableCompat
import
androidx.fragment.app.Fragment
import
com.google.android.material.bottomnavigation.BottomNavigationItemView
import
com.google.android.material.bottomnavigation.BottomNavigationMenuView
...
...
@@ -60,7 +69,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
private
val
codeRequestPermissions
=
9527
var
doubleBackToExitPressedOnce
=
false
;
private
var
isReceiverRegistered
=
false
var
accentColorOS
=
0
companion
object
{
...
...
@@ -70,12 +79,16 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
//ThemeColors(this);
setContentView
(
R
.
layout
.
activity_main
)
mActivity
=
this
disableCategoryIfOpenSource
()
bottom_navigation_view
.
setOnNavigationItemSelectedListener
{
if
(
selectFragment
(
it
.
itemId
,
it
))
{
disableCategoryIfOpenSource
()
...
...
@@ -102,6 +115,28 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
}
setupLangReceiver
()
applicationManagerServiceConnection
.
bindService
(
this
)
getAccentColor
();
bottom_navigation_view_color
()
}
private
fun
bottom_navigation_view_color
()
{
val
iconsColorStates
=
ColorStateList
(
arrayOf
(
intArrayOf
(-
android
.
R
.
attr
.
state_checked
),
intArrayOf
(
android
.
R
.
attr
.
state_checked
)),
intArrayOf
(
Color
.
parseColor
(
"#C4CFD9"
),
accentColorOS
))
val
textColorStates
=
ColorStateList
(
arrayOf
(
intArrayOf
(-
android
.
R
.
attr
.
state_checked
),
intArrayOf
(
android
.
R
.
attr
.
state_checked
)),
intArrayOf
(
Color
.
parseColor
(
"#C4CFD9"
),
accentColorOS
))
bottom_navigation_view
.
setItemIconTintList
(
iconsColorStates
)
bottom_navigation_view
.
setItemTextColor
(
textColorStates
)
}
private
fun
initialiseUpdatesWorker
()
{
...
...
@@ -116,9 +151,9 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
}
private
fun
initialiseFragments
(
applicationManager
:
ApplicationManager
)
{
homeFragment
.
initialise
(
applicationManager
)
searchFragment
.
initialise
(
applicationManager
)
updatesFragment
.
initialise
(
applicationManager
)
homeFragment
.
initialise
(
applicationManager
,
accentColorOS
)
searchFragment
.
initialise
(
applicationManager
,
accentColorOS
)
updatesFragment
.
initialise
(
applicationManager
,
accentColorOS
)
}
override
fun
onNavigationItemSelected
(
item
:
MenuItem
):
Boolean
{
...
...
@@ -144,17 +179,28 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
return
"any"
}
fun
tintMenuIcon
(
context
:
Context
,
item
:
MenuItem
,
@ColorRes
color
:
Int
)
{
val
normalDrawable
=
item
.
icon
val
wrapDrawable
=
DrawableCompat
.
wrap
(
normalDrawable
)
DrawableCompat
.
setTint
(
wrapDrawable
,
ContextCompat
.
getColor
(
context
,
color
))
//context.resources.getColor(color))
item
.
icon
=
wrapDrawable
}
private
fun
selectFragment
(
fragmentId
:
Int
,
item
:
MenuItem
?):
Boolean
{
when
(
fragmentId
)
{
R
.
id
.
menu_home
->
{
item
?.
setIcon
(
R
.
drawable
.
ic_menu_home
)
showFragment
(
homeFragment
)
return
true
}
R
.
id
.
menu_categories
->
{
item
?.
setIcon
(
R
.
drawable
.
ic_menu_categories
)
showFragment
(
CategoriesFragment
())
return
true
}
R
.
id
.
menu_search
->
{
...
...
@@ -265,4 +311,20 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
}
},
2000
)
}
/*
* get Accent color from OS
*
* */
private
fun
getAccentColor
()
{
val
typedValue
=
TypedValue
()
val
contextThemeWrapper
=
ContextThemeWrapper
(
this
,
android
.
R
.
style
.
Theme_DeviceDefault
)
contextThemeWrapper
.
getTheme
().
resolveAttribute
(
android
.
R
.
attr
.
colorAccent
,
typedValue
,
true
)
@ColorInt
val
color
=
typedValue
.
data
accentColorOS
=
color
;
}
}
app/src/main/java/foundation/e/apps/application/ApplicationActivity.kt
View file @
ba4ef9bb
...
...
@@ -32,6 +32,7 @@ import android.text.SpannableStringBuilder
import
android.text.method.LinkMovementMethod
import
android.text.style.ForegroundColorSpan
import
android.util.DisplayMetrics
import
android.util.Log
import
android.util.TypedValue
import
android.view.Menu
import
android.view.MenuItem
...
...
@@ -39,8 +40,10 @@ import android.view.View
import
android.widget.ImageView
import
android.widget.LinearLayout
import
android.widget.TextView
import
androidx.annotation.ColorInt
import
androidx.appcompat.app.AlertDialog
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.view.ContextThemeWrapper
import
androidx.appcompat.widget.Toolbar
import
com.google.android.material.snackbar.Snackbar
import
foundation.e.apps.MainActivity.Companion.sharedPreferences
...
...
@@ -90,7 +93,7 @@ class ApplicationActivity :
private
var
imageMargin
=
0
private
var
defaultElevation
=
0f
private
val
sharedPrefFile
=
"kotlinsharedpreference"
var
accentColorOS
=
0
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -113,6 +116,14 @@ class ApplicationActivity :
this
.
applicationPackageName
=
applicationPackageName
!!
applicationManagerServiceConnection
.
bindService
(
this
)
}
getAccentColor
()
app_install
.
setTextColor
(
Color
.
parseColor
(
"#ffffff"
))
app_install
.
setBackgroundColor
(
accentColorOS
)
app_category
.
setTextColor
(
accentColorOS
)
app_expand_description
.
setTextColor
(
accentColorOS
)
}
...
...
@@ -749,4 +760,14 @@ class ApplicationActivity :
applicationManagerServiceConnection
.
unbindService
(
this
)
}
}
private
fun
getAccentColor
()
{
val
typedValue
=
TypedValue
()
val
contextThemeWrapper
=
ContextThemeWrapper
(
this
,
android
.
R
.
style
.
Theme_DeviceDefault
)
contextThemeWrapper
.
getTheme
().
resolveAttribute
(
android
.
R
.
attr
.
colorAccent
,
typedValue
,
true
)
@ColorInt
val
color
=
typedValue
.
data
accentColorOS
=
color
;
}
}
app/src/main/java/foundation/e/apps/application/ApplicationViewHolder.kt
View file @
ba4ef9bb
...
...
@@ -48,17 +48,17 @@ import kotlinx.android.synthetic.main.install_button_layout.view.*
import
java.lang.Exception
class
ApplicationViewHolder
(
private
val
activity
:
Activity
,
private
val
view
:
View
)
:
class
ApplicationViewHolder
(
private
val
activity
:
Activity
,
private
val
view
:
View
,
accentColorOS
:
Int
)
:
RecyclerView
.
ViewHolder
(
view
),
ApplicationStateListener
,
Downloader
.
DownloadProgressCallback
,
BasicData
.
IconLoaderCallback
,
PwasBasicData
.
IconLoaderCallback
{
PwasBasicData
.
IconLoaderCallback
{
private
val
icon
:
ImageView
=
view
.
app_icon
private
val
title
:
TextView
=
view
.
app_title
private
val
pwa_icon
:
TextView
=
view
.
pwa_sympol
private
val
pwa_icon
:
TextView
=
view
.
pwa_sympol
private
val
author
:
TextView
=
view
.
app_author
private
val
ratingBar
:
RatingBar
=
view
.
app_rating_bar
private
val
rating
:
TextView
=
view
.
app_rating
...
...
@@ -67,28 +67,33 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
private
var
application
:
Application
?
=
null
private
val
applicationViewModel
=
ApplicationViewModel
()
private
var
downloader
:
Downloader
?
=
null
var
accentColorOS
=
accentColorOS
;
init
{
pwa_icon
.
visibility
=
View
.
GONE
pwa_icon
.
visibility
=
View
.
GONE
view
.
setOnClickListener
{
if
(
application
!=
null
)
{
if
(
application
!!
.
packageName
!=
Constants
.
MICROG_PACKAGE
)
applicationViewModel
.
onApplicationClick
(
view
.
context
,
application
!!
)
}
}
installButton
.
setTextColor
(
Color
.
parseColor
(
"#ffffff"
))
if
(
0
!=
this
.
accentColorOS
){
installButton
.
setBackgroundColor
(
this
.
accentColorOS
)
}
installButton
?.
setOnClickListener
{
if
(
application
?.
fullData
!=
null
&&
application
!!
.
fullData
!!
.
getLastVersion
()
==
null
)
{
Snackbar
.
make
(
view
,
activity
.
getString
(
Error
.
APK_UNAVAILABLE
.
description
),
Snackbar
.
LENGTH_LONG
).
show
()
}
else
if
(
application
?.
pwabasicdata
!=
null
){
}
else
if
(
application
?.
pwabasicdata
!=
null
)
{
application
?.
pwaInstall
(
activity
)
}
else
if
(
application
?.
searchAppsBasicData
!=
null
&&
application
?.
searchAppsBasicData
!!
.
is_pwa
){
}
else
if
(
application
?.
searchAppsBasicData
!=
null
&&
application
?.
searchAppsBasicData
!!
.
is_pwa
)
{
application
?.
pwaInstall
(
activity
)
}
else
{
}
else
{
application
?.
buttonClicked
(
activity
,
activity
)
}
}
...
...
@@ -96,46 +101,46 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
fun
createApplicationView
(
app
:
Application
)
{
pwa_icon
.
visibility
=
View
.
GONE
this
.
application
=
app
pwa_icon
.
visibility
=
View
.
GONE
this
.
application
=
app
if
(
app
.
basicData
!=
null
)
{
this
.
application
?.
removeListener
(
this
)
this
.
application
=
app
icon
.
setImageDrawable
(
view
.
context
.
resources
.
getDrawable
(
R
.
drawable
.
ic_app_default
))
application
!!
.
loadIcon
(
this
)
application
!!
.
addListener
(
this
)
title
.
text
=
application
!!
.
basicData
!!
.
name
author
.
text
=
application
!!
.
basicData
!!
.
author
ratingBar
.
rating
=
application
!!
.
basicData
!!
.
ratings
!!
.
rating
!!
if
(
application
!!
.
basicData
!!
.
ratings
!!
.
rating
!=
-
1f
)
{
rating
.
text
=
application
!!
.
basicData
!!
.
ratings
!!
.
rating
.
toString
()
}
else
{
rating
.
text
=
activity
.
getString
(
R
.
string
.
not_available
)
}
if
(
application
!!
.
basicData
!!
.
privacyRating
!=
null
&&
application
!!
.
basicData
!!
.
privacyRating
!=
-
1f
)
{
privacyScore
.
text
=
application
!!
.
basicData
!!
.
privacyRating
.
toString
()
}
else
{
privacyScore
.
text
=
activity
.
getString
(
R
.
string
.
not_available
)
if
(
app
.
basicData
!=
null
)
{
this
.
application
?.
removeListener
(
this
)
this
.
application
=
app
icon
.
setImageDrawable
(
view
.
context
.
resources
.
getDrawable
(
R
.
drawable
.
ic_app_default
))
application
!!
.
loadIcon
(
this
)
application
!!
.
addListener
(
this
)
title
.
text
=
application
!!
.
basicData
!!
.
name
author
.
text
=
application
!!
.
basicData
!!
.
author
ratingBar
.
rating
=
application
!!
.
basicData
!!
.
ratings
!!
.
rating
!!
if
(
application
!!
.
basicData
!!
.
ratings
!!
.
rating
!=
-
1f
)
{
rating
.
text
=
application
!!
.
basicData
!!
.
ratings
!!
.
rating
.
toString
()
}
else
{
rating
.
text
=
activity
.
getString
(
R
.
string
.
not_available
)
}
if
(
application
!!
.
basicData
!!
.
privacyRating
!=
null
&&
application
!!
.
basicData
!!
.
privacyRating
!=
-
1f
)
{
privacyScore
.
text
=
application
!!
.
basicData
!!
.
privacyRating
.
toString
()
}
else
{
privacyScore
.
text
=
activity
.
getString
(
R
.
string
.
not_available
)
}
}
else
{
this
.
application
?.
removeListener
(
this
)
this
.
application
=
app
icon
.
setImageDrawable
(
view
.
context
.
resources
.
getDrawable
(
R
.
drawable
.
ic_app_default
))
application
!!
.
addListener
(
this
)
if
(
application
!!
.
searchAppsBasicData
!=
null
)
{
if
(
application
!!
.
searchAppsBasicData
!!
.
is_pwa
)
{
pwa_icon
.
visibility
=
View
.
VISIBLE
}
}
else
{
this
.
application
?.
removeListener
(
this
)
this
.
application
=
app
icon
.
setImageDrawable
(
view
.
context
.
resources
.
getDrawable
(
R
.
drawable
.
ic_app_default
))
application
!!
.
addListener
(
this
)
if
(
application
!!
.
searchAppsBasicData
!=
null
)
{
if
(
application
!!
.
searchAppsBasicData
!!
.
is_pwa
)
{
pwa_icon
.
visibility
=
View
.
VISIBLE
}
application
!!
.
SearchAppsloadIcon
(
this
)
title
.
text
=
application
!!
.
searchAppsBasicData
!!
.
name
author
.
text
=
application
!!
.
searchAppsBasicData
!!
.
author
}
else
{
application
!!
.
PwaloadIcon
(
this
)
title
.
text
=
application
!!
.
pwabasicdata
!!
.
name
application
!!
.
SearchAppsloadIcon
(
this
)
title
.
text
=
application
!!
.
searchAppsBasicData
!!
.
name
author
.
text
=
application
!!
.
searchAppsBasicData
!!
.
author
}
else
{
application
!!
.
PwaloadIcon
(
this
)
title
.
text
=
application
!!
.
pwabasicdata
!!
.
name
}
}
}
stateChanged
(
application
!!
.
state
)
}
...
...
@@ -147,13 +152,20 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
override
fun
stateChanged
(
state
:
State
)
{
Execute
({},
{
installButton
.
setBackgroundResource
(
R
.
drawable
.
app_install_border_simple
)
// installButton.setBackgroundResource(R.drawable.app_install_border_simple)
installButton
?.
text
=
activity
.
getString
(
state
.
installButtonTextId
)
when
(
state
)
{
State
.
NOT_DOWNLOADED
->{
installButton
.
setTextColor
(
Color
.
parseColor
(
"#0088ED"
))
State
.
NOT_DOWNLOADED
->
{
if
(
0
!=
this
.
accentColorOS
){
installButton
.
setTextColor
(
this
.
accentColorOS
)
}
else
{
installButton
.
setTextColor
(
Color
.
parseColor
(
"#0088ED"
))
}
installButton
.
setBackgroundResource
(
R
.
drawable
.
app_install_border_simple
)
installButton
.
isEnabled
=
true
}
...
...
@@ -162,15 +174,27 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
installButton
?.
isEnabled
=
Common
.
appHasLaunchActivity
(
activity
,
application
!!
.
packageName
)
if
(
0
!=
this
.
accentColorOS
){
installButton
!!
.
setBackgroundColor
(
this
.
accentColorOS
)
}
else
{
installButton
!!
.
setBackgroundResource
(
R
.
drawable
.
app_install_border
)
}
installButton
.
setTextColor
(
Color
.
parseColor
(
"#FAFAFA"
))
installButton
!!
.
setBackgroundResource
(
R
.
drawable
.
app_install_border
)
}
State
.
INSTALLING
->
{
installButton
?.
isEnabled
=
false
}
State
.
NOT_UPDATED
->
{
installButton
.
setTextColor
(
Color
.
parseColor
(
"#FAFAFA"
))
installButton
!!
.
setBackgroundResource
(
R
.
drawable
.
app_install_border
)
//installButton!!.setBackgroundResource(R.drawable.app_install_border)
if
(
0
!=
this
.
accentColorOS
){
installButton
!!
.
setBackgroundColor
(
this
.
accentColorOS
)
}
else
{
installButton
!!
.
setBackgroundResource
(
R
.
drawable
.
app_install_border
)
}
installButton
?.
isEnabled
=
true
}
else
->
{
...
...
@@ -178,6 +202,7 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
installButton
?.
isEnabled
=
true
}
}
})
}
...
...
@@ -204,4 +229,5 @@ class ApplicationViewHolder(private val activity: Activity, private val view: Vi
downloader
?.
removeListener
(
this
)
downloader
=
null
}
}
app/src/main/java/foundation/e/apps/application/SmallApplicationViewHolder.kt
View file @
ba4ef9bb
...
...
@@ -53,6 +53,7 @@ class SmallApplicationViewHolder(private val activity: Activity, private val vie
BasicData
.
IconLoaderCallback
,
PwasBasicData
.
IconLoaderCallback
{
private
val
icon
:
ImageView
=
view
.
app_icon
private
val
title
:
TextView
=
view
.
app_title
private
val
installButton
:
Button
=
view
.
app_install
...
...
@@ -67,6 +68,7 @@ class SmallApplicationViewHolder(private val activity: Activity, private val vie
applicationViewModel
.
onApplicationClick
(
view
.
context
,
application
!!
)
}
}
installButton
.
setOnClickListener
{
if
(
application
?.
fullData
!=
null
&&
application
!!
.
fullData
!!
.
getLastVersion
()
==
null
)
{
...
...
@@ -82,7 +84,6 @@ class SmallApplicationViewHolder(private val activity: Activity, private val vie
}
}
}
fun
createApplicationView
(
app
:
Application
)
{
if
(
app
.
basicData
!=
null
)
{
this
.
application
?.
removeListener
(
this
)
...
...
@@ -116,11 +117,14 @@ class SmallApplicationViewHolder(private val activity: Activity, private val vie
installButton
.
text
=
activity
.
getString
(
state
.
installButtonTextId
)
installButton
.
clearAnimation
()
installButton
.
clearFocus
();
var
color
=
application
?.
getAccentColor
(
activity
);
when
(
state
)
{
State
.
NOT_DOWNLOADED
->{
installButton
.
setTextColor
(
Color
.
parseColor
(
"#0088ED"
))
installButton
.
setBackgroundResource
(
R
.
drawable
.
app_install_border_simple
)
if
(
color
!=
null
)
{
installButton
.
setTextColor
(
color
)
};
installButton
.
isEnabled
=
true
}
...
...
@@ -128,7 +132,10 @@ class SmallApplicationViewHolder(private val activity: Activity, private val vie
installButton
.
isEnabled
=
Common
.
appHasLaunchActivity
(
activity
,
application
!!
.
packageName
)
installButton
.
setTextColor
(
Color
.
parseColor
(
"#FAFAFA"
))
installButton
!!
.
setBackgroundResource
(
R
.
drawable
.
app_install_border
)
if
(
color
!=
null
)
{
//installButton!!.setBackgroundResource(R.drawable.app_install_border)
installButton
.
setBackgroundColor
(
color
)
};
}
State
.
INSTALLING
->
{
installButton
.
isEnabled
=
false
...
...
@@ -137,7 +144,11 @@ class SmallApplicationViewHolder(private val activity: Activity, private val vie
}
State
.
NOT_UPDATED
->
{
installButton
.
setTextColor
(
Color
.
parseColor
(
"#FAFAFA"
))
installButton
!!
.
setBackgroundResource
(
R
.
drawable
.
app_install_border
)
// installButton!!.setBackgroundResource(R.drawable.app_install_border)
if
(
color
!=
null
)
{
//installButton!!.setBackgroundResource(R.drawable.app_install_border)
installButton
.
setBackgroundColor
(
color
)
};
installButton
.
isEnabled
=
true
}
else
->
{
...
...
app/src/main/java/foundation/e/apps/application/model/Application.kt
View file @
ba4ef9bb
...
...
@@ -18,11 +18,16 @@
package
foundation.e.apps.application.model
import
android.Manifest
import
android.R
import
android.app.Activity
import
android.app.DownloadManager
import
android.content.Context
import
android.content.Intent
import
android.content.pm.PackageManager
import
android.util.Log
import
android.util.TypedValue
import
androidx.annotation.ColorInt
import
androidx.appcompat.view.ContextThemeWrapper
import
foundation.e.apps.MainActivity.Companion.mActivity
import
foundation.e.apps.pwa.PwaInstaller
import
foundation.e.apps.XAPK.XAPKFile
...
...
@@ -37,9 +42,7 @@ import foundation.e.apps.utils.*
import
java.util.concurrent.atomic.AtomicInteger
class
Application
(
val
packageName
:
String
,
private
val
applicationManager
:
ApplicationManager
)
:
DownloaderInterface
,
InstallerInterface
{
DownloaderInterface
,
InstallerInterface
{
private
val
uses
=
AtomicInteger
(
0
)
...
...
@@ -48,9 +51,9 @@ class Application(val packageName: String, private val applicationManager: Appli
var
basicData
:
BasicData
?
=
null
var
releaseData
:
ReleaseData
?
=
null
var
fullData
:
FullData
?
=
null
var
pwabasicdata
:
PwasBasicData
?
=
null
var
pwabasicdata
:
PwasBasicData
?
=
null
var
pwaFullData
:
PwaFullData
?
=
null
var
searchAppsBasicData
:
SearchAppsBasicData
?
=
null
var
searchAppsBasicData
:
SearchAppsBasicData
?
=
null
fun
addListener
(
listener
:
ApplicationStateListener
)
{
...
...
@@ -79,16 +82,13 @@ class Application(val packageName: String, private val applicationManager: Appli
fun
checkForStateUpdate
(
context
:
Context
)
{
if
(
basicData
!=
null
)
{
stateManager
.
find
(
context
,
basicData
!!
)
}
else
if
(
searchAppsBasicData
!=
null
){
if
(
searchAppsBasicData
!!
.
is_pwa
){
}
else
if
(
searchAppsBasicData
!=
null
)
{
if
(
searchAppsBasicData
!!
.
is_pwa
)
{
// stateManager.pwaFind()
}
else
{
}
else
{
stateManager
.
searchAppsFind
(
context
,
searchAppsBasicData
!!
)
}
}
else
if
(
pwabasicdata
!=
null
){
}
else
if
(
pwabasicdata
!=
null
)
{
// stateManager.pwaFind()
}
}
...
...
@@ -102,16 +102,16 @@ class Application(val packageName: String, private val applicationManager: Appli
fun
pwaInstall
(
context
:
Context
)
{
var
error
:
Error
?
=
null
Thread
(
Runnable
{
error
=
assertFullData
(
context
)
Thread
(
Runnable
{
error
=
assertFullData
(
context
)
mActivity
.
runOnUiThread
(
Runnable
{
mActivity
.
runOnUiThread
(
Runnable
{
run
{
if
(
error
==
null
)
{
val
intent
=
Intent
(
context
,
PwaInstaller
::
class
.
java
)
intent
.
putExtra
(
"NAME"
,
pwaFullData
!!
.
name
)
intent
.
putExtra
(
"URL"
,
pwaFullData
!!
.
url
)
val
intent
=
Intent
(
context
,
PwaInstaller
::
class
.
java
)
intent
.
putExtra
(
"NAME"
,
pwaFullData
!!
.
name
)
intent
.
putExtra
(
"URL"
,
pwaFullData
!!
.
url
)
context
.
startActivity
(
intent
)
}
else
{
stateManager
.
notifyError
(
error
!!
)
...
...
@@ -231,11 +231,10 @@ class Application(val packageName: String, private val applicationManager: Appli
synchronized
(
blocker
)
{
blocker
.
notify
()
}
if
(
basicData
!=
null
)
{
if
(
basicData
!=
null
)
{
info
.
getApkFile
(
context
,
basicData
!!
).
delete
()
applicationManager
.
stopInstalling
(
context
,
this
)
}
else
{
}
else
{
applicationManager
.
stopInstalling
(
context
,
this
)
}
}
...
...
@@ -276,16 +275,12 @@ class Application(val packageName: String, private val applicationManager: Appli
fun
assertFullData
(
context
:
Context
):
Error
?
{
if
(
fullData
!=
null
)
{
return
null
}
else
if
(
pwabasicdata
!=
null
){
}
else
if
(
pwabasicdata
!=
null
)
{
return
findPwaFullData
(
context
)
}
else
if
(
searchAppsBasicData
!=
null
){
if
(
searchAppsBasicData
!!
.
is_pwa
){
}
else
if
(
searchAppsBasicData
!=
null
)
{
if
(
searchAppsBasicData
!!
.
is_pwa
)
{
return
findSearchResultPwaFulldata
(
context
)
}
else
{
}
else
{
findSearchAppsFullData
(
context
)