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
f5aa6a3c
Commit
f5aa6a3c
authored
Aug 10, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update module fragment
Update UI and logic for loading modules
parent
c944277e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
134 additions
and
153 deletions
+134
-153
RepoUpdater.kt
.../main/java/com/topjohnwu/magisk/core/tasks/RepoUpdater.kt
+1
-1
ModuleRvItem.kt
...om/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
+5
-10
CompatHelpers.kt
...c/main/java/com/topjohnwu/magisk/ui/base/CompatHelpers.kt
+1
-1
ModuleViewModel.kt
...in/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt
+109
-117
fragment_module_md2.xml
app/src/main/res/layout/fragment_module_md2.xml
+1
-1
item_section_md2.xml
app/src/main/res/layout/item_section_md2.xml
+10
-16
item_settings_section.xml
app/src/main/res/layout/item_settings_section.xml
+2
-2
styles_md2_appearance.xml
app/src/main/res/values/styles_md2_appearance.xml
+5
-5
No files found.
app/src/main/java/com/topjohnwu/magisk/core/tasks/RepoUpdater.kt
View file @
f5aa6a3c
...
...
@@ -92,7 +92,7 @@ class RepoUpdater(
}
}
suspend
operator
fun
invoke
(
forced
:
Boolean
)
=
withContext
(
Dispatchers
.
IO
)
{
suspend
fun
run
(
forced
:
Boolean
)
=
withContext
(
Dispatchers
.
IO
)
{
val
cached
=
HashSet
(
repoDB
.
repoIDList
).
synchronized
()
when
(
loadPage
(
cached
,
etag
=
repoDB
.
etagKey
))
{
PageResult
.
CACHED
->
if
(
forced
)
forcedReload
(
cached
)
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
View file @
f5aa6a3c
package
com.topjohnwu.magisk.model.entity.recycler
import
androidx.databinding.Bindable
import
androidx.databinding.Observable
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.model.module.Module
...
...
@@ -62,7 +61,7 @@ sealed class RepoItem(val item: Repo) : ObservableItem<RepoItem>() {
}
}
class
ModuleItem
(
val
item
:
Module
)
:
ObservableItem
<
ModuleItem
>()
,
Observable
{
class
ModuleItem
(
val
item
:
Module
)
:
ObservableItem
<
ModuleItem
>()
{
override
val
layoutRes
=
R
.
layout
.
item_module_md2
...
...
@@ -71,19 +70,15 @@ class ModuleItem(val item: Module) : ObservableItem<ModuleItem>(), Observable {
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
repo
)
@get
:
Bindable
var
isEnabled
get
()
=
item
.
enable
set
(
value
)
{
var
isEnabled
=
item
.
enable
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
enabled
)
{
item
.
enable
=
value
notifyPropertyChanged
(
BR
.
enabled
)
}
@get
:
Bindable
var
isRemoved
get
()
=
item
.
remove
set
(
value
)
{
var
isRemoved
=
item
.
remove
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
removed
)
{
item
.
remove
=
value
notifyPropertyChanged
(
BR
.
removed
)
}
val
isUpdated
get
()
=
item
.
updated
...
...
app/src/main/java/com/topjohnwu/magisk/ui/base/CompatHelpers.kt
View file @
f5aa6a3c
...
...
@@ -27,7 +27,7 @@ inline fun <T : ComparableRvItem<*>> filterableListOf(
override
fun
areContentsTheSame
(
oldItem
:
T
,
newItem
:
T
)
=
oldItem
.
genericContentSameAs
(
newItem
)
}).
also
{
it
.
update
(
newItems
.
toList
())
}
fun
<
T
:
ComparableRvItem
<*
>
>
adapterOf
()
=
object
:
BindingRecyclerViewAdapter
<
T
>()
{
fun
<
T
:
RvItem
>
adapterOf
()
=
object
:
BindingRecyclerViewAdapter
<
T
>()
{
override
fun
onBindBinding
(
binding
:
ViewDataBinding
,
variableId
:
Int
,
...
...
app/src/main/java/com/topjohnwu/magisk/ui/module/ModuleViewModel.kt
View file @
f5aa6a3c
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/fragment_module_md2.xml
View file @
f5aa6a3c
...
...
@@ -32,7 +32,7 @@
android:id=
"@+id/module_list"
adapter=
"@{viewModel.adapter}"
dividerHorizontal=
"@{@drawable/divider_l1}"
dividerVertical=
"@{@drawable/divider_l
1
}"
dividerVertical=
"@{@drawable/divider_l
_50
}"
gone=
"@{viewModel.loading && viewModel.items.empty}"
itemBinding=
"@{viewModel.itemBinding}"
items=
"@{viewModel.items}"
...
...
app/src/main/res/layout/item_section_md2.xml
View file @
f5aa6a3c
...
...
@@ -15,42 +15,36 @@
</data>
<
androidx.constraintlayout.widget.Constraint
Layout
<
Linear
Layout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:animateLayoutChanges=
"true"
android:
layout_height=
"wrap_content
"
>
android:
gravity=
"center_vertical
"
>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:id=
"@+id/module_title"
android:layout_weight=
"1"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"@{item.title}"
android:textAppearance=
"@style/AppearanceFoundation.
Body
"
android:textAppearance=
"@style/AppearanceFoundation.
Large
"
android:textColor=
"@color/color_primary_transient"
android:textStyle=
"bold"
tools:text=
"@tools:sample/lorem/random"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/module_button"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
tools:text=
"Installed"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/module_button"
style=
"@style/WidgetFoundation.Button.Text.Secondary"
gon
e=
"@{!item.hasButton}"
invisibl
e=
"@{!item.hasButton}"
android:onClick=
"@{() -> viewModel.sectionPressed(item)}"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/l1"
android:text=
"@{item.button}"
tools:text=
"@tools:sample/lorem"
android:textAllCaps=
"false"
app:icon=
"@{item.icon}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/module_title"
app:layout_constraintTop_toTopOf=
"parent"
/>
tools:text=
"Reboot"
/>
</
androidx.constraintlayout.widget.Constraint
Layout>
</
Linear
Layout>
</layout>
app/src/main/res/layout/item_settings_section.xml
View file @
f5aa6a3c
...
...
@@ -22,7 +22,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@{item.title}"
android:textAppearance=
"@style/AppearanceFoundation.
Display
.Secondary"
android:textAppearance=
"@style/AppearanceFoundation.
Large
.Secondary"
android:textStyle=
"bold"
tools:text=
"@tools:sample/lorem"
/>
...
...
@@ -36,4 +36,4 @@
</LinearLayout>
</layout>
\ No newline at end of file
</layout>
app/src/main/res/values/styles_md2_appearance.xml
View file @
f5aa6a3c
...
...
@@ -2,19 +2,19 @@
<resources>
<!--region Display-->
<style
name=
"AppearanceFoundation.
Display"
parent=
"TextAppearance.AppCompat.Display1
"
>
<style
name=
"AppearanceFoundation.
Large"
parent=
"TextAppearance.AppCompat.Large
"
>
<item
name=
"android:textColor"
>
?attr/colorOnSurface
</item>
</style>
<style
name=
"AppearanceFoundation.
Display
.Secondary"
>
<style
name=
"AppearanceFoundation.
Large
.Secondary"
>
<item
name=
"android:textColor"
>
?colorSecondary
</item>
</style>
<style
name=
"AppearanceFoundation.
Display
.Variant"
>
<style
name=
"AppearanceFoundation.
Large
.Variant"
>
<item
name=
"android:textColor"
>
?attr/colorOnSurfaceVariant
</item>
</style>
<style
name=
"AppearanceFoundation.Display.OnPrimary"
>
<style
name=
"AppearanceFoundation.Display.OnPrimary"
parent=
"TextAppearance.AppCompat.Display1"
>
<item
name=
"android:textColor"
>
?attr/colorOnPrimary
</item>
</style>
...
...
@@ -119,4 +119,4 @@
</style>
<!--endregion-->
</resources>
\ No newline at end of file
</resources>
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