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
2997258f
Commit
2997258f
authored
Jan 17, 2022
by
vvb2060
Committed by
John Wu
Jan 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup code
parent
11600fc1
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
8 additions
and
452 deletions
+8
-452
BaseUIFragment.kt
...src/main/java/com/topjohnwu/magisk/arch/BaseUIFragment.kt
+0
-6
Queryable.kt
app/src/main/java/com/topjohnwu/magisk/arch/Queryable.kt
+0
-17
AdaptersRecycler.kt
...java/com/topjohnwu/magisk/databinding/AdaptersRecycler.kt
+0
-57
DataBindingAdapters.kt
...a/com/topjohnwu/magisk/databinding/DataBindingAdapters.kt
+0
-17
ViewEvents.kt
app/src/main/java/com/topjohnwu/magisk/events/ViewEvents.kt
+0
-13
Dimens.kt
app/src/main/java/com/topjohnwu/magisk/ktx/Dimens.kt
+0
-9
XFlow.kt
app/src/main/java/com/topjohnwu/magisk/ktx/XFlow.kt
+0
-2
XString.kt
app/src/main/java/com/topjohnwu/magisk/ktx/XString.kt
+0
-41
MainActivity.kt
app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt
+0
-4
DenyListViewModel.kt
...in/java/com/topjohnwu/magisk/ui/deny/DenyListViewModel.kt
+6
-11
CachedValue.kt
app/src/main/java/com/topjohnwu/magisk/utils/CachedValue.kt
+0
-22
EndlessRecyclerScrollListener.kt
...m/topjohnwu/magisk/utils/EndlessRecyclerScrollListener.kt
+0
-116
KItemDecoration.kt
...c/main/java/com/topjohnwu/magisk/utils/KItemDecoration.kt
+0
-118
include_log_magisk.xml
app/src/main/res/layout/include_log_magisk.xml
+2
-3
item_console_md2.xml
app/src/main/res/layout/item_console_md2.xml
+0
-1
item_log_access_md2.xml
app/src/main/res/layout/item_log_access_md2.xml
+0
-3
menu_module_md2.xml
app/src/main/res/menu/menu_module_md2.xml
+0
-10
dimens.xml
app/src/main/res/values/dimens.xml
+0
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/arch/BaseUIFragment.kt
View file @
2997258f
...
...
@@ -84,9 +84,3 @@ abstract class BaseUIFragment<VM : BaseViewModel, Binding : ViewDataBinding> :
}
}
interface
ReselectionTarget
{
fun
onReselected
()
}
app/src/main/java/com/topjohnwu/magisk/arch/Queryable.kt
deleted
100644 → 0
View file @
11600fc1
package
com.topjohnwu.magisk.arch
import
android.os.Handler
import
androidx.core.os.postDelayed
import
com.topjohnwu.superuser.internal.UiThreadHandler
interface
Queryable
{
val
queryDelay
:
Long
val
queryHandler
:
Handler
get
()
=
UiThreadHandler
.
handler
fun
submitQuery
()
{
queryHandler
.
postDelayed
(
queryDelay
)
{
query
()
}
}
fun
query
()
}
app/src/main/java/com/topjohnwu/magisk/databinding/AdaptersRecycler.kt
deleted
100644 → 0
View file @
11600fc1
package
com.topjohnwu.magisk.databinding
import
android.graphics.drawable.GradientDrawable
import
android.graphics.drawable.InsetDrawable
import
androidx.databinding.BindingAdapter
import
androidx.recyclerview.widget.RecyclerView
import
com.topjohnwu.magisk.ktx.startEndToLeftRight
import
com.topjohnwu.magisk.ktx.toPx
import
com.topjohnwu.magisk.utils.KItemDecoration
import
kotlin.math.roundToInt
@BindingAdapter
(
"dividerColor"
,
"dividerHorizontal"
,
"dividerSize"
,
"dividerAfterLast"
,
"dividerMarginStart"
,
"dividerMarginEnd"
,
"dividerMarginTop"
,
"dividerMarginBottom"
,
requireAll
=
false
)
fun
setDivider
(
view
:
RecyclerView
,
color
:
Int
,
horizontal
:
Boolean
,
_size
:
Float
,
_afterLast
:
Boolean
?,
marginStartF
:
Float
,
marginEndF
:
Float
,
marginTopF
:
Float
,
marginBottomF
:
Float
)
{
val
orientation
=
if
(
horizontal
)
RecyclerView
.
HORIZONTAL
else
RecyclerView
.
VERTICAL
val
size
=
if
(
_size
>
0
)
_size
.
roundToInt
()
else
1
.
toPx
()
val
(
width
,
height
)
=
if
(
horizontal
)
size
to
1
else
1
to
size
val
afterLast
=
_afterLast
?:
true
val
marginStart
=
marginStartF
.
roundToInt
()
val
marginEnd
=
marginEndF
.
roundToInt
()
val
marginTop
=
marginTopF
.
roundToInt
()
val
marginBottom
=
marginBottomF
.
roundToInt
()
val
(
marginLeft
,
marginRight
)
=
view
.
context
.
startEndToLeftRight
(
marginStart
,
marginEnd
)
val
drawable
=
GradientDrawable
().
apply
{
setSize
(
width
,
height
)
shape
=
GradientDrawable
.
RECTANGLE
setColor
(
color
)
}.
let
{
InsetDrawable
(
it
,
marginLeft
,
marginTop
,
marginRight
,
marginBottom
)
}
val
decoration
=
KItemDecoration
(
view
.
context
,
orientation
)
.
setDeco
(
drawable
)
.
apply
{
showAfterLast
=
afterLast
}
view
.
addItemDecoration
(
decoration
)
}
app/src/main/java/com/topjohnwu/magisk/databinding/DataBindingAdapters.kt
View file @
2997258f
...
...
@@ -30,7 +30,6 @@ import com.google.android.material.textfield.TextInputLayout
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.di.ServiceLocator
import
com.topjohnwu.magisk.ktx.coroutineScope
import
com.topjohnwu.magisk.ktx.replaceRandomWithSpecial
import
com.topjohnwu.superuser.internal.UiThreadHandler
import
com.topjohnwu.widget.IndeterminateCheckBox
import
kotlinx.coroutines.*
...
...
@@ -78,22 +77,6 @@ fun setImageResource(view: ImageView, drawable: Drawable) {
view
.
setImageDrawable
(
drawable
)
}
@BindingAdapter
(
"movieBehavior"
,
"movieBehaviorText"
)
fun
setMovieBehavior
(
view
:
TextView
,
isMovieBehavior
:
Boolean
,
text
:
String
)
{
(
view
.
tag
as
?
Job
)
?.
cancel
()
view
.
tag
=
null
if
(
isMovieBehavior
)
{
view
.
tag
=
GlobalScope
.
launch
(
Dispatchers
.
Main
.
immediate
)
{
while
(
true
)
{
delay
(
150
)
view
.
text
=
text
.
replaceRandomWithSpecial
()
}
}
}
else
{
view
.
text
=
text
}
}
@BindingAdapter
(
"onTouch"
)
fun
setOnTouchListener
(
view
:
View
,
listener
:
View
.
OnTouchListener
)
{
view
.
setOnTouchListener
(
listener
)
...
...
app/src/main/java/com/topjohnwu/magisk/events/ViewEvents.kt
View file @
2997258f
...
...
@@ -10,22 +10,9 @@ import com.topjohnwu.magisk.MainDirections
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.arch.*
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.model.module.OnlineModule
import
com.topjohnwu.magisk.events.dialog.MarkDownDialog
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.view.MagiskDialog
import
com.topjohnwu.magisk.view.Shortcuts
class
OpenReadmeEvent
(
private
val
item
:
OnlineModule
)
:
MarkDownDialog
()
{
override
suspend
fun
getMarkdownText
()
=
item
.
notes
()
override
fun
build
(
dialog
:
MagiskDialog
)
{
super
.
build
(
dialog
)
dialog
.
applyButton
(
MagiskDialog
.
ButtonType
.
NEGATIVE
)
{
titleRes
=
android
.
R
.
string
.
cancel
}.
cancellable
(
true
)
}
}
class
PermissionEvent
(
private
val
permission
:
String
,
private
val
callback
:
(
Boolean
)
->
Unit
...
...
app/src/main/java/com/topjohnwu/magisk/ktx/Dimens.kt
deleted
100644 → 0
View file @
11600fc1
package
com.topjohnwu.magisk.ktx
import
android.content.res.Resources
import
kotlin.math.ceil
import
kotlin.math.roundToInt
fun
Int
.
toDp
():
Int
=
ceil
(
this
/
Resources
.
getSystem
().
displayMetrics
.
density
).
roundToInt
()
fun
Int
.
toPx
():
Int
=
(
this
*
Resources
.
getSystem
().
displayMetrics
.
density
).
roundToInt
()
app/src/main/java/com/topjohnwu/magisk/ktx/XFlow.kt
View file @
2997258f
package
com.topjohnwu.magisk.ktx
import
kotlinx.coroutines.FlowPreview
import
kotlinx.coroutines.flow.Flow
import
kotlinx.coroutines.flow.flatMapMerge
import
kotlinx.coroutines.flow.flow
@FlowPreview
inline
fun
<
T
,
R
>
Flow
<
T
>.
concurrentMap
(
crossinline
transform
:
suspend
(
T
)
->
R
):
Flow
<
R
>
{
return
flatMapMerge
{
value
->
flow
{
emit
(
transform
(
value
))
}
...
...
app/src/main/java/com/topjohnwu/magisk/ktx/XString.kt
deleted
100644 → 0
View file @
11600fc1
package
com.topjohnwu.magisk.ktx
val
specialChars
=
arrayOf
(
'!'
,
'@'
,
'#'
,
'$'
,
'%'
,
'&'
,
'?'
)
val
fullSpecialChars
=
arrayOf
(
'!'
,
'@'
,
'#'
,
'$'
,
'%'
,
'&'
,
'?'
)
fun
String
.
isCJK
():
Boolean
{
for
(
i
in
0
until
length
)
if
(
isCJK
(
codePointAt
(
i
)))
return
true
return
false
}
fun
isCJK
(
codepoint
:
Int
)
=
Character
.
isIdeographic
(
codepoint
)
fun
String
.
replaceRandomWithSpecial
(
passes
:
Int
):
String
{
var
string
=
this
repeat
(
passes
)
{
string
=
string
.
replaceRandomWithSpecial
()
}
return
string
}
fun
String
.
replaceRandomWithSpecial
():
String
{
val
sp
=
if
(
isCJK
())
fullSpecialChars
else
specialChars
var
random
:
Char
do
{
random
=
random
()
}
while
(
random
==
'.'
)
return
replace
(
random
,
sp
.
random
())
}
fun
StringBuilder
.
appendIf
(
condition
:
Boolean
,
builder
:
StringBuilder
.()
->
Unit
)
=
if
(
condition
)
apply
(
builder
)
else
this
fun
String
.
trimEmptyToNull
():
String
?
=
if
(
isBlank
())
null
else
this
fun
String
.
legalFilename
()
=
replace
(
" "
,
"_"
).
replace
(
"'"
,
""
).
replace
(
"\""
,
""
)
.
replace
(
"$"
,
""
).
replace
(
"`"
,
""
).
replace
(
"*"
,
""
).
replace
(
"/"
,
"_"
)
.
replace
(
"#"
,
""
).
replace
(
"@"
,
""
).
replace
(
"\\"
,
"_"
)
fun
String
.
isEmptyInternal
()
=
isNullOrBlank
()
app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt
View file @
2997258f
...
...
@@ -20,7 +20,6 @@ import com.topjohnwu.magisk.MainDirections
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.arch.BaseMainActivity
import
com.topjohnwu.magisk.arch.BaseViewModel
import
com.topjohnwu.magisk.arch.ReselectionTarget
import
com.topjohnwu.magisk.core.*
import
com.topjohnwu.magisk.databinding.ActivityMainMd2Binding
import
com.topjohnwu.magisk.di.viewModel
...
...
@@ -82,9 +81,6 @@ class MainActivity : BaseMainActivity<MainViewModel, ActivityMainMd2Binding>() {
getScreen
(
it
.
itemId
)
?.
navigate
()
true
}
binding
.
mainNavigation
.
setOnItemReselectedListener
{
(
currentFragment
as
?
ReselectionTarget
)
?.
onReselected
()
}
binding
.
mainNavigation
.
menu
.
apply
{
findItem
(
R
.
id
.
superuserFragment
)
?.
isEnabled
=
Utils
.
showSuperUser
()
findItem
(
R
.
id
.
modulesFragment
)
?.
isEnabled
=
Info
.
env
.
isActive
...
...
app/src/main/java/com/topjohnwu/magisk/ui/deny/DenyListViewModel.kt
View file @
2997258f
...
...
@@ -5,7 +5,6 @@ import android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES
import
androidx.lifecycle.viewModelScope
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.arch.BaseViewModel
import
com.topjohnwu.magisk.arch.Queryable
import
com.topjohnwu.magisk.databinding.filterableListOf
import
com.topjohnwu.magisk.databinding.itemBindingOf
import
com.topjohnwu.magisk.di.AppContext
...
...
@@ -15,29 +14,25 @@ import com.topjohnwu.superuser.Shell
import
kotlinx.coroutines.*
import
kotlinx.coroutines.flow.*
import
java.util.*
import
kotlin.collections.ArrayList
@FlowPreview
class
DenyListViewModel
:
BaseViewModel
(),
Queryable
{
override
val
queryDelay
=
0L
class
DenyListViewModel
:
BaseViewModel
()
{
var
isShowSystem
=
false
set
(
value
)
{
field
=
value
submitQ
uery
()
q
uery
()
}
var
isShowOS
=
false
set
(
value
)
{
field
=
value
submitQ
uery
()
q
uery
()
}
var
query
=
""
set
(
value
)
{
field
=
value
submitQ
uery
()
q
uery
()
}
val
items
=
filterableListOf
<
DenyListRvItem
>()
...
...
@@ -71,10 +66,10 @@ class DenyListViewModel : BaseViewModel(), Queryable {
apps
to
items
.
calculateDiff
(
apps
)
}
items
.
update
(
apps
,
diff
)
submitQ
uery
()
q
uery
()
}
override
fun
query
()
{
fun
query
()
{
items
.
filter
{
fun
filterSystem
()
=
isShowSystem
||
!
it
.
info
.
isSystemApp
()
...
...
app/src/main/java/com/topjohnwu/magisk/utils/CachedValue.kt
deleted
100644 → 0
View file @
11600fc1
package
com.topjohnwu.magisk.utils
class
CachedValue
<
T
>(
private
val
factory
:
()
->
T
)
:
Lazy
<
T
>
{
private
var
_val
:
T
?
=
null
override
val
value
:
T
get
()
{
val
local
=
_val
return
local
?:
synchronized
(
this
)
{
_val
?:
factory
().
also
{
_val
=
it
}
}
}
override
fun
isInitialized
()
=
_val
!=
null
fun
invalidate
()
{
synchronized
(
this
)
{
_val
=
null
}
}
}
app/src/main/java/com/topjohnwu/magisk/utils/EndlessRecyclerScrollListener.kt
deleted
100644 → 0
View file @
11600fc1
package
com.topjohnwu.magisk.utils
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.StaggeredGridLayoutManager
import
com.topjohnwu.magisk.arch.ViewEvent
class
EndlessRecyclerScrollListener
(
private
val
layoutManager
:
RecyclerView
.
LayoutManager
,
private
val
loadMore
:
(
page
:
Int
,
totalItemsCount
:
Int
,
view
:
RecyclerView
?)
->
Unit
,
private
val
direction
:
Direction
=
Direction
.
BOTTOM
,
visibleRowsThreshold
:
Int
=
VISIBLE_THRESHOLD
)
:
RecyclerView
.
OnScrollListener
()
{
constructor
(
layoutManager
:
RecyclerView
.
LayoutManager
,
loadMore
:
()
->
Unit
,
direction
:
Direction
=
Direction
.
BOTTOM
,
visibleRowsThreshold
:
Int
=
VISIBLE_THRESHOLD
)
:
this
(
layoutManager
,
{
_
,
_
,
_
->
loadMore
()
},
direction
,
visibleRowsThreshold
)
enum
class
Direction
{
TOP
,
BOTTOM
}
companion
object
{
private
const
val
VISIBLE_THRESHOLD
=
5
private
const
val
STARTING_PAGE_INDEX
=
0
}
// The minimum amount of items to have above/below your current scroll position
// before loading more.
private
val
visibleThreshold
=
when
(
layoutManager
)
{
is
LinearLayoutManager
->
visibleRowsThreshold
is
GridLayoutManager
->
visibleRowsThreshold
*
layoutManager
.
spanCount
is
StaggeredGridLayoutManager
->
visibleRowsThreshold
*
layoutManager
.
spanCount
else
->
throw
IllegalArgumentException
(
"Only LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager are supported"
)
}
// The current offset index of data you have loaded
private
var
currentPage
=
0
// The total number of items in the dataset after the last load
private
var
previousTotalItemCount
=
0
// True if we are still waiting for the last set of data to load.
private
var
loading
=
true
// This happens many times a second during a scroll, so be wary of the code you place here.
// We are given a few useful parameters to help us work out if we need to load some more data,
// but first we check if we are waiting for the previous load to finish.
override
fun
onScrolled
(
view
:
RecyclerView
,
dx
:
Int
,
dy
:
Int
)
{
if
(
dx
==
0
&&
dy
==
0
)
return
val
totalItemCount
=
layoutManager
.
itemCount
val
visibleItemPosition
=
if
(
direction
==
Direction
.
BOTTOM
)
{
when
(
layoutManager
)
{
is
StaggeredGridLayoutManager
->
layoutManager
.
findLastVisibleItemPositions
(
null
).
maxOrNull
()
?:
0
is
GridLayoutManager
->
layoutManager
.
findLastVisibleItemPosition
()
is
LinearLayoutManager
->
layoutManager
.
findLastVisibleItemPosition
()
else
->
throw
IllegalArgumentException
(
"Only LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager are supported"
)
}
}
else
{
when
(
layoutManager
)
{
is
StaggeredGridLayoutManager
->
layoutManager
.
findFirstVisibleItemPositions
(
null
).
minOrNull
()
?:
0
is
GridLayoutManager
->
layoutManager
.
findFirstVisibleItemPosition
()
is
LinearLayoutManager
->
layoutManager
.
findFirstVisibleItemPosition
()
else
->
throw
IllegalArgumentException
(
"Only LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager are supported"
)
}
}
// If the total item count is zero and the previous isn't, assume the
// list is invalidated and should be reset back to initial state
if
(
totalItemCount
<
previousTotalItemCount
)
{
currentPage
=
STARTING_PAGE_INDEX
previousTotalItemCount
=
totalItemCount
if
(
totalItemCount
==
0
)
{
loading
=
true
}
}
// If it’s still loading, we check to see if the dataset count has
// changed, if so we conclude it has finished loading and update the current page
// number and total item count.
if
(
loading
&&
totalItemCount
>
previousTotalItemCount
)
{
loading
=
false
previousTotalItemCount
=
totalItemCount
}
// If it isn’t currently loading, we check to see if we have breached
// the visibleThreshold and need to reload more data.
// If we do need to reload some more data, we execute onLoadMore to fetch the data.
// threshold should reflect how many total columns there are too
if
(!
loading
&&
shouldLoadMoreItems
(
visibleItemPosition
,
totalItemCount
))
{
currentPage
++
loadMore
(
currentPage
,
totalItemCount
,
view
)
loading
=
true
}
}
private
fun
shouldLoadMoreItems
(
visibleItemPosition
:
Int
,
itemCount
:
Int
)
=
when
(
direction
)
{
Direction
.
TOP
->
visibleItemPosition
<
visibleThreshold
Direction
.
BOTTOM
->
visibleItemPosition
+
visibleThreshold
>
itemCount
}
// Call this method whenever performing new searches
fun
resetState
()
{
currentPage
=
STARTING_PAGE_INDEX
previousTotalItemCount
=
0
loading
=
true
}
class
ResetState
:
ViewEvent
()
}
app/src/main/java/com/topjohnwu/magisk/utils/KItemDecoration.kt
deleted
100644 → 0
View file @
11600fc1
package
com.topjohnwu.magisk.utils
import
android.content.Context
import
android.graphics.Canvas
import
android.graphics.Rect
import
android.graphics.drawable.Drawable
import
android.view.View
import
androidx.annotation.DrawableRes
import
androidx.core.view.get
import
androidx.recyclerview.widget.DividerItemDecoration
import
androidx.recyclerview.widget.RecyclerView
import
com.topjohnwu.magisk.ktx.drawableCompat
import
kotlin.math.roundToInt
class
KItemDecoration
(
private
val
context
:
Context
,
@RecyclerView
.
Orientation
private
val
orientation
:
Int
)
:
RecyclerView
.
ItemDecoration
()
{
private
val
bounds
=
Rect
()
private
var
divider
:
Drawable
?
=
null
var
showAfterLast
=
true
fun
setDeco
(
@DrawableRes
drawable
:
Int
)
=
apply
{
setDeco
(
context
.
drawableCompat
(
drawable
))
}
fun
setDeco
(
drawable
:
Drawable
?)
=
apply
{
divider
=
drawable
}
override
fun
onDraw
(
canvas
:
Canvas
,
parent
:
RecyclerView
,
state
:
RecyclerView
.
State
)
{
parent
.
layoutManager
?:
return
divider
?.
let
{
if
(
orientation
==
DividerItemDecoration
.
VERTICAL
)
{
drawVertical
(
canvas
,
parent
,
it
)
}
else
{
drawHorizontal
(
canvas
,
parent
,
it
)
}
}
}
private
fun
drawVertical
(
canvas
:
Canvas
,
parent
:
RecyclerView
,
drawable
:
Drawable
)
{
canvas
.
save
()
val
left
:
Int
val
right
:
Int
if
(
parent
.
clipToPadding
)
{
left
=
parent
.
paddingLeft
right
=
parent
.
width
-
parent
.
paddingRight
canvas
.
clipRect
(
left
,
parent
.
paddingTop
,
right
,
parent
.
height
-
parent
.
paddingBottom
)
}
else
{
left
=
0
right
=
parent
.
width
}
val
to
=
if
(
showAfterLast
)
parent
.
childCount
else
parent
.
childCount
-
1
(
0
until
to
)
.
map
{
parent
[
it
]
}
.
forEach
{
child
->
parent
.
getDecoratedBoundsWithMargins
(
child
,
bounds
)
val
bottom
=
bounds
.
bottom
+
child
.
translationY
.
roundToInt
()
val
top
=
bottom
-
drawable
.
intrinsicHeight
drawable
.
setBounds
(
left
,
top
,
right
,
bottom
)
drawable
.
draw
(
canvas
)
}
canvas
.
restore
()
}
private
fun
drawHorizontal
(
canvas
:
Canvas
,
parent
:
RecyclerView
,
drawable
:
Drawable
)
{
canvas
.
save
()
val
top
:
Int
val
bottom
:
Int
if
(
parent
.
clipToPadding
)
{
top
=
parent
.
paddingTop
bottom
=
parent
.
height
-
parent
.
paddingBottom
canvas
.
clipRect
(
parent
.
paddingLeft
,
top
,
parent
.
width
-
parent
.
paddingRight
,
bottom
)
}
else
{
top
=
0
bottom
=
parent
.
height
}
val
to
=
if
(
showAfterLast
)
parent
.
childCount
else
parent
.
childCount
-
1
(
0
until
to
)
.
map
{
parent
[
it
]
}
.
forEach
{
child
->
parent
.
layoutManager
!!
.
getDecoratedBoundsWithMargins
(
child
,
bounds
)
val
right
=
bounds
.
right
+
child
.
translationX
.
roundToInt
()
val
left
=
right
-
drawable
.
intrinsicWidth
drawable
.
setBounds
(
left
,
top
,
right
,
bottom
)
drawable
.
draw
(
canvas
)
}
canvas
.
restore
()
}
override
fun
getItemOffsets
(
outRect
:
Rect
,
view
:
View
,
parent
:
RecyclerView
,
state
:
RecyclerView
.
State
)
{
if
(
parent
.
getChildAdapterPosition
(
view
)
==
state
.
itemCount
-
1
)
{
outRect
.
setEmpty
()
return
}
if
(
orientation
==
RecyclerView
.
VERTICAL
)
{
outRect
.
set
(
0
,
0
,
0
,
divider
?.
intrinsicHeight
?:
0
)
}
else
{
outRect
.
set
(
0
,
0
,
divider
?.
intrinsicWidth
?:
0
,
0
)
}
}
}
app/src/main/res/layout/include_log_magisk.xml
View file @
2997258f
...
...
@@ -30,11 +30,10 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"monospace"
precomputedText=
"@{viewModel.consoleText}"
android:textAppearance=
"@style/AppearanceFoundation.Caption"
android:textSize=
"10sp"
android:paddingTop=
"@dimen/internal_action_bar_size"
android:paddingBottom=
"128dp"
android:text=
"@{viewModel.consoleText}"
android:textAppearance=
"@style/AppearanceFoundation.Caption"
app:layout_fitsSystemWindowsInsets=
"top|bottom"
tools:text=
"@tools:sample/lorem/random"
/>
...
...
app/src/main/res/layout/item_console_md2.xml
View file @
2997258f
...
...
@@ -16,7 +16,6 @@
android:fontFamily=
"monospace"
android:text=
"@{item.item}"
android:textAppearance=
"@style/AppearanceFoundation.Caption"
android:textSize=
"10sp"
tools:text=
"@tools:sample/lorem/random"
/>
</layout>
app/src/main/res/layout/item_log_access_md2.xml
View file @
2997258f
...
...
@@ -66,7 +66,6 @@
android:layout_height=
"wrap_content"
android:text=
"@{item.date}"
android:textAppearance=
"@style/AppearanceFoundation.Caption.Variant"
android:textSize=
"10sp"
app:layout_constraintBottom_toTopOf=
"@+id/log_app_details"
app:layout_constraintTop_toBottomOf=
"@+id/log_app_name"
tools:text=
"06:00 PM, 10 Oct 2019"
/>
...
...
@@ -77,7 +76,6 @@
android:layout_height=
"wrap_content"
android:text=
"@{String.format(`%s %s`, @string/pid(item.item.fromPid), @string/target_uid(item.item.toUid))}"
android:textAppearance=
"@style/AppearanceFoundation.Caption.Variant"
android:textSize=
"10sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/log_command"
app:layout_constraintStart_toStartOf=
"parent"
...
...
@@ -91,7 +89,6 @@
android:fontFamily=
"monospace"
android:text=
"@{item.item.command}"
android:textAppearance=
"@style/AppearanceFoundation.Caption.Variant"
android:textSize=
"10sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/log_app_details"
app:layout_constraintTop_toTopOf=
"@+id/log_app_details"
...
...
app/src/main/res/menu/menu_module_md2.xml
deleted
100644 → 0
View file @
11600fc1
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
android:id=
"@+id/action_refresh"
android:icon=
"@drawable/ic_refresh_data_md2"
android:title=
"@string/refresh"
app:showAsAction=
"ifRoom"
/>
</menu>
\ No newline at end of file
app/src/main/res/values/dimens.xml
View file @
2997258f
...
...
@@ -13,7 +13,5 @@
<dimen
name=
"r1"
>
8dp
</dimen>
<!--l1 + fab size-->
<dimen
name=
"internal_action_bar_size"
>
56dp
</dimen>
</resources>
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