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
706d5306
Commit
706d5306
authored
Apr 09, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename TransitiveText
parent
0f95a7ba
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
112 additions
and
68 deletions
+112
-68
BaseUIFragment.kt
...src/main/java/com/topjohnwu/magisk/arch/BaseUIFragment.kt
+0
-1
SnackbarEvent.kt
...rc/main/java/com/topjohnwu/magisk/events/SnackbarEvent.kt
+5
-5
HomeViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+6
-6
BaseSettingsItem.kt
...java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt
+6
-6
SettingsItems.kt
...in/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
+45
-45
SuperuserViewModel.kt
...a/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
+3
-3
TextHolder.kt
app/src/main/java/com/topjohnwu/magisk/utils/TextHolder.kt
+47
-0
SignApk.java
app/src/main/java/com/topjohnwu/signing/SignApk.java
+0
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/arch/BaseUIFragment.kt
View file @
706d5306
...
@@ -5,7 +5,6 @@ import android.view.KeyEvent
...
@@ -5,7 +5,6 @@ import android.view.KeyEvent
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
androidx.core.graphics.Insets
import
androidx.databinding.DataBindingUtil
import
androidx.databinding.DataBindingUtil
import
androidx.databinding.OnRebindCallback
import
androidx.databinding.OnRebindCallback
import
androidx.databinding.ViewDataBinding
import
androidx.databinding.ViewDataBinding
...
...
app/src/main/java/com/topjohnwu/magisk/events/SnackbarEvent.kt
View file @
706d5306
...
@@ -6,11 +6,11 @@ import com.google.android.material.snackbar.Snackbar
...
@@ -6,11 +6,11 @@ import com.google.android.material.snackbar.Snackbar
import
com.topjohnwu.magisk.arch.ActivityExecutor
import
com.topjohnwu.magisk.arch.ActivityExecutor
import
com.topjohnwu.magisk.arch.BaseUIActivity
import
com.topjohnwu.magisk.arch.BaseUIActivity
import
com.topjohnwu.magisk.arch.ViewEvent
import
com.topjohnwu.magisk.arch.ViewEvent
import
com.topjohnwu.magisk.utils.T
ransitiveText
import
com.topjohnwu.magisk.utils.T
extHolder
import
com.topjohnwu.magisk.utils.asT
ransitive
import
com.topjohnwu.magisk.utils.asT
ext
class
SnackbarEvent
constructor
(
class
SnackbarEvent
constructor
(
private
val
msg
:
T
ransitiveText
,
private
val
msg
:
T
extHolder
,
private
val
length
:
Int
=
Snackbar
.
LENGTH_SHORT
,
private
val
length
:
Int
=
Snackbar
.
LENGTH_SHORT
,
private
val
builder
:
Snackbar
.()
->
Unit
=
{}
private
val
builder
:
Snackbar
.()
->
Unit
=
{}
)
:
ViewEvent
(),
ActivityExecutor
{
)
:
ViewEvent
(),
ActivityExecutor
{
...
@@ -19,13 +19,13 @@ class SnackbarEvent constructor(
...
@@ -19,13 +19,13 @@ class SnackbarEvent constructor(
@StringRes
res
:
Int
,
@StringRes
res
:
Int
,
length
:
Int
=
Snackbar
.
LENGTH_SHORT
,
length
:
Int
=
Snackbar
.
LENGTH_SHORT
,
builder
:
Snackbar
.()
->
Unit
=
{}
builder
:
Snackbar
.()
->
Unit
=
{}
)
:
this
(
res
.
asT
ransitive
(),
length
,
builder
)
)
:
this
(
res
.
asT
ext
(),
length
,
builder
)
constructor
(
constructor
(
msg
:
String
,
msg
:
String
,
length
:
Int
=
Snackbar
.
LENGTH_SHORT
,
length
:
Int
=
Snackbar
.
LENGTH_SHORT
,
builder
:
Snackbar
.()
->
Unit
=
{}
builder
:
Snackbar
.()
->
Unit
=
{}
)
:
this
(
msg
.
asT
ransitive
(),
length
,
builder
)
)
:
this
(
msg
.
asT
ext
(),
length
,
builder
)
private
fun
snackbar
(
private
fun
snackbar
(
...
...
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
View file @
706d5306
...
@@ -16,7 +16,7 @@ import com.topjohnwu.magisk.events.dialog.EnvFixDialog
...
@@ -16,7 +16,7 @@ import com.topjohnwu.magisk.events.dialog.EnvFixDialog
import
com.topjohnwu.magisk.events.dialog.ManagerInstallDialog
import
com.topjohnwu.magisk.events.dialog.ManagerInstallDialog
import
com.topjohnwu.magisk.events.dialog.UninstallDialog
import
com.topjohnwu.magisk.events.dialog.UninstallDialog
import
com.topjohnwu.magisk.ktx.await
import
com.topjohnwu.magisk.ktx.await
import
com.topjohnwu.magisk.utils.asT
ransitive
import
com.topjohnwu.magisk.utils.asT
ext
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.Shell
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
...
@@ -54,13 +54,13 @@ class HomeViewModel(
...
@@ -54,13 +54,13 @@ class HomeViewModel(
val
magiskInstalledVersion
get
()
=
Info
.
env
.
run
{
val
magiskInstalledVersion
get
()
=
Info
.
env
.
run
{
if
(
isActive
)
if
(
isActive
)
"$magiskVersionString ($magiskVersionCode)"
.
asT
ransitive
()
"$magiskVersionString ($magiskVersionCode)"
.
asT
ext
()
else
else
R
.
string
.
not_available
.
asT
ransitive
()
R
.
string
.
not_available
.
asT
ext
()
}
}
@get
:
Bindable
@get
:
Bindable
var
managerRemoteVersion
=
R
.
string
.
loading
.
asT
ransitive
()
var
managerRemoteVersion
=
R
.
string
.
loading
.
asT
ext
()
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
managerRemoteVersion
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
managerRemoteVersion
)
val
managerInstalledVersion
=
Info
.
stub
?.
let
{
val
managerInstalledVersion
=
Info
.
stub
?.
let
{
...
@@ -92,14 +92,14 @@ class HomeViewModel(
...
@@ -92,14 +92,14 @@ class HomeViewModel(
}
}
managerRemoteVersion
=
managerRemoteVersion
=
"${magisk.version} (${magisk.versionCode}) (${stub.versionCode})"
.
asT
ransitive
()
"${magisk.version} (${magisk.versionCode}) (${stub.versionCode})"
.
asT
ext
()
launch
{
launch
{
ensureEnv
()
ensureEnv
()
}
}
}
?:
{
}
?:
{
state
=
State
.
LOADING_FAILED
state
=
State
.
LOADING_FAILED
managerRemoteVersion
=
R
.
string
.
not_available
.
asT
ransitive
()
managerRemoteVersion
=
R
.
string
.
not_available
.
asT
ext
()
}()
}()
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ui/settings/BaseSettingsItem.kt
View file @
706d5306
...
@@ -9,8 +9,8 @@ import androidx.databinding.Bindable
...
@@ -9,8 +9,8 @@ import androidx.databinding.Bindable
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.databinding.ObservableItem
import
com.topjohnwu.magisk.databinding.ObservableItem
import
com.topjohnwu.magisk.utils.T
ransitiveText
import
com.topjohnwu.magisk.utils.T
extHolder
import
com.topjohnwu.magisk.utils.asT
ransitive
import
com.topjohnwu.magisk.utils.asT
ext
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.magisk.view.MagiskDialog
import
com.topjohnwu.magisk.view.MagiskDialog
import
org.koin.core.KoinComponent
import
org.koin.core.KoinComponent
...
@@ -21,9 +21,9 @@ sealed class BaseSettingsItem : ObservableItem<BaseSettingsItem>() {
...
@@ -21,9 +21,9 @@ sealed class BaseSettingsItem : ObservableItem<BaseSettingsItem>() {
override
val
layoutRes
get
()
=
R
.
layout
.
item_settings
override
val
layoutRes
get
()
=
R
.
layout
.
item_settings
open
val
icon
:
Int
get
()
=
0
open
val
icon
:
Int
get
()
=
0
open
val
title
:
T
ransitiveText
get
()
=
TransitiveText
.
EMPTY
open
val
title
:
T
extHolder
get
()
=
TextHolder
.
EMPTY
@get
:
Bindable
@get
:
Bindable
open
val
description
:
T
ransitiveText
get
()
=
TransitiveText
.
EMPTY
open
val
description
:
T
extHolder
get
()
=
TextHolder
.
EMPTY
// ---
// ---
...
@@ -151,8 +151,8 @@ sealed class BaseSettingsItem : ObservableItem<BaseSettingsItem>() {
...
@@ -151,8 +151,8 @@ sealed class BaseSettingsItem : ObservableItem<BaseSettingsItem>() {
open
val
entries
get
()
=
resources
.
getArrayOrEmpty
(
entryRes
)
open
val
entries
get
()
=
resources
.
getArrayOrEmpty
(
entryRes
)
open
val
entryValues
get
()
=
resources
.
getArrayOrEmpty
(
entryValRes
)
open
val
entryValues
get
()
=
resources
.
getArrayOrEmpty
(
entryValRes
)
override
val
description
:
T
ransitiveText
override
val
description
:
T
extHolder
get
()
=
entries
.
getOrNull
(
value
)
?.
asT
ransitive
()
?:
TransitiveText
.
EMPTY
get
()
=
entries
.
getOrNull
(
value
)
?.
asT
ext
()
?:
TextHolder
.
EMPTY
private
fun
Resources
.
getArrayOrEmpty
(
id
:
Int
):
Array
<
String
>
=
private
fun
Resources
.
getArrayOrEmpty
(
id
:
Int
):
Array
<
String
>
=
runCatching
{
getStringArray
(
id
)
}.
getOrDefault
(
emptyArray
())
runCatching
{
getStringArray
(
id
)
}.
getOrDefault
(
emptyArray
())
...
...
app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
View file @
706d5306
...
@@ -20,9 +20,9 @@ import com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding
...
@@ -20,9 +20,9 @@ import com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding
import
com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding
import
com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding
import
com.topjohnwu.magisk.databinding.DialogSettingsUpdateChannelBinding
import
com.topjohnwu.magisk.databinding.DialogSettingsUpdateChannelBinding
import
com.topjohnwu.magisk.ktx.get
import
com.topjohnwu.magisk.ktx.get
import
com.topjohnwu.magisk.utils.T
ransitiveText
import
com.topjohnwu.magisk.utils.T
extHolder
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.utils.asT
ransitive
import
com.topjohnwu.magisk.utils.asT
ext
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.Shell
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.CoroutineScope
...
@@ -31,7 +31,7 @@ import kotlinx.coroutines.launch
...
@@ -31,7 +31,7 @@ import kotlinx.coroutines.launch
// --- Customization
// --- Customization
object
Customization
:
BaseSettingsItem
.
Section
()
{
object
Customization
:
BaseSettingsItem
.
Section
()
{
override
val
title
=
R
.
string
.
settings_customization
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_customization
.
asT
ext
()
}
}
object
Language
:
BaseSettingsItem
.
Selector
()
{
object
Language
:
BaseSettingsItem
.
Selector
()
{
...
@@ -40,7 +40,7 @@ object Language : BaseSettingsItem.Selector() {
...
@@ -40,7 +40,7 @@ object Language : BaseSettingsItem.Selector() {
Config
.
locale
=
entryValues
[
it
]
Config
.
locale
=
entryValues
[
it
]
}
}
override
val
title
=
R
.
string
.
language
.
asT
ransitive
()
override
val
title
=
R
.
string
.
language
.
asT
ext
()
override
var
entries
=
emptyArray
<
String
>()
override
var
entries
=
emptyArray
<
String
>()
override
var
entryValues
=
emptyArray
<
String
>()
override
var
entryValues
=
emptyArray
<
String
>()
...
@@ -58,18 +58,18 @@ object Language : BaseSettingsItem.Selector() {
...
@@ -58,18 +58,18 @@ object Language : BaseSettingsItem.Selector() {
object
Theme
:
BaseSettingsItem
.
Blank
()
{
object
Theme
:
BaseSettingsItem
.
Blank
()
{
override
val
icon
=
R
.
drawable
.
ic_paint
override
val
icon
=
R
.
drawable
.
ic_paint
override
val
title
=
R
.
string
.
section_theme
.
asT
ransitive
()
override
val
title
=
R
.
string
.
section_theme
.
asT
ext
()
}
}
// --- App
// --- App
object
AppSettings
:
BaseSettingsItem
.
Section
()
{
object
AppSettings
:
BaseSettingsItem
.
Section
()
{
override
val
title
=
R
.
string
.
home_app_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
home_app_title
.
asT
ext
()
}
}
object
ClearRepoCache
:
BaseSettingsItem
.
Blank
()
{
object
ClearRepoCache
:
BaseSettingsItem
.
Blank
()
{
override
val
title
=
R
.
string
.
settings_clear_cache_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_clear_cache_title
.
asT
ext
()
override
val
description
=
R
.
string
.
settings_clear_cache_summary
.
asT
ransitive
()
override
val
description
=
R
.
string
.
settings_clear_cache_summary
.
asT
ext
()
override
fun
refresh
()
{
override
fun
refresh
()
{
isEnabled
=
Info
.
env
.
isActive
isEnabled
=
Info
.
env
.
isActive
...
@@ -77,8 +77,8 @@ object ClearRepoCache : BaseSettingsItem.Blank() {
...
@@ -77,8 +77,8 @@ object ClearRepoCache : BaseSettingsItem.Blank() {
}
}
object
Hide
:
BaseSettingsItem
.
Input
()
{
object
Hide
:
BaseSettingsItem
.
Input
()
{
override
val
title
=
R
.
string
.
settings_hide_app_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_hide_app_title
.
asT
ext
()
override
val
description
=
R
.
string
.
settings_hide_app_summary
.
asT
ransitive
()
override
val
description
=
R
.
string
.
settings_hide_app_summary
.
asT
ext
()
override
var
value
=
""
override
var
value
=
""
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
...
@@ -106,21 +106,21 @@ object Hide : BaseSettingsItem.Input() {
...
@@ -106,21 +106,21 @@ object Hide : BaseSettingsItem.Input() {
}
}
object
Restore
:
BaseSettingsItem
.
Blank
()
{
object
Restore
:
BaseSettingsItem
.
Blank
()
{
override
val
title
=
R
.
string
.
settings_restore_app_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_restore_app_title
.
asT
ext
()
override
val
description
=
R
.
string
.
settings_restore_app_summary
.
asT
ransitive
()
override
val
description
=
R
.
string
.
settings_restore_app_summary
.
asT
ext
()
}
}
object
AddShortcut
:
BaseSettingsItem
.
Blank
()
{
object
AddShortcut
:
BaseSettingsItem
.
Blank
()
{
override
val
title
=
R
.
string
.
add_shortcut_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
add_shortcut_title
.
asT
ext
()
override
val
description
=
R
.
string
.
setting_add_shortcut_summary
.
asT
ransitive
()
override
val
description
=
R
.
string
.
setting_add_shortcut_summary
.
asT
ext
()
}
}
object
DownloadPath
:
BaseSettingsItem
.
Input
()
{
object
DownloadPath
:
BaseSettingsItem
.
Input
()
{
override
var
value
=
Config
.
downloadDir
override
var
value
=
Config
.
downloadDir
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
downloadDir
=
it
}
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
downloadDir
=
it
}
override
val
title
=
R
.
string
.
settings_download_path_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_download_path_title
.
asT
ext
()
override
val
description
get
()
=
path
.
asT
ransitive
()
override
val
description
get
()
=
path
.
asT
ext
()
override
val
inputResult
:
String
get
()
=
result
override
val
inputResult
:
String
get
()
=
result
...
@@ -143,24 +143,24 @@ object UpdateChannel : BaseSettingsItem.Selector() {
...
@@ -143,24 +143,24 @@ object UpdateChannel : BaseSettingsItem.Selector() {
Info
.
remote
=
Info
.
EMPTY_REMOTE
Info
.
remote
=
Info
.
EMPTY_REMOTE
}
}
override
val
title
=
R
.
string
.
settings_update_channel_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_update_channel_title
.
asT
ext
()
override
val
entries
:
Array
<
String
>
=
resources
.
getStringArray
(
R
.
array
.
update_channel
).
let
{
override
val
entries
:
Array
<
String
>
=
resources
.
getStringArray
(
R
.
array
.
update_channel
).
let
{
if
(
BuildConfig
.
VERSION_CODE
%
100
==
0
)
if
(
BuildConfig
.
VERSION_CODE
%
100
==
0
)
it
.
toMutableList
().
apply
{
removeAt
(
Config
.
Value
.
CANARY_CHANNEL
)
}.
toTypedArray
()
it
.
toMutableList
().
apply
{
removeAt
(
Config
.
Value
.
CANARY_CHANNEL
)
}.
toTypedArray
()
else
it
else
it
}
}
override
val
description
override
val
description
get
()
=
entries
.
getOrNull
(
value
)
?.
asT
ransitive
()
?:
TransitiveText
.
String
(
entries
[
0
])
get
()
=
entries
.
getOrNull
(
value
)
?.
asT
ext
()
?:
TextHolder
.
String
(
entries
[
0
])
}
}
object
UpdateChannelUrl
:
BaseSettingsItem
.
Input
()
{
object
UpdateChannelUrl
:
BaseSettingsItem
.
Input
()
{
override
val
title
=
R
.
string
.
settings_update_custom
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_update_custom
.
asT
ext
()
override
var
value
=
Config
.
customChannelUrl
override
var
value
=
Config
.
customChannelUrl
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
customChannelUrl
=
it
Config
.
customChannelUrl
=
it
Info
.
remote
=
Info
.
EMPTY_REMOTE
Info
.
remote
=
Info
.
EMPTY_REMOTE
}
}
override
val
description
get
()
=
value
.
asT
ransitive
()
override
val
description
get
()
=
value
.
asT
ext
()
override
val
inputResult
get
()
=
result
override
val
inputResult
get
()
=
result
...
@@ -177,8 +177,8 @@ object UpdateChannelUrl : BaseSettingsItem.Input() {
...
@@ -177,8 +177,8 @@ object UpdateChannelUrl : BaseSettingsItem.Input() {
}
}
object
UpdateChecker
:
BaseSettingsItem
.
Toggle
()
{
object
UpdateChecker
:
BaseSettingsItem
.
Toggle
()
{
override
val
title
=
R
.
string
.
settings_check_update_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_check_update_title
.
asT
ext
()
override
val
description
=
R
.
string
.
settings_check_update_summary
.
asT
ransitive
()
override
val
description
=
R
.
string
.
settings_check_update_summary
.
asT
ext
()
override
var
value
=
Config
.
checkUpdate
override
var
value
=
Config
.
checkUpdate
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
checkUpdate
=
it
Config
.
checkUpdate
=
it
...
@@ -187,8 +187,8 @@ object UpdateChecker : BaseSettingsItem.Toggle() {
...
@@ -187,8 +187,8 @@ object UpdateChecker : BaseSettingsItem.Toggle() {
}
}
object
DoHToggle
:
BaseSettingsItem
.
Toggle
()
{
object
DoHToggle
:
BaseSettingsItem
.
Toggle
()
{
override
val
title
=
R
.
string
.
settings_doh_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_doh_title
.
asT
ext
()
override
val
description
=
R
.
string
.
settings_doh_description
.
asT
ransitive
()
override
val
description
=
R
.
string
.
settings_doh_description
.
asT
ext
()
override
var
value
=
Config
.
doh
override
var
value
=
Config
.
doh
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
doh
=
it
Config
.
doh
=
it
...
@@ -197,35 +197,35 @@ object DoHToggle : BaseSettingsItem.Toggle() {
...
@@ -197,35 +197,35 @@ object DoHToggle : BaseSettingsItem.Toggle() {
// check whether is module already installed beforehand?
// check whether is module already installed beforehand?
object
SystemlessHosts
:
BaseSettingsItem
.
Blank
()
{
object
SystemlessHosts
:
BaseSettingsItem
.
Blank
()
{
override
val
title
=
R
.
string
.
settings_hosts_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_hosts_title
.
asT
ext
()
override
val
description
=
R
.
string
.
settings_hosts_summary
.
asT
ransitive
()
override
val
description
=
R
.
string
.
settings_hosts_summary
.
asT
ext
()
}
}
object
Tapjack
:
BaseSettingsItem
.
Toggle
()
{
object
Tapjack
:
BaseSettingsItem
.
Toggle
()
{
override
val
title
=
R
.
string
.
settings_su_tapjack_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_su_tapjack_title
.
asT
ext
()
override
var
description
=
R
.
string
.
settings_su_tapjack_summary
.
asT
ransitive
()
override
var
description
=
R
.
string
.
settings_su_tapjack_summary
.
asT
ext
()
override
var
value
=
Config
.
suTapjack
override
var
value
=
Config
.
suTapjack
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
suTapjack
=
it
}
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
suTapjack
=
it
}
}
}
object
Biometrics
:
BaseSettingsItem
.
Toggle
()
{
object
Biometrics
:
BaseSettingsItem
.
Toggle
()
{
override
val
title
=
R
.
string
.
settings_su_biometric_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_su_biometric_title
.
asT
ext
()
override
var
value
=
Config
.
suBiometric
override
var
value
=
Config
.
suBiometric
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
suBiometric
=
it
}
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
suBiometric
=
it
}
override
var
description
=
R
.
string
.
settings_su_biometric_summary
.
asT
ransitive
()
override
var
description
=
R
.
string
.
settings_su_biometric_summary
.
asT
ext
()
override
fun
refresh
()
{
override
fun
refresh
()
{
isEnabled
=
BiometricHelper
.
isSupported
isEnabled
=
BiometricHelper
.
isSupported
if
(!
isEnabled
)
{
if
(!
isEnabled
)
{
value
=
false
value
=
false
description
=
R
.
string
.
no_biometric
.
asT
ransitive
()
description
=
R
.
string
.
no_biometric
.
asT
ext
()
}
}
}
}
}
}
object
Reauthenticate
:
BaseSettingsItem
.
Toggle
()
{
object
Reauthenticate
:
BaseSettingsItem
.
Toggle
()
{
override
val
title
=
R
.
string
.
settings_su_reauth_title
.
asT
ransitive
()
override
val
title
=
R
.
string
.
settings_su_reauth_title
.
asT
ext
()
override
val
description
=
R
.
string
.
settings_su_reauth_summary
.
asT
ransitive
()
override
val
description
=
R
.
string
.
settings_su_reauth_summary
.
asT
ext
()
override
var
value
=
Config
.
suReAuth
override
var
value
=
Config
.
suReAuth
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
suReAuth
=
it
}
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
Config
.
suReAuth
=
it
}
...
@@ -237,12 +237,12 @@ object Reauthenticate : BaseSettingsItem.Toggle() {
...
@@ -237,12 +237,12 @@ object Reauthenticate : BaseSettingsItem.Toggle() {
// --- Magisk
// --- Magisk
object
Magisk
:
BaseSettingsItem
.
Section
()
{
object
Magisk
:
BaseSettingsItem
.
Section
()
{
override
val
title
=
R
.
string
.
magisk
.
asT
ransitive
()
override
val
title
=
R
.
string
.
magisk
.
asT
ext
()
}
}
object
MagiskHide
:
BaseSettingsItem
.
Toggle
()
{
object
MagiskHide
:
BaseSettingsItem
.
Toggle
()
{
override
val
title
=
R
.
string
.
magiskhide
.
asT
ransitive
()
override
val
title
=
R
.
string
.
magiskhide
.
asT
ext
()
override
val
description
=
R
.
string
.
settings_magiskhide_summary
.
asT
ransitive
()
override
val
description
=
R
.
string
.
settings_magiskhide_summary
.
asT
ext
()
override
var
value
=
Config
.
magiskHide
override
var
value
=
Config
.
magiskHide
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
set
(
value
)
=
setV
(
value
,
field
,
{
field
=
it
})
{
val
cmd
=
if
(
it
)
"enable"
else
"disable"
val
cmd
=
if
(
it
)
"enable"
else
"disable"
...
@@ -256,11 +256,11 @@ object MagiskHide : BaseSettingsItem.Toggle() {
...
@@ -256,11 +256,11 @@ object MagiskHide : BaseSettingsItem.Toggle() {
// --- Superuser
// --- Superuser
object
Superuser
:
BaseSettingsItem
.
Section
()
{
object
Superuser
:
BaseSettingsItem
.
Section
()
{
override
val
title
=
R
.
string
.
superuser
.
asT
ransitive
()
override
val
title
=
R
.
string
.
superuser
.
asT
ext
()
}
}
object
AccessMode
:
BaseSettingsItem
.
Selector
()
{
object
AccessMode
:
BaseSettingsItem
.
Selector
()
{
override
val
title
=
R
.
string
.
superuser_access
.
asT
ransitive
()
override
val
title
=
R
.
string
.
superuser_access
.
asT
ext
()
override
val
entryRes
=
R
.
array
.
su_access
override
val
entryRes
=
R
.
array
.
su_access
override
var
value
=
Config
.
rootMode
override
var
value
=
Config
.
rootMode
...
@@ -270,7 +270,7 @@ object AccessMode : BaseSettingsItem.Selector() {
...
@@ -270,7 +270,7 @@ object AccessMode : BaseSettingsItem.Selector() {
}
}
object
MultiuserMode
:
BaseSettingsItem
.
Selector
()
{
object
MultiuserMode
:
BaseSettingsItem
.
Selector
()
{
override
val
title
=
R
.
string
.
multiuser_mode
.
asT
ransitive
()
override
val
title
=
R
.
string
.
multiuser_mode
.
asT
ext
()
override
val
entryRes
=
R
.
array
.
multiuser_mode
override
val
entryRes
=
R
.
array
.
multiuser_mode
override
var
value
=
Config
.
suMultiuserMode
override
var
value
=
Config
.
suMultiuserMode
...
@@ -279,7 +279,7 @@ object MultiuserMode : BaseSettingsItem.Selector() {
...
@@ -279,7 +279,7 @@ object MultiuserMode : BaseSettingsItem.Selector() {
}
}
override
val
description
override
val
description
get
()
=
resources
.
getStringArray
(
R
.
array
.
multiuser_summary
)[
value
].
asT
ransitive
()
get
()
=
resources
.
getStringArray
(
R
.
array
.
multiuser_summary
)[
value
].
asT
ext
()
override
fun
refresh
()
{
override
fun
refresh
()
{
isEnabled
=
Const
.
USER_ID
==
0
isEnabled
=
Const
.
USER_ID
==
0
...
@@ -287,7 +287,7 @@ object MultiuserMode : BaseSettingsItem.Selector() {
...
@@ -287,7 +287,7 @@ object MultiuserMode : BaseSettingsItem.Selector() {
}
}
object
MountNamespaceMode
:
BaseSettingsItem
.
Selector
()
{
object
MountNamespaceMode
:
BaseSettingsItem
.
Selector
()
{
override
val
title
=
R
.
string
.
mount_namespace_mode
.
asT
ransitive
()
override
val
title
=
R
.
string
.
mount_namespace_mode
.
asT
ext
()
override
val
entryRes
=
R
.
array
.
namespace
override
val
entryRes
=
R
.
array
.
namespace
override
var
value
=
Config
.
suMntNamespaceMode
override
var
value
=
Config
.
suMntNamespaceMode
...
@@ -296,11 +296,11 @@ object MountNamespaceMode : BaseSettingsItem.Selector() {
...
@@ -296,11 +296,11 @@ object MountNamespaceMode : BaseSettingsItem.Selector() {
}
}
override
val
description
override
val
description
get
()
=
resources
.
getStringArray
(
R
.
array
.
namespace_summary
)[
value
].
asT
ransitive
()
get
()
=
resources
.
getStringArray
(
R
.
array
.
namespace_summary
)[
value
].
asT
ext
()
}
}
object
AutomaticResponse
:
BaseSettingsItem
.
Selector
()
{
object
AutomaticResponse
:
BaseSettingsItem
.
Selector
()
{
override
val
title
=
R
.
string
.
auto_response
.
asT
ransitive
()
override
val
title
=
R
.
string
.
auto_response
.
asT
ext
()
override
val
entryRes
=
R
.
array
.
auto_response
override
val
entryRes
=
R
.
array
.
auto_response
override
var
value
=
Config
.
suAutoResponse
override
var
value
=
Config
.
suAutoResponse
...
@@ -310,7 +310,7 @@ object AutomaticResponse : BaseSettingsItem.Selector() {
...
@@ -310,7 +310,7 @@ object AutomaticResponse : BaseSettingsItem.Selector() {
}
}
object
RequestTimeout
:
BaseSettingsItem
.
Selector
()
{
object
RequestTimeout
:
BaseSettingsItem
.
Selector
()
{
override
val
title
=
R
.
string
.
request_timeout
.
asT
ransitive
()
override
val
title
=
R
.
string
.
request_timeout
.
asT
ext
()
override
val
entryRes
=
R
.
array
.
request_timeout
override
val
entryRes
=
R
.
array
.
request_timeout
override
val
entryValRes
=
R
.
array
.
request_timeout_value
override
val
entryValRes
=
R
.
array
.
request_timeout_value
...
@@ -324,7 +324,7 @@ object RequestTimeout : BaseSettingsItem.Selector() {
...
@@ -324,7 +324,7 @@ object RequestTimeout : BaseSettingsItem.Selector() {
}
}
object
SUNotification
:
BaseSettingsItem
.
Selector
()
{
object
SUNotification
:
BaseSettingsItem
.
Selector
()
{
override
val
title
=
R
.
string
.
superuser_notification
.
asT
ransitive
()
override
val
title
=
R
.
string
.
superuser_notification
.
asT
ext
()
override
val
entryRes
=
R
.
array
.
su_notification
override
val
entryRes
=
R
.
array
.
su_notification
override
var
value
=
Config
.
suNotification
override
var
value
=
Config
.
suNotification
...
...
app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
View file @
706d5306
...
@@ -18,7 +18,7 @@ import com.topjohnwu.magisk.events.SnackbarEvent
...
@@ -18,7 +18,7 @@ import com.topjohnwu.magisk.events.SnackbarEvent
import
com.topjohnwu.magisk.events.dialog.BiometricEvent
import
com.topjohnwu.magisk.events.dialog.BiometricEvent
import
com.topjohnwu.magisk.events.dialog.SuperuserRevokeDialog
import
com.topjohnwu.magisk.events.dialog.SuperuserRevokeDialog
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.utils.asT
ransitive
import
com.topjohnwu.magisk.utils.asT
ext
import
com.topjohnwu.magisk.view.TappableHeadlineItem
import
com.topjohnwu.magisk.view.TappableHeadlineItem
import
com.topjohnwu.magisk.view.TextItem
import
com.topjohnwu.magisk.view.TextItem
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
...
@@ -116,7 +116,7 @@ class SuperuserViewModel(
...
@@ -116,7 +116,7 @@ class SuperuserViewModel(
else
->
R
.
string
.
su_snack_notif_off
else
->
R
.
string
.
su_snack_notif_off
}
}
}
}
SnackbarEvent
(
res
.
asT
ransitive
(
policy
.
appName
)).
publish
()
SnackbarEvent
(
res
.
asT
ext
(
policy
.
appName
)).
publish
()
}
}
fun
togglePolicy
(
item
:
PolicyRvItem
,
enable
:
Boolean
)
{
fun
togglePolicy
(
item
:
PolicyRvItem
,
enable
:
Boolean
)
{
...
@@ -130,7 +130,7 @@ class SuperuserViewModel(
...
@@ -130,7 +130,7 @@ class SuperuserViewModel(
db
.
update
(
app
)
db
.
update
(
app
)
val
res
=
if
(
app
.
policy
==
SuPolicy
.
ALLOW
)
R
.
string
.
su_snack_grant
val
res
=
if
(
app
.
policy
==
SuPolicy
.
ALLOW
)
R
.
string
.
su_snack_grant
else
R
.
string
.
su_snack_deny
else
R
.
string
.
su_snack_deny
SnackbarEvent
(
res
.
asT
ransitive
(
item
.
item
.
appName
)).
publish
()
SnackbarEvent
(
res
.
asT
ext
(
item
.
item
.
appName
)).
publish
()
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/T
ransitiveText
.kt
→
app/src/main/java/com/topjohnwu/magisk/utils/T
extHolder
.kt
View file @
706d5306
...
@@ -3,9 +3,8 @@ package com.topjohnwu.magisk.utils
...
@@ -3,9 +3,8 @@ package com.topjohnwu.magisk.utils
import
android.content.res.Resources
import
android.content.res.Resources
import
android.widget.TextView
import
android.widget.TextView
import
androidx.databinding.BindingAdapter
import
androidx.databinding.BindingAdapter
import
androidx.databinding.InverseBindingAdapter
sealed
class
T
ransitiveText
{
sealed
class
T
extHolder
{
abstract
val
isEmpty
:
Boolean
abstract
val
isEmpty
:
Boolean
abstract
fun
getText
(
resources
:
Resources
):
CharSequence
abstract
fun
getText
(
resources
:
Resources
):
CharSequence
...
@@ -14,21 +13,20 @@ sealed class TransitiveText {
...
@@ -14,21 +13,20 @@ sealed class TransitiveText {
class
String
(
class
String
(
private
val
value
:
CharSequence
private
val
value
:
CharSequence
)
:
T
ransitiveText
()
{
)
:
T
extHolder
()
{
override
val
isEmpty
=
value
.
isEmpty
()
override
val
isEmpty
get
()
=
value
.
isEmpty
()
override
fun
getText
(
resources
:
Resources
)
=
value
override
fun
getText
(
resources
:
Resources
)
=
value
}
}
class
Res
(
class
Res
ource
(
private
val
value
:
Int
,
private
val
value
:
Int
,
private
vararg
val
params
:
Any
private
vararg
val
params
:
Any
)
:
T
ransitiveText
()
{
)
:
T
extHolder
()
{
override
val
isEmpty
=
value
==
0
override
val
isEmpty
get
()
=
value
==
0
override
fun
getText
(
resources
:
Resources
)
=
override
fun
getText
(
resources
:
Resources
)
=
resources
.
getString
(
value
,
*
params
)
resources
.
getString
(
value
,
*
params
)
}
}
...
@@ -39,15 +37,11 @@ sealed class TransitiveText {
...
@@ -39,15 +37,11 @@ sealed class TransitiveText {
}
}
}
}
fun
Int
.
asText
(
vararg
params
:
Any
):
TextHolder
=
TextHolder
.
Resource
(
this
,
*
params
)
fun
Int
.
asTransitive
(
vararg
params
:
Any
):
TransitiveText
=
TransitiveText
.
Res
(
this
,
*
params
)
fun
CharSequence
.
asText
():
TextHolder
=
TextHolder
.
String
(
this
)
fun
CharSequence
.
asTransitive
():
TransitiveText
=
TransitiveText
.
String
(
this
)
@BindingAdapter
(
"android:text"
)
@BindingAdapter
(
"android:text"
)
fun
TextView
.
setText
(
text
:
T
ransitiveText
)
{
fun
TextView
.
setText
(
text
:
T
extHolder
)
{
this
.
text
=
text
.
getText
(
context
.
resources
)
this
.
text
=
text
.
getText
(
context
.
resources
)
}
}
@InverseBindingAdapter
(
attribute
=
"android:text"
,
event
=
"android:textAttrChanged"
)
fun
TextView
.
getTransitiveText
()
=
text
.
asTransitive
()
app/src/main/java/com/topjohnwu/signing/SignApk.java
View file @
706d5306
...
@@ -10,7 +10,6 @@ import org.bouncycastle.cms.CMSSignedData;
...
@@ -10,7 +10,6 @@ import org.bouncycastle.cms.CMSSignedData;
import
org.bouncycastle.cms.CMSSignedDataGenerator
;
import
org.bouncycastle.cms.CMSSignedDataGenerator
;
import
org.bouncycastle.cms.CMSTypedData
;
import
org.bouncycastle.cms.CMSTypedData
;
import
org.bouncycastle.cms.jcajce.JcaSignerInfoGeneratorBuilder
;
import
org.bouncycastle.cms.jcajce.JcaSignerInfoGeneratorBuilder
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.bouncycastle.operator.ContentSigner
;
import
org.bouncycastle.operator.ContentSigner
;
import
org.bouncycastle.operator.OperatorCreationException
;
import
org.bouncycastle.operator.OperatorCreationException
;
import
org.bouncycastle.operator.jcajce.JcaContentSignerBuilder
;
import
org.bouncycastle.operator.jcajce.JcaContentSignerBuilder
;
...
@@ -31,7 +30,6 @@ import java.security.InvalidKeyException;
...
@@ -31,7 +30,6 @@ import java.security.InvalidKeyException;
import
java.security.MessageDigest
;
import
java.security.MessageDigest
;
import
java.security.PrivateKey
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.security.PublicKey
;
import
java.security.Security
;
import
java.security.cert.CertificateEncodingException
;
import
java.security.cert.CertificateEncodingException
;
import
java.security.cert.X509Certificate
;
import
java.security.cert.X509Certificate
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
...
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