Mercari 借助 Jetpack Compose 将界面开发效率提高了 56%
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Mercari 让数百万人能够购物和销售几乎任何商品。该公司于 2013 年在日本成立,现已成为日本最大的以智能手机为主的 C2C 购物平台。Mercari 的 Client Architect 团队于 2020 年开始使用 Jetpack Compose,目标是使用能够长期扩展的现代解决方案和技术,为新应用构建技术栈。
策略
Mercari 团队需要实现一个在 Android View 上实现复杂状态管理和样式设置的设计系统,这是一项非常复杂的任务。通过使用 Jetpack Compose,他们不仅能够实现这个复杂的系统,还得以减少用于开发每个界面的时间。
Jetpack Compose 还帮助该团队利用设计系统为新应用编写界面代码,使其界面代码简洁且易于理解。因此,该团队可以将更多时间用于编写界面和业务逻辑,例如为深色主题提供实际支持。
此外,Mercari 团队还编写了一个概念验证工具,用于将 Figma 与设计系统集成,该工具会自动根据组件设计生成界面代码。该团队表示,由于 Compose 的声明性,使用 Compose 开发该工具会更轻松。
“一旦 Android 开发者习惯了编写 Jetpack Compose 代码,他们就不想再回来。”- Mercari 的 Android 技术主管 Anthony Allan Conda
成果
在 Jetpack Compose 和新的设计系统之间,Mercari 使用的代码编写界面的量要少得多。在包含可无限滚动内容这种常见用例的屏幕上,他们实际上将代码减少了约 56%。因此,他们得以在相同的时间内编写更多屏幕,让他们有更多时间来编写业务逻辑和代码的其他部分。
此外,开发者还可以利用界面本身执行更多操作,例如添加动画以及使用直观的 API(例如 AnimatedVisibility、Crossfade 和 Animatable)。
Mercari 计划在其新应用中继续使用 Jetpack Compose,直至 Jetpack Compose 发布。他们的设计系统(使用 Jetpack Compose 编写的 Android SDK)还可与 Mercari 中的多个应用配合使用。
开始使用
详细了解 Jetpack Compose。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2021-05-19。
[null,null,["最后更新时间 (UTC):2021-05-19。"],[],[],null,["# Mercari improves UI development productivity by 56% with Jetpack Compose\n\n[Mercari](https://play.google.com/store/apps/details?id=com.kouzoh.mercari) allows millions of people to shop and sell almost anything. The company was founded in 2013 in Japan, and it now is the largest smartphone-focused C2C marketplace in Japan. Mercari's Client Architect Team started using [Jetpack Compose](https://developer.android.com/jetpack/compose) in 2020 with the goal of using modern solutions and technologies that can scale for the long term to build their tech stack for new applications.\n\nWhat they did\n-------------\n\nThe Mercari team needed to implement a design system with complex state management and styling on Android Views --- a very complex task. Using Jetpack Compose, they were not only able to implement this complex system, it helped them spend less time developing each screen.\n\nJetpack Compose also helped the team write UI code for their new app utilizing the design system, making their UI code concise and easy to understand. As a result, the team can spend more time writing screens and business logic, such as practical support for the dark theme.\n\nIn addition, the Mercari team wrote a proof-of-concept tool for integrating Figma with the design system, which automatically generates UI code from the component designs. The team said that developing this tool was easier with Compose due to its declarative nature.\n\n*\"Once Android developers get used to writing Jetpack Compose code, they wouldn't wish to go back.\" - Anthony Allan Conda, Android Tech Lead at Mercari*\n\nResults\n-------\n\nBetween Jetpack Compose and their new design system, Mercari was able to use far less code to write screens. On screens with infinitely-scrollable content --- a common use case --- they actually reduced their code by about 56%. As a result, they were able to write more screens in the same amount of time, giving them more time to write business logic and other parts of the code.\n\nAlso, they were able to do more with the UI itself, such as incorporating animations and using intuitive APIs such as *AnimatedVisibility* , *Crossfade* , and *Animatable*.\n\nMercari is planning to continue using Jetpack Compose in their new application until its release. Their design system, with the Android SDK written in Jetpack Compose, is also designed to work with multiple applications within Mercari.\n\nGet started\n-----------\n\nLearn more about [Jetpack Compose](https://developer.android.com/jetpack/compose)."]]