6.6.1 - Alpha2 - 支持更多的包名前缀省略形式 (如 RecyclerView)
This commit is contained in:
1 parent
b76ad3508d
commit
124638f9d0
4 files changed
+45
-6
No files matched your search
@@ -11,7 +11,8 @@
|
||||
],
|
||||
"improvement": [
|
||||
"脚本项目识别在 project.json 损坏情况下尽可能还原关键信息",
|
||||
"打包单文件时自动生成的包名后缀支持将简体中文自动转换为拼音"
|
||||
"打包单文件时自动生成的包名后缀支持将简体中文自动转换为拼音",
|
||||
"支持更多的包名前缀省略形式 (如 RecyclerView, Snackbar 等)"
|
||||
]
|
||||
},
|
||||
"v6.6.0": {
|
||||
|
||||
@@ -16,17 +16,54 @@ object ClassNameFilter {
|
||||
|
||||
}
|
||||
|
||||
val extendedClassNameMap = mapOf(
|
||||
"CardView" to "androidx.cardview.widget.CardView",
|
||||
"ConstraintLayout" to "androidx.constraintlayout.widget.ConstraintLayout",
|
||||
"CoordinatorLayout" to "androidx.coordinatorlayout.widget.CoordinatorLayout",
|
||||
"NestedScrollView" to "androidx.core.widget.NestedScrollView",
|
||||
"DrawerLayout" to "androidx.drawerlayout.widget.DrawerLayout",
|
||||
"FragmentContainerView" to "androidx.fragment.app.FragmentContainerView",
|
||||
"RecyclerView" to "androidx.recyclerview.widget.RecyclerView",
|
||||
"SwipeRefreshLayout" to "androidx.swiperefreshlayout.widget.SwipeRefreshLayout",
|
||||
"ViewPager" to "androidx.viewpager.widget.ViewPager",
|
||||
"ViewPager2" to "androidx.viewpager2.widget.ViewPager2",
|
||||
"AppBarLayout" to "com.google.android.material.appbar.AppBarLayout",
|
||||
"MaterialToolbar" to "com.google.android.material.appbar.MaterialToolbar",
|
||||
"BottomNavigationView" to "com.google.android.material.bottomnavigation.BottomNavigationView",
|
||||
"BottomSheetDialog" to "com.google.android.material.bottomsheet.BottomSheetDialog",
|
||||
"MaterialButton" to "com.google.android.material.button.MaterialButton",
|
||||
"Chip" to "com.google.android.material.chip.Chip",
|
||||
"MaterialCalendarGridView" to "com.google.android.material.datepicker.MaterialCalendarGridView",
|
||||
"FloatingActionButton" to "com.google.android.material.floatingactionbutton.FloatingActionButton",
|
||||
"BaselineLayout" to "com.google.android.material.internal.BaselineLayout",
|
||||
"CheckableImageButton" to "com.google.android.material.internal.CheckableImageButton",
|
||||
"ClippableRoundedCornerLayout" to "com.google.android.material.internal.ClippableRoundedCornerLayout",
|
||||
"NavigationMenuItemView" to "com.google.android.material.internal.NavigationMenuItemView",
|
||||
"NavigationMenuView" to "com.google.android.material.internal.NavigationMenuView",
|
||||
"TouchObserverFrameLayout" to "com.google.android.material.internal.TouchObserverFrameLayout",
|
||||
"VisibilityAwareImageButton" to "com.google.android.material.internal.VisibilityAwareImageButton",
|
||||
"NavigationView" to "com.google.android.material.navigation.NavigationView",
|
||||
"Snackbar" to "com.google.android.material.snackbar.Snackbar",
|
||||
"TabLayout" to "com.google.android.material.tabs.TabLayout",
|
||||
"TextInputEditText" to "com.google.android.material.textfield.TextInputEditText",
|
||||
"TextInputLayout" to "com.google.android.material.textfield.TextInputLayout",
|
||||
"ChipTextInputComboView" to "com.google.android.material.timepicker.ChipTextInputComboView",
|
||||
"ClockFaceView" to "com.google.android.material.timepicker.ClockFaceView",
|
||||
"ClockHandView" to "com.google.android.material.timepicker.ClockHandView",
|
||||
"TimePickerView" to "com.google.android.material.timepicker.TimePickerView",
|
||||
)
|
||||
|
||||
@Suppress("CovariantEquals")
|
||||
fun equals(text: String) = when (text.contains(".")) {
|
||||
true -> text
|
||||
else -> "android.widget.$text"
|
||||
else -> extendedClassNameMap[text] ?: "android.widget.$text"
|
||||
}.let { StringEqualsFilter(it, CLASS_NAME_GETTER) }
|
||||
|
||||
fun contains(str: String) = StringContainsFilter(str, CLASS_NAME_GETTER)
|
||||
|
||||
fun startsWith(prefix: String) = when (prefix.contains(".")) {
|
||||
true -> prefix
|
||||
else -> "android.widget.$prefix"
|
||||
else -> extendedClassNameMap[prefix] ?: "android.widget.$prefix"
|
||||
}.let { StringStartsWithFilter(it, CLASS_NAME_GETTER) }
|
||||
|
||||
fun endsWith(suffix: String) = StringEndsWithFilter(suffix, CLASS_NAME_GETTER)
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.view.ViewGroup
|
||||
import android.widget.Space
|
||||
import org.autojs.autojs.annotation.ScriptInterface
|
||||
import org.autojs.autojs.app.GlobalAppContext
|
||||
import org.autojs.autojs.core.automator.filter.ClassNameFilter
|
||||
import org.autojs.autojs.core.ui.inflater.inflaters.BaseViewInflater
|
||||
import org.autojs.autojs.core.ui.inflater.inflaters.JsActionMenuViewInflater
|
||||
import org.autojs.autojs.core.ui.inflater.inflaters.JsAppBarLayoutInflater
|
||||
@@ -355,7 +356,7 @@ open class DynamicLayoutInflater {
|
||||
return View(context)
|
||||
}
|
||||
if (!niceName.contains(".") && !androidWidgetPrefixBlacklist.contains(niceName)) {
|
||||
niceName = "android.widget.$niceName"
|
||||
niceName = ClassNameFilter.extendedClassNameMap[niceName] ?: "android.widget.$niceName"
|
||||
}
|
||||
val creator = mViewCreators[niceName]
|
||||
if (creator != null) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
#Thu Dec 05 01:03:06 CST 2024
|
||||
BUILD_TIME=1733331786695
|
||||
#Thu Dec 05 01:41:07 CST 2024
|
||||
BUILD_TIME=1733334067701
|
||||
COMPILE_SDK_VERSION=34
|
||||
JAVA_VERSION=23
|
||||
JAVA_VERSION_MIN_RADICAL=0
|
||||
|
||||
Reference in new issue
Block a user