What this book covers
Chapter 1, Building Your First Compose App, shows you how to build your first Compose app. Also, important key ideas such as composable functions and using previews are introduced. It is important to whet the appetite by offering early success, so we will build, preview, and run composable functions before digging too deep into details.
Chapter 2, Understanding the Declarative Paradigm, explains how Android UI development was done before Jetpack Compose and what the issues with this “old” approach are. Also, you will discover how composables are different from views and why this is both important and beneficial.
Chapter 3, Exploring the Key Principles of Compose, explores important terminology, concepts, and techniques. Their knowledge is essential to write well-behaving Compose apps.
Chapter 4, Laying Out UI Elements in Compose, examines how the way Jetpack Compose’s layout system works is different compared to the classic Android UI toolkit. This chapter introduces some of the existing layouts. It also shows you how to implement custom layouts. These are needed if the built-in layouts cannot provide the required distribution of UI elements on screen.
Chapter 5, Managing State of Your Composable Functions, details why reacting to state changes is critical to how modern mobile apps work. Jetpack Compose tries to address this need by providing reactive state primitives. This chapter looks at how to use these state primitives and how they work under the hood.
Chapter 6, Building a Real-World App, revisits previously learned concepts and brings them together in one app. Seeing concepts in actual code will help you to understand them and make it easier to reuse in your own programs.
Chapter 7, Exploring App Architecture, further explores ViewModels and how they can help build a solid app architecture. You will learn how to inject objects such as repositories during ViewModel creation and why this is important. The chapter also introduces side effects as a means to trigger or react to changes outside the Compose world.
Chapter 8, Working with Animations, contains a detailed look at animations and transitions. Using them makes apps really shine. Jetpack Compose simplifies the process of adding animation effects greatly over the old view-based approach. This chapter introduces all the relevant APIs.
Chapter 9, Exploring Interoperability APIs, explains how to mix Jetpack Compose and old-fashioned views in one app. Although Jetpack Compose is the UI toolkit of choice for new apps, its powers can be leveraged in existing apps, too. This chapter discusses strategies to combine both declarative and imperative approaches in one app and offers a migration strategy to painlessly update existing UIs to Jetpack Compose.
Chapter 10, Testing and Debugging Compose Apps, explains why testing the UI of a Compose app works differently than testing a view-based UI. Compose uses a more declarative approach to testing. This chapter introduces basic testing scenarios for Compose apps.
Chapter 11, Developing for Different Form Factors, shows you how to write Compose apps that look great not only on smartphones but also on large-screen devices, such as tablets and foldables. It introduces the concept of Window Size Classes and shows you how they are used to organize screen content.
Chapter 12, Bringing Your Compose UI to Different Platforms, shows you how to bring Compose UIs to different platforms such as the desktop (Windows, Linux, or macOS) and the web. It offers a quick introduction to Compose Multiplatform and related technologies such as Kotlin Multiplatform (KMP). You will learn how to take one of the sample apps of the book to the desktop.