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
f5342a09
Commit
f5342a09
authored
Nov 19, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added back safe mode notice
parent
f72de687
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
6 deletions
+51
-6
ModuleRvItem.kt
...om/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
+13
-0
ModuleViewModel.kt
...a/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
+8
-6
item_safe_mode_notice.xml
app/src/main/res/layout/item_safe_mode_notice.xml
+30
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/ModuleRvItem.kt
View file @
f5342a09
...
...
@@ -81,6 +81,19 @@ class RepoRvItem(val item: Repo) : ComparableRvItem<RepoRvItem>() {
override
fun
itemSameAs
(
other
:
RepoRvItem
):
Boolean
=
item
.
id
==
other
.
item
.
id
}
object
SafeModeNotice
:
ComparableRvItem
<
SafeModeNotice
>()
{
override
val
layoutRes
=
R
.
layout
.
item_safe_mode_notice
override
fun
onBindingBound
(
binding
:
ViewDataBinding
)
{
super
.
onBindingBound
(
binding
)
val
params
=
binding
.
root
.
layoutParams
as
?
StaggeredGridLayoutManager
.
LayoutParams
params
?.
isFullSpan
=
true
}
override
fun
contentSameAs
(
other
:
SafeModeNotice
)
=
this
==
other
override
fun
itemSameAs
(
other
:
SafeModeNotice
)
=
this
===
other
}
object
InstallModule
:
ComparableRvItem
<
InstallModule
>()
{
override
val
layoutRes
=
R
.
layout
.
item_module_download
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
View file @
f5342a09
...
...
@@ -15,10 +15,7 @@ import com.topjohnwu.magisk.model.download.RemoteFileService
import
com.topjohnwu.magisk.model.entity.internal.DownloadSubject
import
com.topjohnwu.magisk.model.entity.module.Module
import
com.topjohnwu.magisk.model.entity.module.Repo
import
com.topjohnwu.magisk.model.entity.recycler.InstallModule
import
com.topjohnwu.magisk.model.entity.recycler.ModuleItem
import
com.topjohnwu.magisk.model.entity.recycler.RepoItem
import
com.topjohnwu.magisk.model.entity.recycler.SectionTitle
import
com.topjohnwu.magisk.model.entity.recycler.*
import
com.topjohnwu.magisk.model.events.InstallExternalModuleEvent
import
com.topjohnwu.magisk.model.events.OpenChangelogEvent
import
com.topjohnwu.magisk.model.events.dialog.ModuleInstallDialog
...
...
@@ -284,12 +281,17 @@ class ModuleViewModel(
active
:
List
<
ModuleItem
>
=
itemsInstalled
,
updatable
:
List
<
RepoItem
.
Update
>
=
itemsUpdatable
,
remote
:
List
<
RepoItem
.
Remote
>
=
itemsRemote
)
=
(
active
+
InstallModule
).
prependIfNotEmpty
{
sectionActive
}
+
)
=
(
active
+
InstallModule
)
.
prependIfNotEmpty
{
sectionActive
}
.
prependIf
(
Config
.
coreOnly
)
{
SafeModeNotice
}
+
updatable
.
prependIfNotEmpty
{
sectionUpdate
}
+
remote
.
prependIfNotEmpty
{
sectionRemote
}
private
fun
<
T
>
List
<
T
>.
prependIf
(
condition
:
Boolean
,
item
:
()
->
T
)
=
if
(
condition
)
listOf
(
item
())
+
this
else
this
private
fun
<
T
>
List
<
T
>.
prependIfNotEmpty
(
item
:
()
->
T
)
=
if
(
isNotEmpty
())
listOf
(
item
())
+
this
else
this
prependIf
(
isNotEmpty
(),
item
)
}
...
...
app/src/main/res/layout/item_safe_mode_notice.xml
0 → 100644
View file @
f5342a09
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"item"
type=
"com.topjohnwu.magisk.model.entity.recycler.SafeModeNotice"
/>
</data>
<com.google.android.material.card.MaterialCardView
style=
"?styleCardNormal"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:cardBackgroundColor=
"?colorError"
>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:padding=
"@dimen/l1"
android:text=
"@string/module_safe_mode_message"
android:textAppearance=
"?appearanceTextCaptionOnPrimary"
android:textStyle=
"bold"
/>
</com.google.android.material.card.MaterialCardView>
</layout>
\ No newline at end of file
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