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
3c301df8
Commit
3c301df8
authored
Aug 19, 2020
by
Dayona Joseph
Browse files
Call unregister Language receiver
Fix home pwa parsing error
parent
25c10350
Pipeline
#68642
passed with stage
in 3 minutes and 10 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/apps/MainActivity.kt
View file @
3c301df8
...
...
@@ -28,7 +28,6 @@ import android.preference.PreferenceManager
import
android.view.MenuItem
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
androidx.core.content.ContextCompat
import
androidx.fragment.app.Fragment
import
com.google.android.material.bottomnavigation.BottomNavigationItemView
import
com.google.android.material.bottomnavigation.BottomNavigationMenuView
...
...
@@ -60,6 +59,7 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
ApplicationManagerServiceConnection
(
this
)
private
val
codeRequestPermissions
=
9527
var
doubleBackToExitPressedOnce
=
false
;
private
var
isReceiverRegistered
=
false
...
...
@@ -75,7 +75,6 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
mActivity
=
this
disableCategoryIfOpenSource
()
bottom_navigation_view
.
setOnNavigationItemSelectedListener
{
if
(
selectFragment
(
it
.
itemId
,
it
))
{
disableCategoryIfOpenSource
()
...
...
@@ -181,11 +180,11 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
mLangReceiver
=
object
:
BroadcastReceiver
()
{
override
fun
onReceive
(
context
:
Context
?,
intent
:
Intent
?)
{
finish
()
// selectFragment(currentFragmentId,null)
}
}
val
filter
=
IntentFilter
(
Intent
.
ACTION_LOCALE_CHANGED
)
registerReceiver
(
mLangReceiver
,
filter
)
isReceiverRegistered
=
true
;
}
return
mLangReceiver
}
...
...
@@ -240,6 +239,10 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
override
fun
onDestroy
()
{
super
.
onDestroy
()
if
(
isReceiverRegistered
)
{
unregisterReceiver
(
mLangReceiver
)
isReceiverRegistered
=
false
// set it back to false.
}
homeFragment
.
decrementApplicationUses
()
searchFragment
.
decrementApplicationUses
()
updatesFragment
.
decrementApplicationUses
()
...
...
app/src/main/java/foundation/e/apps/api/HomePwaRequest.kt
View file @
3c301df8
...
...
@@ -31,6 +31,7 @@ class HomePwaRequest {
urlConnection
.
disconnect
()
callback
.
invoke
(
null
,
result
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
callback
.
invoke
(
Error
.
findError
(
e
),
null
)
}
}
...
...
@@ -42,13 +43,13 @@ class HomePwaRequest {
@JsonProperty
(
"headings"
)
val
headings
:
Map
<
String
,
String
>?,
@JsonProperty
(
BANNER_APPS_KEY
)
val
bannerApps
:
List
<
BasicData
>,
val
bannerApps
:
List
<
Pwas
BasicData
>,
@JsonProperty
(
POPULAR_APPS_KEY
)
val
topUpdatedApps
:
List
<
BasicData
>,
val
topUpdatedApps
:
List
<
Pwas
BasicData
>,
@JsonProperty
(
POPULAR_GAMES_KEY
)
val
topUpdatedGames
:
List
<
BasicData
>,
val
topUpdatedGames
:
List
<
Pwas
BasicData
>,
@JsonProperty
(
DISCOVER_KEY
)
val
discover
:
List
<
BasicData
>
val
discover
:
List
<
Pwas
BasicData
>
)
{
companion
object
{
...
...
@@ -61,7 +62,7 @@ class HomePwaRequest {
}
fun
getBannerApps
(
applicationManager
:
ApplicationManager
,
context
:
Context
):
ArrayList
<
Application
>
{
return
ApplicationParser
.
p
arseToApps
(
applicationManager
,
context
,
bannerApps
.
toTypedArray
())
return
ApplicationParser
.
PwaP
arseToApps
(
applicationManager
,
context
,
bannerApps
.
toTypedArray
())
}
fun
getApps
(
applicationManager
:
ApplicationManager
,
context
:
Context
):
LinkedHashMap
<
Category
,
ArrayList
<
Application
>>
{
...
...
@@ -71,9 +72,9 @@ class HomePwaRequest {
heading
=
heading
?:
""
// Use default heading as empty to let it generate from the key itself.
val
parsedApps
=
when
(
it
)
{
POPULAR_APPS_KEY
->
ApplicationParser
.
p
arseToApps
(
applicationManager
,
context
,
topUpdatedApps
.
toTypedArray
())
POPULAR_GAMES_KEY
->
ApplicationParser
.
p
arseToApps
(
applicationManager
,
context
,
topUpdatedGames
.
toTypedArray
())
DISCOVER_KEY
->
ApplicationParser
.
p
arseToApps
(
applicationManager
,
context
,
discover
.
toTypedArray
())
POPULAR_APPS_KEY
->
ApplicationParser
.
PwaP
arseToApps
(
applicationManager
,
context
,
topUpdatedApps
.
toTypedArray
())
POPULAR_GAMES_KEY
->
ApplicationParser
.
PwaP
arseToApps
(
applicationManager
,
context
,
topUpdatedGames
.
toTypedArray
())
DISCOVER_KEY
->
ApplicationParser
.
PwaP
arseToApps
(
applicationManager
,
context
,
discover
.
toTypedArray
())
else
->
throw
IllegalArgumentException
(
"Unrecognised key $it encountered"
)
}
apps
[
Category
(
it
,
heading
)]
=
parsedApps
...
...
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