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
89e11c9c
Commit
89e11c9c
authored
Jul 07, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes in flash viewmodel
parent
05cf53fe
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
59 deletions
+25
-59
build.gradle.kts
app/build.gradle.kts
+0
-6
FlashViewModel.kt
...main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt
+24
-52
fragment_flash_md2.xml
app/src/main/res/layout/fragment_flash_md2.xml
+1
-1
No files found.
app/build.gradle.kts
View file @
89e11c9c
import
java.util.*
plugins
{
plugins
{
id
(
"com.android.application"
)
id
(
"com.android.application"
)
kotlin
(
"android"
)
kotlin
(
"android"
)
...
@@ -8,10 +6,6 @@ plugins {
...
@@ -8,10 +6,6 @@ plugins {
id
(
"androidx.navigation.safeargs.kotlin"
)
id
(
"androidx.navigation.safeargs.kotlin"
)
}
}
val
props
=
Properties
()
val
vKotlin
=
"1.3.72"
val
vNav
=
"2.3.0"
kapt
{
kapt
{
correctErrorTypes
=
true
correctErrorTypes
=
true
useBuildCache
=
true
useBuildCache
=
true
...
...
app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt
View file @
89e11c9c
...
@@ -3,9 +3,7 @@ package com.topjohnwu.magisk.ui.flash
...
@@ -3,9 +3,7 @@ package com.topjohnwu.magisk.ui.flash
import
android.Manifest
import
android.Manifest
import
android.content.res.Resources
import
android.content.res.Resources
import
android.net.Uri
import
android.net.Uri
import
android.os.Handler
import
android.view.MenuItem
import
android.view.MenuItem
import
androidx.core.os.postDelayed
import
androidx.databinding.ObservableArrayList
import
androidx.databinding.ObservableArrayList
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Config
...
@@ -27,14 +25,11 @@ import java.io.File
...
@@ -27,14 +25,11 @@ import java.io.File
import
java.util.*
import
java.util.*
class
FlashViewModel
(
class
FlashViewModel
(
private
val
args
:
FlashFragmentArgs
,
args
:
FlashFragmentArgs
,
private
val
resources
:
Resources
private
val
resources
:
Resources
)
:
BaseViewModel
(),
)
:
BaseViewModel
(),
FlashResultListener
{
FlashResultListener
{
val
canShowReboot
=
Shell
.
rootAccess
()
val
showRestartTitle
=
KObservableField
(
false
)
val
showReboot
=
KObservableField
(
Shell
.
rootAccess
())
val
behaviorText
=
KObservableField
(
resources
.
getString
(
R
.
string
.
flashing
))
val
behaviorText
=
KObservableField
(
resources
.
getString
(
R
.
string
.
flashing
))
val
adapter
=
BindingAdapter
<
ConsoleItem
>()
val
adapter
=
BindingAdapter
<
ConsoleItem
>()
...
@@ -42,8 +37,7 @@ class FlashViewModel(
...
@@ -42,8 +37,7 @@ class FlashViewModel(
val
itemBinding
=
itemBindingOf
<
ConsoleItem
>()
val
itemBinding
=
itemBindingOf
<
ConsoleItem
>()
private
val
outItems
=
ObservableArrayList
<
String
>()
private
val
outItems
=
ObservableArrayList
<
String
>()
private
val
logItems
=
private
val
logItems
=
Collections
.
synchronizedList
(
mutableListOf
<
String
>())
Collections
.
synchronizedList
(
mutableListOf
<
String
>())
init
{
init
{
outItems
.
sendUpdatesTo
(
items
)
{
it
.
map
{
ConsoleItem
(
it
)
}
}
outItems
.
sendUpdatesTo
(
items
)
{
it
.
map
{
ConsoleItem
(
it
)
}
}
...
@@ -58,38 +52,25 @@ class FlashViewModel(
...
@@ -58,38 +52,25 @@ class FlashViewModel(
private
fun
startFlashing
(
installer
:
Uri
,
uri
:
Uri
?,
action
:
String
)
{
private
fun
startFlashing
(
installer
:
Uri
,
uri
:
Uri
?,
action
:
String
)
{
when
(
action
)
{
when
(
action
)
{
Const
.
Value
.
FLASH_ZIP
->
Flashing
.
Install
(
Const
.
Value
.
FLASH_ZIP
->
{
installer
,
Flashing
.
Install
(
installer
,
outItems
,
logItems
,
this
).
exec
()
outItems
,
}
logItems
,
Const
.
Value
.
UNINSTALL
->
{
this
showReboot
.
value
=
false
).
exec
()
Flashing
.
Uninstall
(
installer
,
outItems
,
logItems
,
this
).
exec
()
Const
.
Value
.
UNINSTALL
->
Flashing
.
Uninstall
(
}
installer
,
Const
.
Value
.
FLASH_MAGISK
->
{
outItems
,
MagiskInstaller
.
Direct
(
installer
,
outItems
,
logItems
,
this
).
exec
()
logItems
,
}
this
Const
.
Value
.
FLASH_INACTIVE_SLOT
->
{
).
exec
()
MagiskInstaller
.
SecondSlot
(
installer
,
outItems
,
logItems
,
this
).
exec
()
Const
.
Value
.
FLASH_MAGISK
->
MagiskInstaller
.
Direct
(
}
installer
,
Const
.
Value
.
PATCH_FILE
->
{
outItems
,
uri
?:
return
logItems
,
showReboot
.
value
=
false
this
MagiskInstaller
.
Patch
(
installer
,
uri
,
outItems
,
logItems
,
this
).
exec
()
).
exec
()
}
Const
.
Value
.
FLASH_INACTIVE_SLOT
->
MagiskInstaller
.
SecondSlot
(
else
->
back
()
installer
,
outItems
,
logItems
,
this
).
exec
()
Const
.
Value
.
PATCH_FILE
->
MagiskInstaller
.
Patch
(
installer
,
uri
?:
return
,
outItems
,
logItems
,
this
).
exec
()
else
->
backPressed
()
}
}
}
}
...
@@ -99,12 +80,6 @@ class FlashViewModel(
...
@@ -99,12 +80,6 @@ class FlashViewModel(
success
->
resources
.
getString
(
R
.
string
.
done
)
success
->
resources
.
getString
(
R
.
string
.
done
)
else
->
resources
.
getString
(
R
.
string
.
failure
)
else
->
resources
.
getString
(
R
.
string
.
failure
)
}
}
if
(
success
)
{
Handler
().
postDelayed
(
500
)
{
showRestartTitle
.
value
=
true
}
}
}
}
fun
onMenuItemClicked
(
item
:
MenuItem
):
Boolean
{
fun
onMenuItemClicked
(
item
:
MenuItem
):
Boolean
{
...
@@ -135,7 +110,4 @@ class FlashViewModel(
...
@@ -135,7 +110,4 @@ class FlashViewModel(
.
add
()
.
add
()
fun
restartPressed
()
=
reboot
()
fun
restartPressed
()
=
reboot
()
fun
backPressed
()
=
back
()
}
}
app/src/main/res/layout/fragment_flash_md2.xml
View file @
89e11c9c
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
</HorizontalScrollView>
</HorizontalScrollView>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
gone=
"@{!viewModel.loaded || !viewModel.
canS
howReboot}"
gone=
"@{!viewModel.loaded || !viewModel.
s
howReboot}"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|end"
android:layout_gravity=
"bottom|end"
...
...
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