SlideShare a Scribd company logo
Migrating a large-scale
banking app to Compose
S. Fatih Giris
@fatih_grs
Jetpack Compose
How to migrate existing apps to
Compose?
Agenda
• Integrating Compose
• Interoperability APIs
• Migration strategies
• Migration at DNB
• Take-aways
Integrating Compose
• Entirely Compose
• View based UI + Compose
• Composables inside Views
• Views inside composables
Interoperability APIs
• ComponentActivity.setContent
• ComposeView (View)
• AndroidView (Composable)
Migration Strategies
• Top-down
• Bottom-up
Top-down
• Start with the top most view
• Go deeper and deeper ⬇
Top-down
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
fragment_top_down.xml
Top-down
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
fragment_top_down.xml
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
fancy_content.xml
Top-down
<androidx.compose.ui.platform.ComposeView
android:id="@+id/composeView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
fancy_content.xml
fragment_top_down.xml
Top-down
class TopDownFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(
R.layout.fragment_top_down,
container,
false
)
}
}
TopDownFragment.kt
Top-down
class TopDownFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return ComposeView(requireContext())
}
}
TopDownFragment.kt
Top-down
return ComposeView(requireContext())
TopDownFragment.kt
Top-down
return ComposeView(requireContext()).apply {
// Dispose the Composition when viewLifecycleOwner is destroyed
setViewCompositionStrategy(
ViewCompositionStrategy.DisposeOnLifecycleDestroyed(viewLifecycleOwner)
)
setContent {
// Compose World
}
}
TopDownFragment.kt
Top-down
return ComposeView(requireContext()).apply {
// Dispose the Composition when viewLifecycleOwner is destroyed
setViewCompositionStrategy(
ViewCompositionStrategy.DisposeOnLifecycleDestroyed(viewLifecycleOwner)
)
setContent {
// Compose World
// Vertical Linear Layout
Column {
// Add views as AndroidView by creating
// programatically or inflating from XML
}
}
}
TopDownFragment.kt
Top-down
setContent {
// Vertical Linear Layout
Column {
}
}
TopDownFragment.kt
Top-down
setContent {
// Vertical Linear Layout
Column {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { context ->
// Inflate it from XML
inflater.inflate(
R.layout.fancy_content,
container,
false
)
},
update = { view ->
// View's been inflated or state read in
// this block has been updated
}
)
}
} TopDownFragment.kt
Top-down
setContent {
// Vertical Linear Layout
Column {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { context ->
// Create view programatically
// android.widget.Button
Button(requireContext())
},
update = { view ->
// View's been inflated or state read in
// this block has been updated
}
)
}
}
TopDownFragment.kt
Top-down
setContent {
// Vertical Linear Layout
Column {
Button(onClick = {}) {
Text("I am a compose button”)
}
}
}
TopDownFragment.kt
Bottom-up
• Start with the inner most UI elements
• Go up and up ⬆
Bottom-up
fragment_bottom_up.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Bottom-up
fragment_bottom_up.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.compose.ui.platform.ComposeView
android:id="@+id/buttonComposeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Bottom-up
class BottomUpFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
buttonComposeView.apply {
// Configure ComposeView
}
}
}
BottomUpFragment.kt
Bottom-up
buttonComposeView.apply {
// Configure ComposeView
}
BottomUpFragment.kt
Bottom-up
buttonComposeView.apply {
// Dispose the Composition when viewLifecycleOwner is destroyed
setViewCompositionStrategy(
ViewCompositionStrategy.DisposeOnLifecycleDestroyed(viewLifecycleOwner)
)
}
BottomUpFragment.kt
Bottom-up
buttonComposeView.apply {
// Dispose the Composition when viewLifecycleOwner is destroyed
setViewCompositionStrategy(
ViewCompositionStrategy.DisposeOnLifecycleDestroyed(viewLifecycleOwner)
)
setContent {
// In Compose world
}
}
BottomUpFragment.kt
Bottom-up
buttonComposeView.apply {
// Dispose the Composition when viewLifecycleOwner is destroyed
setViewCompositionStrategy(
ViewCompositionStrategy.DisposeOnLifecycleDestroyed(viewLifecycleOwner)
)
setContent {
// In Compose world
Button(onClick = {}) {
Text(text = "I am migrated Button")
}
}
}
BottomUpFragment.kt
Bottom-up
fragment_bottom_up.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.compose.ui.platform.ComposeView
android:id="@+id/buttonComposeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Bottom-up
fragment_bottom_up.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.compose.ui.platform.ComposeView
android:id="@+id/buttonComposeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<androidx.compose.ui.platform.ComposeView
android:id="@+id/textComposeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Bottom-up
fragment_bottom_up.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
Bottom-up
fragment_bottom_up.xml
<androidx.compose.ui.platform.ComposeView
android:id="@+id/fragmentComposeView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Voilà 🎉
Design System at DNB
• Eufemia Design System 🌈
• Theming
• Core components (EufemiaTextView, EufemiaButton etc.)
• Tetris 📱(WIP)
• Common UI components (Toolbar etc.)
Design System at DNB
Eufemia
App1
App2
uses
uses
Design System at DNB
Eufemia
Tetris
(WIP)
App1
App2
uses
uses
uses
How?
Migration Plan
• Start with Eufemia & Tetris
• Eufemia
• Migrate design system to Compose (colours, shapes, typography)
• Convert each component to Compose one by one
• Tetris
• Create Components as composables from the scratch
• Use AndroidView for Eufemia Android Views
Migration Plan
• Pick a screen in the app
• Apply bottom-up approach
• Create components in Tetris & Eufemia
• Iterate for all screens
During Migration
Eufemia
Compose
Tetris
Compose
App1
App2
uses
uses
uses
Eufemia
uses
After Migration
Eufemia
Compose
Tetris
Compose
App1
App2
uses
uses
uses
Migration of Apps
Activity + Fragment
Migration of Apps
Activity + Fragment
• Single Activity
• Jetpack Navigation
Migration of Apps
• No Fragment
• Activity sets content
• Navigate between composables
• Requires navigation-compose
How to replace Fragments with Composables?
We don’t for now
Migration Plan
Activity + Fragment + Compose
Migration Plan
• Only change the way views are
presented (ComposeView +
Composables)
• No change in navigation
• After all screens are migrated,
remove fragments
Compose POC
Compose POC
Toolbar
Header
Selectable item
Compose POC
• Android Studio: Bumblebee Canary 1
• Android Gradle Plugin: 7.1.0-alpha01
• Kotlin: 1.5.21
• Compose: 1.0.1
Compose POC
Gradle Android cache fix plugin + AGP 7.1.0-alpha01 incompatibility
✅ Bypass version check or comment out the plugin :)
Compose POC
Hilt 2.38.1 + AGP 7.1.0-alpha01 bug*
*https://github.com/google/dagger/issues/2618
✅ Update AGP to 7.1.0-alpha06
Compose POC
2 files found with path 'META-INF/ui_release.kotlin_module' from inputs:
- /Users/fatih/.gradle/caches/transforms-3/90edb5b9f55f1931b87d2b5c8a7aa61d/…
- /Users/fatih/.gradle/caches/transforms-3/52dda4f473a3d3633ea54e66766f28d2/…
✅ Exclude META-INF/ui_release.kotlin_module in packaging options
Compose POC
✅ Update all Kotlin versions to the same version
Compose POC
Toolbar ✅
Header ✅
Selectable item ✅
Compose POC
✅ Update androidx.activity version to 1.3.0
Compose POC
Migration Status
• Eufemia
• Theming: Colors, typography, shape ✅
• Core components 🚧
• Tetris 🚧
• Apps 🚧
Take-aways
• Plan your migration
• POC
• Make use of interoperability APIs
• Stick to the migration plan
THANKS ♥

