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
82120cf4
Commit
82120cf4
authored
Nov 11, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added processing of the download states
parent
027a5695
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
0 deletions
+40
-0
ModuleInstallDialog.kt
...pjohnwu/magisk/model/events/dialog/ModuleInstallDialog.kt
+35
-0
ModuleViewModel.kt
...a/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
+4
-0
item_repo_md2.xml
app/src/main/res/layout/item_repo_md2.xml
+1
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/model/events/dialog/ModuleInstallDialog.kt
0 → 100644
View file @
82120cf4
package
com.topjohnwu.magisk.model.events.dialog
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.model.download.DownloadService
import
com.topjohnwu.magisk.model.entity.internal.Configuration
import
com.topjohnwu.magisk.model.entity.internal.DownloadSubject
import
com.topjohnwu.magisk.model.entity.module.Repo
import
com.topjohnwu.magisk.view.MagiskDialog
class
ModuleInstallDialog
(
private
val
item
:
Repo
)
:
DialogEvent
()
{
override
fun
build
(
dialog
:
MagiskDialog
)
{
with
(
dialog
)
{
fun
download
(
install
:
Boolean
)
=
DownloadService
(
context
)
{
val
config
=
if
(
install
)
Configuration
.
Flash
.
Primary
else
Configuration
.
Download
subject
=
DownloadSubject
.
Module
(
item
,
config
)
}
applyTitle
(
context
.
getString
(
R
.
string
.
repo_install_title
,
item
.
name
))
.
applyMessage
(
context
.
getString
(
R
.
string
.
repo_install_msg
,
item
.
downloadFilename
))
.
cancellable
(
true
)
.
applyButton
(
MagiskDialog
.
ButtonType
.
POSITIVE
)
{
titleRes
=
R
.
string
.
install
onClick
{
download
(
true
)
}
}
.
applyButton
(
MagiskDialog
.
ButtonType
.
NEGATIVE
)
{
titleRes
=
R
.
string
.
download
onClick
{
download
(
false
)
}
}
.
reveal
()
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt
View file @
82120cf4
...
...
@@ -195,6 +195,10 @@ class ModuleViewModel(
.
subscribeK
()
}
fun
download
(
item
:
RepoItem
)
{
ModuleInstallDialog
(
item
.
item
).
publish
()
}
// ---
private
fun
cleanup
()
=
Completable
...
...
app/src/main/res/layout/item_repo_md2.xml
View file @
82120cf4
...
...
@@ -96,6 +96,7 @@
android:id=
"@+id/module_download"
style=
"?styleIconPrimary"
android:contentDescription=
"@string/download"
android:onClick=
"@{() -> viewModel.download(item)}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/module_divider"
...
...
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