{"id":291364,"date":"2018-10-25T17:05:02","date_gmt":"2018-10-25T13:05:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=291364"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=291364","title":{"rendered":"\u0421\u043e\u0432\u0435\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f RecyclerView. \u0427\u0430\u0441\u0442\u044c 2"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7ae\/e60\/5e4\/7aee605e43b5a93938bc89e379a43776.jpg\" alt=\"\u0421\u043e\u0432\u0435\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f RecyclerView. \u0427\u0430\u0441\u0442\u044c 2\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f <a href=\"https:\/\/habr.com\/post\/425945\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u0432 \u044d\u0442\u043e\u0439 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e <code>ItemDecoration<\/code> \u0438 <code>ItemAnimator<\/code> \u0438 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 <code>RecyclerView<\/code> \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0430 <a href=\"https:\/\/github.com\/passiondroid\/Marvels\">Github<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"1-itemdecoration\">1. ItemDecoration<\/h2>\n<p>  <\/p>\n<p><code>ItemDecoration<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432 <code>RecyclerView<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ItemDecoration<\/code> \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438 \u043c\u0435\u0436\u0434\u0443 <code>view<\/code>-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c, \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0438\u0445 \u0438\u043b\u0438 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u0440\u0430\u0432\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430\u043c\u0438. \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043c\u0435\u0436\u0434\u0443 <code>view<\/code>-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u043a\u043b\u0430\u0441\u0441\u043e\u043c <code>DividerItemDecoration<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0432\u0435\u0440\u0441\u0438\u0438 25.1.0 \u0438 \u0432\u044b\u0448\u0435. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">mDividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),              mLayoutManager.getOrientation()); recyclerView.addItemDecoration(mDividerItemDecoration);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041b\u0443\u0447\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u2014 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <code>RecyclerView.ItemDecoration<\/code>. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <code>GridLayoutManager<\/code> \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b <code>CharacterItemDecoration<\/code> \u043a <code>RecyclerView<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">recyclerView.addItemDecoration(new CharacterItemDecoration(50));<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c <code>CharacterItemDecoration<\/code> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 (<em>\u0430\u043d\u0433\u043b.<\/em> offset) \u043d\u0430 50 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0432 \u0441\u0432\u043e\u0451\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 <code>getItemOffsets(...)<\/code>. \u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <code>getItemOffsets()<\/code> \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u043b\u0435 <code>outRects<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e <code>view<\/code>-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043e\u0442\u0441\u0442\u0443\u043f\u0430\u043c. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <code>GridLayoutManager<\/code> \u0438 \u0445\u043e\u0442\u0435\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0430\u0432\u043d\u044b\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u0435\u0442\u043a\u0438, \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u043e\u0442\u0441\u0442\u0443\u043f \u0441\u043f\u0440\u0430\u0432\u0430 \u0432 25 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 (\u0442.\u0435. offset\/2) \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0447\u0451\u0442\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438 \u043e\u0442\u0441\u0442\u0443\u043f \u0441\u043b\u0435\u0432\u0430 \u0432 25 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u0435\u0447\u0451\u0442\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u043e\u0442\u0441\u0442\u0443\u043f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e7b\/4a6\/e06\/e7b4a6e06f168c1b7911366eaf0dc141.jpg\" alt=\"\u041e\u0442\u0441\u0442\u0443\u043f\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u0435\u0442\u043a\u0435\"><\/p>\n<p>  <\/p>\n<h2 id=\"2-itemanimator\">2. ItemAnimator<\/h2>\n<p>  <\/p>\n<p><code>ItemAnimator<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043b\u0438 <code>view<\/code>-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 <code>RecyclerView<\/code>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/430\/7bf\/32c\/4307bf32cf5f6e8f59a24ebd4abd113b.gif\" alt=\"\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435\"><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u00ab\u0418\u043d\u0441\u0442\u0430\u0433\u0440\u0430\u043c\u043e\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c\u00bb, \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0432 <code>DefaultItemAnimator<\/code> \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder) {         return true; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>canReuseUpdatedViewHolder(...)<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0431\u0443\u0434\u0435\u0442 \u043b\u0438 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 <code>ViewHolder<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u0442\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>false<\/code>, \u0442\u043e \u043e\u0431\u0430 <code>ViewHolders<\/code> \u2014 \u0441\u0442\u0430\u0440\u044b\u0439 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u2014 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434 <code>animateChange(...)<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">public ItemHolderInfo recordPreLayoutInformation(@NonNull RecyclerView.State state, @NonNull RecyclerView.ViewHolder viewHolder, int changeFlags, @NonNull List&lt;Object&gt; payloads) {     if (changeFlags == FLAG_CHANGED) {         for (Object payload : payloads) {             if (payload instanceof String) {                 return new CharacterItemHolderInfo((String) payload);             }         }     }     return super.recordPreLayoutInformation(state, viewHolder, changeFlags, payloads); }  public static class CharacterItemHolderInfo extends ItemHolderInfo {         public String updateAction;          public CharacterItemHolderInfo(String updateAction) {             this.updateAction = updateAction;         } }<\/code><\/pre>\n<p>  <\/p>\n<p><code>RecyclerView<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>recordPreLayoutInformation(...)<\/code> \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 <code>layout<\/code>. <code>ItemAnimator<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e <code>view<\/code>-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u043d, \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0451\u043d. \u0414\u0430\u043d\u043d\u044b\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u044d\u0442\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c, \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e <code>animateChange(...)<\/code>).<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@Override public boolean animateChange(@NonNull RecyclerView.ViewHolder oldHolder,                                  @NonNull RecyclerView.ViewHolder newHolder,                                  @NonNull ItemHolderInfo preInfo,                                  @NonNull ItemHolderInfo postInfo) {    if (preInfo instanceof CharacterItemHolderInfo) {     CharacterItemHolderInfo recipesItemHolderInfo = (CharacterItemHolderInfo) preInfo;     CharacterRVAdapter.CharacterViewHolder holder = (CharacterRVAdapter.CharacterViewHolder) newHolder;        if (CharacterRVAdapter.ACTION_LIKE_IMAGE_DOUBLE_CLICKED.equals(recipesItemHolderInfo.updateAction)) {             animatePhotoLike(holder);           }         }        return false;     }  private void animatePhotoLike(final CharacterRVAdapter.CharacterViewHolder holder) {      holder.likeIV.setVisibility(View.VISIBLE);      holder.likeIV.setScaleY(0.0f);      holder.likeIV.setScaleX(0.0f);       AnimatorSet animatorSet = new AnimatorSet();      ObjectAnimator scaleLikeIcon = ObjectAnimator.ofPropertyValuesHolder               (holder.likeIV, PropertyValuesHolder.ofFloat(\"scaleX\", 0.0f, 2.0f),                PropertyValuesHolder.ofFloat(\"scaleY\", 0.0f, 2.0f), PropertyValuesHolder.ofFloat(\"alpha\", 0.0f, 1.0f, 0.0f));      scaleLikeIcon.setInterpolator(DECELERATE_INTERPOLATOR);      scaleLikeIcon.setDuration(1000);       ObjectAnimator scaleLikeBackground = ObjectAnimator.ofPropertyValuesHolder               (holder.characterCV, PropertyValuesHolder.ofFloat(\"scaleX\", 1.0f, 0.95f, 1.0f),               PropertyValuesHolder.ofFloat(\"scaleY\", 1.0f, 0.95f, 1.0f));      scaleLikeBackground.setInterpolator(DECELERATE_INTERPOLATOR);      scaleLikeBackground.setDuration(600);      animatorSet.playTogether(scaleLikeIcon, scaleLikeBackground);      animatorSet.start(); }<\/code><\/pre>\n<p>  <\/p>\n<p><code>RecyclerView<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>animateChange(...)<\/code>, \u043a\u043e\u0433\u0434\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <code>notifyItemChanged(int)<\/code>. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>notifyDataSetChanged()<\/code>, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b <code>RecyclerView<\/code> \u043c\u043e\u0433 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>view<\/code>-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432 \u0442\u0435\u0445 \u0436\u0435 <code>ViewHolders<\/code>. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432: <em>(ViewHolder oldHolder, ViewHolder newHolder, ItemHolderInfo preInfo, ItemHolderInfo postInfo)<\/em>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>ViewHolder<\/code>, \u043e\u0431\u0430 \u2014 oldHolder \u0438 newHolder \u2014 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u0432\u0430\u0436\u0434\u044b \u043a\u043b\u0438\u043a\u0430\u0435\u0442 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">notifyItemChanged(position, ACTION_LIKE_IMAGE_DOUBLE_CLICKED);<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0432\u044b\u0437\u043e\u0432\u043e\u0432: <code>canReuseUpdatedViewHolder(...)<\/code>, <code>recordPreLayoutInformation(...)<\/code> \u0438, \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435, <code>animateChange(...)<\/code> \u0432 <code>ItemAnimator<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0430\u043d\u0438\u043c\u0438\u0440\u0443\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u0438\u043a\u043e\u043d\u043a\u0443 \u0441\u0435\u0440\u0434\u0435\u0447\u043a\u0430 \u0432 \u044d\u0442\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 (\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u0433\u0438\u0444\u043a\u0435 \u0432\u044b\u0448\u0435).<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0440\u043e <code>RecyclerView<\/code>. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u0442\u043e \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0435\u0451 <a href=\"https:\/\/habr.com\/post\/425945\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u0442\u0435\u043c\u0443 <code>RecyclerView<\/code>:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/medium.com\/@trionkidnapper\/recyclerview-more-animations-with-less-code-using-support-library-listadapter-62e65126acdb\">RecyclerView \u2014\u00a0More Animations with Less Code using Support Library ListAdapter<\/a><\/li>\n<li><a href=\"https:\/\/medium.com\/mindorks\/using-snaphelper-in-recyclerview-fc616b6833e8\">Using SnapHelper in RecyclerView<\/a><\/li>\n<li><a href=\"https:\/\/proandroiddev.com\/file-template-for-recyclerview-adapter-in-kotlin-4e31d2364842\">File template for RecyclerView Adapter in Kotlin<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/post\/425945\/\">\u2190 \u0421\u043e\u0432\u0435\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f RecyclerView. \u0427\u0430\u0441\u0442\u044c 1<\/a><\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/post\/426773\/\"> https:\/\/habr.com\/post\/426773\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7ae\/e60\/5e4\/7aee605e43b5a93938bc89e379a43776.jpg\" alt=\"\u0421\u043e\u0432\u0435\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f RecyclerView. \u0427\u0430\u0441\u0442\u044c 2\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f <a href=\"https:\/\/habr.com\/post\/425945\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u0432 \u044d\u0442\u043e\u0439 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e <code>ItemDecoration<\/code> \u0438 <code>ItemAnimator<\/code> \u0438 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 <code>RecyclerView<\/code> \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0430 <a href=\"https:\/\/github.com\/passiondroid\/Marvels\">Github<\/a>.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-291364","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291364","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=291364"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291364\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}