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
89b1fa34
Commit
89b1fa34
authored
Dec 13, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added assigning repo to installed modules to show readme
Close #1089
parent
3bda7cb2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
0 deletions
+35
-0
Repo.kt
app/src/main/java/com/topjohnwu/magisk/data/database/Repo.kt
+3
-0
ModuleRvItem.kt
...om/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
+7
-0
ModuleViewModel.kt
...a/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
+11
-0
item_module_md2.xml
app/src/main/res/layout/item_module_md2.xml
+14
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/data/database/Repo.kt
View file @
89b1fa34
...
...
@@ -14,6 +14,9 @@ interface RepoBase {
@Query
(
"SELECT * FROM repos WHERE id = :id AND versionCode > :versionCode LIMIT 1"
)
fun
getUpdatableRepoById
(
id
:
String
,
versionCode
:
Int
):
Repo
?
@Query
(
"SELECT * FROM repos WHERE id = :id LIMIT 1"
)
fun
getRepoById
(
id
:
String
):
Repo
?
companion
object
{
const
val
LIMIT
=
10
}
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
View file @
89b1fa34
...
...
@@ -170,6 +170,13 @@ class ModuleItem(val item: Module) : ObservableItem<ModuleItem>(), Observable {
override
val
layoutRes
=
R
.
layout
.
item_module_md2
@get
:
Bindable
var
repo
:
Repo
?
=
null
set
(
value
)
{
field
=
value
notifyChange
(
BR
.
repo
)
}
@get
:
Bindable
var
isEnabled
=
item
.
enable
set
(
value
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
View file @
89b1fa34
...
...
@@ -129,6 +129,7 @@ class ModuleViewModel(
override
fun
refresh
()
=
Single
.
fromCallable
{
Module
.
loadModules
()
}
.
map
{
it
.
map
{
ModuleItem
(
it
)
}
}
.
map
{
it
.
order
()
}
.
map
{
it
.
loadDetail
()
}
.
map
{
build
(
active
=
it
,
updatable
=
loadUpdates
(
it
))
}
.
map
{
it
to
items
.
calculateDiff
(
it
)
}
.
applyViewModel
(
this
)
...
...
@@ -222,6 +223,13 @@ class ModuleViewModel(
.
sortedBy
{
it
.
item
.
name
.
toLowerCase
(
currentLocale
)
}
.
toList
()
@WorkerThread
private
fun
List
<
ModuleItem
>.
loadDetail
()
=
onEach
{
module
->
Single
.
fromCallable
{
dao
.
getRepoById
(
module
.
item
.
id
)
!!
}
.
subscribeK
{
module
.
repo
=
it
}
.
add
()
}
private
fun
update
(
repo
:
Repo
,
progress
:
Int
)
=
Single
.
fromCallable
{
itemsRemote
+
itemsSearch
}
.
map
{
it
.
first
{
it
.
item
.
id
==
repo
.
id
}
}
...
...
@@ -263,6 +271,9 @@ class ModuleViewModel(
fun
downloadPressed
(
item
:
RepoItem
)
=
ModuleInstallDialog
(
item
.
item
).
publish
()
fun
installPressed
()
=
InstallExternalModuleEvent
().
publish
()
fun
infoPressed
(
item
:
RepoItem
)
=
OpenChangelogEvent
(
item
.
item
).
publish
()
fun
infoPressed
(
item
:
ModuleItem
)
{
OpenChangelogEvent
(
item
.
repo
?:
return
).
publish
()
}
// ---
...
...
app/src/main/res/layout/item_module_md2.xml
View file @
89b1fa34
...
...
@@ -97,7 +97,21 @@
android:background=
"?colorSurfaceVariant"
app:layout_constraintTop_toBottomOf=
"@+id/module_description"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/module_info"
style=
"@style/WidgetFoundation.Icon"
gone=
"@{item.repo == null}"
android:layout_width=
"wrap_content"
android:alpha=
".5"
android:onClick=
"@{() -> viewModel.infoPressed(item)}"
android:paddingEnd=
"@dimen/l_50"
app:layout_constraintBottom_toBottomOf=
"@+id/module_remove"
app:layout_constraintEnd_toStartOf=
"@+id/module_remove"
app:layout_constraintTop_toTopOf=
"@+id/module_remove"
app:srcCompat=
"@drawable/ic_info"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/module_remove"
style=
"@style/WidgetFoundation.Button.Text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
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