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
64f5ff54
Commit
64f5ff54
authored
Feb 28, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use global A/B detection
parent
75877711
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
9 deletions
+4
-9
InstallViewModel.kt
.../java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
+3
-8
fragment_install_md2.xml
app/src/main/res/layout/fragment_install_md2.xml
+1
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
View file @
64f5ff54
...
@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.ui.install
...
@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.ui.install
import
android.net.Uri
import
android.net.Uri
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.download.DownloadService
import
com.topjohnwu.magisk.core.download.DownloadService
import
com.topjohnwu.magisk.core.download.RemoteFileService
import
com.topjohnwu.magisk.core.download.RemoteFileService
import
com.topjohnwu.magisk.extensions.addOnPropertyChangedCallback
import
com.topjohnwu.magisk.extensions.addOnPropertyChangedCallback
...
@@ -11,14 +12,13 @@ import com.topjohnwu.magisk.model.events.RequestFileEvent
...
@@ -11,14 +12,13 @@ import com.topjohnwu.magisk.model.events.RequestFileEvent
import
com.topjohnwu.magisk.ui.base.BaseViewModel
import
com.topjohnwu.magisk.ui.base.BaseViewModel
import
com.topjohnwu.magisk.utils.KObservableField
import
com.topjohnwu.magisk.utils.KObservableField
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.ShellUtils
import
org.koin.core.get
import
org.koin.core.get
import
kotlin.math.roundToInt
import
kotlin.math.roundToInt
class
InstallViewModel
:
BaseViewModel
(
State
.
LOADED
)
{
class
InstallViewModel
:
BaseViewModel
(
State
.
LOADED
)
{
val
isRooted
=
Shell
.
rootAccess
()
val
isRooted
get
()
=
Shell
.
rootAccess
()
val
isAB
=
isABDevice
()
val
isAB
get
()
=
Info
.
isAB
val
step
=
KObservableField
(
0
)
val
step
=
KObservableField
(
0
)
val
method
=
KObservableField
(-
1
)
val
method
=
KObservableField
(-
1
)
...
@@ -64,9 +64,4 @@ class InstallViewModel : BaseViewModel(State.LOADED) {
...
@@ -64,9 +64,4 @@ class InstallViewModel : BaseViewModel(State.LOADED) {
R
.
id
.
method_inactive_slot
->
Configuration
.
Flash
.
Secondary
R
.
id
.
method_inactive_slot
->
Configuration
.
Flash
.
Secondary
else
->
throw
IllegalArgumentException
(
"Unknown value"
)
else
->
throw
IllegalArgumentException
(
"Unknown value"
)
}
}
private
fun
isABDevice
()
=
ShellUtils
.
fastCmd
(
"grep_prop ro.build.ab_update"
)
.
let
{
it
.
isNotEmpty
()
&&
it
.
toBoolean
()
}
}
}
app/src/main/res/layout/fragment_install_md2.xml
View file @
64f5ff54
...
@@ -206,7 +206,7 @@
...
@@ -206,7 +206,7 @@
<com.google.android.material.radiobutton.MaterialRadioButton
<com.google.android.material.radiobutton.MaterialRadioButton
android:id=
"@+id/method_inactive_slot"
android:id=
"@+id/method_inactive_slot"
style=
"@style/WidgetFoundation.RadioButton"
style=
"@style/WidgetFoundation.RadioButton"
gone=
"@{!viewModel.
rooted || !viewModel.a
B}"
gone=
"@{!viewModel.
isRooted || !viewModel.isA
B}"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/install_inactive_slot"
/>
android:text=
"@string/install_inactive_slot"
/>
...
...
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