mirror of
https://github.com/BetterAndroid/Hikage.git
synced 2025-09-04 01:35:33 +08:00
Compare commits
7 Commits
51a59b672c
...
0d99806004
Author | SHA1 | Date | |
---|---|---|---|
0d99806004
|
|||
1cb95849ab
|
|||
714c8552ab
|
|||
18ccf196b6
|
|||
76df8fa06c
|
|||
8e25430d68
|
|||
0529d6a2b6
|
@@ -18,7 +18,16 @@ Time zone of version release date: **UTC+8**
|
||||
|
||||
## hikage-core
|
||||
|
||||
### 1.0.1 | 2025.05.06  <Badge type="tip" text="latest" vertical="middle" />
|
||||
### 1.0.2 | 2025.08.24  <Badge type="tip" text="latest" vertical="middle" />
|
||||
|
||||
- Migrated Java reflection related behaviors from [YukiReflection](https://github.com/HighCapable/YukiReflection) to [KavaRef](https://github.com/HighCapable/KavaRef)
|
||||
- Adapted to Android 16 (API 36), fixed the `XmlBlock` crash issue on Android 16
|
||||
- Optimized layout performance, removed unnecessary inline operations, added caching for reflection operations
|
||||
- Added `final` parameter to `HikageView` and `HikageViewDeclaration` to support new features in `hikage-compiler`
|
||||
- Added `SurfaceView` and `WebView` built-in components to `Widgets`
|
||||
- Adjusted some components in `Widgets` to be `final`
|
||||
|
||||
### 1.0.1 | 2025.05.06  <Badge type="warning" text="stale" vertical="middle" />
|
||||
|
||||
- Fixed the issue where the KSP source code was not successfully released
|
||||
- Added states management feature
|
||||
@@ -29,19 +38,32 @@ Time zone of version release date: **UTC+8**
|
||||
|
||||
## hikage-compiler
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="latest" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="latest" vertical="middle" />
|
||||
|
||||
- Added support for the `final` parameter of `HikageView` and `HikageViewDeclaration`, please refer to the relevant usage in the documentation
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="stale" vertical="middle" />
|
||||
|
||||
- The first version is submitted to Maven
|
||||
|
||||
## hikage-extension
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="latest" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="latest" vertical="middle" />
|
||||
|
||||
- Migrated Java reflection related behaviors from [YukiReflection](https://github.com/HighCapable/YukiReflection) to [KavaRef](https://github.com/HighCapable/KavaRef)
|
||||
- Added generic `ViewGroup.LayoutParams` support for `addView` in `ViewGroup`
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="stale" vertical="middle" />
|
||||
|
||||
- The first version is submitted to Maven
|
||||
|
||||
## hikage-extension-betterandroid
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="latest" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="latest" vertical="middle" />
|
||||
|
||||
- Adapted to decoupled `ui-component` and `ui-component-adapter` in `BetterAndroid`
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="stale" vertical="middle" />
|
||||
|
||||
- The first version is submitted to Maven
|
||||
|
||||
@@ -53,12 +75,21 @@ Time zone of version release date: **UTC+8**
|
||||
|
||||
## hikage-widget-androidx
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="latest" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="latest" vertical="middle" />
|
||||
|
||||
- Added `MotionLayout`, `ImageFilterButton`, `ImageFilterView`, `MockView`, `MotionButton`, `MotionLabel`, `MotionTelltales` components to `ConstraintLayout`
|
||||
- Adjusted some components to be `final`
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="stale" vertical="middle" />
|
||||
|
||||
- The first version is submitted to Maven
|
||||
|
||||
## hikage-widget-material
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="latest" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="latest" vertical="middle" />
|
||||
|
||||
- Adjusted some components to be `final`
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="stale" vertical="middle" />
|
||||
|
||||
- The first version is submitted to Maven
|
@@ -139,12 +139,13 @@ Hikage can automatically generate the `Hikageable` function corresponding to the
|
||||
|
||||
You can add the `HikageView` annotation on your custom `View` to mark it as a Hikage layout component.
|
||||
|
||||
| Parameter Name | Description |
|
||||
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `lparams` | LayoutParams `Class` object, if your custom `View` is a subclass of `ViewGroup`, you can declare or leave it blank to use the default value |
|
||||
| `alias` | The alias of the layout component, that is, the function name to be generated, gets the name of the current Class by default |
|
||||
| `requireInit` | Whether to fill in the initialization method block of the layout, the default is the omitted parameters |
|
||||
| `requirePerformer` | Whether to fill in the `performer` method block of the layout, the default is an omitted parameter, which only takes effect when your custom `View` is a subclass of `ViewGroup` |
|
||||
| Parameter Name | Description |
|
||||
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `lparams` | LayoutParams `Class` object, if your custom `View` is a subclass of `ViewGroup`, you can declare or leave it blank to use the default value |
|
||||
| `alias` | The alias of the layout component, that is, the function name to be generated, gets the name of the current Class by default |
|
||||
| `requireInit` | Whether to fill in the initialization method block of the layout, the default is the omitted parameters |
|
||||
| `requirePerformer` | Whether to fill in the `performer` method block of the layout, the default is an omitted parameter, which only takes effect when your custom `View` is a subclass of `ViewGroup` |
|
||||
| `final` | Whether to declare the layout as "final layout", the default is false, that is, whether this layout is `ViewGroup` or its subclasses will not generate the `performer` method block. After set to `true`, `lparams` and `requirePerformer` will no longer be valid. |
|
||||
|
||||
> The following example
|
||||
|
||||
@@ -177,13 +178,14 @@ Hikageable {
|
||||
|
||||
Hikage can also automatically generate layout component functions for the `View` component provided by third parties, and you can use the `HikageViewDeclaration` annotation to complete it.
|
||||
|
||||
| Parameter Name | Description |
|
||||
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `view` | Class object of layout component that needs to be declared |
|
||||
| `lparams` | LayoutParams `Class` object, if your custom `View` is a subclass of `ViewGroup`, you can declare or leave it blank to use the default value |
|
||||
| `alias` | The alias of the layout component, that is, the name of the function to be generated, obtains the name of the `view` Class by default |
|
||||
| `requireInit` | Whether to fill in the initialization method block of the layout, the default is the omitted parameters |
|
||||
| `requirePerformer` | Whether to fill in the `performer` method block of the layout, the default is an omitted parameter, which only takes effect when your custom `View` is a subclass of `ViewGroup` |
|
||||
| Parameter Name | Description |
|
||||
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `view` | Class object of layout component that needs to be declared |
|
||||
| `lparams` | LayoutParams `Class` object, if your custom `View` is a subclass of `ViewGroup`, you can declare or leave it blank to use the default value |
|
||||
| `alias` | The alias of the layout component, that is, the name of the function to be generated, obtains the name of the `view` Class by default |
|
||||
| `requireInit` | Whether to fill in the initialization method block of the layout, the default is the omitted parameters |
|
||||
| `requirePerformer` | Whether to fill in the `performer` method block of the layout, the default is an omitted parameter, which only takes effect when your custom `View` is a subclass of `ViewGroup` |
|
||||
| `final` | Whether to declare the layout as "final layout", the default is false, that is, whether this layout is `ViewGroup` or its subclasses will not generate the `performer` method block. After set to `true`, `lparams` and `requirePerformer` will no longer be valid. |
|
||||
|
||||
> The following example
|
||||
|
||||
|
@@ -219,7 +219,7 @@ Or, use in a custom `View`.
|
||||
class CustomView(context: Context, attrs: AttributeSet? = null) : FrameLayout(context, attrs) {
|
||||
|
||||
init {
|
||||
addView {
|
||||
addView<FrameLayout.LayoutParams> {
|
||||
TextView {
|
||||
text = "Hello, World!"
|
||||
textSize = 16f
|
||||
|
@@ -10,7 +10,16 @@
|
||||
|
||||
## hikage-core
|
||||
|
||||
### 1.0.1 | 2025.05.06  <Badge type="tip" text="最新" vertical="middle" />
|
||||
### 1.0.2 | 2025.08.24  <Badge type="tip" text="最新" vertical="middle" />
|
||||
|
||||
- 将 Java 反射相关行为由 [YukiReflection](https://github.com/HighCapable/YukiReflection) 迁移至 [KavaRef](https://github.com/HighCapable/KavaRef)
|
||||
- 适配 Android 16 (API 36),解决了 Android 16 上 `XmlBlock` 的崩溃问题
|
||||
- 优化布局性能,移除了不必要的内联操作,对反射操作增加缓存
|
||||
- `HikageView` 和 `HikageViewDeclaration` 新增 `final` 参数以配合 `hikage-compiler` 实现新功能
|
||||
- `Widgets` 新增 `SurfaceView` 和 `WebView` 内置组件
|
||||
- `Widgets` 调整部分组件为 `final`
|
||||
|
||||
### 1.0.1 | 2025.05.06  <Badge type="warning" text="过旧" vertical="middle" />
|
||||
|
||||
- 修复 KSP 源码没有成功发布的问题
|
||||
- 新增状态管理功能
|
||||
@@ -21,19 +30,32 @@
|
||||
|
||||
## hikage-compiler
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="最新" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="最新" vertical="middle" />
|
||||
|
||||
- 新增对 `HikageView` 和 `HikageViewDeclaration` 的 `final` 参数的支持,详情请参考文档的相关用法
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="过旧" vertical="middle" />
|
||||
|
||||
- 首个版本提交至 Maven
|
||||
|
||||
## hikage-extension
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="最新" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="最新" vertical="middle" />
|
||||
|
||||
- 将 Java 反射相关行为由 [YukiReflection](https://github.com/HighCapable/YukiReflection) 迁移至 [KavaRef](https://github.com/HighCapable/KavaRef)
|
||||
- `ViewGroup` 新增对 `addView` 的泛型 `ViewGroup.LayoutParams` 支持
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="过旧" vertical="middle" />
|
||||
|
||||
- 首个版本提交至 Maven
|
||||
|
||||
## hikage-extension-betterandroid
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="最新" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="最新" vertical="middle" />
|
||||
|
||||
- 适配了 `BetterAndroid` 解耦合后的 `ui-component` 和 `ui-component-adapter`
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="过旧" vertical="middle" />
|
||||
|
||||
- 首个版本提交至 Maven
|
||||
|
||||
@@ -45,12 +67,21 @@
|
||||
|
||||
## hikage-widget-androidx
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="最新" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="最新" vertical="middle" />
|
||||
|
||||
- `ConstraintLayout` 新增 `MotionLayout`、`ImageFilterButton`、`ImageFilterView`、`MockView`、`MotionButton`、`MotionLabel`、`MotionTelltales` 组件
|
||||
- 调整部分组件为 `final`
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="过旧" vertical="middle" />
|
||||
|
||||
- 首个版本提交至 Maven
|
||||
|
||||
## hikage-widget-material
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="tip" text="最新" vertical="middle" />
|
||||
### 1.0.1 | 2025.08.24  <Badge type="tip" text="最新" vertical="middle" />
|
||||
|
||||
- 调整部分组件为 `final`
|
||||
|
||||
### 1.0.0 | 2025.04.20  <Badge type="warning" text="过旧" vertical="middle" />
|
||||
|
||||
- 首个版本提交至 Maven
|
@@ -136,12 +136,13 @@ Hikage 可以在编译时为指定的布局组件自动生成布局组件对应
|
||||
|
||||
你可以在你的自定义 `View` 上加入 `HikageView` 注解,以标记它生成为 Hikage 布局组件。
|
||||
|
||||
| 参数名称 | 描述 |
|
||||
| ------------------ | --------------------------------------------------------------------------------------------------------------------- |
|
||||
| `lparams` | 布局参数 `ViewGroup.LayoutParams` Class 对象,如果你的自定义 `View` 是 `ViewGroup` 的子类,则可以声明或留空使用默认值 |
|
||||
| `alias` | 布局组件的别名,即要生成的函数名称,默认获取当前 Class 的名称 |
|
||||
| `requireInit` | 是否要求填写布局的初始化方法块,默认为可省略的参数 |
|
||||
| `requirePerformer` | 是否要求填写布局的 `performer` 方法块,默认为可省略的参数,仅在你的自定义 `View` 是 `ViewGroup` 的子类时生效 |
|
||||
| 参数名称 | 描述 |
|
||||
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `lparams` | 布局参数 `ViewGroup.LayoutParams` Class 对象,如果你的自定义 `View` 是 `ViewGroup` 的子类,则可以声明或留空使用默认值 |
|
||||
| `alias` | 布局组件的别名,即要生成的函数名称,默认获取当前 Class 的名称 |
|
||||
| `requireInit` | 是否要求填写布局的初始化方法块,默认为可省略的参数 |
|
||||
| `requirePerformer` | 是否要求填写布局的 `performer` 方法块,默认为可省略的参数,仅在你的自定义 `View` 是 `ViewGroup` 的子类时生效 |
|
||||
| `final` | 是否将布局声明为 “最终布局”,默认否,即此布局是否是 `ViewGroup` 还是从其继承都将不会生成 `performer` 方法块,设置为 `true` 之后,`lparams` 和 `requirePerformer` 将不再有效。 |
|
||||
|
||||
> 示例如下
|
||||
|
||||
@@ -174,13 +175,14 @@ Hikageable {
|
||||
|
||||
Hikage 同样可以为第三方提供的 `View` 组件自动生成布局组件函数,你可以使用 `HikageViewDeclaration` 注解来完成。
|
||||
|
||||
| 参数名称 | 描述 |
|
||||
| ------------------ | --------------------------------------------------------------------------------------------------------------------- |
|
||||
| `view` | 需要声明的布局组件的 Class 对象 |
|
||||
| `lparams` | 布局参数 `ViewGroup.LayoutParams` Class 对象,如果你的自定义 `View` 是 `ViewGroup` 的子类,则可以声明或留空使用默认值 |
|
||||
| `alias` | 布局组件的别名,即要生成的函数名称,默认获取 `view` Class 的名称 |
|
||||
| `requireInit` | 是否要求填写布局的初始化方法块,默认为可省略的参数 |
|
||||
| `requirePerformer` | 是否要求填写布局的 `performer` 方法块,默认为可省略的参数,仅在你的自定义 `View` 是 `ViewGroup` 的子类时生效 |
|
||||
| 参数名称 | 描述 |
|
||||
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `view` | 需要声明的布局组件的 Class 对象 |
|
||||
| `lparams` | 布局参数 `ViewGroup.LayoutParams` Class 对象,如果你的自定义 `View` 是 `ViewGroup` 的子类,则可以声明或留空使用默认值 |
|
||||
| `alias` | 布局组件的别名,即要生成的函数名称,默认获取 `view` Class 的名称 |
|
||||
| `requireInit` | 是否要求填写布局的初始化方法块,默认为可省略的参数 |
|
||||
| `requirePerformer` | 是否要求填写布局的 `performer` 方法块,默认为可省略的参数,仅在你的自定义 `View` 是 `ViewGroup` 的子类时生效 |
|
||||
| `final` | 是否将布局声明为 “最终布局”,默认否,即此布局是否是 `ViewGroup` 还是从其继承都将不会生成 `performer` 方法块,设置为 `true` 之后,`lparams` 和 `requirePerformer` 将不再有效。 |
|
||||
|
||||
> 示例如下
|
||||
|
||||
|
@@ -217,7 +217,7 @@ root.addView {
|
||||
class CustomView(context: Context, attrs: AttributeSet? = null) : FrameLayout(context, attrs) {
|
||||
|
||||
init {
|
||||
addView {
|
||||
addView<FrameLayout.LayoutParams> {
|
||||
TextView {
|
||||
text = "Hello, World!"
|
||||
textSize = 16f
|
||||
|
@@ -14,23 +14,23 @@ project.samples-app.packageName=com.highcapable.hikage.demo
|
||||
project.samples-app.versionName=universal
|
||||
project.samples-app.versionCode=1
|
||||
project.hikage-core.namespace=${project.groupName}.core
|
||||
project.hikage-core.version="1.0.1"
|
||||
project.hikage-core.version="1.0.2"
|
||||
project.hikage-core-lint.namespace=${project.groupName}.core.lint
|
||||
project.hikage-core-lint.identifier=${project.groupName}:hikage-core:${project.hikage-core.version}
|
||||
project.hikage-core-lint.min-api=9
|
||||
project.hikage-core-lint.registry-v2-class="${project.hikage-core-lint.namespace}.HikageIssueRegistry"
|
||||
project.hikage-extension.namespace=${project.groupName}.extension
|
||||
project.hikage-extension.version="1.0.0"
|
||||
project.hikage-extension.version="1.0.1"
|
||||
project.hikage-extension-betterandroid.namespace=${project.groupName}.extension.betterandroid
|
||||
project.hikage-extension-betterandroid.version="1.0.0"
|
||||
project.hikage-extension-betterandroid.version="1.0.1"
|
||||
project.hikage-extension-compose.namespace=${project.groupName}.extension.androidx.compose
|
||||
project.hikage-extension-compose.version="1.0.0"
|
||||
project.hikage-compiler.namespace="${project.groupName}.compiler"
|
||||
project.hikage-compiler.version="1.0.0"
|
||||
project.hikage-compiler.version="1.0.1"
|
||||
project.hikage-widget-androidx.namespace=${project.groupName}.widget.androidx
|
||||
project.hikage-widget-androidx.version="1.0.0"
|
||||
project.hikage-widget-androidx.version="1.0.1"
|
||||
project.hikage-widget-material.namespace=${project.groupName}.widget.google.material
|
||||
project.hikage-widget-material.version="1.0.0"
|
||||
project.hikage-widget-material.version="1.0.1"
|
||||
# Maven Publish Configuration
|
||||
SONATYPE_HOST=CENTRAL_PORTAL
|
||||
RELEASE_SIGNING_ENABLED=true
|
||||
|
@@ -131,7 +131,8 @@ libraries:
|
||||
version: 3.7.0
|
||||
com.android.tools.lint:
|
||||
lint:
|
||||
version: 31.12.1
|
||||
version: 31.9.0
|
||||
auto-update: false
|
||||
lint-api:
|
||||
version-ref: <this>::lint
|
||||
lint-checks:
|
||||
|
@@ -211,7 +211,7 @@ class HikageViewGenerator(override val environment: SymbolProcessorEnvironment)
|
||||
if (!performer.annotation.requireInit) defaultValue("{}")
|
||||
}.build()
|
||||
)
|
||||
lparamsClass?.second?.let {
|
||||
lparamsClass?.second?.takeIf { !performer.annotation.final }?.let {
|
||||
addParameter(
|
||||
ParameterSpec.builder(
|
||||
name = "performer",
|
||||
@@ -343,7 +343,8 @@ class HikageViewGenerator(override val environment: SymbolProcessorEnvironment)
|
||||
override val lparams: KSClassDeclaration?,
|
||||
override val alias: String?,
|
||||
override val requireInit: Boolean,
|
||||
override val requirePerformer: Boolean
|
||||
override val requirePerformer: Boolean,
|
||||
override val final: Boolean
|
||||
) : HikageAnnotationSpec {
|
||||
|
||||
companion object {
|
||||
@@ -360,12 +361,13 @@ class HikageViewGenerator(override val environment: SymbolProcessorEnvironment)
|
||||
val alias = annotation.arguments.getOrNull<String>("alias")
|
||||
val requireInit = annotation.arguments.getOrNull<Boolean>("requireInit") ?: false
|
||||
val requirePerformer = annotation.arguments.getOrNull<Boolean>("requirePerformer") ?: false
|
||||
val final = annotation.arguments.getOrNull<Boolean>("final") ?: false
|
||||
|
||||
// Solve the actual content of the annotation parameters.
|
||||
val declaration = Processor.createViewDeclaration(NAME, alias, ksClass)
|
||||
val resolvedLparams = Processor.resolvedLparamsDeclaration(NAME, resolver, declaration, lparams)
|
||||
|
||||
return HikageViewSpec(resolvedLparams, alias, requireInit, requirePerformer) to declaration
|
||||
return HikageViewSpec(resolvedLparams, alias, requireInit, requirePerformer, final) to declaration
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,7 +377,8 @@ class HikageViewGenerator(override val environment: SymbolProcessorEnvironment)
|
||||
override val lparams: KSClassDeclaration?,
|
||||
override val alias: String?,
|
||||
override val requireInit: Boolean,
|
||||
override val requirePerformer: Boolean
|
||||
override val requirePerformer: Boolean,
|
||||
override val final: Boolean
|
||||
) : HikageAnnotationSpec {
|
||||
|
||||
companion object {
|
||||
@@ -393,6 +396,7 @@ class HikageViewGenerator(override val environment: SymbolProcessorEnvironment)
|
||||
val alias = annotation.arguments.getOrNull<String>("alias")
|
||||
val requireInit = annotation.arguments.getOrNull<Boolean>("requireInit") ?: false
|
||||
val requirePerformer = annotation.arguments.getOrNull<Boolean>("requirePerformer") ?: false
|
||||
val final = annotation.arguments.getOrNull<Boolean>("final") ?: false
|
||||
|
||||
// Solve the actual content of the annotation parameters.
|
||||
val resolvedView = view?.declaration?.getClassDeclaration(resolver) ?: error("Internal error.")
|
||||
@@ -407,7 +411,7 @@ class HikageViewGenerator(override val environment: SymbolProcessorEnvironment)
|
||||
}
|
||||
|
||||
val resolvedLparams = Processor.resolvedLparamsDeclaration(NAME, resolver, declaration, lparams)
|
||||
return HikageViewDeclarationSpec(resolvedView, resolvedLparams, alias, requireInit, requirePerformer) to declaration
|
||||
return HikageViewDeclarationSpec(resolvedView, resolvedLparams, alias, requireInit, requirePerformer, final) to declaration
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,6 +421,7 @@ class HikageViewGenerator(override val environment: SymbolProcessorEnvironment)
|
||||
val alias: String?
|
||||
val requireInit: Boolean
|
||||
val requirePerformer: Boolean
|
||||
val final: Boolean
|
||||
}
|
||||
|
||||
private data class Performer(
|
||||
|
@@ -45,6 +45,9 @@ import kotlin.reflect.KClass
|
||||
* @param requireInit whether to force the `init` parameter to be called, default is false.
|
||||
* @param requirePerformer whether to force the `performer` parameter to be called, default is false,
|
||||
* this parameter will be ignored when no `performer` parameter is needed here.
|
||||
* @param final whether to declare this layout as "final layout", default is false, that is,
|
||||
* whether this layout inherits from or is [ViewGroup], the `performer` parameter will not be generated.
|
||||
* After set to `true`, [lparams] and [requirePerformer] will no longer be valid.
|
||||
*/
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@@ -53,5 +56,6 @@ annotation class HikageView(
|
||||
val lparams: KClass<*> = Any::class,
|
||||
val alias: String = "",
|
||||
val requireInit: Boolean = false,
|
||||
val requirePerformer: Boolean = false
|
||||
val requirePerformer: Boolean = false,
|
||||
val final: Boolean = false
|
||||
)
|
@@ -48,6 +48,9 @@ import kotlin.reflect.KClass
|
||||
* @param requireInit whether to force the `init` parameter to be called, default is false.
|
||||
* @param requirePerformer whether to force the `performer` parameter to be called, default is false,
|
||||
* this parameter will be ignored when no `performer` parameter is needed here.
|
||||
* @param final whether to declare this layout as "final layout", default is false, that is,
|
||||
* whether this layout inherits from or is [ViewGroup], the `performer` parameter will not be generated.
|
||||
* After set to `true`, [lparams] and [requirePerformer] will no longer be valid.
|
||||
*/
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@@ -57,5 +60,6 @@ annotation class HikageViewDeclaration(
|
||||
val lparams: KClass<*> = Any::class,
|
||||
val alias: String = "",
|
||||
val requireInit: Boolean = false,
|
||||
val requirePerformer: Boolean = false
|
||||
val requirePerformer: Boolean = false,
|
||||
val final: Boolean = false
|
||||
)
|
@@ -24,7 +24,8 @@
|
||||
|
||||
package com.highcapable.hikage.widget.android
|
||||
|
||||
import android.widget.AbsListView
|
||||
import android.view.SurfaceView
|
||||
import android.webkit.WebView
|
||||
import android.widget.ActionMenuView
|
||||
import android.widget.AutoCompleteTextView
|
||||
import android.widget.Button
|
||||
@@ -101,7 +102,7 @@ private object SpaceDeclaration
|
||||
@HikageViewDeclaration(CheckedTextView::class)
|
||||
private object CheckedTextViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(ExpandableListView::class, AbsListView.LayoutParams::class)
|
||||
@HikageViewDeclaration(ExpandableListView::class, final = true)
|
||||
private object ExpandableListViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(Spinner::class)
|
||||
@@ -143,13 +144,13 @@ private object TextSwitcherDeclaration
|
||||
@HikageViewDeclaration(ActionMenuView::class, ActionMenuView.LayoutParams::class)
|
||||
private object ActionMenuViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(CalendarView::class, FrameLayout.LayoutParams::class)
|
||||
@HikageViewDeclaration(CalendarView::class, final = true)
|
||||
private object CalendarViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(DatePicker::class, FrameLayout.LayoutParams::class)
|
||||
@HikageViewDeclaration(DatePicker::class, final = true)
|
||||
private object DatePickerDeclaration
|
||||
|
||||
@HikageViewDeclaration(TimePicker::class, FrameLayout.LayoutParams::class)
|
||||
@HikageViewDeclaration(TimePicker::class, final = true)
|
||||
private object TimePickerDeclaration
|
||||
|
||||
@HikageViewDeclaration(RatingBar::class)
|
||||
@@ -173,19 +174,25 @@ private object ViewFlipperDeclaration
|
||||
@HikageViewDeclaration(ViewAnimator::class, FrameLayout.LayoutParams::class)
|
||||
private object ViewAnimatorDeclaration
|
||||
|
||||
@HikageViewDeclaration(SurfaceView::class)
|
||||
private object SurfaceVieweclaration
|
||||
|
||||
@HikageViewDeclaration(VideoView::class)
|
||||
private object VideoViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(Toolbar::class, Toolbar.LayoutParams::class)
|
||||
@HikageViewDeclaration(WebView::class, final = true)
|
||||
private object WebViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(Toolbar::class, final = true)
|
||||
private object ToolbarDeclaration
|
||||
|
||||
@HikageViewDeclaration(GridLayout::class, GridLayout.LayoutParams::class)
|
||||
private object GridLayoutDeclaration
|
||||
|
||||
@HikageViewDeclaration(GridView::class, AbsListView.LayoutParams::class)
|
||||
@HikageViewDeclaration(GridView::class, final = true)
|
||||
private object GridViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(ListView::class, AbsListView.LayoutParams::class)
|
||||
@HikageViewDeclaration(ListView::class, final = true)
|
||||
private object ListViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(ImageView::class)
|
||||
@@ -200,10 +207,10 @@ private object TableLayoutDeclaration
|
||||
@HikageViewDeclaration(TableRow::class, TableRow.LayoutParams::class)
|
||||
private object TableRowDeclaration
|
||||
|
||||
@HikageViewDeclaration(NumberPicker::class, LinearLayout.LayoutParams::class)
|
||||
@HikageViewDeclaration(NumberPicker::class, final = true)
|
||||
private object NumberPickerDeclaration
|
||||
|
||||
@HikageViewDeclaration(SearchView::class, FrameLayout.LayoutParams::class)
|
||||
@HikageViewDeclaration(SearchView::class, final = true)
|
||||
private object SearchViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(Switch::class)
|
||||
@@ -212,5 +219,5 @@ private object SwitchDeclaration
|
||||
@HikageViewDeclaration(TabHost::class, FrameLayout.LayoutParams::class)
|
||||
private object TabHostDeclaration
|
||||
|
||||
@HikageViewDeclaration(TabWidget::class, LinearLayout.LayoutParams::class)
|
||||
@HikageViewDeclaration(TabWidget::class, final = true)
|
||||
private object TabWidgetDeclaration
|
@@ -30,6 +30,18 @@ import com.highcapable.hikage.core.base.HikageFactoryBuilder
|
||||
import com.highcapable.hikage.core.base.HikagePerformer
|
||||
import com.highcapable.hikage.core.base.Hikageable
|
||||
|
||||
/**
|
||||
* @see ViewGroup.addView
|
||||
* @see Hikageable
|
||||
* @return [Hikage]
|
||||
*/
|
||||
@JvmName("addViewTyped")
|
||||
inline fun <reified LP : ViewGroup.LayoutParams> ViewGroup.addView(
|
||||
index: Int = -1,
|
||||
factory: HikageFactoryBuilder.() -> Unit = {},
|
||||
performer: HikagePerformer<LP>
|
||||
) = Hikageable<LP>(context = context, factory = factory, performer = performer).apply { addView(root, index) }
|
||||
|
||||
/**
|
||||
* @see ViewGroup.addView
|
||||
* @see Hikageable
|
||||
@@ -39,7 +51,7 @@ inline fun ViewGroup.addView(
|
||||
index: Int = -1,
|
||||
factory: HikageFactoryBuilder.() -> Unit = {},
|
||||
performer: HikagePerformer<ViewGroup.LayoutParams>
|
||||
) = Hikageable(context = context, factory = factory, performer = performer).apply { addView(root, index) }
|
||||
) = addView<ViewGroup.LayoutParams>(index, factory, performer)
|
||||
|
||||
/**
|
||||
* @see ViewGroup.addView
|
||||
|
@@ -78,7 +78,7 @@ private object AppCompatTextViewDeclaration
|
||||
@HikageViewDeclaration(AppCompatToggleButton::class)
|
||||
private object AppCompatToggleButtonDeclaration
|
||||
|
||||
@HikageViewDeclaration(AppCompatToolbar::class, AppCompatToolbar.LayoutParams::class)
|
||||
@HikageViewDeclaration(AppCompatToolbar::class, final = true)
|
||||
private object AppCompatToolbarDeclaration
|
||||
|
||||
@HikageViewDeclaration(AppCompatCheckedTextView::class)
|
||||
@@ -87,7 +87,7 @@ private object AppCompatCheckedTextViewDeclaration
|
||||
@HikageViewDeclaration(SwitchCompat::class)
|
||||
private object SwitchCompatDeclaration
|
||||
|
||||
@HikageViewDeclaration(AppCompatSearchView::class)
|
||||
@HikageViewDeclaration(AppCompatSearchView::class, final = true)
|
||||
private object AppCompatSearchViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(LinearLayoutCompat::class, LinearLayoutCompat.LayoutParams::class)
|
||||
|
@@ -24,8 +24,36 @@
|
||||
|
||||
package com.highcapable.hikage.widget.androidx.constraintlayout
|
||||
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import androidx.constraintlayout.utils.widget.ImageFilterButton
|
||||
import androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
import androidx.constraintlayout.utils.widget.MockView
|
||||
import androidx.constraintlayout.utils.widget.MotionButton
|
||||
import androidx.constraintlayout.utils.widget.MotionLabel
|
||||
import androidx.constraintlayout.utils.widget.MotionTelltales
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.highcapable.hikage.annotation.HikageViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(ConstraintLayout::class, ConstraintLayout.LayoutParams::class)
|
||||
private object ConstraintLayoutDeclaration
|
||||
|
||||
@HikageViewDeclaration(MotionLayout::class, ConstraintLayout.LayoutParams::class)
|
||||
private object MotionLayoutDeclaration
|
||||
|
||||
@HikageViewDeclaration(ImageFilterButton::class)
|
||||
private object ImageFilterButtonDeclaration
|
||||
|
||||
@HikageViewDeclaration(ImageFilterView::class)
|
||||
private object ImageFilterViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(MockView::class)
|
||||
private object MockViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(MotionButton::class)
|
||||
private object MotionButtonDeclaration
|
||||
|
||||
@HikageViewDeclaration(MotionLabel::class)
|
||||
private object MotionLabelDeclaration
|
||||
|
||||
@HikageViewDeclaration(MotionTelltales::class)
|
||||
private object MotionTelltalesDeclaration
|
@@ -27,5 +27,5 @@ package com.highcapable.hikage.widget.androidx.recyclerview
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.highcapable.hikage.annotation.HikageViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(RecyclerView::class, RecyclerView.LayoutParams::class)
|
||||
@HikageViewDeclaration(RecyclerView::class, final = true)
|
||||
private object RecyclerViewDeclaration
|
@@ -28,8 +28,8 @@ import androidx.viewpager.widget.ViewPager
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.highcapable.hikage.annotation.HikageViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(ViewPager::class, ViewPager.LayoutParams::class)
|
||||
@HikageViewDeclaration(ViewPager::class, final = true)
|
||||
private object ViewPagerDeclaration
|
||||
|
||||
@HikageViewDeclaration(ViewPager2::class)
|
||||
@HikageViewDeclaration(ViewPager2::class, final = true)
|
||||
private object ViewPager2Declaration
|
@@ -24,7 +24,6 @@
|
||||
|
||||
package com.highcapable.hikage.widget.google.material.appbar
|
||||
|
||||
import android.widget.Toolbar
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
import com.google.android.material.appbar.MaterialToolbar
|
||||
@@ -33,7 +32,7 @@ import com.highcapable.hikage.annotation.HikageViewDeclaration
|
||||
@HikageViewDeclaration(AppBarLayout::class, AppBarLayout.LayoutParams::class)
|
||||
private object AppBarLayoutDeclaration
|
||||
|
||||
@HikageViewDeclaration(MaterialToolbar::class, Toolbar.LayoutParams::class)
|
||||
@HikageViewDeclaration(MaterialToolbar::class, final = true)
|
||||
private object MaterialToolbarDeclaration
|
||||
|
||||
@HikageViewDeclaration(CollapsingToolbarLayout::class, CollapsingToolbarLayout.LayoutParams::class)
|
||||
|
@@ -24,9 +24,8 @@
|
||||
|
||||
package com.highcapable.hikage.widget.google.material.bottomappbar
|
||||
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import com.google.android.material.bottomappbar.BottomAppBar
|
||||
import com.highcapable.hikage.annotation.HikageViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(BottomAppBar::class, Toolbar.LayoutParams::class)
|
||||
@HikageViewDeclaration(BottomAppBar::class, final = true)
|
||||
private object BottomAppBarDeclaration
|
@@ -24,9 +24,8 @@
|
||||
|
||||
package com.highcapable.hikage.widget.google.material.bottomnavigation
|
||||
|
||||
import android.widget.FrameLayout
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import com.highcapable.hikage.annotation.HikageViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(BottomNavigationView::class, FrameLayout.LayoutParams::class)
|
||||
@HikageViewDeclaration(BottomNavigationView::class, final = true)
|
||||
private object BottomNavigationViewDeclaration
|
@@ -24,9 +24,8 @@
|
||||
|
||||
package com.highcapable.hikage.widget.google.material.navigation
|
||||
|
||||
import android.widget.FrameLayout
|
||||
import com.google.android.material.navigation.NavigationView
|
||||
import com.highcapable.hikage.annotation.HikageViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(NavigationView::class, FrameLayout.LayoutParams::class)
|
||||
@HikageViewDeclaration(NavigationView::class, final = true)
|
||||
private object NavigationViewDeclaration
|
@@ -24,9 +24,8 @@
|
||||
|
||||
package com.highcapable.hikage.widget.google.material.navigationrail
|
||||
|
||||
import android.widget.FrameLayout
|
||||
import com.google.android.material.navigationrail.NavigationRailView
|
||||
import com.highcapable.hikage.annotation.HikageViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(NavigationRailView::class, FrameLayout.LayoutParams::class)
|
||||
@HikageViewDeclaration(NavigationRailView::class, final = true)
|
||||
private object NavigationRailViewDeclaration
|
@@ -25,12 +25,11 @@
|
||||
package com.highcapable.hikage.widget.google.material.search
|
||||
|
||||
import android.widget.FrameLayout
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import com.google.android.material.search.SearchBar
|
||||
import com.google.android.material.search.SearchView
|
||||
import com.highcapable.hikage.annotation.HikageViewDeclaration
|
||||
|
||||
@HikageViewDeclaration(SearchBar::class, Toolbar.LayoutParams::class)
|
||||
@HikageViewDeclaration(SearchBar::class, final = true)
|
||||
private object SearchBarDeclaration
|
||||
|
||||
@HikageViewDeclaration(SearchView::class, FrameLayout.LayoutParams::class)
|
||||
|
Reference in New Issue
Block a user