Skip to content

1.4.0

Latest

Choose a tag to compare

@donglua donglua released this 23 Jun 02:02

中文

新增

  • 为业务自定义 View / ViewFactory 生成 synthetic AttributeSet,保留 XML 中的 android/app 属性名称、原始值和资源 ID。
  • 新增 layoutX2C.enableSyntheticAttributeSet 开关,必要时可关闭 synthetic attrs 生成。
  • Demo 增加自定义属性示例,并用真机 instrumentation 覆盖 ViewFactory 读取 synthetic attrs 的路径。

修复

  • 默认生成的自定义 View 构造器恢复为 View(context),避免把普通 Java/Kotlin AttributeSet 传入 Android View(context, attrs) 后触发 XmlBlock.Parser 强转崩溃。
  • synthetic attrs 仅传给 ViewFactory hook 做原始 AttributeSet 查询;已声明的安全属性继续通过 typed setter 重放。

验证

  • ./gradlew check
  • ./gradlew test :demo:assembleDebug :runtime:assembleRelease :demo:assembleRelease :demo:assembleDebugAndroidTest
  • 真机 adb install + am instrument,41 个 instrumentation tests 全部通过。

兼容性

  • 无破坏性变更。

English

Added

  • Generate synthetic AttributeSet metadata for business custom Views and ViewFactory hooks, preserving android/app attribute names, raw values, and resource IDs from XML.
  • Add the layoutX2C.enableSyntheticAttributeSet option to disable synthetic attrs generation when needed.
  • Add a demo custom-attribute layout and device instrumentation coverage for ViewFactory synthetic attrs inspection.

Fixed

  • Keep generated custom-view default constructors on View(context) so Android does not crash by casting a plain Java/Kotlin AttributeSet to its internal XmlBlock.Parser.
  • Limit synthetic attrs to ViewFactory hook raw AttributeSet inspection; declared safe custom attributes continue to be replayed through typed setters.

Verified

  • ./gradlew check
  • ./gradlew test :demo:assembleDebug :runtime:assembleRelease :demo:assembleRelease :demo:assembleDebugAndroidTest
  • Real-device adb install + am instrument, all 41 instrumentation tests passed.

Compatibility

  • No breaking changes.