{"id":386616,"date":"2024-06-29T06:49:41","date_gmt":"2024-06-29T06:49:41","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=386616"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=386616","title":{"rendered":"<span>\u0423\u043c\u043d\u044b\u0439 BottomNavigationView \u0431\u0435\u0437 \u0431\u043e\u043b\u0438: \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043c\u0435\u043d\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0432 Android-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0421\u0435\u0440\u0433\u0435\u0439 \u0412\u0435\u043b\u0435\u0441\u043a\u043e. \u042f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438 \u043c\u043d\u0435 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043c\u0435\u043d\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. \u0412 Android \u0437\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 BottomNavigationView. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043e\u043f\u044b\u0442\u043e\u043c, \u043a\u0430\u043a \u0433\u0438\u0431\u043a\u043e \u0438 \u043f\u0440\u0438\u044f\u0442\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438\u0437 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430.<\/p>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u0447\u0435\u043c?<\/h2>\n<ul>\n<li>\n<p>\u041d\u0438\u0436\u043d\u0435\u0435 \u043c\u0435\u043d\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043c\u0435\u043d\u044e \u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e, \u0431\u0435\u0437 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430 \u0440\u0435\u043b\u0438\u0437\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u043a\u043e\u043d\u043a\u0438 \u043a \u043d\u043e\u0432\u043e\u043c\u0443 \u0433\u043e\u0434\u0443 \u0438\u043b\u0438 \u0425\u044d\u043b\u043e\u0443\u0438\u043d\u0443. \u0418\u043b\u0438, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435-\u043c\u0430\u0433\u0430\u0437\u0438\u043d, \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043d\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b \u0430\u043a\u0446\u0438\u0439 \u0438 \u0442.\u043f.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u043d\u044e \u0434\u043e\u043b\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u043a\u043e\u043d\u043a\u0438 \u0438\u0437 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0442\u0430\u043a \u0438 \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u044b\u0435 \u0438\u043a\u043e\u043d\u043a\u0438, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043f\u043e url.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c?<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c, \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c 3 \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<ul>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 1. <\/strong>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 API \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u0435\u043d\u044e \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0443\u0436\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u043b\u0435\u0442\u0443, \u0442.\u043a. \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 2.<\/strong> \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u0443\u044e \u0438\u043a\u043e\u043d\u043a\u0443 \u043f\u043e url, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0448\u0435\u043b url \u0438\u043a\u043e\u043d\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 3.<\/strong> \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043c\u0435\u043d\u044e \u043f\u043e \u0441\u0435\u0442\u0438 (\u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u043a\u0446\u0438\u0439 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c, \u0442\u0438\u043f\u043e\u043c \u0438\u043a\u043e\u043d\u043a\u0438 \u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u043e\u0439)<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<h2>API \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 BottomNavigationView<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u0435\u043d\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u044f <s>\u043a \u0441\u0447\u0430\u0441\u0442\u044c\u044e<\/s> \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0435\u0433\u043e \u0441\u0435\u043a\u0446\u0438\u0439 \u0432 XML. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043c\u0430\u043a\u0430\u0440\u043e\u043d\u043d\u0443\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u043f\u0440\u044f\u043c\u043e \u0432 Activity \u0438\u043b\u0438 FlowFragment, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0441\u0442\u043e\u043c \u0434\u043b\u044f \u043c\u0435\u043d\u044e, \u043c\u0435\u043d\u044f \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u043b\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043c\u043e\u0434\u0443\u043b\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043b \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 ui \u0434\u043b\u044f \u043c\u0435\u043d\u044e, \u0430 \u0442\u043e\u0447\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0442\u043e\u0440 \u0441\u0434\u0435\u043b\u0430\u043b extension-\u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>setup<\/em> \u0434\u043b\u044f BottomNavigationView. \u0427\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u0442\u0430\u043a\u043e\u0433\u043e:<\/p>\n<pre><code class=\"kotlin\">override fun onViewCreated(view: View, savedInstanceState: Bundle?) {     ...     binding.bottomNavigationView.setup {         \/\/ build your bottom navigation using custom dsl     }     ... }<\/code><\/pre>\n<p>\u041f\u0443\u0441\u0442\u044c \u044d\u0442\u0430 extension-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0438\u043b\u0434\u0435\u0440\u0443 \u0441 <s>\u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c<\/s> \u0443\u0434\u043e\u0431\u043d\u044b\u043c DSL. \u0412 \u044d\u0442\u043e\u043c \u043c\u043d\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 <a href=\"https:\/\/kotlinlang.org\/docs\/lambdas.html#function-literals-with-receiver\" rel=\"noopener noreferrer nofollow\">\u043b\u044f\u043c\u0431\u0434\u044b \u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0438\u0437 Kotlin<\/a>. \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u043d\u044b.<\/p>\n<p>\u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u043a\u0446\u0438\u0439, \u0438 \u043e\u0431\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043c\u0435\u043d\u044e. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438\u00a0 \u0435\u0441\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u0441\u0441\u044b\u043b\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u044d\u043a\u0440\u0430\u043d, \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u043a\u043e\u043d\u043a\u0438 (id \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0438\u043b\u0438 url):<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e16\/e5d\/9ff\/e16e5d9ff9369a8f8d0e84fd4b74e3b7.png\" alt=\"\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0439 \u043c\u0435\u043d\u044e\" title=\"\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0439 \u043c\u0435\u043d\u044e\" width=\"682\" height=\"171\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e16\/e5d\/9ff\/e16e5d9ff9369a8f8d0e84fd4b74e3b7.png\"\/><figcaption>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0439 \u043c\u0435\u043d\u044e<\/figcaption><\/figure>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0449\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043c\u0435\u043d\u044e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432, click listener \u0438 \u043b\u043e\u0430\u0434\u0435\u0440 \u0438\u043a\u043e\u043d\u043e\u043a \u043f\u043e url. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>BottomNavigationConfig &#8212; \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u043c\u0435\u043d\u044e, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">data class BottomNavigationConfig(     val sectionList: List&lt;BottomNavigationSection>,     @ColorRes val tint: Int? = null,     val onItemClicked: (BottomNavigationSection) -> Unit,     val loader: MenuIconLoader )<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>BottomNavigationSection &#8212; \u043a\u043e\u043d\u0444\u0438\u0433 \u0441\u0435\u043a\u0446\u0438\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u0438, \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u043a\u043e\u043d\u043a\u0438, \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">data class BottomNavigationSection(     val title: String,     val iconSource: IconSource = IconSource.NotDefined,     val link: String )<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>IconSource &#8212; \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u043a\u043e\u043d\u043a\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">sealed class IconSource {     data class Url(val url: String) : IconSource()     data class ResourceId(@DrawableRes val drawableResourceId: Int) : IconSource()     object NotDefined : IconSource()      companion object {         fun url(url: String): Url = Url(url)         fun resource(@DrawableRes resourceId: Int) = ResourceId(resourceId)         fun notDefined() = NotDefined     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>MenuIconLoader &#8212; \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u043e url<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">interface MenuIconLoader {     fun loadIcon(menuItem: MenuItem, url: String) }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418 \u0431\u0438\u043b\u0434\u0435\u0440\u044b&#8230;<\/p>\n<details class=\"spoiler\">\n<summary>BottomNavigationConfigBuilder &#8212; \u0431\u0438\u043b\u0434\u0435\u0440 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class BottomNavigationConfigBuilder {     private var onItemClicked: (BottomNavigationSection) -> Unit = {}     private var loader: MenuIconLoader = object : MenuIconLoader {         override fun loadIcon(menuItem: MenuItem, url: String) {             \/\/ fallback implementation, ignore         }     }     private val sections: MutableList&lt;BottomNavigationSection> = mutableListOf()      @ColorRes     private var tintRes: Int? = null      fun sections(sectionList: List&lt;BottomNavigationSection>) {         sections.clear()         sections.addAll(sectionList)     }      fun sections(builder: BottomNavigationSectionsBlockBuilder.() -> Unit) {         val sectionList = BottomNavigationSectionsBlockBuilder().apply(builder).build()         sections.clear()         sections.addAll(sectionList.sections)     }      fun onItemClicked(listener: (BottomNavigationSection) -> Unit) {         onItemClicked = listener     }      fun remoteLoader(loader: MenuIconLoader) {         this.loader = loader     }      fun tint(@ColorRes colorSelectorIdRes: Int) {         tintRes = colorSelectorIdRes     }      fun build(): BottomNavigationConfig = BottomNavigationConfig(sections, tintRes, onItemClicked, loader) }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>BottomNavigationSectionsBlockBuilder &#8212; \u0431\u0438\u043b\u0434\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 \u0441 \u0441\u0435\u043a\u0446\u0438\u044f\u043c\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class BottomNavigationSectionsBlockBuilder {     private val sections: MutableList&lt;BottomNavigationSection> = mutableListOf()      fun section(builder: BottomNavigationSectionBuilder.() -> Unit = {}) {         BottomNavigationSectionBuilder().apply(builder).build()             .apply(sections::add)     }      fun build(): SectionsBlock = SectionsBlock(sections) }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>BottomNavigationSectionBuilder &#8212; \u0431\u0438\u043b\u0434\u0435\u0440 \u0441\u0435\u043a\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class BottomNavigationSectionBuilder {     private var _id: String = \"\"     private var _title: String = \"\"     private var _iconSource: IconSource = IconSource.NotDefined      fun link(id: String) {         _id = id     }      fun title(title: String) {         _title = title     }      fun iconSource(iconSource: IconSource) {         _iconSource = iconSource     }      fun build(): BottomNavigationSection = BottomNavigationSection(         link = _id,         title = _title,         iconSource = _iconSource     ) }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u0438\u043b\u0434\u0435\u0440\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u044b, \u043d\u0430\u043f\u0438\u0448\u0435\u043c extension-\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f BottomNavigationView, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 extension-\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">fun BottomNavigationView.setup(builder: BottomNavigationConfigBuilder.() -> Unit = {}) {     val bottomNavigationConfig = BottomNavigationConfigBuilder().apply(builder).build()     setBottomNavigationSections(bottomNavigationConfig)     setBottomNavigationTint(bottomNavigationConfig) }  private fun BottomNavigationView.setBottomNavigationSections(bottomNavigationConfig: BottomNavigationConfig) {     menu.clear()     bottomNavigationConfig.sectionList.forEachIndexed { index, bottomNavigationSection ->         menu.add(0, index, index, bottomNavigationSection.title).apply {             when (val src = bottomNavigationSection.iconSource) {                 is IconSource.ResourceId -> setIcon(src.drawableResourceId)                 is IconSource.Url -> bottomNavigationConfig.loader.loadIcon(this, src.url)                 IconSource.NotDefined -> {}             }              setOnMenuItemClickListener {                 bottomNavigationConfig.onItemClicked(bottomNavigationSection)                 false             }         }     } }  private fun BottomNavigationView.setBottomNavigationTint(config: BottomNavigationConfig) {     config.tint?.let {         itemIconTintList = ContextCompat.getColorStateList(context, it)         itemTextColor = ContextCompat.getColorStateList(context, it)     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e DSL \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<details class=\"spoiler\">\n<summary>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u0435\u043d\u044e \u0432\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">override fun onViewCreated(view: View, savedInstanceState: Bundle?) {     \/\/ ...     binding.bottomNavigationView.setup {         sections {             section {                 title(\"Dashboard\")                 iconSource(resource(R.drawable.ic_dashboard_black_24dp))                 link(\"dashboard\")             }             section {                 title(\"Home\")                 iconSource(resource(R.drawable.ic_home_black_24dp))                 link(\"home\")             }             section {                 title(\"Notifications\")                 iconSource(url(\"https:\/\/www.seekpng.com\/png\/full\/138-1387657_app-icon-set-login-icon-comments-avatar-icon.png\"))                 link(\"notifications\")             }         }         tint(R.color.bottom_nav_tint)         remoteLoader(GlideMenuIconLoader(context = context.applicationContext))         onItemClicked { section ->             navController.navigate(route = section.link)             Log.d(TAG, \"section clicked: $section\")         }     }     \/\/ ... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0430\u0448\u0438\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0438\u043a\u043e\u043d\u043e\u043a \u0438 \u0442.\u0434.<\/p>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e url \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043a\u043e\u043d\u043a\u0438 \u0434\u043b\u044f MenuItem<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 MenuIconLoader. \u041e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0435\u0433\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u044f \u0441\u043e\u0437\u0434\u0430\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043c\u043e\u0434\u0443\u043b\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/bumptech\/glide\" rel=\"noopener noreferrer nofollow\">glide<\/a> (\u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e MenuIconLoader \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0435 \u0432 \u0431\u0438\u043b\u0434\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0430)<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0442\u0430\u0440\u0433\u0435\u0442 \u0434\u043b\u044f MenuItem:<\/p>\n<details class=\"spoiler\">\n<summary>CustomTarget<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">internal class MenuItemTarget(     private val context: Context,     private val menuItem: MenuItem ) : CustomTarget&lt;Bitmap>() {     override fun onResourceReady(resource: Bitmap, transition: Transition&lt;in Bitmap>?) {         menuItem.icon = resource.toDrawable(context.resources)     }      override fun onLoadCleared(placeholder: Drawable?) {         \/\/ ignore     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 glide-\u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430. \u0423 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0438\u043a\u043e\u043d\u043e\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Glide<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class GlideMenuIconLoader(private val context: Context) : MenuIconLoader {     override fun loadIcon(menuItem: MenuItem, url: String) {         Glide.with(context)             .asBitmap()             .load(url)             .diskCacheStrategy(DiskCacheStrategy.DATA)             .into(MenuItemTarget(context, menuItem)) \/\/ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0442\u0430\u0440\u0433\u0435\u0442     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c GlideMenuIconLoader \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 BottomNavigationView \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 \u0438\u043a\u043e\u043d\u043e\u043a \u043f\u043e url. \u041d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0435\u043c\u0443 Context.<\/p>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043c\u0435\u043d\u044e \u0438\u0437 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430<\/h2>\n<p>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043c\u0435\u043d\u044e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 \u0431\u044d\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>firebase remote config<\/p>\n<\/li>\n<li>\n<p>\u0432\u0430\u0448 \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0442\u043e\u0431\u044b \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">interface BottomNavigationRepository {     val bottomNavigationData: List&lt;BottomNavigationSectionData>     suspend fun load() }  data class BottomNavigationSectionData(     val title: String,     val link: String,     val iconUrl: String = \"\", )<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 &#8212; \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u0434\u0430\u0435\u0442 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e (\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e bottomNavigationData). \u0422\u0430\u043a\u0436\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0438\u043c\u0435\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e load(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c. \u041e\u0442\u0441\u044e\u0434\u0430 \u0432\u044b\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c \u0432 \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/598\/58d\/710\/59858d7107b7925337d207f431317dc9.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 BottomNavigationRepository\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 BottomNavigationRepository\" width=\"701\" height=\"101\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/598\/58d\/710\/59858d7107b7925337d207f431317dc9.png\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 BottomNavigationRepository<\/figcaption><\/figure>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043c\u0435\u043d\u044e? \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043a\u0430\u0437\u0430 splash screen, \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u043d\u044e \u0435\u0449\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0441\u0435\u0442\u044c. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0432\u044b\u0448\u043b\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class BottomNavigationRepositoryImpl(     remoteBottomNavSource: RemoteBottomNavSource ) : BottomNavigationRepository {      private val _bottomNavigationData: MutableList&lt;BottomNavigationSectionData> = DEFAULT_BOTTOM_NAV_CONFIG      \/\/ Should be called in main activity or flow fragment     override val bottomNavigationData: List&lt;BottomNavigationSectionData>         get() = _bottomNavigationData      \/\/ Should be called in splash screen     override suspend fun load() {         val sectionList: List&lt;BottomNavigationSectionData> = remoteBottomNavSource.fetchBottomNavigationConfig()         _bottomNavigationData.clear()         _bottomNavigationData.addAll(sectionList)     }          companion object {         private val DEFAULT_BOTTOM_NAV_CONFIG = mutableListOf(             BottomNavigationSectionData(\"Home\", \"home\"),             BottomNavigationSectionData(\"Dashboard\", \"dashboard\"),             BottomNavigationSectionData(\"Notifications\", \"notifications\", \"https:\/\/www.seekpng.com\/png\/full\/138-1387657_app-icon-set-login-icon-comments-avatar-icon.png\"),         )     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f view model \u044d\u043a\u0440\u0430\u043d\u0430-\u0445\u043e\u0441\u0442\u0430 \u0438 \u0441\u043c\u0430\u043f\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 <code>List&lt;BottomNavigationSectionData><\/code> \u0441 ui-\u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c <code>BottomNavigationConfig<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 DSL:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 ViewModel<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class MainViewModel : ViewModel() {     private val bottomNavigationRepository = BottomNavigationRepositoryImpl()     private val _bottomNavigationSections = MutableLiveData&lt;List&lt;BottomNavigationSection>>()     val bottomNavigationSections: LiveData&lt;List&lt;BottomNavigationSection>>         get() = _bottomNavigationSections      init {         _bottomNavigationSections.postValue(             bottomNavigationRepository.bottomNavigationData.toBottomNavigationSections()         )     }      private fun List&lt;BottomNavigationSectionData>.toBottomNavigationSections(): List&lt;BottomNavigationSection> =     filter {         it.iconUrl.isNotEmpty() || it.link.isNotEmpty()     }.map {         BottomNavigationSection(             title = it.title,             iconSource = if (it.iconUrl.isEmpty()) {                 IconSource.resource(it.link.mapLinkToDrawableRes())             } else {                 IconSource.url(it.iconUrl)             },             link = it.link,         )     }      private fun String.mapLinkToDrawableRes(): Int {         return when (this) {             \"dashboard\" -> R.drawable.ic_dashboard_black_24dp             \"home\" -> R.drawable.ic_home_black_24dp             \"notifications\" -> R.drawable.ic_notifications_black_24dp             else -> throw IllegalStateException()         }     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0427\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c?<\/h2>\n<details class=\"spoiler\">\n<summary>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u0435\u043d\u044e \u0432\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e view model<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">override fun onViewCreated(view: View, savedInstanceState: Bundle?) {     \/\/ ...     viewModel.bottomNavigationSections.observe(viewLifecycleOwner) { bottomNavigationSections ->         binding.bottomNavigationView.setup {             sections(bottomNavigationSections)             tint(R.color.bottom_nav_tint)             remoteLoader(GlideMenuIconLoader(context = this@MainActivity.applicationContext))             onItemClicked { section ->                 navController.navigate(route = section.link)                 Log.d(TAG, \"section clicked: $section\")             }         }     }     \/\/ ... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u0441\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 livedata \u0432 ViewModel \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433. \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u0448 BottomNavigationView \u0432 5 \u0441\u0442\u0440\u043e\u0447\u0435\u043a.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dc5\/aa5\/478\/dc5aa5478103065ed539d562609ce3fa.png\" alt=\"\" title=\"\" width=\"1094\" height=\"390\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dc5\/aa5\/478\/dc5aa5478103065ed539d562609ce3fa.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0437\u0430\u043c\u043e\u043a\u0430\u043b \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0434\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438\u0437 \u0442\u0440\u0435\u0445 \u0441\u0435\u043a\u0446\u0438\u0439, \u043e\u0434\u043d\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 url \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0438\u043a\u043e\u043d\u043a\u0438 (\u0441\u0435\u043a\u0446\u0438\u044f Notifications \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435).<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>BottomNavigationView \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0431\u0435\u0437 \u0431\u043e\u043b\u0438 (\u043d\u0443 \u043f\u043e\u0447\u0442\u0438). \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0442\u0430\u043b \u043f\u043e\u043d\u044f\u0442\u0435\u043d, \u0443\u0434\u043e\u0431\u0435\u043d, \u0430 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d. \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451! \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0442\u0435\u043c, \u043a\u0442\u043e \u0447\u0438\u0442\u0430\u0435\u0442 \u044d\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0438, \u0437\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043a \u0441\u0442\u0430\u0442\u044c\u0435 \ud83d\ude42 \u041a\u043e\u0434 \u0441\u044d\u043c\u043f\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/raininforest\/bottom-navigation-extension\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/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\/697578\/\"> https:\/\/habr.com\/ru\/articles\/697578\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0421\u0435\u0440\u0433\u0435\u0439 \u0412\u0435\u043b\u0435\u0441\u043a\u043e. \u042f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438 \u043c\u043d\u0435 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043c\u0435\u043d\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. \u0412 Android \u0437\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 BottomNavigationView. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043e\u043f\u044b\u0442\u043e\u043c, \u043a\u0430\u043a \u0433\u0438\u0431\u043a\u043e \u0438 \u043f\u0440\u0438\u044f\u0442\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438\u0437 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430.<\/p>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u0447\u0435\u043c?<\/h2>\n<ul>\n<li>\n<p>\u041d\u0438\u0436\u043d\u0435\u0435 \u043c\u0435\u043d\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043c\u0435\u043d\u044e \u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e, \u0431\u0435\u0437 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430 \u0440\u0435\u043b\u0438\u0437\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u043a\u043e\u043d\u043a\u0438 \u043a \u043d\u043e\u0432\u043e\u043c\u0443 \u0433\u043e\u0434\u0443 \u0438\u043b\u0438 \u0425\u044d\u043b\u043e\u0443\u0438\u043d\u0443. \u0418\u043b\u0438, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435-\u043c\u0430\u0433\u0430\u0437\u0438\u043d, \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043d\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b \u0430\u043a\u0446\u0438\u0439 \u0438 \u0442.\u043f.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u043d\u044e \u0434\u043e\u043b\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u043a\u043e\u043d\u043a\u0438 \u0438\u0437 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0442\u0430\u043a \u0438 \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u044b\u0435 \u0438\u043a\u043e\u043d\u043a\u0438, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043f\u043e url.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c?<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c, \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c 3 \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<ul>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 1. <\/strong>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 API \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u0435\u043d\u044e \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0443\u0436\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u043b\u0435\u0442\u0443, \u0442.\u043a. \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 2.<\/strong> \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0440\u0430\u0441\u0442\u0440\u043e\u0432\u0443\u044e \u0438\u043a\u043e\u043d\u043a\u0443 \u043f\u043e url, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0448\u0435\u043b url \u0438\u043a\u043e\u043d\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 3.<\/strong> \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043c\u0435\u043d\u044e \u043f\u043e \u0441\u0435\u0442\u0438 (\u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u043a\u0446\u0438\u0439 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c, \u0442\u0438\u043f\u043e\u043c \u0438\u043a\u043e\u043d\u043a\u0438 \u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u043e\u0439)<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<h2>API \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 BottomNavigationView<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u0435\u043d\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u044f <s>\u043a \u0441\u0447\u0430\u0441\u0442\u044c\u044e<\/s> \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0435\u0433\u043e \u0441\u0435\u043a\u0446\u0438\u0439 \u0432 XML. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043c\u0430\u043a\u0430\u0440\u043e\u043d\u043d\u0443\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u043f\u0440\u044f\u043c\u043e \u0432 Activity \u0438\u043b\u0438 FlowFragment, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0441\u0442\u043e\u043c \u0434\u043b\u044f \u043c\u0435\u043d\u044e, \u043c\u0435\u043d\u044f \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u043b\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043c\u043e\u0434\u0443\u043b\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043b \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 ui \u0434\u043b\u044f \u043c\u0435\u043d\u044e, \u0430 \u0442\u043e\u0447\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0442\u043e\u0440 \u0441\u0434\u0435\u043b\u0430\u043b extension-\u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>setup<\/em> \u0434\u043b\u044f BottomNavigationView. \u0427\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u0442\u0430\u043a\u043e\u0433\u043e:<\/p>\n<pre><code class=\"kotlin\">override fun onViewCreated(view: View, savedInstanceState: Bundle?) {     ...     binding.bottomNavigationView.setup {         \/\/ build your bottom navigation using custom dsl     }     ... }<\/code><\/pre>\n<p>\u041f\u0443\u0441\u0442\u044c \u044d\u0442\u0430 extension-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0438\u043b\u0434\u0435\u0440\u0443 \u0441 <s>\u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c<\/s> \u0443\u0434\u043e\u0431\u043d\u044b\u043c DSL. \u0412 \u044d\u0442\u043e\u043c \u043c\u043d\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 <a href=\"https:\/\/kotlinlang.org\/docs\/lambdas.html#function-literals-with-receiver\" rel=\"noopener noreferrer nofollow\">\u043b\u044f\u043c\u0431\u0434\u044b \u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0438\u0437 Kotlin<\/a>. \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u043d\u044b.<\/p>\n<p>\u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u043a\u0446\u0438\u0439, \u0438 \u043e\u0431\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043c\u0435\u043d\u044e. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438\u00a0 \u0435\u0441\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u0441\u0441\u044b\u043b\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u044d\u043a\u0440\u0430\u043d, \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u043a\u043e\u043d\u043a\u0438 (id \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0438\u043b\u0438 url):<\/p>\n<figure class=\"full-width\"><figcaption>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0439 \u043c\u0435\u043d\u044e<\/figcaption><\/figure>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0449\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043c\u0435\u043d\u044e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432, click listener \u0438 \u043b\u043e\u0430\u0434\u0435\u0440 \u0438\u043a\u043e\u043d\u043e\u043a \u043f\u043e url. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>BottomNavigationConfig &#8212; \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u043c\u0435\u043d\u044e, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">data class BottomNavigationConfig(     val sectionList: List&lt;BottomNavigationSection>,     @ColorRes val tint: Int? = null,     val onItemClicked: (BottomNavigationSection) -> Unit,     val loader: MenuIconLoader )<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>BottomNavigationSection &#8212; \u043a\u043e\u043d\u0444\u0438\u0433 \u0441\u0435\u043a\u0446\u0438\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u0438, \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u043a\u043e\u043d\u043a\u0438, \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">data class BottomNavigationSection(     val title: String,     val iconSource: IconSource = IconSource.NotDefined,     val link: String )<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>IconSource &#8212; \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u043a\u043e\u043d\u043a\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">sealed class IconSource {     data class Url(val url: String) : IconSource()     data class ResourceId(@DrawableRes val drawableResourceId: Int) : IconSource()     object NotDefined : IconSource()      companion object {         fun url(url: String): Url = Url(url)         fun resource(@DrawableRes resourceId: Int) = ResourceId(resourceId)         fun notDefined() = NotDefined     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>MenuIconLoader &#8212; \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u043e url<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">interface MenuIconLoader {     fun loadIcon(menuItem: MenuItem, url: String) }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418 \u0431\u0438\u043b\u0434\u0435\u0440\u044b&#8230;<\/p>\n<details class=\"spoiler\">\n<summary>BottomNavigationConfigBuilder &#8212; \u0431\u0438\u043b\u0434\u0435\u0440 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class BottomNavigationConfigBuilder {     private var onItemClicked: (BottomNavigationSection) -> Unit = {}     private var loader: MenuIconLoader = object : MenuIconLoader {         override fun loadIcon(menuItem: MenuItem, url: String) {             \/\/ fallback implementation, ignore         }     }     private val sections: MutableList&lt;BottomNavigationSection> = mutableListOf()      @ColorRes     private var tintRes: Int? = null      fun sections(sectionList: List&lt;BottomNavigationSection>) {         sections.clear()         sections.addAll(sectionList)     }      fun sections(builder: BottomNavigationSectionsBlockBuilder.() -> Unit) {         val sectionList = BottomNavigationSectionsBlockBuilder().apply(builder).build()         sections.clear()         sections.addAll(sectionList.sections)     }      fun onItemClicked(listener: (BottomNavigationSection) -> Unit) {         onItemClicked = listener     }      fun remoteLoader(loader: MenuIconLoader) {         this.loader = loader     }      fun tint(@ColorRes colorSelectorIdRes: Int) {         tintRes = colorSelectorIdRes     }      fun build(): BottomNavigationConfig = BottomNavigationConfig(sections, tintRes, onItemClicked, loader) }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>BottomNavigationSectionsBlockBuilder &#8212; \u0431\u0438\u043b\u0434\u0435\u0440 \u0431\u043b\u043e\u043a\u0430 \u0441 \u0441\u0435\u043a\u0446\u0438\u044f\u043c\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class BottomNavigationSectionsBlockBuilder {     private val sections: MutableList&lt;BottomNavigationSection> = mutableListOf()      fun section(builder: BottomNavigationSectionBuilder.() -> Unit = {}) {         BottomNavigationSectionBuilder().apply(builder).build()             .apply(sections::add)     }      fun build(): SectionsBlock = SectionsBlock(sections) }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>BottomNavigationSectionBuilder &#8212; \u0431\u0438\u043b\u0434\u0435\u0440 \u0441\u0435\u043a\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class BottomNavigationSectionBuilder {     private var _id: String = \"\"     private var _title: String = \"\"     private var _iconSource: IconSource = IconSource.NotDefined      fun link(id: String) {         _id = id     }      fun title(title: String) {         _title = title     }      fun iconSource(iconSource: IconSource) {         _iconSource = iconSource     }      fun build(): BottomNavigationSection = BottomNavigationSection(         link = _id,         title = _title,         iconSource = _iconSource     ) }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u0438\u043b\u0434\u0435\u0440\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u044b, \u043d\u0430\u043f\u0438\u0448\u0435\u043c extension-\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f BottomNavigationView, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 extension-\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">fun BottomNavigationView.setup(builder: BottomNavigationConfigBuilder.() -> Unit = {}) {     val bottomNavigationConfig = BottomNavigationConfigBuilder().apply(builder).build()     setBottomNavigationSections(bottomNavigationConfig)     setBottomNavigationTint(bottomNavigationConfig) }  private fun BottomNavigationView.setBottomNavigationSections(bottomNavigationConfig: BottomNavigationConfig) {     menu.clear()     bottomNavigationConfig.sectionList.forEachIndexed { index, bottomNavigationSection ->         menu.add(0, index, index, bottomNavigationSection.title).apply {             when (val src = bottomNavigationSection.iconSource) {                 is IconSource.ResourceId -> setIcon(src.drawableResourceId)                 is IconSource.Url -> bottomNavigationConfig.loader.loadIcon(this, src.url)                 IconSource.NotDefined -> {}             }              setOnMenuItemClickListener {                 bottomNavigationConfig.onItemClicked(bottomNavigationSection)                 false             }         }     } }  private fun BottomNavigationView.setBottomNavigationTint(config: BottomNavigationConfig) {     config.tint?.let {         itemIconTintList = ContextCompat.getColorStateList(context, it)         itemTextColor = ContextCompat.getColorStateList(context, it)     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e DSL \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<details class=\"spoiler\">\n<summary>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u0435\u043d\u044e \u0432\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">override fun onViewCreated(view: View, savedInstanceState: Bundle?) {     \/\/ ...     binding.bottomNavigationView.setup {         sections {             section {                 title(\"Dashboard\")                 iconSource(resource(R.drawable.ic_dashboard_black_24dp))                 link(\"dashboard\")             }             section {                 title(\"Home\")                 iconSource(resource(R.drawable.ic_home_black_24dp))                 link(\"home\")             }             section {                 title(\"Notifications\")                 iconSource(url(\"https:\/\/www.seekpng.com\/png\/full\/138-1387657_app-icon-set-login-icon-comments-avatar-icon.png\"))                 link(\"notifications\")             }         }         tint(R.color.bottom_nav_tint)         remoteLoader(GlideMenuIconLoader(context = context.applicationContext))         onItemClicked { section ->             navController.navigate(route = section.link)             Log.d(TAG, \"section clicked: $section\")         }     }     \/\/ ... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0430\u0448\u0438\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0438\u043a\u043e\u043d\u043e\u043a \u0438 \u0442.\u0434.<\/p>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e url \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043a\u043e\u043d\u043a\u0438 \u0434\u043b\u044f MenuItem<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 MenuIconLoader. \u041e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0435\u0433\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u044f \u0441\u043e\u0437\u0434\u0430\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043c\u043e\u0434\u0443\u043b\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/bumptech\/glide\" rel=\"noopener noreferrer nofollow\">glide<\/a> (\u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e MenuIconLoader \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0435 \u0432 \u0431\u0438\u043b\u0434\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0430)<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0442\u0430\u0440\u0433\u0435\u0442 \u0434\u043b\u044f MenuItem:<\/p>\n<details class=\"spoiler\">\n<summary>CustomTarget<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">internal class MenuItemTarget(     private val context: Context,     private val menuItem: MenuItem ) : CustomTarget&lt;Bitmap>() {     override fun onResourceReady(resource: Bitmap, transition: Transition&lt;in Bitmap>?) {         menuItem.icon = resource.toDrawable(context.resources)     }      override fun onLoadCleared(placeholder: Drawable?) {         \/\/ ignore     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 glide-\u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430. \u0423 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0438\u043a\u043e\u043d\u043e\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Glide<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class GlideMenuIconLoader(private val context: Context) : MenuIconLoader {     override fun loadIcon(menuItem: MenuItem, url: String) {         Glide.with(context)             .asBitmap()             .load(url)<\/code><\/pre>\n<\/div>\n<\/details>\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-386616","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/386616","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=386616"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/386616\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=386616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=386616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=386616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}