{"id":456556,"date":"2025-04-18T21:00:34","date_gmt":"2025-04-18T21:00:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=456556"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=456556","title":{"rendered":"<span>\u0427\u0430\u0441\u0442\u044c 2: XML \u0438\u043b\u0438 Compose \u2014 \u0447\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c, \u0438 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0431\u043e\u0440\u043e\u043c<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><strong>\u0410\u0432\u0442\u043e\u0440:<\/strong> Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441 7+ \u0433\u043e\u0434\u0430\u043c\u0438 \u043e\u043f\u044b\u0442\u0430, \u0437\u043d\u0430\u044e\u0449\u0438\u0439 \u0442\u043e\u043b\u043a \u0432 FrameLayout, merge, include, RecyclerView, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0438 Modifier.padding.<\/p>\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u0442\u043e\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0431\u043e\u0440\u043e\u043c: \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0441 XML \u0438\u043b\u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c UI \u043d\u0430 Jetpack Compose, \u2014 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432\u044b \u0443\u0436\u0435 \u043d\u0430 \u043f\u043e\u043b\u043f\u0443\u0442\u0438 \u043a \u043d\u043e\u0432\u043e\u043c\u0443 \u0443\u0440\u043e\u0432\u043d\u044e. \u041d\u043e \u044d\u0442\u043e\u0442 \u0432\u044b\u0431\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u043c. Compose \u2014 \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u201c\u0434\u0430\u0432\u0430\u0439 \u0432\u0441\u0451 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c\u201d. \u042d\u0442\u043e \u0448\u0430\u0433 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043d\u043e\u0432\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0435\u0431\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<h3>\u0412\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0435\u0431\u0435 (\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0435)<\/h3>\n<h4>1. \u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u043e\u0432\u044b\u0439 \u0438\u043b\u0438 \u0443\u0436\u0435 \u0436\u0438\u0432\u043e\u0439?<\/h4>\n<ul>\n<li>\n<p>\u2705 \u041d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442: Compose \u2014 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440. \u041d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0442\u0430\u0449\u0438\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u26a0 \u0416\u0438\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442: \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0442\u043e\u0438\u0442 \u0438\u0434\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 Gradual Migration (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u043a\u0440\u0430\u043d\u044b \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443).<\/p>\n<\/li>\n<\/ul>\n<p>2.\u00a0\u041a\u0430\u043a\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u043d\u0430\u043d\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b?<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u201c\u0442\u044b\u201d \u0441 Kotlin, Coroutines, StateFlow \u2014 Compose \u0437\u0430\u0439\u0434\u0451\u0442 \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0432 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0435 MVP \u0438 LiveData \u2014 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u043d\u043e, \u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>3.\u00a0\u041a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0442\u0435\u043a\u0443\u0449\u0438\u0439 UI-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a?<\/p>\n<ul>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f DataBinding? ViewBinding? MVVM?<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043b\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 View \u0438\u043b\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438?<\/p>\n<\/li>\n<\/ul>\n<h4>4. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043b\u0438 WebView, MapView, ExoPlayer?<\/h4>\n<ul>\n<li>\n<p>\u042d\u0442\u0438 \u0448\u0442\u0443\u043a\u0438 \u043f\u043e\u043a\u0430 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0442\u0430\u043d\u0446\u0435\u0432 \u0432 Compose, \u043b\u0438\u0431\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c AndroidView.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u0447\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440<\/h3>\n<h4> \u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/h4>\n<ul>\n<li>\n<p>XML (ViewSystem):<\/p>\n<ul>\n<li>\n<p>\u041b\u0451\u0433\u043a\u0430\u044f \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435, \u0432\u0441\u0451 \u0443\u0436\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0442\u044f\u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0432\u0435\u0440\u0445\u0443.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Jetpack Compose:<\/p>\n<ul>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044f\u043c (foundation, material, ui-tooling \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0442 1 \u0434\u043e 4 \u041c\u0411 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>Kotlin Compiler Plugin \u0438 Compose Compiler \u0442\u043e\u0436\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u0441\u0431\u043e\u0440\u043a\u0443.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u26a0 \u0415\u0441\u043b\u0438 size-critical \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0435, \u0441\u0442\u043e\u0438\u0442 \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c \u0441 preview, tooling, animation<\/p>\n<\/blockquote>\n<h3>\u0420\u0430\u0437\u043c\u0435\u0440\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a Jetpack Compose (release-\u0441\u0431\u043e\u0440\u043a\u0430)<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432 APK (minified)<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.ui:ui<\/p>\n<\/td>\n<td>\n<p align=\"left\">~420 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.foundation:foundation<\/p>\n<\/td>\n<td>\n<p align=\"left\">~700 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.material:material<\/p>\n<\/td>\n<td>\n<p align=\"left\">~1.3 MB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.runtime:runtime<\/p>\n<\/td>\n<td>\n<p align=\"left\">~380 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.compiler:compiler<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u26a0\ufe0f \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 APK \u2014 \u044d\u0442\u043e \u043f\u043b\u0430\u0433\u0438\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.material3:material3<\/p>\n<\/td>\n<td>\n<p align=\"left\">~1.7 MB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.animation:animation<\/p>\n<\/td>\n<td>\n<p align=\"left\">~600 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.ui:ui-tooling<\/p>\n<\/td>\n<td>\n<p align=\"left\">~1.2 MB (\u0442\u043e\u043b\u044c\u043a\u043e debug)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.activity:activity-compose<\/p>\n<\/td>\n<td>\n<p align=\"left\">~120 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.navigation:navigation-compose<\/p>\n<\/td>\n<td>\n<p align=\"left\">~240 KB<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0448\u044c <strong>Material 3<\/strong>, \u043e\u043d\u0430 \u0432\u0435\u0441\u0438\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c Material 2, \u0437\u0430 \u0441\u0447\u0451\u0442 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0442\u0435\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>Tooling<\/strong> \u0438 <strong>Preview<\/strong> \u2014 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 debug, \u0438 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 release.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c, <strong>\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 Compose \u0441\u0442\u0435\u043a<\/strong> (\u0431\u0435\u0437 Material, \u0431\u0435\u0437 Navigation) \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <strong>2\u20133 \u041c\u0411<\/strong> \u043a \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c\u0443 .apk.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a \u0441 material3, animation, navigation, foundation, \u0438 \u043f\u0440. \u2014 <strong>\u0434\u043e 5\u20136 \u041c\u0411<\/strong> \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 Proguard \u0438 R8 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/h2>\n<h2>XML<\/h2>\n<ul>\n<li>\n<p>LayoutInflater \u2192 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u0435\u0440\u0435\u0432\u043e View-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>MeasureSpec + onMeasure\/onLayout\/onDraw.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0451 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 ViewRootImpl, Choreographer, Handler.<\/p>\n<\/li>\n<\/ul>\n<h3>Compose<\/h3>\n<ul>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0430\u0439\u043b\u0438\u0442\u0441\u044f \u0432 <em>SlotTable<\/em> \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f UI \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>Recomposer \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0435 Composables.<\/p>\n<\/li>\n<li>\n<p>LayoutNode \u2192 RenderNode \u2192 Skia \u2192 Canvas.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 View, \u043d\u0435\u0442 LayoutInflater, \u043d\u0435\u0442 findViewById.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\ud83d\udccc State \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u2192 recomposition \u2192 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c UI \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u2192 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 overdraw.<\/p>\n<\/blockquote>\n<h3>\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b<\/h3>\n<ul>\n<li>\n<p>XML \u2192 \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 Activity\/Fragment lifecycle \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<\/li>\n<li>\n<p>Compose \u2192 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 remember, DisposableEffect, LaunchedEffect, SideEffect, \u0438 <em>Composition Lifecycle<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0432\u0430\u0448\u0438 UI-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441\u0430\u043c\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439. \u041e\u043d\u0438 \u0437\u043d\u0430\u044e\u0442, \u043a\u043e\u0433\u0434\u0430 \u0438\u0445 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u043b\u0438, \u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435 \u2014 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f.<\/p>\n<h3>\u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0432\u0438\u0434\u043d\u044b \u0441\u0440\u0430\u0437\u0443<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>View System (XML)<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Jetpack Compose<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f UI<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0427\u0435\u0440\u0435\u0437 custom View<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0427\u0435\u0440\u0435\u0437 Composable-\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 UI<\/p>\n<\/td>\n<td>\n<p align=\"left\">Espresso, Robolectric<\/p>\n<\/td>\n<td>\n<p align=\"left\">Compose Test API (JUnit)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">Fragment + NavComponent<\/p>\n<\/td>\n<td>\n<p align=\"left\">Compose Navigation (\u0438\u043b\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041f\u0440\u0435\u0432\u044c\u044e \u0432 IDE<\/p>\n<\/td>\n<td>\n<p align=\"left\">XML Layout Editor<\/p>\n<\/td>\n<td>\n<p align=\"left\">Compose Preview<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 UI<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0427\u0435\u0440\u0435\u0437 if\/else + View.GONE<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u0441\u0442\u043e if (condition) {}<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u041a\u043e\u0433\u0434\u0430 \u0442\u043e\u0447\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0431\u0440\u0430\u0442\u044c Compose<\/h3>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0435 \u0434\u0438\u0437\u0430\u0439\u043d \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 Adapter \u0438 ViewHolder.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0447\u0442\u0430\u0435\u0442\u0435 \u043f\u0440\u043e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 \u0431\u043e\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 Kotlin \u0438 \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u044b\u0433\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 XML \u0438 \u043a\u043e\u0434\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0427\u0442\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0433\u043b\u0443\u0431\u0436\u0435<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/jetpack\/compose\/phases#slot-table\" rel=\"noopener noreferrer nofollow\">Understanding SlotTable in Compose<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/jetpack\/compose\/mental-model\" rel=\"noopener noreferrer nofollow\">Recomposition explained<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/frameworks\/support\/+\/androidx-main\/compose\" rel=\"noopener noreferrer nofollow\">Compose Compiler Source<\/a><\/p>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 XML \u0438 Compose \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e. \u042d\u0442\u043e \u043f\u0440\u043e \u0442\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043e\u0442\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0435. Compose \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u0438\u044f, \u043d\u043e \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0435\u0433\u043e \u0434\u0430\u0434\u0438\u0442\u0435 \u2014 \u043e\u043d \u0443\u0434\u0438\u0432\u0438\u0442 \u0432\u0430\u0441 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e, \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c\u044e \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e <strong>\u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0441\u043b\u043e\u0436\u043d\u044b\u0445 UI<\/strong> \u0432 Compose \u2014 \u043a\u0430\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u0431\u0435\u0437 \u0431\u043e\u043b\u0438.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/902252\/\"> https:\/\/habr.com\/ru\/articles\/902252\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><strong>\u0410\u0432\u0442\u043e\u0440:<\/strong> Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441 7+ \u0433\u043e\u0434\u0430\u043c\u0438 \u043e\u043f\u044b\u0442\u0430, \u0437\u043d\u0430\u044e\u0449\u0438\u0439 \u0442\u043e\u043b\u043a \u0432 FrameLayout, merge, include, RecyclerView, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0438 Modifier.padding.<\/p>\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u0442\u043e\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0431\u043e\u0440\u043e\u043c: \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0441 XML \u0438\u043b\u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c UI \u043d\u0430 Jetpack Compose, \u2014 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432\u044b \u0443\u0436\u0435 \u043d\u0430 \u043f\u043e\u043b\u043f\u0443\u0442\u0438 \u043a \u043d\u043e\u0432\u043e\u043c\u0443 \u0443\u0440\u043e\u0432\u043d\u044e. \u041d\u043e \u044d\u0442\u043e\u0442 \u0432\u044b\u0431\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u043c. Compose \u2014 \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u201c\u0434\u0430\u0432\u0430\u0439 \u0432\u0441\u0451 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c\u201d. \u042d\u0442\u043e \u0448\u0430\u0433 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043d\u043e\u0432\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0435\u0431\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<h3>\u0412\u043e\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0435\u0431\u0435 (\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0435)<\/h3>\n<h4>1. \u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u043e\u0432\u044b\u0439 \u0438\u043b\u0438 \u0443\u0436\u0435 \u0436\u0438\u0432\u043e\u0439?<\/h4>\n<ul>\n<li>\n<p>\u2705 \u041d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442: Compose \u2014 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440. \u041d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0442\u0430\u0449\u0438\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u26a0 \u0416\u0438\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442: \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0442\u043e\u0438\u0442 \u0438\u0434\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 Gradual Migration (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u043a\u0440\u0430\u043d\u044b \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443).<\/p>\n<\/li>\n<\/ul>\n<p>2.\u00a0\u041a\u0430\u043a\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u043d\u0430\u043d\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b?<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u201c\u0442\u044b\u201d \u0441 Kotlin, Coroutines, StateFlow \u2014 Compose \u0437\u0430\u0439\u0434\u0451\u0442 \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0432 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0435 MVP \u0438 LiveData \u2014 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u043d\u043e, \u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>3.\u00a0\u041a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0442\u0435\u043a\u0443\u0449\u0438\u0439 UI-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a?<\/p>\n<ul>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f DataBinding? ViewBinding? MVVM?<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043b\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 View \u0438\u043b\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438?<\/p>\n<\/li>\n<\/ul>\n<h4>4. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043b\u0438 WebView, MapView, ExoPlayer?<\/h4>\n<ul>\n<li>\n<p>\u042d\u0442\u0438 \u0448\u0442\u0443\u043a\u0438 \u043f\u043e\u043a\u0430 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0442\u0430\u043d\u0446\u0435\u0432 \u0432 Compose, \u043b\u0438\u0431\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c AndroidView.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u0447\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440<\/h3>\n<h4> \u0420\u0430\u0437\u043c\u0435\u0440 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/h4>\n<ul>\n<li>\n<p>XML (ViewSystem):<\/p>\n<ul>\n<li>\n<p>\u041b\u0451\u0433\u043a\u0430\u044f \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435, \u0432\u0441\u0451 \u0443\u0436\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0442\u044f\u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0432\u0435\u0440\u0445\u0443.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Jetpack Compose:<\/p>\n<ul>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044f\u043c (foundation, material, ui-tooling \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0442 1 \u0434\u043e 4 \u041c\u0411 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>Kotlin Compiler Plugin \u0438 Compose Compiler \u0442\u043e\u0436\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u0441\u0431\u043e\u0440\u043a\u0443.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u26a0 \u0415\u0441\u043b\u0438 size-critical \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0435, \u0441\u0442\u043e\u0438\u0442 \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c \u0441 preview, tooling, animation<\/p>\n<\/blockquote>\n<h3>\u0420\u0430\u0437\u043c\u0435\u0440\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a Jetpack Compose (release-\u0441\u0431\u043e\u0440\u043a\u0430)<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432 APK (minified)<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.ui:ui<\/p>\n<\/td>\n<td>\n<p align=\"left\">~420 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.foundation:foundation<\/p>\n<\/td>\n<td>\n<p align=\"left\">~700 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.material:material<\/p>\n<\/td>\n<td>\n<p align=\"left\">~1.3 MB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.runtime:runtime<\/p>\n<\/td>\n<td>\n<p align=\"left\">~380 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.compiler:compiler<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u26a0\ufe0f \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 APK \u2014 \u044d\u0442\u043e \u043f\u043b\u0430\u0433\u0438\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.material3:material3<\/p>\n<\/td>\n<td>\n<p align=\"left\">~1.7 MB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.animation:animation<\/p>\n<\/td>\n<td>\n<p align=\"left\">~600 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.compose.ui:ui-tooling<\/p>\n<\/td>\n<td>\n<p align=\"left\">~1.2 MB (\u0442\u043e\u043b\u044c\u043a\u043e debug)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.activity:activity-compose<\/p>\n<\/td>\n<td>\n<p align=\"left\">~120 KB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">androidx.navigation:navigation-compose<\/p>\n<\/td>\n<td>\n<p align=\"left\">~240 KB<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0448\u044c <strong>Material 3<\/strong>, \u043e\u043d\u0430 \u0432\u0435\u0441\u0438\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c Material 2, \u0437\u0430 \u0441\u0447\u0451\u0442 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0442\u0435\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>Tooling<\/strong> \u0438 <strong>Preview<\/strong> \u2014 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 debug, \u0438 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 release.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c, <strong>\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 Compose \u0441\u0442\u0435\u043a<\/strong> (\u0431\u0435\u0437 Material, \u0431\u0435\u0437 Navigation) \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <strong>2\u20133 \u041c\u0411<\/strong> \u043a \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c\u0443 .apk.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a \u0441 material3, animation, navigation, foundation, \u0438 \u043f\u0440. \u2014 <strong>\u0434\u043e 5\u20136 \u041c\u0411<\/strong> \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 Proguard \u0438 R8 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/h2>\n<h2>XML<\/h2>\n<ul>\n<li>\n<p>LayoutInflater \u2192 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u0435\u0440\u0435\u0432\u043e View-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>MeasureSpec + onMeasure\/onLayout\/onDraw.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0451 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 ViewRootImpl, Choreographer, Handler.<\/p>\n<\/li>\n<\/ul>\n<h3>Compose<\/h3>\n<ul>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0430\u0439\u043b\u0438\u0442\u0441\u044f \u0432 <em>SlotTable<\/em> \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f UI \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>Recomposer \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0435 Composables.<\/p>\n<\/li>\n<li>\n<p>LayoutNode \u2192 RenderNode \u2192 Skia \u2192 Canvas.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 View, \u043d\u0435\u0442 LayoutInflater, \u043d\u0435\u0442 findViewById.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\ud83d\udccc State \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u2192 recomposition \u2192 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c UI \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u2192 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 overdraw.<\/p>\n<\/blockquote>\n<h3>\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b<\/h3>\n<ul>\n<li>\n<p>XML \u2192 \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 Activity\/Fragment lifecycle \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<\/li>\n<li>\n<p>Compose \u2192 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 remember, DisposableEffect, LaunchedEffect, SideEffect, \u0438 <em>Composition Lifecycle<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0432\u0430\u0448\u0438 UI-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441\u0430\u043c\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439. \u041e\u043d\u0438 \u0437\u043d\u0430\u044e\u0442, \u043a\u043e\u0433\u0434\u0430 \u0438\u0445 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u043b\u0438, \u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435 \u2014 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f.<\/p>\n<h3>\u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0432\u0438\u0434\u043d\u044b \u0441\u0440\u0430\u0437\u0443<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>View System (XML)<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Jetpack Compose<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f UI<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0427\u0435\u0440\u0435\u0437 custom View<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0427\u0435\u0440\u0435\u0437 Composable-\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 UI<\/p>\n<\/td>\n<td>\n<p align=\"left\">Espresso, Robolectric<\/p>\n<\/td>\n<td>\n<p align=\"left\">Compose Test API (JUnit)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">Fragment + NavComponent<\/p>\n<\/td>\n<td>\n<p align=\"left\">Compose Navigation (\u0438\u043b\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041f\u0440\u0435\u0432\u044c\u044e \u0432 IDE<\/p>\n<\/td>\n<td>\n<p align=\"left\">XML Layout Editor<\/p>\n<\/td>\n<td>\n<p align=\"left\">Compose Preview<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 UI<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0427\u0435\u0440\u0435\u0437 if\/else + View.GONE<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u0441\u0442\u043e if (condition) {}<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u041a\u043e\u0433\u0434\u0430 \u0442\u043e\u0447\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0431\u0440\u0430\u0442\u044c Compose<\/h3>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0435 \u0434\u0438\u0437\u0430\u0439\u043d \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 Adapter \u0438 ViewHolder.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0447\u0442\u0430\u0435\u0442\u0435 \u043f\u0440\u043e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 \u0431\u043e\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 Kotlin \u0438 \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u044b\u0433\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 XML \u0438 \u043a\u043e\u0434\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0427\u0442\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0433\u043b\u0443\u0431\u0436\u0435<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/jetpack\/compose\/phases#slot-table\" rel=\"noopener noreferrer nofollow\">Understanding SlotTable in Compose<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/jetpack\/compose\/mental-model\" rel=\"noopener noreferrer nofollow\">Recomposition explained<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/frameworks\/support\/+\/androidx-main\/compose\" rel=\"noopener noreferrer nofollow\">Compose Compiler Source<\/a><\/p>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 XML \u0438 Compose \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e. \u042d\u0442\u043e \u043f\u0440\u043e \u0442\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043e\u0442\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0435. Compose \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u0438\u044f, \u043d\u043e \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0435\u0433\u043e \u0434\u0430\u0434\u0438\u0442\u0435 \u2014 \u043e\u043d \u0443\u0434\u0438\u0432\u0438\u0442 \u0432\u0430\u0441 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e, \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c\u044e \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e <strong>\u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0441\u043b\u043e\u0436\u043d\u044b\u0445 UI<\/strong> \u0432 Compose \u2014 \u043a\u0430\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u0431\u0435\u0437 \u0431\u043e\u043b\u0438.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/902252\/\"> https:\/\/habr.com\/ru\/articles\/902252\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-456556","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=456556"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456556\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=456556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=456556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=456556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}