{"id":342482,"date":"2022-12-12T21:00:11","date_gmt":"2022-12-12T21:00:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=342482"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=342482","title":{"rendered":"<span>RecyclerView \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0433\u043e Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/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>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439, \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c. \u041a\u0430\u0436\u0434\u044b\u0439 Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a  \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a, \u0434\u043b\u044f  \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0443 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c  \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u043c \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c, \u043a\u0430\u043a RecyclerView.<\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043e \u0442\u043e\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e RecyclerView, \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438  \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u0431\u0430\u0437\u043e\u0432\u044b\u0439, \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u044f\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438 \u0432 Android.<\/p>\n<p>\u0412\u0441\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/coder-chekunkov\/RecyclerView-Article\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<figure class=\"bordered\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2k\/vn\/9q\/2kvn9qc9gn4cdo45upnmgs29ifs.gif\" alt=\"\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u0432 \u0441\u0442\u0430\u0442\u044c\u0435.\" title=\"\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u0432 \u0441\u0442\u0430\u0442\u044c\u0435.\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/webt\/2k\/vn\/9q\/2kvn9qc9gn4cdo45upnmgs29ifs.gif\"\/><figcaption>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u0432 \u0441\u0442\u0430\u0442\u044c\u0435.<\/figcaption><\/figure>\n<h3>ListView \u0438\u043b\u0438 RecyclerView?<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0443 Android \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0432\u0430 \u043f\u0443\u0442\u0438 &#8212; <a href=\"https:\/\/developer.android.com\/reference\/android\/widget\/ListView\" rel=\"noopener noreferrer nofollow\">ListView<\/a> \u0438 <a href=\"https:\/\/developer.android.com\/reference\/kotlin\/androidx\/recyclerview\/widget\/RecyclerView\" rel=\"noopener noreferrer nofollow\">RecyclerView<\/a>.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0438\u0434\u0436\u0435\u0442 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442. \u041d\u043e, \u043a  \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, ListView \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c  \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<p>\u0412 \u0441\u0432\u043e\u044e \u0436\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u044c RecyclerView &#171;\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438&#187; \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442  \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043f\u0438\u0441\u043a\u0430, \u0447\u0435\u043c  ListView. \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c RecyclerView, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c,  \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0430 \u0441\u0442\u0435\u0440\u043e\u0438\u0434\u0430\u0445.<\/p>\n<p>RecyclerView \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435  \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430; \u043f\u0440\u0438 \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0435 \u0441\u043f\u0438\u0441\u043a\u0430  \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0443\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f  \u0432\u043d\u0438\u0437 \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<h3>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b RecyclerView<\/h3>\n<p>\u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b RecyclerView \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\n<p><code>RecyclerView<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043c\u0430\u043a\u0435\u0442 \u043d\u0430\u0448\u0435\u0433\u043e Activity;<\/p>\n<\/li>\n<li>\n<p><code>Adapter<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p><code>ViewHolder<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a;<\/p>\n<\/li>\n<li>\n<p><code>ItemDecorator<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0434\u0435\u043a\u043e\u0440;<\/p>\n<\/li>\n<li>\n<p><code>ItemAnimator<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438, \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439;<\/p>\n<\/li>\n<li>\n<p><code>DiffUtil<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043b\u044e\u0434\u044f\u0445. \u041a\u0430\u0436\u0434\u044b\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0438\u043c\u044f, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u043d\u0438\u043c (\u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440, \u0443\u0434\u0430\u043b\u0438\u0442\u044c, \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0432\u0435\u0440\u0445\/\u0432\u043d\u0438\u0437, \u043b\u0430\u0439\u043a\u043d\u0443\u0442\u044c).<\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Kotlin. \u0422\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/bumptech\/glide\" rel=\"noopener noreferrer nofollow\">Glide<\/a> \u0438 <a href=\"https:\/\/github.com\/DiUS\/java-faker\" rel=\"noopener noreferrer nofollow\">Faker<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a RecyclerView.<\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c <strong>\u0443\u043a\u0430\u0436\u0435\u043c \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c, \u0432 \u0444\u0430\u0439\u043b \u0441\u0431\u043e\u0440\u043a\u0438 <code>build.gradle<\/code> \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"kotlin\">    implementation 'androidx.recyclerview:recyclerview:1.2.1'     implementation 'com.github.javafaker:javafaker:1.0.2'     implementation 'com.github.bumptech.glide:glide:4.14.2' <\/code><\/pre>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 AndroidStudio \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 RecyclerView. \u0414\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Material.<\/em><\/p>\n<p>\u0418 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e <strong>\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c<\/strong> <a href=\"https:\/\/developer.android.com\/topic\/libraries\/view-binding\" rel=\"noopener noreferrer nofollow\">ViewBinding<\/a> \u0432 \u0444\u0430\u0439\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 <code>build.gradle<\/code> \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"json\">buildFeatures {         viewBinding = true }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <strong>\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/strong> \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>AndroidManifest.xml<\/code> (\u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Glide):<\/p>\n<pre><code class=\"xml\">&lt;uses-permission android:name=\"android.permission.INTERNET\"\/> &lt;uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"\/><\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 <strong>\u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0430\u043a\u0435\u0442\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b<\/strong>: \u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u043b\u044f ActivityMain, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 RecyclerView, \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 (\u0447\u0435\u043b\u043e\u0432\u0435\u043a).<\/p>\n<p><em>activity_main.xml<\/em>:<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?> &lt;FrameLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:tools=\"http:\/\/schemas.android.com\/tools\"     android:id=\"@+id\/activityMain\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"     tools:context=\".MainActivity\">      &lt;androidx.recyclerview.widget.RecyclerView         android:id=\"@+id\/recyclerView\"         android:layout_width=\"match_parent\"         android:layout_height=\"match_parent\" \/>  &lt;\/FrameLayout><\/code><\/pre>\n<p><em>item_person.xml:<\/em><\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?> &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"     xmlns:tools=\"http:\/\/schemas.android.com\/tools\"     android:layout_width=\"match_parent\"     android:layout_height=\"wrap_content\"     android:background=\"?selectableItemBackground\"     android:paddingStart=\"10dp\"     android:paddingTop=\"5dp\"     android:paddingEnd=\"10dp\"     android:paddingBottom=\"5dp\">      &lt;ImageView         android:id=\"@+id\/imageView\"         android:layout_width=\"wrap_content\"         android:layout_height=\"match_parent\"         android:src=\"@drawable\/ic_person\"         app:layout_constraintBottom_toBottomOf=\"parent\"         app:layout_constraintStart_toStartOf=\"parent\"         app:layout_constraintTop_toTopOf=\"parent\" \/>      &lt;TextView         android:id=\"@+id\/nameTextView\"         style=\"@style\/TextAppearance.AppCompat.Body2\"         android:layout_width=\"wrap_content\"         android:layout_height=\"wrap_content\"         android:layout_marginStart=\"15dp\"         app:layout_constraintStart_toEndOf=\"@id\/imageView\"         app:layout_constraintTop_toTopOf=\"parent\" \/>      &lt;TextView         android:id=\"@+id\/companyTextView\"         android:layout_width=\"wrap_content\"         android:layout_height=\"wrap_content\"         android:layout_marginStart=\"15dp\"         app:layout_constraintStart_toEndOf=\"@id\/imageView\"         app:layout_constraintTop_toBottomOf=\"@id\/nameTextView\" \/>      &lt;ImageView         android:id=\"@+id\/likedImageView\"         android:layout_width=\"wrap_content\"         android:layout_height=\"wrap_content\"         android:layout_marginEnd=\"15dp\"         android:src=\"@drawable\/ic_like\"         app:layout_constraintBottom_toBottomOf=\"parent\"         app:layout_constraintEnd_toStartOf=\"@id\/more\"         app:layout_constraintTop_toTopOf=\"parent\" \/>      &lt;ImageView         android:id=\"@+id\/more\"         android:layout_width=\"wrap_content\"         android:layout_height=\"wrap_content\"         android:src=\"@drawable\/ic_more\"         app:layout_constraintBottom_toBottomOf=\"parent\"         app:layout_constraintEnd_toEndOf=\"parent\"         app:layout_constraintTop_toTopOf=\"parent\" \/>  &lt;\/androidx.constraintlayout.widget.ConstraintLayout><\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0431\u044b\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b, \u0432\u0441\u0435 \u043c\u0430\u043a\u0435\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e <strong>\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043b\u044e\u0434\u044f\u0445<\/strong> (\u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c, \u0431\u043e\u0435\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u0445 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 <em>PersonService<\/em> \u0438 data-class <em>Person<\/em>:<\/p>\n<pre><code class=\"kotlin\">data class Person(     val id: Long, \/\/ \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f     val name: String, \/\/ \u0418\u043c\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430     val companyName: String, \/\/ \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0438\u0438     val photo: String, \/\/ \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0444\u043e\u0442\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430     val isLiked: Boolean \/\/ \u0411\u044b\u043b \u043b\u0438 \u043b\u0430\u0439\u043a\u043d\u0443\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c )<\/code><\/pre>\n<pre><code class=\"kotlin\">class PersonService {      private var persons = mutableListOf&lt;Person>() \/\/ \u0412\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438      init {         val faker = Faker.instance() \/\/ \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445          persons = (1..50).map {             Person(                 id = it.toLong(),                 name = faker.name().fullName(),                 companyName = faker.company().name(),                 photo = IMAGES[it % IMAGES.size],                 isLiked = false             )         }.toMutableList()     }      companion object {         private val IMAGES = mutableListOf(             \"https:\/\/images.unsplash.com\/photo-1600267185393-e158a98703de?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NjQ0&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1579710039144-85d6bdffddc9?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0Njk1&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1488426862026-3ee34a7d66df?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0ODE0&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1620252655460-080dbec533ca?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NzQ1&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1613679074971-91fc27180061?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NzUz&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1485795959911-ea5ebf41b6ae?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NzU4&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1545996124-0501ebae84d0?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NzY1&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/flagged\/photo-1568225061049-70fb3006b5be?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0Nzcy&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1567186937675-a5131c8a89ea?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0ODYx&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1546456073-92b9f0a8d413?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0ODY1&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\"         )     } }<\/code><\/pre>\n<p>\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 PersonService \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043b\u0438\u0441\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0432 <code>init<\/code> (initializers blocks), \u0438 \u043b\u0438\u0441\u0442 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u043b\u0430\u0441\u0441 PersonService \u0441\u0434\u0435\u043b\u0430\u0442\u044c <code>Singleton<\/code> \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 <em>App<\/em>, \u0438 \u0443\u043a\u0430\u0436\u0435\u043c \u0432 \u043d\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"kotlin\">class App : Application() {     val personService = PersonService() }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c <strong>\u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0430\u0434\u0430\u043f\u0442\u0435\u0440<\/strong> <em>PersonAdapter<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <code>RecyclerView.Adapter<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0443\u0436\u0435\u043d ViewHolder. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c <em>PersonViewHolder<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c <code>RecyclerView.ViewHolder<\/code> \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0430\u0448 binding.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 PersonAdapter \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0435\u043c\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u0441\u0435\u0442\u0442\u0435\u0440. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<pre><code class=\"kotlin\">class PersonAdapter : RecyclerView.Adapter&lt;PersonAdapter.PersonViewHolder>() {      var data: List&lt;Person> = emptyList()         set(newValue) {             field = newValue             notifyDataSetChanged()         }      class PersonViewHolder(val binding: ItemPersonBinding) : RecyclerView.ViewHolder(binding.root) }<\/code><\/pre>\n<p>\u041d\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 (AndroidStudio \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u0442 \u043d\u0430\u043c).<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>getItemCount<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438; <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>onCreateViewHolder<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 ViewHolder. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f <em>parent<\/em> \u0438 <em>viewType<\/em> (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043f\u0438\u0441\u043a\u0430); <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>onBindViewHolder<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 (\u0438\u043c\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u0438 \u0442.\u0434.):<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<pre><code class=\"kotlin\">    override fun getItemCount(): Int = data.size \/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PersonViewHolder {         val inflater = LayoutInflater.from(parent.context)         val binding = ItemPersonBinding.inflate(inflater, parent, false)          return PersonViewHolder(binding)     }      override fun onBindViewHolder(holder: PersonViewHolder, position: Int) {         val person = data[position] \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438         val context = holder.itemView.context          with(holder.binding) {             val color = if (person.isLiked) R.color.red else R.color.grey \/\/ \u0426\u0432\u0435\u0442 \"\u0441\u0435\u0440\u0434\u0446\u0430\", \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u044b\u043b \u043b\u0430\u0439\u043a\u043d\u0443\u0442              nameTextView.text = person.name \/\/ \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f             companyTextView.text = person.companyName \/\/ \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f             likedImageView.setColorFilter( \/\/ \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0446\u0432\u0435\u0442\u0430 \"\u0441\u0435\u0440\u0434\u0446\u0430\"                 ContextCompat.getColor(context, color),                 android.graphics.PorterDuff.Mode.SRC_IN             )             Glide.with(context).load(person.photo).circleCrop() \/\/ \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Glide                 .error(R.drawable.ic_person)                  .placeholder(R.drawable.ic_person).into(imageView)         }     }<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0448 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0434\u0430\u043f\u0442\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0433\u043e\u0442\u043e\u0432.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u043d\u0430 \u043d\u0430\u0448 RecyclerView \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0438 LayoutManager. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 MainActivity \u043f\u0440\u043e\u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"kotlin\">class MainActivity : AppCompatActivity() {      private lateinit var binding: ActivityMainBinding     private lateinit var adapter: PersonAdapter \/\/ \u041e\u0431\u044a\u0435\u043a\u0442 Adapter     private val personService: PersonService \/\/ \u041e\u0431\u044a\u0435\u043a\u0442 PersonService         get() = (applicationContext as App).personService      override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         binding = ActivityMainBinding.inflate(layoutInflater)         setContentView(binding.root)          val manager = LinearLayoutManager(this) \/\/ LayoutManager         adapter = PersonAdapter() \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430         adapter.data = personService.getPersons() \/\/ \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438          binding.recyclerView.layoutManager = manager \/\/ \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 LayoutManager \u0434\u043b\u044f RecyclerView         binding.recyclerView.adapter = adapter \/\/ \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430 \u0434\u043b\u044f RecyclerView     } } <\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439!<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/4b\/8c\/rl\/4b8crl0uwwv8t4nzadvzaajssta.jpeg\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/webt\/4b\/8c\/rl\/4b8crl0uwwv8t4nzadvzaajssta.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0442\u044c, \u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u044d\u0442\u043e.<\/p>\n<p>\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 PersonService \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<ul>\n<li>\n<p><em>likePerson<\/em> &#8212; \u043b\u0430\u0439\u043a\u0430\u0435\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p><em>removePerson<\/em> &#8212; \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p><em>movePerson<\/em> &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 (\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0438 \u043a\u0443\u0434\u0430 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c: &#171;1&#187; &#8212; \u0432\u043d\u0438\u0437, &#171;-1&#187; &#8212; \u0432\u0432\u0435\u0440\u0445).<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"kotlin\">    fun likePerson(person: Person) {         val index = persons.indexOfFirst { it.id == person.id } \/\/ \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435         if (index == -1) return \/\/ \u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430          persons = ArrayList(persons) \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a         persons[index] = persons[index].copy(isLiked = !persons[index].isLiked) \/\/ \u041c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \"\u043b\u0430\u0439\u043a\u0430\" \u043d\u0430 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0435     }      fun removePerson(person: Person) {         val index = persons.indexOfFirst { it.id == person.id } \/\/ \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435         if (index == -1) return \/\/ \u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430          persons = ArrayList(persons) \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a         persons.removeAt(index) \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430     }      fun movePerson(person: Person, moveBy: Int) {         val oldIndex = persons.indexOfFirst { it.id == person.id } \/\/ \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435         if (oldIndex == -1) return \/\/ \u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430          val newIndex = oldIndex + moveBy \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a         persons = ArrayList(persons) \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a         Collections.swap(persons, oldIndex, newIndex) \/\/ \u041c\u0435\u043d\u044f\u0435\u043c \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u043b\u044e\u0434\u0435\u0439             }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043b\u044e\u0434\u044c\u043c\u0438, \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 PersonService \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e <strong>\u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f<\/strong>:<\/p>\n<pre><code class=\"kotlin\">typealias PersonListener = (persons: List&lt;Person>) -> Unit<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0436\u0435 <strong>\u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c<\/strong> \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439, \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439, \u0438 \u043e\u0434\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 &#171;\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f&#187;:<\/p>\n<pre><code class=\"kotlin\">    private var listeners = mutableListOf&lt;PersonListener>() \/\/ \u0412\u0441\u0435 \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0438      fun addListener(listener: PersonListener) {         listeners.add(listener)         listener.invoke(persons)     }      fun removeListener(listener: PersonListener) {         listeners.remove(listener)         listener.invoke(persons)     }      private fun notifyChanges() = listeners.forEach { it.invoke(persons) }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 <em>notifyChanges<\/em> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 likePerson, removePerson \u0438 movePerson.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u043b\u044e\u0434\u0435\u0439 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0433\u043e\u0442\u043e\u0432. \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 PersonAdapter, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c <strong>\u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/strong> \u043d\u0430\u0448\u0438\u0445 \u043b\u044e\u0434\u0435\u0439. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em>PersonActionListener<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443 \u0447\u0435\u0442\u044b\u0440\u0435 \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<ul>\n<li>\n<p><em>onPersonGetId<\/em> &#8212; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p><em>onPersonLike<\/em> &#8212; \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0431\u044b\u043b \u043b\u0430\u0439\u043a\u043d\u0443\u0442;<\/p>\n<\/li>\n<li>\n<p><em>onPersonRemove<\/em> &#8212; \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p><em>onPersonMove<\/em> &#8212; \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"kotlin\">interface PersonActionListener {     fun onPersonGetId(person: Person)     fun onPersonLike(person: Person)     fun onPersonRemove(person: Person)     fun onPersonMove(person: Person, moveBy: Int) }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 PersonAdapter \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0430\u0448 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0422\u0430\u043a\u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em>OnClickListener<\/em>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 PersonAdaper \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">class PersonAdapter(private val personActionListener: PersonActionListener) :     RecyclerView.Adapter&lt;PersonAdapter.PersonViewHolder>(), View.OnClickListener {<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 PersonAdapter \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 onBindViewHolder \u043a\u043b\u0430\u0434\u0451\u043c \u0432 tag \u043a\u0430\u0436\u0434\u043e\u0433\u043e view, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u0435, \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430:<\/p>\n<pre><code class=\"kotlin\">holder.itemView.tag = person holder.binding.likedImageView.tag = person holder.binding.more.tag = person<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 onCreateViewHolder \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043f\u0438\u0441\u043a\u0430, \u043a\u043d\u043e\u043f\u043a\u0443 more (\u0442\u0440\u0438 \u0442\u043e\u0447\u043a\u0438) \u0438 likedImageView (\u0441\u0435\u0440\u0434\u0446\u0435):<\/p>\n<pre><code class=\"kotlin\">binding.root.setOnClickListener(this) binding.more.setOnClickListener(this) binding.likedImageView.setOnClickListener(this)<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434 <em>showPopupMenu<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 &#171;\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c&#187; \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u0435 \u043c\u0435\u043d\u044e \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0432\u0435\u0440\u0445, \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u0437:<\/p>\n<pre><code class=\"kotlin\">    private fun showPopupMenu(view: View) {         val popupMenu = PopupMenu(view.context, view)         val person = view.tag as Person         val position = data.indexOfFirst { it.id == person.id }          popupMenu.menu.add(0, ID_MOVE_UP, Menu.NONE, \"Up\").apply {             isEnabled = position > 0         }         popupMenu.menu.add(0, ID_MOVE_DOWN, Menu.NONE, \"Down\").apply {             isEnabled = position &lt; data.size - 1         }         popupMenu.menu.add(0, ID_REMOVE, Menu.NONE, \"Remove\")          popupMenu.setOnMenuItemClickListener {             when (it.itemId) {                 ID_MOVE_UP -> personActionListener.onPersonMove(person, -1)                 ID_MOVE_DOWN -> personActionListener.onPersonMove(person, 1)                 ID_REMOVE -> personActionListener.onPersonRemove(person)             }             return@setOnMenuItemClickListener true         }          popupMenu.show()     }      companion object {         private const val ID_MOVE_UP = 1         private const val ID_MOVE_DOWN = 2         private const val ID_REMOVE = 3     }<\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 <em>onClick<\/em> \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430:<\/p>\n<pre><code class=\"kotlin\">    override fun onClick(view: View) {         val person: Person = view.tag as Person \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u0442\u044d\u0433\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430          when (view.id) {             R.id.more -> showPopupMenu(view)             R.id.likedImageView -> personActionListener.onPersonLike(person)             else -> personActionListener.onPersonGetId(person)         }     }<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0448 \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0433\u043e\u0442\u043e\u0432. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 MainActivity \u0438, \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<pre><code class=\"kotlin\">adapter = PersonAdapter(object : PersonActionListener { \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430    override fun onPersonGetId(person: Person) =       Toast.makeText(this@MainActivity, \"Persons ID: ${person.id}\", Toast.LENGTH_SHORT).show()     override fun onPersonLike(person: Person) = personService.likePerson(person)     override fun onPersonRemove(person: Person) = personService.removePerson(person)     override fun onPersonMove(person: Person, moveBy: Int) = personService.movePerson(person, moveBy)  })<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f \u0432 MainActivity, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432 PersonService:<\/p>\n<pre><code class=\"kotlin\">private val listener: PersonListener = {adapter.data = it}<\/code><\/pre>\n<p>\u0418 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 onCreate \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"kotlin\">personService.addListener(listener)<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0448\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/nn\/fy\/r2\/nnfyr2ixgxdaxwwuixcvk0cqgbc.jpeg\" alt=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.\" title=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/webt\/nn\/fy\/r2\/nnfyr2ixgxdaxwwuixcvk0cqgbc.jpeg\" data-blurred=\"true\"\/><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/figcaption><\/figure>\n<p>\u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b RecyclerView. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u0412\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c DiffUtil, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a, ItemDecorator, \u0434\u043b\u044f \u0434\u0435\u043a\u043e\u0440\u0430 \u043d\u0430\u0448\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0442.\u0434.<\/p>\n<p><a href=\"https:\/\/github.com\/coder-chekunkov\/RecyclerView-Article\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/a><\/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\/post\/705064\/\"> https:\/\/habr.com\/ru\/post\/705064\/<\/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>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439, \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c. \u041a\u0430\u0436\u0434\u044b\u0439 Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a  \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a, \u0434\u043b\u044f  \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0443 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c  \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u043c \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c, \u043a\u0430\u043a RecyclerView.<\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043e \u0442\u043e\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e RecyclerView, \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438  \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u0431\u0430\u0437\u043e\u0432\u044b\u0439, \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u044f\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438 \u0432 Android.<\/p>\n<p>\u0412\u0441\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/coder-chekunkov\/RecyclerView-Article\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<figure class=\"bordered\"><figcaption>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u0432 \u0441\u0442\u0430\u0442\u044c\u0435.<\/figcaption><\/figure>\n<h3>ListView \u0438\u043b\u0438 RecyclerView?<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0443 Android \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0432\u0430 \u043f\u0443\u0442\u0438 &#8212; <a href=\"https:\/\/developer.android.com\/reference\/android\/widget\/ListView\" rel=\"noopener noreferrer nofollow\">ListView<\/a> \u0438 <a href=\"https:\/\/developer.android.com\/reference\/kotlin\/androidx\/recyclerview\/widget\/RecyclerView\" rel=\"noopener noreferrer nofollow\">RecyclerView<\/a>.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0438\u0434\u0436\u0435\u0442 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442. \u041d\u043e, \u043a  \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, ListView \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c  \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<p>\u0412 \u0441\u0432\u043e\u044e \u0436\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u044c RecyclerView &#171;\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438&#187; \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442  \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043f\u0438\u0441\u043a\u0430, \u0447\u0435\u043c  ListView. \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c RecyclerView, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c,  \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0430 \u0441\u0442\u0435\u0440\u043e\u0438\u0434\u0430\u0445.<\/p>\n<p>RecyclerView \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435  \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430; \u043f\u0440\u0438 \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0435 \u0441\u043f\u0438\u0441\u043a\u0430  \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0443\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f  \u0432\u043d\u0438\u0437 \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<h3>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b RecyclerView<\/h3>\n<p>\u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b RecyclerView \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\n<p><code>RecyclerView<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043c\u0430\u043a\u0435\u0442 \u043d\u0430\u0448\u0435\u0433\u043e Activity;<\/p>\n<\/li>\n<li>\n<p><code>Adapter<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p><code>ViewHolder<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a;<\/p>\n<\/li>\n<li>\n<p><code>ItemDecorator<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0434\u0435\u043a\u043e\u0440;<\/p>\n<\/li>\n<li>\n<p><code>ItemAnimator<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438, \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439;<\/p>\n<\/li>\n<li>\n<p><code>DiffUtil<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043b\u044e\u0434\u044f\u0445. \u041a\u0430\u0436\u0434\u044b\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0438\u043c\u044f, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u043d\u0438\u043c (\u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440, \u0443\u0434\u0430\u043b\u0438\u0442\u044c, \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0432\u0435\u0440\u0445\/\u0432\u043d\u0438\u0437, \u043b\u0430\u0439\u043a\u043d\u0443\u0442\u044c).<\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Kotlin. \u0422\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/bumptech\/glide\" rel=\"noopener noreferrer nofollow\">Glide<\/a> \u0438 <a href=\"https:\/\/github.com\/DiUS\/java-faker\" rel=\"noopener noreferrer nofollow\">Faker<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a RecyclerView.<\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c <strong>\u0443\u043a\u0430\u0436\u0435\u043c \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c, \u0432 \u0444\u0430\u0439\u043b \u0441\u0431\u043e\u0440\u043a\u0438 <code>build.gradle<\/code> \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"kotlin\">    implementation 'androidx.recyclerview:recyclerview:1.2.1'     implementation 'com.github.javafaker:javafaker:1.0.2'     implementation 'com.github.bumptech.glide:glide:4.14.2' <\/code><\/pre>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 AndroidStudio \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 RecyclerView. \u0414\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Material.<\/em><\/p>\n<p>\u0418 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e <strong>\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c<\/strong> <a href=\"https:\/\/developer.android.com\/topic\/libraries\/view-binding\" rel=\"noopener noreferrer nofollow\">ViewBinding<\/a> \u0432 \u0444\u0430\u0439\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 <code>build.gradle<\/code> \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"json\">buildFeatures {         viewBinding = true }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <strong>\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/strong> \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>AndroidManifest.xml<\/code> (\u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Glide):<\/p>\n<pre><code class=\"xml\">&lt;uses-permission android:name=\"android.permission.INTERNET\"\/> &lt;uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"\/><\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 <strong>\u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0430\u043a\u0435\u0442\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b<\/strong>: \u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u043b\u044f ActivityMain, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 RecyclerView, \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 (\u0447\u0435\u043b\u043e\u0432\u0435\u043a).<\/p>\n<p><em>activity_main.xml<\/em>:<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?> &lt;FrameLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:tools=\"http:\/\/schemas.android.com\/tools\"     android:id=\"@+id\/activityMain\"     android:layout_width=\"match_parent\"     android:layout_height=\"match_parent\"     tools:context=\".MainActivity\">      &lt;androidx.recyclerview.widget.RecyclerView         android:id=\"@+id\/recyclerView\"         android:layout_width=\"match_parent\"         android:layout_height=\"match_parent\" \/>  &lt;\/FrameLayout><\/code><\/pre>\n<p><em>item_person.xml:<\/em><\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?> &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"     xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"     xmlns:tools=\"http:\/\/schemas.android.com\/tools\"     android:layout_width=\"match_parent\"     android:layout_height=\"wrap_content\"     android:background=\"?selectableItemBackground\"     android:paddingStart=\"10dp\"     android:paddingTop=\"5dp\"     android:paddingEnd=\"10dp\"     android:paddingBottom=\"5dp\">      &lt;ImageView         android:id=\"@+id\/imageView\"         android:layout_width=\"wrap_content\"         android:layout_height=\"match_parent\"         android:src=\"@drawable\/ic_person\"         app:layout_constraintBottom_toBottomOf=\"parent\"         app:layout_constraintStart_toStartOf=\"parent\"         app:layout_constraintTop_toTopOf=\"parent\" \/>      &lt;TextView         android:id=\"@+id\/nameTextView\"         style=\"@style\/TextAppearance.AppCompat.Body2\"         android:layout_width=\"wrap_content\"         android:layout_height=\"wrap_content\"         android:layout_marginStart=\"15dp\"         app:layout_constraintStart_toEndOf=\"@id\/imageView\"         app:layout_constraintTop_toTopOf=\"parent\" \/>      &lt;TextView         android:id=\"@+id\/companyTextView\"         android:layout_width=\"wrap_content\"         android:layout_height=\"wrap_content\"         android:layout_marginStart=\"15dp\"         app:layout_constraintStart_toEndOf=\"@id\/imageView\"         app:layout_constraintTop_toBottomOf=\"@id\/nameTextView\" \/>      &lt;ImageView         android:id=\"@+id\/likedImageView\"         android:layout_width=\"wrap_content\"         android:layout_height=\"wrap_content\"         android:layout_marginEnd=\"15dp\"         android:src=\"@drawable\/ic_like\"         app:layout_constraintBottom_toBottomOf=\"parent\"         app:layout_constraintEnd_toStartOf=\"@id\/more\"         app:layout_constraintTop_toTopOf=\"parent\" \/>      &lt;ImageView         android:id=\"@+id\/more\"         android:layout_width=\"wrap_content\"         android:layout_height=\"wrap_content\"         android:src=\"@drawable\/ic_more\"         app:layout_constraintBottom_toBottomOf=\"parent\"         app:layout_constraintEnd_toEndOf=\"parent\"         app:layout_constraintTop_toTopOf=\"parent\" \/>  &lt;\/androidx.constraintlayout.widget.ConstraintLayout><\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0431\u044b\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b, \u0432\u0441\u0435 \u043c\u0430\u043a\u0435\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e <strong>\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043b\u044e\u0434\u044f\u0445<\/strong> (\u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c, \u0431\u043e\u0435\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u0445 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 <em>PersonService<\/em> \u0438 data-class <em>Person<\/em>:<\/p>\n<pre><code class=\"kotlin\">data class Person(     val id: Long, \/\/ \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f     val name: String, \/\/ \u0418\u043c\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430     val companyName: String, \/\/ \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0438\u0438     val photo: String, \/\/ \u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0444\u043e\u0442\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430     val isLiked: Boolean \/\/ \u0411\u044b\u043b \u043b\u0438 \u043b\u0430\u0439\u043a\u043d\u0443\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c )<\/code><\/pre>\n<pre><code class=\"kotlin\">class PersonService {      private var persons = mutableListOf&lt;Person>() \/\/ \u0412\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438      init {         val faker = Faker.instance() \/\/ \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445          persons = (1..50).map {             Person(                 id = it.toLong(),                 name = faker.name().fullName(),                 companyName = faker.company().name(),                 photo = IMAGES[it % IMAGES.size],                 isLiked = false             )         }.toMutableList()     }      companion object {         private val IMAGES = mutableListOf(             \"https:\/\/images.unsplash.com\/photo-1600267185393-e158a98703de?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NjQ0&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1579710039144-85d6bdffddc9?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0Njk1&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1488426862026-3ee34a7d66df?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0ODE0&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1620252655460-080dbec533ca?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NzQ1&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1613679074971-91fc27180061?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NzUz&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1485795959911-ea5ebf41b6ae?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NzU4&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1545996124-0501ebae84d0?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0NzY1&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/flagged\/photo-1568225061049-70fb3006b5be?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0Nzcy&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1567186937675-a5131c8a89ea?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0ODYx&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=800\",             \"https:\/\/images.unsplash.com\/photo-1546456073-92b9f0a8d413?crop=entropy&amp;cs=tinysrgb&amp;fit=crop&amp;fm=jpg&amp;h=600&amp;ixid=MnwxfDB8MXxyYW5kb218fHx8fHx8fHwxNjI0MDE0ODY1&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=ap<\/code><\/pre>\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-342482","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342482","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=342482"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342482\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}