{"id":331254,"date":"2022-03-30T15:00:08","date_gmt":"2022-03-30T15:00:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=331254"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=331254","title":{"rendered":"<span>Material You \u0438 Jetpack Compose<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>05.18.21, \u0431\u044b\u043b\u0430 <a href=\"https:\/\/material.io\/blog\/announcing-material-you\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 <\/a>\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f Material Design. \u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435, \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u043e\u0432\u044b\u043c Material You.<\/p>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043f\u0443\u0441\u0442\u043e\u0435 Compose \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/832\/20c\/d31\/83220cd311ff7440873c301483e5168d.png\" alt=\"\" title=\"\" width=\"974\" height=\"692\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/832\/20c\/d31\/83220cd311ff7440873c301483e5168d.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d75\/d49\/643\/d75d49643c246a265d05cc4f3e2e9008.png\" width=\"974\" height=\"692\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d75\/d49\/643\/d75d49643c246a265d05cc4f3e2e9008.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c 3 \u0432\u0435\u0440\u0441\u0438\u044e Compose:<\/p>\n<pre><code class=\"kotlin\">app\/build.gradle  dependencies {   ...   implementation \"androidx.compose.material3:material3:1.0.0-alpha08\" }<\/code><\/pre>\n<p>\u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0444\u0430\u0439\u043b \u0442\u0435\u043c\u044b:<\/p>\n<pre><code class=\"kotlin\">package com.example.myapplication.ui.theme  import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalContext  @Composable fun MyApplicationTheme(     isDarkTheme: Boolean = isSystemInDarkTheme(),     content: @Composable () -> Unit ) {      val colorScheme = when {         isDarkTheme -> {             dynamicDarkColorScheme(LocalContext.current)         }         else -> {dynamicLightColorScheme(LocalContext.current)}     }      \/\/ Make use of Material3     MaterialTheme(         colorScheme =  colorScheme,         content = content     ) } <\/code><\/pre>\n<pre><code class=\"xml\">AndroidManifest.xml  &lt;?xml version=\"1.0\" encoding=\"utf-8\"?> &lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"           package=\"com.example.myapplication\">      &lt;application             android:allowBackup=\"true\"             android:icon=\"@mipmap\/ic_launcher\"             android:label=\"@string\/app_name\"             android:roundIcon=\"@mipmap\/ic_launcher_round\"             android:supportsRtl=\"true\"             android:theme=\"@style\/Theme.MyApplication\">         &lt;activity                 android:name=\".MainActivity\"                 android:exported=\"true\"                 android:label=\"@string\/app_name\">             &lt;intent-filter>                 &lt;action android:name=\"android.intent.action.MAIN\"\/>                  &lt;category android:name=\"android.intent.category.LAUNCHER\"\/>             &lt;\/intent-filter>         &lt;\/activity>     &lt;\/application>  &lt;\/manifest><\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0446\u0432\u0435\u0442\u043e\u0432:<\/p>\n<pre><code class=\"kotlin\">package com.example.myapplication  import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import com.example.myapplication.ui.theme.MyApplicationTheme  class MainActivity : ComponentActivity() {     @OptIn(ExperimentalMaterial3Api::class)     override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContent {             MyApplicationTheme {                 Scaffold {                     Text(text = \"Hello!\")                 }             }         }     } } <\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c <a href=\"https:\/\/google.github.io\/accompanist\/systemuicontroller\/\" rel=\"noopener noreferrer nofollow\">systemuicontroller<\/a>, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0431\u0430\u0440, \u0432 \u0434\u0438\u043d. \u0446\u0432\u0435\u0442\u0430:<\/p>\n<pre><code class=\"kotlin\">app\/build.gradle  dependencies {   ...   implementation \"com.google.accompanist:accompanist-systemuicontroller:0.17.0\" }<\/code><\/pre>\n<pre><code class=\"kotlin\">package com.example.todo.theme  ... import com.google.accompanist.systemuicontroller.rememberSystemUiController ...   @Composable fun MyApplicationTheme(     isDarkTheme: Boolean = isSystemInDarkTheme(),     content: @Composable () -> Unit ) {      val colorScheme = when {         isDarkTheme -> {             dynamicDarkColorScheme(LocalContext.current)         }         else -> {dynamicLightColorScheme(LocalContext.current)}     }          rememberSystemUiController().setSystemBarsColor(         color = colorScheme.background     )      \/\/ Make use of Material3     MaterialTheme(         colorScheme =  colorScheme,         content = content     ) }<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/462\/de3\/2b7\/462de32b7d96efbfb95daf6a5b8db7fa.jpg\" width=\"1080\" height=\"717\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/462\/de3\/2b7\/462de32b7d96efbfb95daf6a5b8db7fa.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/df0\/6de\/fcc\/df06defcc8f8ce403f58a462fe9cbdc8.jpg\" width=\"1080\" height=\"582\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/df0\/6de\/fcc\/df06defcc8f8ce403f58a462fe9cbdc8.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/672\/ab4\/d82\/672ab4d8204be96fd2c4fdab48bd95b5.jpg\" width=\"1080\" height=\"951\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/672\/ab4\/d82\/672ab4d8204be96fd2c4fdab48bd95b5.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/ea9\/6c6\/c7c\/ea96c6c7ce6d37ede6eca77cef045441.jpg\" width=\"1080\" height=\"616\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ea9\/6c6\/c7c\/ea96c6c7ce6d37ede6eca77cef045441.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0448\u0430\u0433\u043e\u0432, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u0442\u0430\u0440\u0442\u0435\u0440 jetpack compose \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 material you<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/658231\/\"> https:\/\/habr.com\/ru\/post\/658231\/<\/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_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>05.18.21, \u0431\u044b\u043b\u0430 <a href=\"https:\/\/material.io\/blog\/announcing-material-you\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 <\/a>\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f Material Design. \u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435, \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u043e\u0432\u044b\u043c Material You.<\/p>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043f\u0443\u0441\u0442\u043e\u0435 Compose \u0430\u043a\u0442\u0438\u0432\u0438\u0442\u0438:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c 3 \u0432\u0435\u0440\u0441\u0438\u044e Compose:<\/p>\n<pre><code class=\"kotlin\">app\/build.gradle  dependencies {   ...   implementation \"androidx.compose.material3:material3:1.0.0-alpha08\" }<\/code><\/pre>\n<p>\u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0444\u0430\u0439\u043b \u0442\u0435\u043c\u044b:<\/p>\n<pre><code class=\"kotlin\">package com.example.myapplication.ui.theme  import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalContext  @Composable fun MyApplicationTheme(     isDarkTheme: Boolean = isSystemInDarkTheme(),     content: @Composable () -> Unit ) {      val colorScheme = when {         isDarkTheme -> {             dynamicDarkColorScheme(LocalContext.current)         }         else -> {dynamicLightColorScheme(LocalContext.current)}     }      \/\/ Make use of Material3     MaterialTheme(         colorScheme =  colorScheme,         content = content     ) } <\/code><\/pre>\n<pre><code class=\"xml\">AndroidManifest.xml  &lt;?xml version=\"1.0\" encoding=\"utf-8\"?> &lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"           package=\"com.example.myapplication\">      &lt;application             android:allowBackup=\"true\"             android:icon=\"@mipmap\/ic_launcher\"             android:label=\"@string\/app_name\"             android:roundIcon=\"@mipmap\/ic_launcher_round\"             android:supportsRtl=\"true\"             android:theme=\"@style\/Theme.MyApplication\">         &lt;activity                 android:name=\".MainActivity\"                 android:exported=\"true\"                 android:label=\"@string\/app_name\">             &lt;intent-filter>                 &lt;action android:name=\"android.intent.action.MAIN\"\/>                  &lt;category android:name=\"android.intent.category.LAUNCHER\"\/>             &lt;\/intent-filter>         &lt;\/activity>     &lt;\/application>  &lt;\/manifest><\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0446\u0432\u0435\u0442\u043e\u0432:<\/p>\n<pre><code class=\"kotlin\">package com.example.myapplication  import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import com.example.myapplication.ui.theme.MyApplicationTheme  class MainActivity : ComponentActivity() {     @OptIn(ExperimentalMaterial3Api::class)     override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContent {             MyApplicationTheme {                 Scaffold {                     Text(text = \"Hello!\")                 }             }         }     } } <\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c <a href=\"https:\/\/google.github.io\/accompanist\/systemuicontroller\/\" rel=\"noopener noreferrer nofollow\">systemuicontroller<\/a>, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0431\u0430\u0440, \u0432 \u0434\u0438\u043d. \u0446\u0432\u0435\u0442\u0430:<\/p>\n<pre><code class=\"kotlin\">app\/build.gradle  dependencies {   ...   implementation \"com.google.accompanist:accompanist-systemuicontroller:0.17.0\" }<\/code><\/pre>\n<pre><code class=\"kotlin\">package com.example.todo.theme  ... import com.google.accompanist.systemuicontroller.rememberSystemUiController ...   @Composable fun MyApplicationTheme(     isDarkTheme: Boolean = isSystemInDarkTheme(),     content: @Composable () -> Unit ) {      val colorScheme = when {         isDarkTheme -> {             dynamicDarkColorScheme(LocalContext.current)         }         else -> {dynamicLightColorScheme(LocalContext.current)}     }          rememberSystemUiController().setSystemBarsColor(         color = colorScheme.background     )      \/\/ Make use of Material3     MaterialTheme(         colorScheme =  colorScheme,         content = content     ) }<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0448\u0430\u0433\u043e\u0432, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u0442\u0430\u0440\u0442\u0435\u0440 jetpack compose \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 material you<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/658231\/\"> https:\/\/habr.com\/ru\/post\/658231\/<\/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-331254","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331254","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=331254"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331254\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=331254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=331254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=331254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}