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
19fd4dd8
Commit
19fd4dd8
authored
Nov 06, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partially reverted removing "moveToState"
parent
f941f5c0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
ModuleRvItem.kt
...om/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
+1
-1
ModuleViewModel.kt
...a/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
+12
-6
item_module_md2.xml
app/src/main/res/layout/item_module_md2.xml
+2
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
View file @
19fd4dd8
...
@@ -107,7 +107,7 @@ class ModuleItem(val item: Module) : ObservableItem<ModuleItem>(), Observable {
...
@@ -107,7 +107,7 @@ class ModuleItem(val item: Module) : ObservableItem<ModuleItem>(), Observable {
fun
delete
(
viewModel
:
ModuleViewModel
)
{
fun
delete
(
viewModel
:
ModuleViewModel
)
{
isRemoved
=
!
isRemoved
isRemoved
=
!
isRemoved
viewModel
.
updateState
(
)
viewModel
.
moveToState
(
this
)
}
}
override
fun
contentSameAs
(
other
:
ModuleItem
):
Boolean
=
item
.
version
==
other
.
item
.
version
override
fun
contentSameAs
(
other
:
ModuleItem
):
Boolean
=
item
.
version
==
other
.
item
.
version
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
View file @
19fd4dd8
...
@@ -53,12 +53,18 @@ class ModuleViewModel : CompatViewModel() {
...
@@ -53,12 +53,18 @@ class ModuleViewModel : CompatViewModel() {
return
me
return
me
}
}
fun
updateState
()
{
fun
moveToState
(
item
:
ModuleItem
)
{
// I don't feel like bothering with moving every single item to its updated state,
items
.
removeAll
{
it
.
itemSameAs
(
item
)
}
// so this kind of wasteful operation helps with that
itemsPending
.
removeAll
{
it
.
itemSameAs
(
item
)
}
Single
.
fromCallable
{
items
+
itemsPending
}
.
map
{
it
.
order
()
}
if
(
item
.
isModified
)
{
.
subscribeK
{
it
.
forEach
{
it
.
update
()
}
}
itemsPending
}
else
{
items
}.
apply
{
add
(
item
)
sortWith
(
compareBy
{
it
.
item
.
name
.
toLowerCase
(
currentLocale
)
})
}
}
}
private
enum
class
ModuleState
{
private
enum
class
ModuleState
{
...
...
app/src/main/res/layout/item_module_md2.xml
View file @
19fd4dd8
...
@@ -93,7 +93,8 @@
...
@@ -93,7 +93,8 @@
android:alpha=
".5"
android:alpha=
".5"
android:onClick=
"@{(v) -> item.delete(viewModel)}"
android:onClick=
"@{(v) -> item.delete(viewModel)}"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"@+id/module_version_author"
app:layout_constraintTop_toTopOf=
"@+id/module_title"
app:srcCompat=
"@drawable/ic_delete_restore"
/>
app:srcCompat=
"@drawable/ic_delete_restore"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
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