From Android View to Jetpack Compose: A Guide to Migration
With Android Views in maintenance mode and Jetpack Compose having been officially released for about three years, the adoption of Jetpack Compose is on the rise. However, for apps with a long history, the transition from Android Views may be slow due to resource constraints or other factors. While Jetpack Compose is easy to introduce, the flexibility in coding style can lead to questions when developing in a team: What rules should we establish? How should we divide Composables? How should we pass arguments to Composable functions? To what extent should we write previews? At mikan Co., Ltd., where I've been helping out as a contractor, we've been working on Jetpack Compose adoption for some time. After some trial and error, we've established guidelines on coding styles and rules. This session will cover mikan's approach to Jetpack Compose migration, using a real-world migration task as an example. We'll demonstrate how to implement layouts using Jetpack Compose, how to leverage previews to reproduce screen behavior close to the actual operation, and more. Agenda: ■ Introducing Jetpack Compose - Adding Jetpack Compose dependencies - Deciding where to place Compose-related files - Establishing naming conventions for files, Composable functions, etc. - Designing for previews that can display not only components but entire screens ■ Migrating to Jetpack Compose: Transitioning an onboarding screen to Jetpack Compose (The example screen may change) - Examining the layout of the screen - Dividing the screen's layout into component units - Identifying tasks required for migration - Implementing the UI - Defining UiState - Using Previews to achieve screen behavior close to the actual operation - Implementing logic - Combining the screen and logic (Translated by the DroidKaigi Committee)
-
syarihu Android Engineer
Summary
- Dates 2024.09.12 / 11:20 ~ 12:00 (40min)
- Place Giraffe
- Language Japanese
Intended audience
- Those who want to learn specific methods for migrating from Android Views to Jetpack Compose - Those who want to leverage Jetpack Compose Previews more effectively in their development