More Related Content

PDF
Declarative UIs with Jetpack Compose
PDF
An introduction to React.js
PDF
Android Jetpack Compose - Turkey 2021
PPTX
An Intro into webpack
PDF
Jetpack Compose - A Lightning Tour
PDF
Scaling Django with gevent
PDF
PostgreSQL High Availability in a Containerized World
PDF
Jetpack Compose a new way to implement UI on Android
Declarative UIs with Jetpack Compose
An introduction to React.js
Android Jetpack Compose - Turkey 2021
An Intro into webpack
Jetpack Compose - A Lightning Tour
Scaling Django with gevent
PostgreSQL High Availability in a Containerized World
Jetpack Compose a new way to implement UI on Android

What's hot (20)

PDF
React JS - Introduction
PPT
Java Basics
PDF
Introduction to React JS
PPT
Admin linux utilisateurs_et_groupes cours 1
PDF
Generics
PPTX
Webpack Introduction
PDF
Cours design pattern m youssfi partie 5 adapter
PDF
Paving the road with Jakarta EE and Apache TomEE - JCON 2021
PDF
Cours design pattern m youssfi partie 1 introduction et pattern strategy
PDF
Bad smells no código
PDF
Java 8 Lambda Expressions
PPT
GUI Programming In Java
PPTX
React js programming concept
PPT
sets and maps
PDF
spring-api-rest.pdf
PDF
Jetpack Compose beginner.pdf
PDF
Gradle - the Enterprise Automation Tool
PPTX
(services)
PPTX
Kotlin Jetpack Tutorial
React JS - Introduction
Java Basics
Introduction to React JS
Admin linux utilisateurs_et_groupes cours 1
Generics
Webpack Introduction
Cours design pattern m youssfi partie 5 adapter
Paving the road with Jakarta EE and Apache TomEE - JCON 2021
Cours design pattern m youssfi partie 1 introduction et pattern strategy
Bad smells no código
Java 8 Lambda Expressions
GUI Programming In Java
React js programming concept
sets and maps
spring-api-rest.pdf
Jetpack Compose beginner.pdf
Gradle - the Enterprise Automation Tool
(services)
Kotlin Jetpack Tutorial
Ad

