mirror of
https://github.com/BetterAndroid/Hikage.git
synced 2026-02-04 12:07:07 +08:00
feat: add SurfaceView and WebView to widget usage detection
This commit is contained in:
@@ -110,7 +110,9 @@ class WidgetsUsageDetector : Detector(), Detector.UastScanner {
|
|||||||
"GridLayout",
|
"GridLayout",
|
||||||
"Switch",
|
"Switch",
|
||||||
"ProgressBar",
|
"ProgressBar",
|
||||||
"TableRow"
|
"TableRow",
|
||||||
|
"SurfaceView",
|
||||||
|
"WebView"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +199,7 @@ class WidgetsUsageDetector : Detector(), Detector.UastScanner {
|
|||||||
val sourceText = callExpr.toUElement()?.asSourceString() ?: return
|
val sourceText = callExpr.toUElement()?.asSourceString() ?: return
|
||||||
val callExprElement = callExpr.toUElement() ?: return
|
val callExprElement = callExpr.toUElement() ?: return
|
||||||
|
|
||||||
// Matchs '>' and like `View<TextView`'s length + 1.
|
// Matches '>' and like `View<TextView`'s length + 1.
|
||||||
val callExprLength = sourceText.split(">")[0].trim().length + 1
|
val callExprLength = sourceText.split(">")[0].trim().length + 1
|
||||||
val nameLocation = context.getRangeLocation(callExprElement, fromDelta = 0, callExprLength)
|
val nameLocation = context.getRangeLocation(callExprElement, fromDelta = 0, callExprLength)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user