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
Expand all
Show 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
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.core.graphics.Insets
import
androidx.databinding.DataBindingUtil
import
androidx.databinding.OnRebindCallback
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
import
com.topjohnwu.magisk.arch.ActivityExecutor
import
com.topjohnwu.magisk.arch.BaseUIActivity
import
com.topjohnwu.magisk.arch.ViewEvent
import
com.topjohnwu.magisk.utils.T
ransitiveText
import
com.topjohnwu.magisk.utils.asT
ransitive
import
com.topjohnwu.magisk.utils.T
extHolder
import
com.topjohnwu.magisk.utils.asT
ext
class
SnackbarEvent
constructor
(
private
val
msg
:
T
ransitiveText
,
private
val
msg
:
T
extHolder
,
private
val
length
:
Int
=
Snackbar
.
LENGTH_SHORT
,
private
val
builder
:
Snackbar
.()
->
Unit
=
{}
)
:
ViewEvent
(),
ActivityExecutor
{
...
...
@@ -19,13 +19,13 @@ class SnackbarEvent constructor(
@StringRes
res
:
Int
,
length
:
Int
=
Snackbar
.
LENGTH_SHORT
,
builder
:
Snackbar
.()
->
Unit
=
{}
)
:
this
(
res
.
asT
ransitive
(),
length
,
builder
)
)
:
this
(
res
.
asT
ext
(),
length
,
builder
)
constructor
(
msg
:
String
,
length
:
Int
=
Snackbar
.
LENGTH_SHORT
,
builder
:
Snackbar
.()
->
Unit
=
{}
)
:
this
(
msg
.
asT
ransitive
(),
length
,
builder
)
)
:
this
(
msg
.
asT
ext
(),
length
,
builder
)
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
import
com.topjohnwu.magisk.events.dialog.ManagerInstallDialog
import
com.topjohnwu.magisk.events.dialog.UninstallDialog
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.superuser.Shell
import
kotlinx.coroutines.launch
...
...
@@ -54,13 +54,13 @@ class HomeViewModel(
val
magiskInstalledVersion
get
()
=
Info
.
env
.
run
{
if
(
isActive
)
"$magiskVersionString ($magiskVersionCode)"
.
asT
ransitive
()
"$magiskVersionString ($magiskVersionCode)"
.
asT
ext
()
else
R
.
string
.
not_available
.
asT
ransitive
()
R
.
string
.
not_available
.
asT
ext
()
}
@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
)
val
managerInstalledVersion
=
Info
.
stub
?.
let
{
...
...
@@ -92,14 +92,14 @@ class HomeViewModel(
}
managerRemoteVersion
=
"${magisk.version} (${magisk.versionCode}) (${stub.versionCode})"
.
asT
ransitive
()
"${magisk.version} (${magisk.versionCode}) (${stub.versionCode})"
.
asT
ext
()
launch
{
ensureEnv
()
}
}
?:
{
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
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.databinding.ObservableItem
import
com.topjohnwu.magisk.utils.T
ransitiveText
import
com.topjohnwu.magisk.utils.asT
ransitive
import
com.topjohnwu.magisk.utils.T
extHolder
import
com.topjohnwu.magisk.utils.asT
ext
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.magisk.view.MagiskDialog
import
org.koin.core.KoinComponent
...
...
@@ -21,9 +21,9 @@ sealed class BaseSettingsItem : ObservableItem<BaseSettingsItem>() {
override
val
layoutRes
get
()
=
R
.
layout
.
item_settings
open
val
icon
:
Int
get
()
=
0
open
val
title
:
T
ransitiveText
get
()
=
TransitiveText
.
EMPTY
open
val
title
:
T
extHolder
get
()
=
TextHolder
.
EMPTY
@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>() {
open
val
entries
get
()
=
resources
.
getArrayOrEmpty
(
entryRes
)
open
val
entryValues
get
()
=
resources
.
getArrayOrEmpty
(
entryValRes
)
override
val
description
:
T
ransitiveText
get
()
=
entries
.
getOrNull
(
value
)
?.
asT
ransitive
()
?:
TransitiveText
.
EMPTY
override
val
description
:
T
extHolder
get
()
=
entries
.
getOrNull
(
value
)
?.
asT
ext
()
?:
TextHolder
.
EMPTY
private
fun
Resources
.
getArrayOrEmpty
(
id
:
Int
):
Array
<
String
>
=
runCatching
{
getStringArray
(
id
)
}.
getOrDefault
(
emptyArray
())
...
...
app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
View file @
706d5306
This diff is collapsed.
Click to expand it.
app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
View file @
706d5306
...
...
@@ -18,7 +18,7 @@ import com.topjohnwu.magisk.events.SnackbarEvent
import
com.topjohnwu.magisk.events.dialog.BiometricEvent
import
com.topjohnwu.magisk.events.dialog.SuperuserRevokeDialog
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.TextItem
import
kotlinx.coroutines.Dispatchers
...
...
@@ -116,7 +116,7 @@ class SuperuserViewModel(
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
)
{
...
...
@@ -130,7 +130,7 @@ class SuperuserViewModel(
db
.
update
(
app
)
val
res
=
if
(
app
.
policy
==
SuPolicy
.
ALLOW
)
R
.
string
.
su_snack_grant
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
import
android.content.res.Resources
import
android.widget.TextView
import
androidx.databinding.BindingAdapter
import
androidx.databinding.InverseBindingAdapter
sealed
class
T
ransitiveText
{
sealed
class
T
extHolder
{
abstract
val
isEmpty
:
Boolean
abstract
fun
getText
(
resources
:
Resources
):
CharSequence
...
...
@@ -14,21 +13,20 @@ sealed class TransitiveText {
class
String
(
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
}
class
Res
(
class
Res
ource
(
private
val
value
:
Int
,
private
vararg
val
params
:
Any
)
:
T
ransitiveText
()
{
)
:
T
extHolder
()
{
override
val
isEmpty
=
value
==
0
override
fun
getText
(
resources
:
Resources
)
=
resources
.
getString
(
value
,
*
params
)
override
val
isEmpty
get
()
=
value
==
0
override
fun
getText
(
resources
:
Resources
)
=
resources
.
getString
(
value
,
*
params
)
}
...
...
@@ -39,15 +37,11 @@ sealed class TransitiveText {
}
}
fun
Int
.
asTransitive
(
vararg
params
:
Any
):
TransitiveText
=
TransitiveText
.
Res
(
this
,
*
params
)
fun
CharSequence
.
asTransitive
():
TransitiveText
=
TransitiveText
.
String
(
this
)
fun
Int
.
asText
(
vararg
params
:
Any
):
TextHolder
=
TextHolder
.
Resource
(
this
,
*
params
)
fun
CharSequence
.
asText
():
TextHolder
=
TextHolder
.
String
(
this
)
@BindingAdapter
(
"android:text"
)
fun
TextView
.
setText
(
text
:
T
ransitiveText
)
{
fun
TextView
.
setText
(
text
:
T
extHolder
)
{
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;
import
org.bouncycastle.cms.CMSSignedDataGenerator
;
import
org.bouncycastle.cms.CMSTypedData
;
import
org.bouncycastle.cms.jcajce.JcaSignerInfoGeneratorBuilder
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.bouncycastle.operator.ContentSigner
;
import
org.bouncycastle.operator.OperatorCreationException
;
import
org.bouncycastle.operator.jcajce.JcaContentSignerBuilder
;
...
...
@@ -31,7 +30,6 @@ import java.security.InvalidKeyException;
import
java.security.MessageDigest
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.security.Security
;
import
java.security.cert.CertificateEncodingException
;
import
java.security.cert.X509Certificate
;
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