Similar to Migrating a large scale banking app to compose (20)

PPTX
Android Layout
PPTX
06 UI Layout
PDF
IT3681 - MOBILE_APPLICATIONS_DEVELOPMENT_LABORATORY (1).pdf
PDF
Designing and implementing_android_uis_for_phones_and_tablets
PDF
Primefaces mobile users_guide_0_9
PDF
Fragments: Why, How, What For?
KEY
Android Workshop
PDF
Android Material Design APIs/Tips
PPTX
04 objective-c session 4
PDF
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
PPTX
06. Android Basic Widget and Container
PPTX
Printing photos-html-using-android
PPTX
Make your app dance with MotionLayout
PDF
Android Design Support Library
PDF
Constraint-ly motion - making your app dance - John Hoford, Google
PDF
Chapter 5 - Layouts
PPT
21 android2 updated
PDF
Invading the home screen
PDF
01 09 - graphical user interface - basic widgets
Android Layout
06 UI Layout
IT3681 - MOBILE_APPLICATIONS_DEVELOPMENT_LABORATORY (1).pdf
Designing and implementing_android_uis_for_phones_and_tablets
Primefaces mobile users_guide_0_9
Fragments: Why, How, What For?
Android Workshop
Android Material Design APIs/Tips
04 objective-c session 4
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
06. Android Basic Widget and Container
Printing photos-html-using-android
Make your app dance with MotionLayout
Android Design Support Library
Constraint-ly motion - making your app dance - John Hoford, Google
Chapter 5 - Layouts
21 android2 updated
Invading the home screen
01 09 - graphical user interface - basic widgets
Ad

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
DOCX
573137875-Attendance-Management-System-original
PPTX
Artificial Intelligence
PPTX
Internet of Things (IOT) - A guide to understanding
PPT
Mechanical Engineering MATERIALS Selection
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PDF
composite construction of structures.pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT
introduction to datamining and warehousing
PPTX
Sustainable Sites - Green Building Construction
PPT
Project quality management in manufacturing
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
web development for engineering and engineering
R24 SURVEYING LAB MANUAL for civil enggi
Embodied AI: Ushering in the Next Era of Intelligent Systems
CYBER-CRIMES AND SECURITY A guide to understanding
Model Code of Practice - Construction Work - 21102022 .pdf
573137875-Attendance-Management-System-original
Artificial Intelligence
Internet of Things (IOT) - A guide to understanding
Mechanical Engineering MATERIALS Selection
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
composite construction of structures.pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
introduction to datamining and warehousing
Sustainable Sites - Green Building Construction
Project quality management in manufacturing
UNIT-1 - COAL BASED THERMAL POWER PLANTS
bas. eng. economics group 4 presentation 1.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
web development for engineering and engineering

Migrating a large scale banking app to compose