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
c7e30ac6
Commit
c7e30ac6
authored
Aug 10, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update superuser list
parent
f5e54794
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
203 additions
and
215 deletions
+203
-215
PolicyRvItem.kt
...om/topjohnwu/magisk/model/entity/recycler/PolicyRvItem.kt
+27
-20
SuperuserViewModel.kt
...a/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
+9
-11
DataBindingAdapters.kt
...in/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt
+5
-0
fragment_superuser_md2.xml
app/src/main/res/layout/fragment_superuser_md2.xml
+5
-7
item_policy_md2.xml
app/src/main/res/layout/item_policy_md2.xml
+157
-177
No files found.
app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/PolicyRvItem.kt
View file @
c7e30ac6
...
@@ -9,53 +9,60 @@ import com.topjohnwu.magisk.databinding.ObservableItem
...
@@ -9,53 +9,60 @@ import com.topjohnwu.magisk.databinding.ObservableItem
import
com.topjohnwu.magisk.ui.superuser.SuperuserViewModel
import
com.topjohnwu.magisk.ui.superuser.SuperuserViewModel
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.magisk.utils.set
class
PolicyItem
(
val
item
:
MagiskPolicy
,
val
icon
:
Drawable
)
:
ObservableItem
<
PolicyItem
>()
{
class
PolicyItem
(
val
item
:
MagiskPolicy
,
val
icon
:
Drawable
,
val
viewModel
:
SuperuserViewModel
)
:
ObservableItem
<
PolicyItem
>()
{
override
val
layoutRes
=
R
.
layout
.
item_policy_md2
override
val
layoutRes
=
R
.
layout
.
item_policy_md2
@get
:
Bindable
@get
:
Bindable
var
isExpanded
=
false
var
isExpanded
=
false
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
expanded
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
expanded
)
@get
:
Bindabl
e
// This property hosts the policy stat
e
var
isEnabled
=
item
.
policy
==
MagiskPolicy
.
ALLOW
var
policyState
=
item
.
policy
==
MagiskPolicy
.
ALLOW
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
enabled
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
enabled
)
// This property binds with the UI state
@get
:
Bindable
var
isEnabled
get
()
=
policyState
set
(
value
)
=
set
(
value
,
policyState
,
{
viewModel
.
togglePolicy
(
this
,
it
)
},
BR
.
enabled
)
@get
:
Bindable
@get
:
Bindable
var
shouldNotify
=
item
.
notification
var
shouldNotify
=
item
.
notification
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
shouldNotify
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
shouldNotify
)
{
viewModel
.
updatePolicy
(
updatedPolicy
,
isLogging
=
false
)
}
@get
:
Bindable
@get
:
Bindable
var
shouldLog
=
item
.
logging
var
shouldLog
=
item
.
logging
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
shouldLog
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
shouldLog
)
{
viewModel
.
updatePolicy
(
updatedPolicy
,
isLogging
=
true
)
}
private
val
updatedPolicy
private
val
updatedPolicy
get
()
=
item
.
copy
(
get
()
=
item
.
copy
(
policy
=
if
(
isEnabled
)
MagiskPolicy
.
ALLOW
else
MagiskPolicy
.
DENY
,
policy
=
if
(
policyState
)
MagiskPolicy
.
ALLOW
else
MagiskPolicy
.
DENY
,
notification
=
shouldNotify
,
notification
=
shouldNotify
,
logging
=
shouldLog
logging
=
shouldLog
)
)
fun
toggle
(
viewModel
:
SuperuserViewModel
)
{
fun
toggleExpand
()
{
if
(
isExpanded
)
{
toggle
()
return
}
isEnabled
=
!
isEnabled
viewModel
.
togglePolicy
(
this
,
isEnabled
)
}
fun
toggle
()
{
isExpanded
=
!
isExpanded
isExpanded
=
!
isExpanded
}
}
fun
toggleNotify
(
viewModel
:
SuperuserViewModel
)
{
fun
toggleNotify
()
{
shouldNotify
=
!
shouldNotify
shouldNotify
=
!
shouldNotify
viewModel
.
updatePolicy
(
updatedPolicy
,
isLogging
=
false
)
}
}
fun
toggleLog
(
viewModel
:
SuperuserViewModel
)
{
fun
toggleLog
()
{
shouldLog
=
!
shouldLog
shouldLog
=
!
shouldLog
viewModel
.
updatePolicy
(
updatedPolicy
,
isLogging
=
true
)
}
fun
revoke
()
{
viewModel
.
deletePressed
(
this
)
}
}
override
fun
contentSameAs
(
other
:
PolicyItem
)
=
itemSameAs
(
other
)
override
fun
contentSameAs
(
other
:
PolicyItem
)
=
itemSameAs
(
other
)
...
...
app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
View file @
c7e30ac6
...
@@ -35,9 +35,7 @@ class SuperuserViewModel(
...
@@ -35,9 +35,7 @@ class SuperuserViewModel(
private
val
itemNoData
=
TextItem
(
R
.
string
.
superuser_policy_none
)
private
val
itemNoData
=
TextItem
(
R
.
string
.
superuser_policy_none
)
private
val
itemsPolicies
=
diffListOf
<
PolicyItem
>()
private
val
itemsPolicies
=
diffListOf
<
PolicyItem
>()
private
val
itemsHelpers
=
ObservableArrayList
<
TextItem
>().
also
{
private
val
itemsHelpers
=
ObservableArrayList
<
TextItem
>()
it
.
add
(
itemNoData
)
}
val
adapter
=
adapterOf
<
ComparableRvItem
<*>>()
val
adapter
=
adapterOf
<
ComparableRvItem
<*>>()
val
items
=
MergeObservableList
<
ComparableRvItem
<*>>()
val
items
=
MergeObservableList
<
ComparableRvItem
<*>>()
...
@@ -45,7 +43,6 @@ class SuperuserViewModel(
...
@@ -45,7 +43,6 @@ class SuperuserViewModel(
.
insertList
(
itemsHelpers
)
.
insertList
(
itemsHelpers
)
.
insertList
(
itemsPolicies
)
.
insertList
(
itemsPolicies
)
val
itemBinding
=
itemBindingOf
<
ComparableRvItem
<*>>
{
val
itemBinding
=
itemBindingOf
<
ComparableRvItem
<*>>
{
it
.
bindExtra
(
BR
.
viewModel
,
this
)
it
.
bindExtra
(
BR
.
listener
,
this
)
it
.
bindExtra
(
BR
.
listener
,
this
)
}
}
...
@@ -55,7 +52,7 @@ class SuperuserViewModel(
...
@@ -55,7 +52,7 @@ class SuperuserViewModel(
state
=
State
.
LOADING
state
=
State
.
LOADING
val
(
policies
,
diff
)
=
withContext
(
Dispatchers
.
Default
)
{
val
(
policies
,
diff
)
=
withContext
(
Dispatchers
.
Default
)
{
val
policies
=
db
.
fetchAll
{
val
policies
=
db
.
fetchAll
{
PolicyItem
(
it
,
it
.
applicationInfo
.
loadIcon
(
packageManager
))
PolicyItem
(
it
,
it
.
applicationInfo
.
loadIcon
(
packageManager
)
,
this
@SuperuserViewModel
)
}.
sortedWith
(
compareBy
(
}.
sortedWith
(
compareBy
(
{
it
.
item
.
appName
.
toLowerCase
(
currentLocale
)
},
{
it
.
item
.
appName
.
toLowerCase
(
currentLocale
)
},
{
it
.
item
.
packageName
}
{
it
.
item
.
packageName
}
...
@@ -63,15 +60,15 @@ class SuperuserViewModel(
...
@@ -63,15 +60,15 @@ class SuperuserViewModel(
policies
to
itemsPolicies
.
calculateDiff
(
policies
)
policies
to
itemsPolicies
.
calculateDiff
(
policies
)
}
}
itemsPolicies
.
update
(
policies
,
diff
)
itemsPolicies
.
update
(
policies
,
diff
)
if
(
itemsPolicies
.
isNotEmpty
())
{
if
(
itemsPolicies
.
isNotEmpty
())
itemsHelpers
.
remove
(
itemNoData
)
itemsHelpers
.
clear
()
}
else
if
(
itemsHelpers
.
isEmpty
())
itemsHelpers
.
add
(
itemNoData
)
state
=
State
.
LOADED
state
=
State
.
LOADED
}
}
// ---
// ---
@Suppress
(
"REDUNDANT_ELSE_IN_WHEN"
)
override
fun
onItemPressed
(
item
:
TappableHeadlineItem
)
=
when
(
item
)
{
override
fun
onItemPressed
(
item
:
TappableHeadlineItem
)
=
when
(
item
)
{
TappableHeadlineItem
.
Hide
->
hidePressed
()
TappableHeadlineItem
.
Hide
->
hidePressed
()
else
->
Unit
else
->
Unit
...
@@ -120,6 +117,8 @@ class SuperuserViewModel(
...
@@ -120,6 +117,8 @@ class SuperuserViewModel(
fun
togglePolicy
(
item
:
PolicyItem
,
enable
:
Boolean
)
{
fun
togglePolicy
(
item
:
PolicyItem
,
enable
:
Boolean
)
{
fun
updateState
()
{
fun
updateState
()
{
item
.
policyState
=
enable
val
policy
=
if
(
enable
)
MagiskPolicy
.
ALLOW
else
MagiskPolicy
.
DENY
val
policy
=
if
(
enable
)
MagiskPolicy
.
ALLOW
else
MagiskPolicy
.
DENY
val
app
=
item
.
item
.
copy
(
policy
=
policy
)
val
app
=
item
.
item
.
copy
(
policy
=
policy
)
...
@@ -127,14 +126,13 @@ class SuperuserViewModel(
...
@@ -127,14 +126,13 @@ class SuperuserViewModel(
db
.
update
(
app
)
db
.
update
(
app
)
val
res
=
if
(
app
.
policy
==
MagiskPolicy
.
ALLOW
)
R
.
string
.
su_snack_grant
val
res
=
if
(
app
.
policy
==
MagiskPolicy
.
ALLOW
)
R
.
string
.
su_snack_grant
else
R
.
string
.
su_snack_deny
else
R
.
string
.
su_snack_deny
SnackbarEvent
(
resources
.
getString
(
res
).
format
(
item
.
item
.
appName
))
SnackbarEvent
(
resources
.
getString
(
res
).
format
(
item
.
item
.
appName
))
.
publish
()
}
}
}
}
if
(
BiometricHelper
.
isEnabled
)
{
if
(
BiometricHelper
.
isEnabled
)
{
BiometricDialog
{
BiometricDialog
{
onSuccess
{
updateState
()
}
onSuccess
{
updateState
()
}
onFailure
{
item
.
isEnabled
=
!
item
.
isEnabled
}
}.
publish
()
}.
publish
()
}
else
{
}
else
{
updateState
()
updateState
()
...
...
app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt
View file @
c7e30ac6
...
@@ -37,6 +37,11 @@ fun setImageResource(view: ImageView, @DrawableRes resId: Int) {
...
@@ -37,6 +37,11 @@ fun setImageResource(view: ImageView, @DrawableRes resId: Int) {
view
.
setImageResource
(
resId
)
view
.
setImageResource
(
resId
)
}
}
@BindingAdapter
(
"srcCompat"
)
fun
setImageResource
(
view
:
ImageView
,
drawable
:
Drawable
)
{
view
.
setImageDrawable
(
drawable
)
}
@BindingAdapter
(
"movieBehavior"
,
"movieBehaviorText"
)
@BindingAdapter
(
"movieBehavior"
,
"movieBehaviorText"
)
fun
setMovieBehavior
(
view
:
TextView
,
isMovieBehavior
:
Boolean
,
text
:
String
)
{
fun
setMovieBehavior
(
view
:
TextView
,
isMovieBehavior
:
Boolean
,
text
:
String
)
{
(
view
.
tag
as
?
Job
)
?.
cancel
()
(
view
.
tag
as
?
Job
)
?.
cancel
()
...
...
app/src/main/res/layout/fragment_superuser_md2.xml
View file @
c7e30ac6
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
android:id=
"@+id/superuser_list"
android:id=
"@+id/superuser_list"
adapter=
"@{viewModel.adapter}"
adapter=
"@{viewModel.adapter}"
dividerHorizontal=
"@{@drawable/divider_l1}"
dividerHorizontal=
"@{@drawable/divider_l1}"
dividerVertical=
"@{@drawable/divider_l
1
}"
dividerVertical=
"@{@drawable/divider_l
_50
}"
goneUnless=
"@{viewModel.loaded || !viewModel.items.empty}"
goneUnless=
"@{viewModel.loaded || !viewModel.items.empty}"
itemBinding=
"@{viewModel.itemBinding}"
itemBinding=
"@{viewModel.itemBinding}"
items=
"@{viewModel.items}"
items=
"@{viewModel.items}"
...
@@ -33,10 +33,7 @@
...
@@ -33,10 +33,7 @@
android:paddingTop=
"@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l1}"
android:paddingTop=
"@{viewModel.insets.top + (int) @dimen/internal_action_bar_size + (int) @dimen/l1}"
android:paddingBottom=
"@{viewModel.insets.bottom + (int) @dimen/l2}"
android:paddingBottom=
"@{viewModel.insets.bottom + (int) @dimen/l2}"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
app:spanCount=
"2"
tools:listitem=
"@layout/item_policy_md2"
/>
tools:layout_marginTop=
"24dp"
tools:listitem=
"@layout/item_policy_md2"
tools:paddingTop=
"@dimen/l1"
/>
<LinearLayout
<LinearLayout
goneUnless=
"@{viewModel.loading && viewModel.items.empty}"
goneUnless=
"@{viewModel.loading && viewModel.items.empty}"
...
@@ -44,9 +41,10 @@
...
@@ -44,9 +41,10 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
android:gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
tools:visibility=
"gone"
>
<
androidx.appcompat.widget.AppCompat
TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/safetynet_attest_loading"
android:text=
"@string/safetynet_attest_loading"
...
...
app/src/main/res/layout/item_policy_md2.xml
View file @
c7e30ac6
...
@@ -9,190 +9,170 @@
...
@@ -9,190 +9,170 @@
name=
"item"
name=
"item"
type=
"com.topjohnwu.magisk.model.entity.recycler.PolicyItem"
/>
type=
"com.topjohnwu.magisk.model.entity.recycler.PolicyItem"
/>
<variable
name=
"viewModel"
type=
"com.topjohnwu.magisk.ui.superuser.SuperuserViewModel"
/>
</data>
</data>
<com.google.android.material.card.MaterialCardView
<FrameLayout
style=
"@style/WidgetFoundation.Card.Variant"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
>
android:alpha=
"@{item.isEnabled() ? 1f : .5f}"
android:onClick=
"@{() -> item.toggle(viewModel)}"
<com.google.android.material.card.MaterialCardView
android:onLongClick=
"@{() -> item.toggle()}"
style=
"@style/WidgetFoundation.Card.Variant"
tools:layout_marginBottom=
"@dimen/l1"
tools:layout_marginEnd=
"@dimen/l1"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
android:alpha=
"@{item.enabled ? 1f : .5f}"
android:onClick=
"@{() -> item.toggleExpand()}"
>
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/policy_app_icon"
style=
"@style/WidgetFoundation.Image"
android:layout_marginStart=
"@dimen/l1"
android:layout_marginTop=
"@dimen/l1"
android:layout_marginBottom=
"@dimen/l1"
android:src=
"@{item.icon}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0"
tools:srcCompat=
"@drawable/ic_logo"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/policy_app_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/margin_generic"
android:layout_marginRight=
"@dimen/margin_generic"
android:ellipsize=
"middle"
android:gravity=
"start"
android:maxLines=
"2"
android:text=
"@{item.item.appName}"
android:textAppearance=
"@style/AppearanceFoundation.Body"
android:textIsSelectable=
"false"
android:textStyle=
"bold"
app:layout_constraintEnd_toStartOf=
"@+id/policy_indicator"
app:layout_constraintStart_toEndOf=
"@+id/policy_app_icon"
app:layout_constraintTop_toTopOf=
"@+id/policy_app_icon"
tools:text=
"@string/app_name"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/policy_package_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"@dimen/l1"
android:ellipsize=
"middle"
android:gravity=
"start"
android:maxLines=
"2"
android:text=
"@{item.item.packageName}"
android:textAppearance=
"@style/AppearanceFoundation.Caption.Variant"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"@id/policy_app_name"
app:layout_constraintStart_toStartOf=
"@id/policy_app_name"
app:layout_constraintTop_toBottomOf=
"@id/policy_app_name"
app:layout_constraintVertical_bias=
"0"
tools:text=
"com.topjohnwu.magisk"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/policy_indicator"
style=
"@style/WidgetFoundation.Switch"
isSelected=
"@{item.enabled}"
android:layout_marginEnd=
"@dimen/l1"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/policy_expand_container"
gone=
"@{!item.isExpanded}"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"?colorSurfaceVariant"
android:orientation=
"vertical"
>
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_width=
"match_parent"
app:layout_constraintStart_toStartOf=
"parent"
android:layout_height=
"wrap_content"
>
app:layout_constraintTop_toBottomOf=
"@+id/policy_package_name"
tools:visibility=
"visible"
>
<ImageView
android:id=
"@+id/policy_app_icon"
<com.google.android.material.button.MaterialButton
style=
"@style/WidgetFoundation.Image"
android:id=
"@+id/policy_notify"
android:layout_marginStart=
"@dimen/l1"
style=
"@style/WidgetFoundation.Button.Text"
android:layout_marginTop=
"@dimen/l1"
isSelected=
"@{item.shouldNotify}"
android:layout_marginBottom=
"@dimen/l1"
android:layout_width=
"0dp"
srcCompat=
"@{item.icon}"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
android:minHeight=
"24dp"
app:layout_constraintStart_toStartOf=
"parent"
android:onClick=
"@{() -> item.toggleNotify(viewModel)}"
app:layout_constraintTop_toTopOf=
"parent"
android:text=
"@string/superuser_toggle_notification"
app:layout_constraintVertical_bias=
"0"
android:textAllCaps=
"false"
tools:srcCompat=
"@drawable/ic_logo"
/>
android:textAppearance=
"@style/AppearanceFoundation.Tiny"
android:textColor=
"@color/color_state_primary_transient"
<TextView
app:icon=
"@drawable/ic_notifications_md2"
android:id=
"@+id/policy_app_name"
app:iconTint=
"@color/color_state_primary_transient"
android:layout_width=
"0dp"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_height=
"wrap_content"
app:layout_constraintEnd_toStartOf=
"@+id/policy_log"
android:layout_marginLeft=
"@dimen/margin_generic"
app:layout_constraintStart_toStartOf=
"parent"
android:layout_marginRight=
"@dimen/margin_generic"
app:layout_constraintTop_toTopOf=
"parent"
android:ellipsize=
"middle"
app:tint=
"@color/color_state_primary_transient"
/>
android:gravity=
"start"
android:maxLines=
"2"
<View
android:text=
"@{item.item.appName}"
android:layout_width=
"1dp"
android:textAppearance=
"@style/AppearanceFoundation.Body"
android:layout_height=
"0dp"
android:textIsSelectable=
"false"
android:layout_marginTop=
"@dimen/l_50"
android:textStyle=
"bold"
android:layout_marginBottom=
"@dimen/l_50"
app:layout_constraintEnd_toStartOf=
"@+id/policy_indicator"
android:background=
"?colorSurface"
app:layout_constraintStart_toEndOf=
"@+id/policy_app_icon"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/policy_app_icon"
app:layout_constraintStart_toEndOf=
"@+id/policy_notify"
tools:text=
"@string/app_name"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
<com.google.android.material.button.MaterialButton
android:id=
"@+id/policy_package_name"
android:id=
"@+id/policy_log"
android:layout_width=
"0dp"
style=
"@style/WidgetFoundation.Button.Text"
android:layout_height=
"wrap_content"
isSelected=
"@{item.shouldLog}"
android:layout_marginBottom=
"@dimen/l1"
android:layout_width=
"0dp"
android:ellipsize=
"middle"
android:layout_height=
"wrap_content"
android:gravity=
"start"
android:minHeight=
"24dp"
android:maxLines=
"2"
android:onClick=
"@{() -> item.toggleLog(viewModel)}"
android:text=
"@{item.item.packageName}"
android:text=
"@string/logs"
android:textAppearance=
"@style/AppearanceFoundation.Caption.Variant"
android:textAllCaps=
"false"
android:textColor=
"@android:color/tertiary_text_dark"
android:textAppearance=
"@style/AppearanceFoundation.Tiny"
android:textIsSelectable=
"false"
android:textColor=
"@color/color_state_primary_transient"
app:layout_constraintBottom_toBottomOf=
"parent"
app:icon=
"@drawable/ic_bug_md2"
app:layout_constraintEnd_toEndOf=
"@id/policy_app_name"
app:iconTint=
"@color/color_state_primary_transient"
app:layout_constraintStart_toStartOf=
"@id/policy_app_name"
app:layout_constrainedWidth=
"true"
app:layout_constraintTop_toBottomOf=
"@id/policy_app_name"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintVertical_bias=
"0"
app:layout_constraintEnd_toStartOf=
"@+id/policy_delete"
tools:text=
"com.topjohnwu.magisk"
/>
app:layout_constraintStart_toEndOf=
"@+id/policy_notify"
app:layout_constraintTop_toTopOf=
"parent"
<com.google.android.material.switchmaterial.SwitchMaterial
app:tint=
"@color/color_state_primary_transient"
/>
android:id=
"@+id/policy_indicator"
android:layout_width=
"wrap_content"
<View
android:layout_height=
"wrap_content"
android:layout_width=
"1dp"
android:checked=
"@={item.enabled}"
android:layout_height=
"0dp"
android:layout_marginEnd=
"@dimen/l1"
android:layout_marginTop=
"@dimen/l_50"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_marginBottom=
"@dimen/l_50"
app:layout_constraintEnd_toEndOf=
"parent"
android:background=
"?colorSurface"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/policy_log"
</androidx.constraintlayout.widget.ConstraintLayout>
app:layout_constraintTop_toTopOf=
"parent"
/>
<LinearLayout
<com.google.android.material.button.MaterialButton
android:id=
"@+id/policy_expand_container"
android:id=
"@+id/policy_delete"
android:orientation=
"horizontal"
style=
"@style/WidgetFoundation.Button.Text"
gone=
"@{!item.isExpanded}"
android:layout_width=
"0dp"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:minHeight=
"24dp"
android:background=
"?colorSurfaceVariant"
android:onClick=
"@{() -> viewModel.deletePressed(item)}"
tools:visibility=
"visible"
>
android:text=
"@string/superuser_toggle_revoke"
android:textAllCaps=
"false"
<com.google.android.material.button.MaterialButton
android:textColor=
"?colorError"
android:id=
"@+id/policy_notify"
android:textSize=
"12sp"
style=
"@style/WidgetFoundation.Button.Text"
app:icon=
"@drawable/ic_delete_md2"
isSelected=
"@{item.shouldNotify}"
app:iconTint=
"?colorError"
android:layout_weight=
"1"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_width=
"0dp"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_height=
"wrap_content"
app:layout_constraintStart_toEndOf=
"@+id/policy_log"
android:minHeight=
"24dp"
app:layout_constraintTop_toTopOf=
"parent"
android:onClick=
"@{() -> item.toggleNotify()}"
app:rippleColor=
"?colorError"
/>
android:text=
"@string/superuser_toggle_notification"
android:textAllCaps=
"false"
</androidx.constraintlayout.widget.ConstraintLayout>
android:textAppearance=
"@style/AppearanceFoundation.Tiny"
android:textColor=
"@color/color_state_primary_transient"
</LinearLayout>
app:icon=
"@drawable/ic_notifications_md2"
app:iconTint=
"@color/color_state_primary_transient"
</com.google.android.material.card.MaterialCardView>
app:tint=
"@color/color_state_primary_transient"
/>
<View
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:layout_marginTop=
"@dimen/l_50"
android:layout_marginBottom=
"@dimen/l_50"
android:background=
"?colorSurfaceSurfaceVariant"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/policy_log"
style=
"@style/WidgetFoundation.Button.Text"
isSelected=
"@{item.shouldLog}"
android:layout_weight=
"1"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:minHeight=
"24dp"
android:onClick=
"@{() -> item.toggleLog()}"
android:text=
"@string/logs"
android:textAllCaps=
"false"
android:textAppearance=
"@style/AppearanceFoundation.Tiny"
android:textColor=
"@color/color_state_primary_transient"
app:icon=
"@drawable/ic_bug_md2"
app:iconTint=
"@color/color_state_primary_transient"
app:tint=
"@color/color_state_primary_transient"
/>
<View
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:layout_marginTop=
"@dimen/l_50"
android:layout_marginBottom=
"@dimen/l_50"
android:background=
"?colorSurfaceSurfaceVariant"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/policy_delete"
style=
"@style/WidgetFoundation.Button.Text"
android:layout_weight=
"1"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:minHeight=
"24dp"
android:onClick=
"@{() -> item.revoke()}"
android:text=
"@string/superuser_toggle_revoke"
android:textAllCaps=
"false"
android:textColor=
"?colorError"
android:textSize=
"12sp"
app:icon=
"@drawable/ic_delete_md2"
app:iconTint=
"?colorError"
app:rippleColor=
"?colorError"
/>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</FrameLayout>
</layout>
</layout>
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