Leanpub Header

Skip to main content

Jetpack Compose 内部原理 (简体中文版)

Jetpack Compose是Android界面开发的未来。掌握其内部工作原理,让您成为更高效的开发者。即使您不是Android开发者,这本书对您来说也很有价值。本书详细介绍了Compose编译器和运行时的工作原理,以及如何使用它们创建客户端库。

This book is a translation into Chinese (Simplified) of Jetpack Compose internals which was originally written in English

Minimum price

$34.99

$49.99

You pay

$49.99

Authors earn

$39.99
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
About

About

About the Book

本书深入探讨了 Jetpack Compose 的核心机制,这是由 Google 和 Android 团队推出的全新库,将成为 Android UI 的未来。现在投入时间深入学习其内部原理,将助您在未来开发出现代、高效的 Android 应用。

如果您对 Jetpack Compose 在 Android 之外的其他使用场景感兴趣,本书同样能满足您的需求。Jetpack Compose 内部原理专注于从通用角度探索其编译器和运行时,使整体内容对目标平台保持中立。本书还专门提供了一个章节,通过代码展示了 Jetpack Compose 的多种使用场景,其中包含了一些非常有趣的示例。

Jetpack Compose 和 Android 是 Google LLC 的商标,本书未经 Google 认可,也未与 Google 有任何关联。

This book is a translation into Chinese (Simplified) of Jetpack Compose internals which was originally written in English

Author

About the Authors

Jorge Castillo

Jorge is a Google Developer Expert (GDE) for Android and Kotlin that has been traditionally very active in the Android community.

TranslateAI

Leanpub now has a TranslateAI service which uses AI to translate their book from English into up to 31 languages, or from one of those 31 languages into English. We also have a GlobalAuthor bundle which uses TranslateAI to translate English-language books into either 8 or 31 languages.

Leanpub exists to serve our authors. We want to help you reach as many readers as possible, in their preferred language. So, just as Leanpub automates the process of publishing a PDF and EPUB ebook, we've now automated the process of translating those books!

Contents

Table of Contents

序章

  1. 为什么要阅读本书
  2. 本书不涵盖的内容
  3. 为什么要写关于内部原理的书
  4. 时刻关注源代码
  5. 代码片段和示例

1. 可组合函数

  1. 可组合函数的含义
  2. 可组合函数的属性
  3. 调用上下文
  4. 幂等性
  5. 避免不受控制的副作用
  6. 可重启性
  7. 快速执行
  8. 位置记忆化
  9. 与挂起函数的相似之处
  10. 可组合函数的颜色
  11. 可组合函数类型

2. Compose 编译器

  1. Kotlin 编译器插件
  2. Compose 注解
  3. 注册编译器扩展
  4. Kotlin 编译器版本
  5. 静态分析
  6. 静态检查器
  7. 调用检查
  8. 类型检查
  9. 声明检查
  10. 诊断抑制
  11. 运行时版本检查
  12. 代码生成
  13. Kotlin IR
  14. 降级
  15. 推断类的稳定性
  16. 启用实时字面量
  17. Compose lambda记忆化
  18. 注入 Composer
  19. 比较传播
  20. 默认参数
  21. 控制流组生成
  22. Klib 和诱饵生成

3. Compose 运行时

  1. 插槽表和变更列表
  2. 深入理解插槽表
  3. 变更列表
  4. Composer(组合器)
  5. 为Composer提供数据
  6. 对变更进行建模
  7. 优化写入时机
  8. 写入和读取组
  9. 记住值
  10. 重组作用域
  11. 编写器中的SideEffects
  12. 存储CompositionLocals
  13. 存储源信息
  14. 通过CompositionContext链接组合
  15. 访问当前状态快照
  16. 导航节点
  17. 保持读取器和写入器同步
  18. 应用更改
  19. 构建节点树时的性能
  20. 如何应用更改
  21. 附加和绘制节点
  22. Composition(组合)
  23. 创建 Composition
  24. 初始化 Composition 过程
  25. 初始组合后应用更改
  26. 关于组合的其他信息
  27. Recomposer
  28. 启动 Recomposer
  29. 重组过程
  30. 并发重组
  31. Recomposer状态

4. Compose UI

  1. 将 UI 与 Compose 运行时集成
  2. 将预定的变更映射到树的实际变更
  3. 从 Compose UI 的角度看 Composition
  4. 从Compose UI的角度看子组合
  5. 在 UI 中反映更改
  6. 不同类型的应用器
  7. 实现新的 LayoutNode
  8. 闭合循环
  9. 实体化移除节点的变更
  10. 实现移动节点的变更
  11. 实现清除所有节点的变更
  12. Compose UI 中的测量
  13. 测量策略
  14. 固有测量
  15. 布局约束
  16. LookaheadLayout
  17. 构建修饰符链
  18. 将修饰符设置到LayoutNode上
  19. LayoutNode 如何处理新的修饰符
  20. 绘制节点树
  21. Jetpack Compose 中的语义
  22. 通知语义变化
  23. 合并和未合并的语义树

5. 状态快照系统

  1. 什么是快照状态
  2. 并发控制系统
  3. 多版本并发控制(MCC 或 MVCC)
  4. 快照
  5. 快照树
  6. 快照和线程
  7. 观察读取和写入
  8. 可变快照
  9. 全局快照和嵌套快照
  10. 状态对象和状态记录
  11. 读取和写入状态
  12. 移除或重用过时记录
  13. 变更传播
  14. 合并写入冲突

6. 副作用和副作用处理器

  1. 副作用介绍
  2. Compose 中的副作用
  3. 我们的需求
  4. 效果处理器
  5. 非挂起效果
  6. 挂起效果
  7. 第三方库适配器

7. Compose Runtime 高级用例

  1. Compose runtime 与 Compose UI
  2. (重新)介绍组合
  3. 矢量图形的组合
  4. 构建矢量图像树
  5. 将矢量组合集成到 Compose UI
  6. 使用 Compose 管理 DOM
  7. 浏览器中的独立组合
  8. 结论

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub