{"id":353422,"date":"2024-05-20T22:27:36","date_gmt":"2024-05-20T22:27:36","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=353422"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=353422","title":{"rendered":"<span>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Compose \u0434\u043b\u044f \u0422\u0412-\u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0418\u0432\u0438: \u043c\u043e\u0449\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 Android-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/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<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d63\/ace\/72c\/d63ace72ca9fbba726ffb0d5471886d0.png\" width=\"1006\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d63\/ace\/72c\/d63ace72ca9fbba726ffb0d5471886d0.png\"\/><\/figure>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0418\u0432\u0438, \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0438\u043d\u043e\u0442\u0435\u0430\u0442\u0440\u043e\u0432 \u0432 \u0420\u043e\u0441\u0441\u0438\u0438, \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b Android. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0432\u0435\u0440\u0441\u0438\u044e \u0434\u043b\u044f Android TV, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u043d\u043d\u043e\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u2014 Jetpack Compose. \u0422\u0430\u043a \u043a\u0430\u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Compose \u0434\u043b\u044f \u0422\u0412 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0430\u043b\u044c\u0444\u0430-\u0432\u0435\u0440\u0441\u0438\u0438, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c, \u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443: \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Jetpack Compose, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0422\u0412-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439?<\/p>\n<h3>\u0420\u0430\u0437\u0432\u0438\u0442\u0438\u0435 Android TV \u0438 \u043e\u0431\u0449\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/h3>\n<figure class=\"float bordered\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3fa\/045\/0f1\/3fa0450f19af2d99a409863dbb2ba464.gif\" alt=\"\u0412\u0435\u0440\u0441\u0438\u044f \u0434\u043b\u044f Android TV\" title=\"\u0412\u0435\u0440\u0441\u0438\u044f \u0434\u043b\u044f Android TV\" width=\"384\" height=\"216\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3fa\/045\/0f1\/3fa0450f19af2d99a409863dbb2ba464.gif\"\/><\/p>\n<div><figcaption>\u0412\u0435\u0440\u0441\u0438\u044f \u0434\u043b\u044f Android TV<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0418\u0432\u0438 \u043c\u044b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u043a \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u0430\u043a \u0438 \u0422\u0412-\u0432\u0435\u0440\u0441\u0438\u0438, \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u043b\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f Android TV. \u041f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0422\u0412-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432. \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u0422\u0412-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c. \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u043c\u044b \u0432\u0437\u044f\u043b\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438 \u0441\u0442\u0430\u043b\u0438 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043f\u043e\u0434 \u0422\u0412. \u0421 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 Unidirectional Data Flow \u0432 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c\u044b\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c  \u2014 \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0441\u043b\u043e\u0439 UI \u0434\u043b\u044f \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 UI \u0434\u043b\u044f TV: \u0432\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 Leanback \u0438 Jetpack Compose<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u044f\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u0432\u044b\u0431\u043e\u0440\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0430 Android TV. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e Jetpack Compose \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0441\u044f \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043b\u044f \u0422\u0412, \u0435\u0433\u043e \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u0430\u0441 \u0440\u0430\u0432\u043d\u043e\u0434\u0443\u0448\u043d\u044b\u043c\u0438. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043e\u0439 \u0431\u044b\u043b\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Leanback, \u043d\u043e \u0443 \u043d\u0435\u0435 \u043d\u0430\u0448\u043b\u0438\u0441\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438.<\/p>\n<h4>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 Leanback<\/h4>\n<p>\u0421\u0430\u043c\u044b\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u0435\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0443\u0437\u043a\u0438\u043c \u043c\u0435\u0441\u0442\u043e\u043c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<h4>\u041f\u043e\u0447\u0435\u043c\u0443 \u0440\u0435\u0448\u0438\u043b\u0438\u0441\u044c \u043d\u0430 Jetpack Compose<\/h4>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0432 \u0430\u043b\u044c\u0444\u0430-\u0432\u0435\u0440\u0441\u0438\u0438, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Jetpack Compose \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0441\u043c\u0435\u043b\u044b\u043c. \u041d\u0430\u0448\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0440\u0430\u043d\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Compose. \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438 \u0434\u043b\u044f \u0422\u0412-\u0432\u0435\u0440\u0441\u0438\u0438?<\/p>\n<h4>\u0424\u043e\u043a\u0443\u0441 \u0432 Leanback \u0438 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 Jetpack Compose<\/h4>\n<p>\u0424\u043e\u043a\u0443\u0441 \u0432 Android TV \u2014 \u044d\u0442\u043e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. Leanback \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0444\u043e\u043a\u0443\u0441\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u043c\u043a\u0430 \u0444\u043e\u043a\u0443\u0441\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a \u0446\u0435\u043d\u0442\u0440\u0443 \u044d\u043a\u0440\u0430\u043d\u0430, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0443\u043b\u044c\u0442. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 Jetpack Compose. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0433\u0438\u0444\u043a\u0438, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0444\u043e\u043a\u0443\u0441\u0430 \u0432 Leanback, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u0432 Jetpack Compose:<\/p>\n<ul>\n<li>\n<p>\u0424\u043e\u043a\u0443\u0441 \u0432 Leanback:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/05c\/cf2\/719\/05ccf27197c02ddecfadd1ddec8004c6.gif\" alt=\"\" title=\"\" width=\"384\" height=\"216\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/05c\/cf2\/719\/05ccf27197c02ddecfadd1ddec8004c6.gif\"\/><\/figure>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u0432 Jetpack Compose (\u043d\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435):<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bce\/77f\/38e\/bce77f38e2dc15869fce53e138315428.gif\" alt=\"\" title=\"\" width=\"384\" height=\"216\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bce\/77f\/38e\/bce77f38e2dc15869fce53e138315428.gif\"\/><\/figure>\n<\/li>\n<\/ul>\n<p>\u0424\u043e\u043a\u0443\u0441 \u0432 Jetpack Compose \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <code>FocusRequester<\/code>-a, <code>focusable()<\/code> Modifier-\u0430 \u0438 <code>onFocusChanged { ... }<\/code> \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0430. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u043e\u043a\u0443\u0441\u0430 \u0432 Jetpack Compose:<\/p>\n<pre><code class=\"kotlin\">@Composable fun FocusingText() {     var color by remember { mutableStateOf(Color.Black) }     val focusRequester = remember { FocusRequester() }     Text(         modifier = Modifier             .focusRequester(focusRequester)             .onFocusChanged { color = if (it.isFocused) Color.Green else Color.Black }             .focusable()             .pointerInput(Unit) { detectTapGestures { focusRequester.requestFocus() } },         text = \"Text\",         color = color     ) }<\/code><\/pre>\n<p>\u0412 Compose \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0435\u0441\u0442\u044c \u043b\u0438 \u043d\u0430 \u043d\u0435\u043c \u0444\u043e\u043a\u0443\u0441, \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043e\u043b\u043b\u0431\u044d\u043a \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u0437\u0432\u0430\u0432 \u043c\u0435\u0442\u043e\u0434 <code>requestFocus()<\/code> \u0443 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0432\u043e\u0445: \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0443\u0441\u043f\u0435\u043b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 <code>recompose<\/code> \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>requestFocus()<\/code>, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u0440\u0430\u0448, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0443\u0431\u0438\u0442\u044c \u0434\u0432\u0438\u0436\u043e\u043a Jetpack Compose \u0434\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<h3>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 Jetpack Compose \u0434\u043b\u044f Android TV \u0438 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f\u043c<\/h3>\n<p>\u041c\u044b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b\u0438 \u043d\u0430 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0438 \u0438\u043d\u043d\u043e\u0432\u0430\u0446\u0438\u0438, \u043d\u043e \u043f\u0435\u0440\u0432\u044b\u0435 \u0448\u0430\u0433\u0438 \u0432 \u043c\u0438\u0440\u0435 Compose \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438, \u0447\u0435\u043c \u043c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0438. \u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e Leanback.<br \/> \u041f\u0440\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 <code>Lazy<\/code> &#8212; \u0441\u043f\u0438\u0441\u043a\u0435 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0444\u043e\u043a\u0443\u0441\u0430 \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 Leanback: \u0444\u043e\u043a\u0443\u0441 \u0443\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442 \u0433\u0430\u043b\u0435\u0440\u0435\u044e, \u0438\u043d\u043e\u0433\u0434\u0430 \u0444\u043e\u043a\u0443\u0441 \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0431\u043e\u0439. \u0422\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e.<\/p>\n<h3>\u041d\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h3>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5da\/4cd\/1b4\/5da4cd1b4c1c29c46f61b26d55f065fa.png\" width=\"812\" height=\"330\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5da\/4cd\/1b4\/5da4cd1b4c1c29c46f61b26d55f065fa.png\"\/><\/figure>\n<p>\u0423 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0438 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441  \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u0430\u044f \u0433\u0430\u043b\u0435\u0440\u0435\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u043e\u043a\u0443\u0441 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0435 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0436\u0430\u0442\u0438\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b &#8212; \u0442\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f <code>DpadFocusController<\/code>.<\/p>\n<p><code>DpadFocusController<\/code> \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439 \u0444\u043e\u043a\u0443\u0441\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 <code>DpadFocusController<\/code> \u0432\u0438\u0434\u0438\u0442 \u0432\u0441\u044e \u043a\u0430\u0440\u0442\u0443 \u0433\u0430\u043b\u0435\u0440\u0435\u0438, \u0442\u043e \u043e\u043d \u0441\u0430\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0444\u043e\u043a\u0443\u0441\u0430 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0448 \u0438 \u043e \u0442\u043e\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u0433\u0430\u043b\u0435\u0440\u0435\u044e. \u041c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441  <code>DpadFocusController<\/code> \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 <code>FocusRequester<\/code>s, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043b\u0438\u0448\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <code>LazyRow<\/code> \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 D-Pad. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c\u0438 <code>FocusRequester<\/code>s \u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0433\u0430\u043b\u0435\u0440\u0435\u0438.<\/p>\n<p>API \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">@Preview @Composable fun testGrid() { val items = listOf(\"1\", \"2\", \"3\", \"4\", \"5\") val scope = rememberCoroutineScope() val state = rememberLazyListState() val dpad = remember { DpadFocusController( mScope = scope, lazyStateY = state, ) } LaunchedEffect(Unit) { dpad.restoreFocusAfterDelay(100) } dpad.updateLastIndexY(items.size - 1)  LazyColumn( modifier = Modifier.dpad(dpad), state = dpad.lazyStateY ) { itemsIndexed(items = items) { i, str -> val outState = remember { mutableStateOf(TouchState.Idle) } val color = when (outState.value) { TouchState.Idle -> Color.Red TouchState.Focused -> Color.Green TouchState.Touched -> Color.Blue else -> Color.Gray } Box( modifier = Modifier .touchAndFocus( outState = outState, focusRequester = dpad.focusRequester(rowPos = i, posX = 0) ) .background(color = color) .padding(10.dp) ) { Text(text = str, color = Color.White, fontSize = 170.sp) } } } }<\/code><\/pre>\n<ul>\n<li>\n<p>\u041d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 LazyColumn\/LazyRow, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043e \u0444\u043e\u043a\u0443\u0441\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f <code>DpadFocusRequester<\/code> \u0438\u0437 <code>DpadFocusController<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u044f <code>Modifer.dpad(DpadFocusController)<\/code> \u043a Lazy-\u0441\u043f\u0438\u0441\u043a\u0443, \u043c\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b:<\/p>\n<pre><code class=\"kotlin\">modifier.onKeyEvent(mOnKeyEventCb)<\/code><\/pre>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438\u0449\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438, \u0438, \u0435\u0441\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442, \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0435\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 <code>DpadFocusController.requestFocus()<\/code> \u043e \u0444\u043e\u043a\u0443\u0441\u0435, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442 \u0433\u0430\u043b\u0435\u0440\u0435\u044e \u043a \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0435\u0439 \u0441\u043a\u0440\u043e\u043b\u043b\u0430 \u043c\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0430\u043c\u0438:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"kotlin\">private suspend fun ScrollScope.scrollToVisibleItem( targetItem: LazyListItemInfo, targetOffset: Int, animDurationMs: Int, ) = animate( targetValue = (targetItem.offset - targetOffset).toFloat(), animationSpec = tween( &lt;-- \u043c\u044b \u0441\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 durationMillis = animDurationMs, easing = FastInSlowOut ), ) { value, velocity -> ... scrollBy(delta) }<\/code><\/pre>\n<ul>\n<li>\n<p>\u043e\u0434\u043d\u0430\u043a\u043e, <code>LazyListState<\/code> \u043d\u0435 \u0434\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0432\u043d\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043f\u0435\u0440\u0432\u0430 \u043f\u0440\u043e\u0441\u043a\u0440\u043e\u043b\u043b\u0438\u0442\u044c \u043d\u0430\u0443\u0433\u0430\u0434:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"kotlin\">private suspend fun ScrollScope.findOrScrollToItem( lazyState: LazyListState, itemIndex: Int, ): LazyListItemInfo? { var targetItem = lazyState.layoutInfo.visibleItemsInfo .firstOrNull { it.index == itemIndex } while (targetItem == null) { val itemsCountNext = lazyState.layoutInfo.visibleItemsInfo.count { it.index > itemIndex } \/\/ 0 1 2 3 4 5 6 7 8 \/\/     *    [visible] = [4 5 6 7 8] \/\/     ^ \/\/     | itemIndex = 2 val scrolledBy = scrollBy(if (itemsCountNext > 0) -50f else 50f) targetItem = lazyState.layoutInfo.visibleItemsInfo .firstOrNull { it.index == itemIndex } if (abs(scrolledBy) &lt; 1f) { break } } return targetItem }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u043a\u0443\u0441\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u044f\u0434\u044b \u0433\u0430\u043b\u0435\u0440\u0435\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u044d\u043a\u0440\u0430\u043d\u0430, \u0434\u0440\u0443\u0433\u0438\u0435 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u044d\u0442\u043e\u0439 \u0433\u0438\u0444\u043a\u0435 \u043e\u0444\u0441\u0435\u0442 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u043e\u0432 \u0441 \u043f\u0440\u0435\u0432\u044c\u044e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0438\u0436\u0435, \u0447\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u044d\u043a\u0440\u0430\u043d\u0430:<\/p>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3e7\/4db\/dc4\/3e74dbdc434990b30aafc0c26a5a3482.gif\" alt=\"\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0444\u0444\u0441\u0435\u0442\u043e\u0432 \u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0434\u0431\u043e\u0440\u043e\u043a \u0438 &quot;\u0421\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0437\u0436\u0435&quot;\" title=\"\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0444\u0444\u0441\u0435\u0442\u043e\u0432 \u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0434\u0431\u043e\u0440\u043e\u043a \u0438 &quot;\u0421\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0437\u0436\u0435&quot;\" width=\"576\" height=\"324\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3e7\/4db\/dc4\/3e74dbdc434990b30aafc0c26a5a3482.gif\"\/><\/p>\n<div><figcaption>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0444\u0444\u0441\u0435\u0442\u043e\u0432 \u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0434\u0431\u043e\u0440\u043e\u043a \u0438 &#171;\u0421\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0437\u0436\u0435&#187;<\/figcaption><\/div>\n<\/figure>\n<p>\u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0441\u044f, \u0442\u043e \u0444\u043e\u043a\u0443\u0441-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u0444\u043e\u043a\u0443\u0441. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0444\u043e\u043a\u0443\u0441\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u044f\u0434\u0443.<\/p>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0442 Google<\/h3>\n<p>\u041f\u043e \u0438\u0440\u043e\u043d\u0438\u0438 \u0441\u0443\u0434\u044c\u0431\u044b, \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u043b\u0438\u0437\u0430, Google \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b \u0430\u043b\u044c\u0444\u0430-\u0432\u0435\u0440\u0441\u0438\u044e Jetpack Compose \u0434\u043b\u044f Android TV. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0443 \u0441\u0435\u0431\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">@Preview @Composable fun TestTvComposeBlock() { val fr = remember { FocusRequester() } LaunchedEffect(Unit) { delay(100) fr.requestFocus() }  val listState = rememberTvLazyListState(0, 0) TvLazyColumn( modifier = Modifier.width(200.dp), state = listState, verticalArrangement = Arrangement.spacedBy(10.dp), pivotOffsets = PivotOffsets(0.5f, 0f) ) { item { TestBlock(fr, -1) }  items( count = 5, key = { it.hashCode() } ) { val state = rememberTvLazyListState(0, 0) TvLazyRow( state = state, pivotOffsets = PivotOffsets(0f, 0f), horizontalArrangement = Arrangement.spacedBy(10.dp), userScrollEnabled = false, ) { items(20, key = { it.hashCode() }) { TestBlock(index = it) } } } } }  @Composable private fun TestBlock( fr: FocusRequester? = null, index: Int) { var color by remember { mutableStateOf(Color.Red) } val focusRequester = fr ?: remember { FocusRequester() } Box( modifier = Modifier .size(50.dp) .background(color = color) .focusRequester(focusRequester) .onFocusChanged { color = if (it.isFocused) Color.Blue else Color.Red } .focusable(true), contentAlignment = Alignment.Center ) { Text(text = index.toString()) } }<\/code><\/pre>\n<p>\u041c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0431\u0430\u0433\u043e\u0432 \u0441 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043b\u0438\u0441\u044c. \u0411\u044b\u0441\u0442\u0440\u044b\u0435 \u0441\u043a\u0440\u043e\u043b\u043b\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0438 \u043a\u0440\u0430\u0448\u0438 \u0438 \u043f\u043e\u0442\u0435\u0440\u0438 \u0444\u043e\u043a\u0443\u0441\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0444\u043e\u043a\u0443\u0441\u0430 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0440\u044f\u0434\u0430\u043c\u0438 \u0431\u044b\u043b\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c: \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441\u043a\u0440\u043e\u043b\u043b\u0430 (\u043d\u0430 \u0433\u0438\u0444\u043a\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u0432\u043d\u0438\u0437 c <code>19<\/code> \u043d\u0430 \u043d\u0438\u0436\u043d\u0438\u0439 \u0440\u044f\u0434, \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0444\u043e\u043a\u0443\u0441 \u043d\u0430 <code>2<\/code> \u0438 \u043f\u0440\u043e\u0441\u043a\u0440\u043e\u043b\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430):<\/p>\n<figure class=\"bordered\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/99b\/c42\/102\/99bc421026df0cf119b1f565e098d895.gif\" alt=\"\u0411\u0430\u0433 \u0432 TvLazyRow \u043e\u0442 Google\" title=\"\u0411\u0430\u0433 \u0432 TvLazyRow \u043e\u0442 Google\" width=\"457\" height=\"632\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/99b\/c42\/102\/99bc421026df0cf119b1f565e098d895.gif\"\/><\/p>\n<div><figcaption>\u0411\u0430\u0433 \u0432 TvLazyRow \u043e\u0442 Google<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u0431\u0430\u0433\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0432 Google IssueTracker <a href=\"https:\/\/issuetracker.google.com\/issues?q=status:open%20componentid:1254578&amp;s=created_time:desc\">IssueTracker &#8212; Compose TV<\/a>.<\/p>\n<h3>\u041c\u043e\u0449\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Jetpack Compose<\/h3>\n<p>Jetpack Compose \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u043a\u0438 UI \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f Android Mobile \u0438 Android TV. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0434 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0418\u0432\u0438 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432:<\/p>\n<pre><code class=\"kotlin\">\/\/ \u041a\u043e\u0434 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043b\u044f Mobile PagesGrid( modifier = Modifier, page = pageState, screenWidth = screenWidthDp(), eventSender = { event -> fireEvent(event) }, dpad = dpad, ... )  \/\/ \u041a\u043e\u0434 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043b\u044f TV PagesGrid( modifier = Modifier, header = { NewTvNavigationMenu( menu = menu, focusGetter = dpad::provideUpGridFocusRequester, onMenuClick = { fireEvent(MainMenuClickEvent(it)) }, ) }, page = pageState, screenWidth = screenWidthDp(), eventSender = { fireEvent(it) }, dpad = dpad, ... )<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Modifier <code>drawWithContent<\/code>, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u0433\u0430\u043b\u0435\u0440\u0435\u0438 \u0441 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438:<\/p>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/576\/253\/795\/576253795bdb1da3a111a29d43f91961.gif\" alt=\"\u041e\u0431\u0440\u0435\u0437\u043a\u0430 \u0433\u0430\u043b\u0435\u0440\u0435\u0438 \u0441 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0439 \u043f\u043e\u043b\u0443\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c\u044e\" title=\"\u041e\u0431\u0440\u0435\u0437\u043a\u0430 \u0433\u0430\u043b\u0435\u0440\u0435\u0438 \u0441 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0439 \u043f\u043e\u043b\u0443\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c\u044e\" width=\"960\" height=\"540\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/576\/253\/795\/576253795bdb1da3a111a29d43f91961.gif\"\/><\/p>\n<div><figcaption>\u041e\u0431\u0440\u0435\u0437\u043a\u0430 \u0433\u0430\u043b\u0435\u0440\u0435\u0438 \u0441 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0439 \u043f\u043e\u043b\u0443\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c\u044e<\/figcaption><\/div>\n<\/figure>\n<pre><code class=\"kotlin\">PagesGrid( modifier = Modifier .graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen } .drawWithContent { drawContent() if (previewAlpha.value > 0f) { drawRect( brush = Brush.verticalGradient( listOf( Color.Black, Color.Transparent, ), 264.dp.toPx(), 324.dp.toPx(), ), blendMode = BlendMode.DstOut ) } }, ...  <\/code><\/pre>\n<h3>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438<\/h3>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043d\u0438\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0438, \u043d\u043e \u0434\u043b\u044f \u0440\u0435\u043b\u0438\u0437\u043d\u043e\u0433\u043e \u0431\u0438\u043b\u0434\u0430 \u043e\u043d\u0430 \u0431\u043b\u0438\u0437\u043a\u0430 \u043a \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439. \u0414\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u044b\u043b\u0438 <code>skippable<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c Compose-\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043d\u0438\u043f\u043f\u0435\u0442 \u0438\u0437 <a href=\"https:\/\/chris.banes.dev\/composable-metrics\/\">\u0441\u0442\u0430\u0442\u044c\u0438 Chris Banes<\/a>:<\/p>\n<pre><code>subprojects { tasks.withType(KotlinCompile).configureEach { kotlinOptions { freeCompilerArgs += [ \"-P\", \"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=\" + project.buildDir.absolutePath + \"\/compose_metrics\" ] freeCompilerArgs += [ \"-P\", \"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=\" + project.buildDir.absolutePath + \"\/compose_metrics\" ] } } }<\/code><\/pre>\n<p>Jetpack Compose \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0440\u0435\u043b\u0438\u0437\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 Modifier, \u0443\u0441\u043a\u043e\u0440\u0438\u0432\u0448\u0435\u0439 \u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043d\u0430 80%, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f Lazy-\u0441\u043f\u0438\u0441\u043a\u043e\u0432. \u0422\u0430\u043a\u0436\u0435, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 Android Gradle Plugin 8.2+, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b Baseline Profiles, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043e 40% \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0433\u043e\u0440\u044f\u0447\u0438\u0445 \u043c\u0435\u0441\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438 dex \u0431\u0430\u0439\u0442\u043a\u043e\u0434\u0430 (<a href=\"https:\/\/android-developers.googleblog.com\/2023\/08\/whats-new-in-jetpack-compose-august-23-release.html\">What\u2019s new in the Jetpack Compose August \u201923 release<\/a>, <a href=\"https:\/\/android-developers.googleblog.com\/2022\/01\/improving-app-performance-with-baseline.html\">Improving App Performance with Baseline Profiles<\/a>).<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>Jetpack Compose \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u043a\u0438 \u0432 UI, \u0447\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f Mobile \u0438 TV \u0441 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043e\u0442\u043b\u0438\u0447\u0438\u044f\u043c\u0438. \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0434\u0438\u0437\u0430\u0439\u043d\u044b, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043e\u043f\u044b\u0442.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Jetpack Compose \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0422\u0412-\u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0418\u0432\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u043f\u043e\u043b\u043d\u0443\u044e \u043c\u043e\u0449\u044c, \u0438, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u00ab\u0434\u0432\u0435\u0440\u044c\u00bb \u043d\u043e\u0432\u044b\u043c \u0444\u0438\u0447\u0430\u043c \u0441 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f\u043c\u0438, \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0434\u0438\u0437\u0430\u0439\u043d\u0430\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0441 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u0432\u044c\u044e \u043d\u0430 Jetpack Compose. \u0412\u0435\u0434\u044c \u043c\u044b \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435!<\/p>\n<\/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\/757550\/\"> https:\/\/habr.com\/ru\/articles\/757550\/<\/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<figure class=\"full-width\"><\/figure>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0418\u0432\u0438, \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0438\u043d\u043e\u0442\u0435\u0430\u0442\u0440\u043e\u0432 \u0432 \u0420\u043e\u0441\u0441\u0438\u0438, \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b Android. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0432\u0435\u0440\u0441\u0438\u044e \u0434\u043b\u044f Android TV, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u043d\u043d\u043e\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u2014 Jetpack Compose. \u0422\u0430\u043a \u043a\u0430\u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Compose \u0434\u043b\u044f \u0422\u0412 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0430\u043b\u044c\u0444\u0430-\u0432\u0435\u0440\u0441\u0438\u0438, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044f\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c, \u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443: \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Jetpack Compose, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0422\u0412-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439?<\/p>\n<h3>\u0420\u0430\u0437\u0432\u0438\u0442\u0438\u0435 Android TV \u0438 \u043e\u0431\u0449\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/h3>\n<figure class=\"float bordered\">\n<div><figcaption>\u0412\u0435\u0440\u0441\u0438\u044f \u0434\u043b\u044f Android TV<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0418\u0432\u0438 \u043c\u044b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u043a \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u0430\u043a \u0438 \u0422\u0412-\u0432\u0435\u0440\u0441\u0438\u0438, \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u043b\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f Android TV. \u041f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0422\u0412-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432. \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u0422\u0412-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c. \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u043c\u044b \u0432\u0437\u044f\u043b\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438 \u0441\u0442\u0430\u043b\u0438 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043f\u043e\u0434 \u0422\u0412. \u0421 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 Unidirectional Data Flow \u0432 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c\u044b\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c  \u2014 \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0441\u043b\u043e\u0439 UI \u0434\u043b\u044f \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 UI \u0434\u043b\u044f TV: \u0432\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 Leanback \u0438 Jetpack Compose<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u044f\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u0432\u044b\u0431\u043e\u0440\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0430 Android TV. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e Jetpack Compose \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0441\u044f \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043b\u044f \u0422\u0412, \u0435\u0433\u043e \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u0430\u0441 \u0440\u0430\u0432\u043d\u043e\u0434\u0443\u0448\u043d\u044b\u043c\u0438. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043e\u0439 \u0431\u044b\u043b\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Leanback, \u043d\u043e \u0443 \u043d\u0435\u0435 \u043d\u0430\u0448\u043b\u0438\u0441\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438.<\/p>\n<h4>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 Leanback<\/h4>\n<p>\u0421\u0430\u043c\u044b\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u0435\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0443\u0437\u043a\u0438\u043c \u043c\u0435\u0441\u0442\u043e\u043c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<h4>\u041f\u043e\u0447\u0435\u043c\u0443 \u0440\u0435\u0448\u0438\u043b\u0438\u0441\u044c \u043d\u0430 Jetpack Compose<\/h4>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0432 \u0430\u043b\u044c\u0444\u0430-\u0432\u0435\u0440\u0441\u0438\u0438, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Jetpack Compose \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0441\u043c\u0435\u043b\u044b\u043c. \u041d\u0430\u0448\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0440\u0430\u043d\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Compose. \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438 \u0434\u043b\u044f \u0422\u0412-\u0432\u0435\u0440\u0441\u0438\u0438?<\/p>\n<h4>\u0424\u043e\u043a\u0443\u0441 \u0432 Leanback \u0438 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 Jetpack Compose<\/h4>\n<p>\u0424\u043e\u043a\u0443\u0441 \u0432 Android TV \u2014 \u044d\u0442\u043e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. Leanback \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0444\u043e\u043a\u0443\u0441\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u043c\u043a\u0430 \u0444\u043e\u043a\u0443\u0441\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a \u0446\u0435\u043d\u0442\u0440\u0443 \u044d\u043a\u0440\u0430\u043d\u0430, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0443\u043b\u044c\u0442. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 Jetpack Compose. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0433\u0438\u0444\u043a\u0438, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0444\u043e\u043a\u0443\u0441\u0430 \u0432 Leanback, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u0432 Jetpack Compose:<\/p>\n<ul>\n<li>\n<p>\u0424\u043e\u043a\u0443\u0441 \u0432 Leanback:<\/p>\n<figure class=\"\"><\/figure>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u0432 Jetpack Compose (\u043d\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435):<\/p>\n<figure class=\"\"><\/figure>\n<\/li>\n<\/ul>\n<p>\u0424\u043e\u043a\u0443\u0441 \u0432 Jetpack Compose \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <code>FocusRequester<\/code>-a, <code>focusable()<\/code> Modifier-\u0430 \u0438 <code>onFocusChanged { ... }<\/code> \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0430. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u043e\u043a\u0443\u0441\u0430 \u0432 Jetpack Compose:<\/p>\n<pre><code class=\"kotlin\">@Composable fun FocusingText() {     var color by remember { mutableStateOf(Color.Black) }     val focusRequester = remember { FocusRequester() }     Text(         modifier = Modifier             .focusRequester(focusRequester)             .onFocusChanged { color = if (it.isFocused) Color.Green else Color.Black }             .focusable()             .pointerInput(Unit) { detectTapGestures { focusRequester.requestFocus() } },         text = \"Text\",         color = color     ) }<\/code><\/pre>\n<p>\u0412 Compose \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0435\u0441\u0442\u044c \u043b\u0438 \u043d\u0430 \u043d\u0435\u043c \u0444\u043e\u043a\u0443\u0441, \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043e\u043b\u043b\u0431\u044d\u043a \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u0437\u0432\u0430\u0432 \u043c\u0435\u0442\u043e\u0434 <code>requestFocus()<\/code> \u0443 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0432\u043e\u0445: \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0443\u0441\u043f\u0435\u043b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 <code>recompose<\/code> \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>requestFocus()<\/code>, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u0440\u0430\u0448, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0443\u0431\u0438\u0442\u044c \u0434\u0432\u0438\u0436\u043e\u043a Jetpack Compose \u0434\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<h3>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 Jetpack Compose \u0434\u043b\u044f Android TV \u0438 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f\u043c<\/h3>\n<p>\u041c\u044b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b\u0438 \u043d\u0430 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0438 \u0438\u043d\u043d\u043e\u0432\u0430\u0446\u0438\u0438, \u043d\u043e \u043f\u0435\u0440\u0432\u044b\u0435 \u0448\u0430\u0433\u0438 \u0432 \u043c\u0438\u0440\u0435 Compose \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438, \u0447\u0435\u043c \u043c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0438. \u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e Leanback.<br \/> \u041f\u0440\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 <code>Lazy<\/code> &#8212; \u0441\u043f\u0438\u0441\u043a\u0435 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0444\u043e\u043a\u0443\u0441\u0430 \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 Leanback: \u0444\u043e\u043a\u0443\u0441 \u0443\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442 \u0433\u0430\u043b\u0435\u0440\u0435\u044e, \u0438\u043d\u043e\u0433\u0434\u0430 \u0444\u043e\u043a\u0443\u0441 \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0431\u043e\u0439. \u0422\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e.<\/p>\n<h3>\u041d\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h3>\n<figure class=\"bordered full-width\"><\/figure>\n<p>\u0423 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0438 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441  \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u0430\u044f \u0433\u0430\u043b\u0435\u0440\u0435\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u043e\u043a\u0443\u0441 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0435 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0436\u0430\u0442\u0438\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b &#8212; \u0442\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f <code>DpadFocusController<\/code>.<\/p>\n<p><code>DpadFocusController<\/code> \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439 \u0444\u043e\u043a\u0443\u0441\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 <code>DpadFocusController<\/code> \u0432\u0438\u0434\u0438\u0442 \u0432\u0441\u044e \u043a\u0430\u0440\u0442\u0443 \u0433\u0430\u043b\u0435\u0440\u0435\u0438, \u0442\u043e \u043e\u043d \u0441\u0430\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0444\u043e\u043a\u0443\u0441\u0430 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0448 \u0438 \u043e \u0442\u043e\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u0433\u0430\u043b\u0435\u0440\u0435\u044e. \u041c\u044b \u0437\u0430\u0434\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441  <code>DpadFocusController<\/code> \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 <code>FocusRequester<\/code>s, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043b\u0438\u0448\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <code>LazyRow<\/code> \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 D-Pad. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c\u0438 <code>FocusRequester<\/code>s \u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0433\u0430\u043b\u0435\u0440\u0435\u0438.<\/p>\n<p>API \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">@Preview @Composable fun testGrid() { val items = listOf(\"1\", \"2\", \"3\", \"4\", \"5\") val scope = rememberCoroutineScope() val state = rememberLazyListState() val dpad = remember { DpadFocusController( mScope = scope, lazyStateY = state, ) } LaunchedEffect(Unit) { dpad.restoreFocusAfterDelay(100) } dpad.updateLastIndexY(items.size - 1)  LazyColumn( modifier = Modifier.dpad(dpad), state = dpad.lazyStateY ) { itemsIndexed(items = items) { i, str -> val outState = remember { mutableStateOf(TouchState.Idle) } val color = when (outState.value) { TouchState.Idle -> Color.Red TouchState.Focused -> Color.Green TouchState.Touched -> Color.Blue else -> Color.Gray } Box( modifier = Modifier .touchAndFocus( outState = outState, focusRequester = dpad.focusRequester(rowPos = i, posX = 0) ) .background(color = color) .padding(10.dp) ) { Text(text = str, color = Color.White, fontSize = 170.sp) } } } }<\/code><\/pre>\n<ul>\n<li>\n<p>\u041d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 LazyColumn\/LazyRow, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043e \u0444\u043e\u043a\u0443\u0441\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f <code>DpadFocusRequester<\/code> \u0438\u0437 <code>DpadFocusController<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u044f <code>Modifer.dpad(DpadFocusController)<\/code> \u043a Lazy-\u0441\u043f\u0438\u0441\u043a\u0443, \u043c\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b:<\/p>\n<pre><code class=\"kotlin\">modifier.onKeyEvent(mOnKeyEventCb)<\/code><\/pre>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438\u0449\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438, \u0438, \u0435\u0441\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442, \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0435\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 <code>DpadFocusController.requestFocus()<\/code> \u043e \u0444\u043e\u043a\u0443\u0441\u0435, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442 \u0433\u0430\u043b\u0435\u0440\u0435\u044e \u043a \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0435\u0439 \u0441\u043a\u0440\u043e\u043b\u043b\u0430 \u043c\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0430\u043c\u0438:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"kotlin\">private suspend fun ScrollScope.scrollToVisibleItem( targetItem: LazyListItemInfo, targetOffset: Int, animDurationMs: Int, ) = animate( targetValue = (targetItem.offset - targetOffset).toFloat(), animationSpec = tween( &lt;-- \u043c\u044b \u0441\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 durationMillis = animDurationMs, easing = FastInSlowOut ), ) { value, velocity -> ... scrollBy(delta) }<\/code><\/pre>\n<ul>\n<li>\n<p>\u043e\u0434\u043d\u0430\u043a\u043e, <code>LazyListState<\/code> \u043d\u0435 \u0434\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0432\u043d\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043f\u0435\u0440\u0432\u0430 \u043f\u0440\u043e\u0441\u043a\u0440\u043e\u043b\u043b\u0438\u0442\u044c \u043d\u0430\u0443\u0433\u0430\u0434:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"kotlin\">private suspend fun ScrollScope.findOrScrollToItem( lazyState: LazyListState, itemIndex: Int, ): LazyListItemInfo? { var targetItem = lazyState.layoutInfo.visibleItemsInfo .firstOrNull { it.index == itemIndex } while (targetItem == null) { val itemsCountNext = lazyState.layoutInfo.visibleItemsInfo.count { it.index > itemIndex } \/\/ 0 1 2 3 4 5 6 7 8 \/\/     *    [visible] = [4 5 6 7 8] \/\/     ^ \/\/     | itemIndex = 2 val scrolledBy = scrollBy(if (itemsCountNext > 0) -50f else 50f) targetItem = lazyState.layoutInfo.visibleItemsInfo .firstOrNull { it.index == itemIndex } if (abs(scrolledBy) &lt; 1f) { break } } return targetItem }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u043a\u0443\u0441\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u044f\u0434\u044b \u0433\u0430\u043b\u0435\u0440\u0435\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u044d\u043a\u0440\u0430\u043d\u0430, \u0434\u0440\u0443\u0433\u0438\u0435 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u044d\u0442\u043e\u0439 \u0433\u0438\u0444\u043a\u0435 \u043e\u0444\u0441\u0435\u0442 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0435\u0440\u043e\u0432 \u0441 \u043f\u0440\u0435\u0432\u044c\u044e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0438\u0436\u0435, \u0447\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u044d\u043a\u0440\u0430\u043d\u0430:<\/p>\n<figure class=\"bordered full-width\">\n<div><figcaption>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0444\u0444\u0441\u0435\u0442\u043e\u0432 \u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0434\u0431\u043e\u0440\u043e\u043a \u0438 &#171;\u0421\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e\u0437\u0436\u0435&#187;<\/figcaption><\/div>\n<\/figure>\n<p>\u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0441\u044f, \u0442\u043e \u0444\u043e\u043a\u0443\u0441-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u0444\u043e\u043a\u0443\u0441. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0444\u043e\u043a\u0443\u0441\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u044f\u0434\u0443.<\/p>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0442 Google<\/h3>\n<p>\u041f\u043e \u0438\u0440\u043e\u043d\u0438\u0438 \u0441\u0443\u0434\u044c\u0431\u044b, \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u043b\u0438\u0437\u0430, Google \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b \u0430\u043b\u044c\u0444\u0430-\u0432\u0435\u0440\u0441\u0438\u044e Jetpack Compose \u0434\u043b\u044f Android TV. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0443 \u0441\u0435\u0431\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">@Preview @Composable fun TestTvComposeBlock() { val fr = remember { FocusRequester() } LaunchedEffect(Unit) { delay(100) fr.requestFocus() }  val listState = rememberTvLazyListState(0, 0) TvLazyColumn( modifier = Modifier.width(200.dp), state = listState, verticalArrangement = Arrangement.spacedBy(10.dp), pivotOffsets = PivotOffsets(0.5f, 0f) ) { item { TestBlock(fr, -1) }  items( count = 5, key = { it.hashCode() } ) { val state = rememberTvLazyListState(0, 0) TvLazyRow( state = state, pivotOffsets = PivotOffsets(0f, 0f), horizontalArrangement = Arrangement.spacedBy(10.dp), userScrollEnabled = false, ) { items(20, key = { it.hashCode() }) { TestBlock(index = it) } } } } }  @Composable private fun TestBlock( fr: FocusRequester? = null, index: Int) { var color by remember { mutableStateOf(Color.Red) } val focusRequester = fr ?: remember { FocusRequester() } Box( modifier = Modifier .size(50.dp) .background(color = color) .focusRequester(focusRequester) .onFocusChanged { color = if (it.isFocused) Color.Blue else Color.Red } .focusable(true), contentAlignment = Alignment.Center ) { Text(text = index.toString()) } }<\/code><\/pre>\n<p>\u041c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0431\u0430\u0433\u043e\u0432 \u0441 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043b\u0438\u0441\u044c. \u0411\u044b\u0441\u0442\u0440\u044b\u0435 \u0441\u043a\u0440\u043e\u043b\u043b\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0438 \u043a\u0440\u0430\u0448\u0438 \u0438 \u043f\u043e\u0442\u0435\u0440\u0438 \u0444\u043e\u043a\u0443\u0441\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0444\u043e\u043a\u0443\u0441\u0430 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0440\u044f\u0434\u0430\u043c\u0438 \u0431\u044b\u043b\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c: \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441\u043a\u0440\u043e\u043b\u043b\u0430 (\u043d\u0430 \u0433\u0438\u0444\u043a\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u0444\u043e\u043a\u0443\u0441\u043e\u043c \u0432\u043d\u0438\u0437 c <code>19<\/code> \u043d\u0430 \u043d\u0438\u0436\u043d\u0438\u0439 \u0440\u044f\u0434, \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0444\u043e\u043a\u0443\u0441 \u043d\u0430 <code>2<\/code> \u0438 \u043f\u0440\u043e\u0441\u043a\u0440\u043e\u043b\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430):<\/p>\n<figure class=\"bordered\">\n<div><figcaption>\u0411\u0430\u0433 \u0432 TvLazyRow \u043e\u0442 Google<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u0431\u0430\u0433\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0432 Google IssueTracker <a href=\"https:\/\/issuetracker.google.com\/issues?q=status:open%20componentid:1254578&amp;s=created_time:desc\">IssueTracker &#8212;<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-353422","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353422","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=353422"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353422\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}