Leanpub Header

Skip to main content

Jetpack Compose 內部原理(繁體中文版)

Jetpack Compose 是 Android 使用者介面的未來。透過深入了解其內部運作原理,你將成為更有效率的開發者。即使你不是 Android 開發者,這些知識對你來說也很有價值。本書提供所有細節,幫助你理解 Compose 編譯器和執行時期是如何運作的,以及如何使用它們來建立客戶端程式庫。

This book is a translation into Chinese (Traditional) 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 (Traditional) 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. 與 suspend 函式的相似之處
  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. Composer 中的 SideEffects
  12. 存儲 CompositionLocals
  13. 存儲源信息
  14. 通過 CompositionContext 連接組合
  15. 訪問當前狀態快照
  16. 導覽節點
  17. 保持讀取器和寫入器同步
  18. 應用變更
  19. 建立節點樹時的效能
  20. 如何應用更改
  21. 附加和繪製節點
  22. Composition(組成)
  23. 創建 Composition
  24. 初始組合過程
  25. 初始組合後應用更改
  26. 關於組合的其他信息
  27. Recomposer
  28. 啟動 Recomposer
  29. 重組過程
  30. 併發重組
  31. Recomposer 的狀態

4. Compose UI

  1. 將 UI 與 Compose 運行時整合
  2. 將預定更改映射到樹的實際更改
  3. Compose UI 視角下的組合
  4. 從 Compose UI 的角度看 Subcomposition
  5. 在 UI 中反映變更
  6. 不同類型的應用器
  7. 具現化新的布局節點
  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. GlobalSnapshot 與巢狀快照
  10. StateObjects 和 StateRecords
  11. 讀取和寫入狀態
  12. 移除或重用過時記錄
  13. 變更傳播
  14. 合併寫入衝突

6. 效果與效果處理器

  1. 認識副作用
  2. Compose 中的副作用
  3. 我們的需求
  4. 效果處理器
  5. 非暫停效果
  6. 暫停效果
  7. 第三方函式庫適配器

7. Compose Runtime 的進階使用案例

  1. Compose runtime 與 Compose UI 的區別
  2. (重新)認識 composition
  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