Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
36a70e99
Commit
36a70e99
authored
Aug 11, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remote -> Online
parent
537ae1a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
ModuleViewModel.kt
...in/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt
+15
-15
strings.xml
app/src/main/res/values/strings.xml
+2
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt
View file @
36a70e99
...
@@ -83,7 +83,7 @@ class ModuleViewModel(
...
@@ -83,7 +83,7 @@ class ModuleViewModel(
private
val
itemsInstalled
=
diffListOf
<
ModuleItem
>()
private
val
itemsInstalled
=
diffListOf
<
ModuleItem
>()
private
val
itemsUpdatable
=
diffListOf
<
RepoItem
.
Update
>()
private
val
itemsUpdatable
=
diffListOf
<
RepoItem
.
Update
>()
private
val
items
Remot
e
=
diffListOf
<
RepoItem
.
Remote
>()
private
val
items
Onlin
e
=
diffListOf
<
RepoItem
.
Remote
>()
private
val
sectionUpdate
=
SectionTitle
(
private
val
sectionUpdate
=
SectionTitle
(
R
.
string
.
module_section_pending
,
R
.
string
.
module_section_pending
,
...
@@ -98,8 +98,8 @@ class ModuleViewModel(
...
@@ -98,8 +98,8 @@ class ModuleViewModel(
R
.
drawable
.
ic_restart
R
.
drawable
.
ic_restart
).
also
{
it
.
hasButton
=
false
}
).
also
{
it
.
hasButton
=
false
}
private
val
section
Remot
e
=
SectionTitle
(
private
val
section
Onlin
e
=
SectionTitle
(
R
.
string
.
module_section_
remot
e
,
R
.
string
.
module_section_
onlin
e
,
R
.
string
.
sorting_order
R
.
string
.
sorting_order
).
apply
{
updateOrderIcon
()
}
).
apply
{
updateOrderIcon
()
}
...
@@ -110,8 +110,8 @@ class ModuleViewModel(
...
@@ -110,8 +110,8 @@ class ModuleViewModel(
.
insertList
(
itemsUpdatable
)
.
insertList
(
itemsUpdatable
)
.
insertList
(
installSectionList
)
.
insertList
(
installSectionList
)
.
insertList
(
itemsInstalled
)
.
insertList
(
itemsInstalled
)
.
insertItem
(
section
Remot
e
)
.
insertItem
(
section
Onlin
e
)
.
insertList
(
items
Remote
)
!!
.
insertList
(
items
Online
)
val
itemBinding
=
itemBindingOf
<
RvItem
>
{
val
itemBinding
=
itemBindingOf
<
RvItem
>
{
it
.
bindExtra
(
BR
.
viewModel
,
this
)
it
.
bindExtra
(
BR
.
viewModel
,
this
)
}
}
...
@@ -170,7 +170,7 @@ class ModuleViewModel(
...
@@ -170,7 +170,7 @@ class ModuleViewModel(
val
items
=
withContext
(
Dispatchers
.
Default
)
{
val
items
=
withContext
(
Dispatchers
.
Default
)
{
val
predicate
=
{
it
:
RepoItem
->
it
.
item
.
id
==
subject
.
module
.
id
}
val
predicate
=
{
it
:
RepoItem
->
it
.
item
.
id
==
subject
.
module
.
id
}
itemsUpdatable
.
filter
(
predicate
)
+
itemsUpdatable
.
filter
(
predicate
)
+
items
Remot
e
.
filter
(
predicate
)
+
items
Onlin
e
.
filter
(
predicate
)
+
itemsSearch
.
filter
(
predicate
)
itemsSearch
.
filter
(
predicate
)
}
}
items
.
forEach
{
it
.
progress
=
progress
.
times
(
100
).
roundToInt
()
}
items
.
forEach
{
it
.
progress
=
progress
.
times
(
100
).
roundToInt
()
}
...
@@ -181,7 +181,7 @@ class ModuleViewModel(
...
@@ -181,7 +181,7 @@ class ModuleViewModel(
return
viewModelScope
.
launch
{
return
viewModelScope
.
launch
{
state
=
State
.
LOADING
state
=
State
.
LOADING
loadInstalled
()
loadInstalled
()
if
(
items
Remot
e
.
isEmpty
())
if
(
items
Onlin
e
.
isEmpty
())
loadRemote
()
loadRemote
()
state
=
State
.
LOADED
state
=
State
.
LOADED
}
}
...
@@ -225,7 +225,7 @@ class ModuleViewModel(
...
@@ -225,7 +225,7 @@ class ModuleViewModel(
if
(
remoteJob
?.
isActive
==
true
)
if
(
remoteJob
?.
isActive
==
true
)
return
return
if
(
items
Remot
e
.
isEmpty
())
if
(
items
Onlin
e
.
isEmpty
())
EndlessRecyclerScrollListener
.
ResetState
().
publish
()
EndlessRecyclerScrollListener
.
ResetState
().
publish
()
remoteJob
=
viewModelScope
.
launch
{
remoteJob
=
viewModelScope
.
launch
{
...
@@ -234,21 +234,21 @@ class ModuleViewModel(
...
@@ -234,21 +234,21 @@ class ModuleViewModel(
}
}
isRemoteLoading
=
true
isRemoteLoading
=
true
val
repos
=
if
(
items
Remot
e
.
isEmpty
())
{
val
repos
=
if
(
items
Onlin
e
.
isEmpty
())
{
repoUpdater
.
run
(
refetch
)
repoUpdater
.
run
(
refetch
)
loadUpdatable
()
loadUpdatable
()
loadRemoteDB
(
0
)
loadRemoteDB
(
0
)
}
else
{
}
else
{
loadRemoteDB
(
items
Remot
e
.
size
)
loadRemoteDB
(
items
Onlin
e
.
size
)
}
}
isRemoteLoading
=
false
isRemoteLoading
=
false
refetch
=
false
refetch
=
false
queryHandler
.
post
{
items
Remot
e
.
addAll
(
repos
)
}
queryHandler
.
post
{
items
Onlin
e
.
addAll
(
repos
)
}
}
}
}
}
fun
forceRefresh
()
{
fun
forceRefresh
()
{
items
Remot
e
.
clear
()
items
Onlin
e
.
clear
()
itemsUpdatable
.
clear
()
itemsUpdatable
.
clear
()
itemsSearch
.
clear
()
itemsSearch
.
clear
()
refetch
=
true
refetch
=
true
...
@@ -299,15 +299,15 @@ class ModuleViewModel(
...
@@ -299,15 +299,15 @@ class ModuleViewModel(
fun
sectionPressed
(
item
:
SectionTitle
)
=
when
(
item
)
{
fun
sectionPressed
(
item
:
SectionTitle
)
=
when
(
item
)
{
sectionInstalled
->
reboot
()
// TODO add reboot picker, regular reboot is not always preferred
sectionInstalled
->
reboot
()
// TODO add reboot picker, regular reboot is not always preferred
section
Remot
e
->
{
section
Onlin
e
->
{
Config
.
repoOrder
=
when
(
Config
.
repoOrder
)
{
Config
.
repoOrder
=
when
(
Config
.
repoOrder
)
{
Config
.
Value
.
ORDER_NAME
->
Config
.
Value
.
ORDER_DATE
Config
.
Value
.
ORDER_NAME
->
Config
.
Value
.
ORDER_DATE
Config
.
Value
.
ORDER_DATE
->
Config
.
Value
.
ORDER_NAME
Config
.
Value
.
ORDER_DATE
->
Config
.
Value
.
ORDER_NAME
else
->
Config
.
Value
.
ORDER_NAME
else
->
Config
.
Value
.
ORDER_NAME
}
}
section
Remot
e
.
updateOrderIcon
()
section
Onlin
e
.
updateOrderIcon
()
queryHandler
.
post
{
queryHandler
.
post
{
items
Remot
e
.
clear
()
items
Onlin
e
.
clear
()
loadRemote
()
loadRemote
()
}
}
Unit
Unit
...
...
app/src/main/res/values/strings.xml
View file @
36a70e99
...
@@ -119,7 +119,7 @@
...
@@ -119,7 +119,7 @@
<string
name=
"hide_filters"
>
Filters
</string>
<string
name=
"hide_filters"
>
Filters
</string>
<string
name=
"hide_search"
>
Search
</string>
<string
name=
"hide_search"
>
Search
</string>
<!--Module
Fragment
-->
<!--Module -->
<string
name=
"no_info_provided"
>
(No info provided)
</string>
<string
name=
"no_info_provided"
>
(No info provided)
</string>
<string
name=
"no_modules_found"
>
No modules found
</string>
<string
name=
"no_modules_found"
>
No modules found
</string>
<string
name=
"reboot_recovery"
>
Reboot to Recovery
</string>
<string
name=
"reboot_recovery"
>
Reboot to Recovery
</string>
...
@@ -137,6 +137,7 @@
...
@@ -137,6 +137,7 @@
<string
name=
"module_update_none"
>
Your modules are up to date!
</string>
<string
name=
"module_update_none"
>
Your modules are up to date!
</string>
<string
name=
"update_available"
>
Update Available
</string>
<string
name=
"update_available"
>
Update Available
</string>
<string
name=
"module_installed"
>
@string/home_installed_version
</string>
<string
name=
"module_installed"
>
@string/home_installed_version
</string>
<string
name=
"module_section_online"
>
Online
</string>
<string
name=
"sorting_order"
>
Sorting Order
</string>
<string
name=
"sorting_order"
>
Sorting Order
</string>
<!--Settings -->
<!--Settings -->
...
...
Write
Preview
Markdown
is supported
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