Wear
下表列出了 androidx.wear
组中的所有工件。
工件 | 当前稳定版 | 下一候选版本 | Beta 版 | Alpha 版 |
---|---|---|---|---|
wear | 1.1.0 | - | - | 1.2.0-alpha02 |
wear-input | - | 1.0.0-rc01 | - | - |
wear-complications-data | - | - | - | 1.0.0-alpha02 |
wear-complications-provider | - | - | - | 1.0.0-alpha02 |
wear-watchface | - | - | - | 1.0.0-alpha02 |
wear-watchface-client | - | - | - | 1.0.0-alpha02 |
wear-watchface-complications-rendering | - | - | - | 1.0.0-alpha02 |
wear-watchface-data | - | - | - | 1.0.0-alpha02 |
wear-watchface-style | - | - | - | 1.0.0-alpha02 |
声明依赖项
如需添加 Wear 的依赖项,您必须将 Google Maven 代码库添加到项目中。如需了解详情,请参阅 Google 的 Maven 代码库。
在应用或模块的 build.gradle
文件中添加所需工件的依赖项:
dependencies { implementation "androidx.wear:wear:1.1.0" // Add support for wearable specific inputs implementation "androidx.wear:wear-input:1.0.0" implementation "androidx.wear:wear-input-testing:1.0.0" // Use to implement wear watchface complications implementation "androidx.wear:wear-complications-provider:1.0.0-alpha04" // Use to implement wear watchfaces implementation "androidx.wear:wear-watchface:1.0.0-alpha04" }
如需详细了解依赖项,请参阅添加构建依赖项。
反馈
您的反馈将帮助我们改进 Jetpack。如果您发现了新问题,或对库的改进有某些建议,请告诉我们。创建新问题前,请先查看此库中的现有问题。您可以点击星标按钮,为现有问题投票。
如需了解详情,请参阅问题跟踪器文档。
Wear Complications 和 Watchface 1.0.0
版本 1.0.0-alpha02
2020 年 11 月 11 日
发布了 androidx.wear:wear-*:1.0.0-alpha02
。版本 1.0.0-alpha02 中包含这些提交内容。
API 变更
ComplicationDetails
现在称为ComplicationState
且已正确封装,同时穿戴式设备支持的用法@ComplicationData.ComplicationType
已迁移至 androidxComplicationType
。(I4dd36)- 向 RenderParameters 添加了一个可选的
highlightedComplicationId
参数,以便您请求突出显示屏幕截图中的单个复杂功能。(I66ce9) ComplicationProviderService
使用新样式的复杂功能 API 以实现一致性 (Id5aea)getPreviewReferenceTimeMillis
现在从DeviceConfig
获取参考时间。(I779fe)- 简化了 Renderer API Surface,可改为使用
SurfaceHolder.Callback
观察变更。(I210db) CanvasComplicationRenderer
并非从Renderer
扩展,为清楚起见,对其进行了重命名。(Ibe880)
问题修复
androidx.wear:wear-watchface-client
的初始版本 (I1e35e)- 为清楚起见,更改了
GlesTextureComplication#renderer
的名称 (Ib78f7) - 为清楚起见,已将
StyleCategory
重命名为StyleSetting
(I488c7) - 添加了
UserStyleSchema
以简化 API (If36f8)
版本 1.0.0-alpha01
2020 年 10 月 28 日
发布了 androidx.wear:wear-complications-*:1.0.0-alpha01
和 androidx.wear:wear-watchface-*:1.0.0-alpha01
。版本 1.0.0-alpha01 中包含这些提交内容。
API 变更
- 移除了我们不希望在公共 API 中公开的某些内容。(I41669)
- 创建了
androidx.wear:wear-complications-provider
库。(I77f1f) - 新增了 ComplicationsUserStyleCategory 类别,推荐用于配置复杂功能 (I96909)
- 添加了 wear-complication-data API。(I7c268)
- 返回布尔值的函数现在采用“is”名称前缀,而非“get”(If36ff)
- API 的推荐做法是避免使用受保护的数据,因此我们重构了这个类,让其通过构造函数接收参数。(I61644)
- 为清楚起见,重命名了 setBackgroundComplication。(I96fe3)
- 为 ComplicationDrawable isHighlighted 及相关数据使用 Kotlin 属性 (I4dcc8)
- 我们添加了 Complication#invalidate(),用于替代 ComplicationRenderer.InvalidateCallback (I4f4c6)
- 这些 API 已在 WearableSupport 中弃用,并在此版本中移除。(Ib425c)
- 重命名了一些 WatchFace 构建器方法,以强调它们 Wear 2.0 遗留产物的性质。(Idb775)
- wear/wear-watchface 的第一个候选 Beta 版 API (Id3981)
- 第一个受到跟踪的 API 版本。(Ie9fe6)
- 正确隐藏 ComplicationDrawable.BorderStyle IntDef 并移至 ComplicationStyle,以实现一致性。(I27f7a)
- 为 ComplicationStyle 方法添加了缺失的注释 (I838fd)
- 此库没有公共 API Surface (I88e2b)
- 所有样式的 Category Option 类现均已正确设置为“final”。(Ib8323)
- 第一个受到跟踪的 API 版本。(I27c85)
问题修复
- 更改了 ComplicationProviderService 以添加明确的 getComplicationPreviewData 方法。(I4905f)
- 针对 androidx 启用了 MissingGetterMatchingBuilder 的 API lint 检查(I4bbea、b/138602561)
- 重命名了 wear-complications-rendering。(Ifea02)
- 样式类别显示名现为 CharSequence (I28990)
- 将“Override”替换为“Overlay”,以符合当前主题与样式的命名惯例。(I4fde9)
- 为清楚起见,重命名了 UserStyle#getOptions。(I695b6)
版本 1.2.0
版本 1.2.0-alpha02
2020 年 11 月 11 日
发布了 androidx.wear:wear:1.2.0-alpha02
。版本 1.2.0-alpha02 中包含这些提交内容。
此版本首次添加了新的“Ongoing Activities API”。开发者可以使用此 API 指示一项长时间的活动(例如,健身运动或媒体播放)正在持续进行中。借助此 API,开发者可以提供周期性状态更新(例如,“跑步距离和时间”和“当前播放的曲目”),以显示在表盘上或应用启动器中。此功能的适用对象为日后启用“正在进行的活动”功能的设备。
API 变更
- 新的 Ongoing Activities API,这在“不受支持的设备”上是一项空操作。(I69a31)
版本 1.2.0-alpha01
2020 年 10 月 28 日
发布了 androidx.wear:wear:1.2.0-alpha01
。版本 1.2.0-alpha01 中包含这些提交内容。
新功能
- 添加了 WearCurvedTextView 组件,以便沿着视图中可内切的最大圆圈的弧线轻松显示曲线文字。用法示例:
<androidx.wear.widget.WearCurvedTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="example curved text"
app:anchorAngleDegrees="180"
app:anchorPosition="center"
app:clockwise="false"
style="@android:style/TextAppearance.Large"
/>
- 添加了 WearArcLayout 容器,用于按顺时针或逆时针方向在圆弧上逐个布置其子元素。其子级可以是标准 Android 微件,也可以是实现其 ArcLayoutWidget 接口的“曲线”微件。用法示例:
<androidx.wear.widget.WearArcLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:anchorPosition="center">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_launcher"
/>
<androidx.wear.widget.WearCurvedTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Curved Text"
style="@android:style/TextAppearance.Small"
android:padding="2dp"
/>
</androidx.wear.widget.WearArcLayout>
(I536da)
Wear-Input 1.0.0
版本 1.0.0-rc01
2020 年 11 月 11 日
发布了 androidx.wear:wear-input:1.0.0-rc01
和 androidx.wear:wear-input-testing:1.0.0-rc01
。版本 1.0.0-rc01 中包含这些提交内容。
此版本与 1.0.0-beta01
完全相同。
版本 1.0.0-beta01
2020 年 10 月 28 日
发布了 androidx.wear:wear-input:1.0.0-beta01
和 androidx.wear:wear-input-testing:1.0.0-beta01
,这两个版本与 1.1.0-alpha01
相比没有变化。版本 1.0.0-beta01 中包含这些提交内容。
Wear-Input-Testing 版本 1.0.0-alpha01
2020 年 10 月 14 日
发布了 androidx.wear:wear-input-testing:1.0.0-alpha01
。版本 1.0.0-alpha01 中包含这些提交内容。
API 变更
- 添加了
androidx.wear.input.test.TestWearableButtonsProvider
,它实现了androidx.wear.input.WearableButtonsProvider
,以便协助测试使用androidx.wear:wear-input
库开发的应用。(I0ed0c)
Wear-Input 版本 1.0.0-alpha01
2020 年 9 月 2 日
发布了 androidx.wear:wear-input:1.0.0-alpha01
。版本 1.0.0-alpha01 中包含这些提交内容。
新功能
将 WearableButtons 功能从穿戴式设备支持库迁移到 Jetpack。在下一个 Jetpack 版本中,androidx.wear:wear-input-testing
库将提供更多测试支持。
版本 1.1.0
版本 1.1.0
2020 年 10 月 14 日
发布了 androidx.wear:wear:1.1.0
。版本 1.1.0 中包含这些提交内容。
自 1.0.0 以来的重要变更
- 为
BoxInsetLayout
的 boxedEdges 属性添加了layout_
前缀(现为layout_BoxedEdges
)以便遵循 android 命名惯例。这将消除 Android Studio 中与这些属性有关的 linter 错误。(I4272f) - 向
ConfirmationActivity
添加了可选的EXTRA_ANIMATION_DURATION_MILLIS
,让您可以控制确认对话框显示的时长。(adb83ce、b/143356547) - 更新了
WearableActionDrawView
,让操作抽屉的膨胀时间延迟到抽屉栏首次打开的时侯。(I01026、b/163870541)
版本 1.1.0-rc03
2020 年 9 月 2 日
发布了 androidx.wear:wear:1.1.0-rc03
。版本 1.1.0-rc03 中包含这些提交内容。
问题修复
- 解决了操作抽屉在打开时不显示内容的问题。(I01026、b/163870541)
版本 1.1.0-rc02
2020 年 6 月 24 日
发布了 androidx.wear:wear:1.1.0-rc02
。版本 1.1.0-rc02 中包含这些提交内容。
问题修复
- 为
BoxInsetLayout
的 boxedEdges 属性添加了layout_
前缀(现为layout_boxedEdges
)以便遵循 android 命名惯例。这将消除 Android Studio 中与这些属性有关的 linter 错误。
版本 1.1.0-rc01
2020 年 5 月 14 日
发布了 androidx.wear:wear:1.1.0-rc01
,该版本与 .1.0-beta01
相比没有变化。版本 1.1.0-rc01 中包含这些提交内容。
版本 1.1.0-beta01
2020 年 4 月 29 日
发布了 androidx.wear:wear:1.1.0-beta01
,该版本与 androidx.wear:wear:1.1.0-alpha01
相比没有变化。版本 1.3.0-beta01 中包含这些提交内容。
版本 1.1.0-alpha01
2020 年 4 月 15 日
发布了 androidx.wear:wear:1.1.0-alpha01
。版本 1.1.0-alpha01 中包含这些提交内容。
API 变更
- 向
ConfirmationActivity
添加了可选的EXTRA_ANIMATION_DURATION_MILLIS
,让您可以控制确认对话框显示的时长。(adb83ce、134523c、b/143356547)
问题修复
- 更新了
WearableActionDrawView
,让操作抽屉的膨胀时间延迟到抽屉栏首次打开的时侯。(5cd32f7)