{"action":"created","comment":{"url":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/comments/74024413","id":74024413,"diff_hunk":"@@ -0,0 +1,125 @@\n+package ru.yandex.yamblz.ui.recyclerstuff;\n+\n+import android.animation.ArgbEvaluator;\n+import android.animation.ValueAnimator;\n+import android.graphics.Color;\n+import android.support.v7.widget.RecyclerView;\n+import android.view.LayoutInflater;\n+import android.view.View;\n+import android.view.ViewGroup;\n+import android.widget.TextView;\n+\n+import java.util.ArrayList;\n+import java.util.Collections;\n+import java.util.List;\n+import java.util.Random;\n+\n+import ru.yandex.yamblz.R;\n+import ru.yandex.yamblz.ui.recyclerstuff.interfaces.IGetItemColor;\n+\n+import static android.support.v7.widget.RecyclerView.NO_POSITION;\n+\n+public class ContentAdapter extends RecyclerView.Adapter<ContentAdapter.ContentHolder>\n+        implements IGetItemColor {\n+    private final Random rnd = new Random();\n+    private final List<Integer> colors = new ArrayList<>();\n+\n+    private static final int CHANGE_COLOR_DURATION = 100;\n+\n+    public ContentAdapter() {\n+        super();\n+        setHasStableIds(true);\n+    }\n+\n+    @Override\n+    public ContentHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n+        final ContentHolder contentHolder = new ContentHolder(LayoutInflater.from(parent.getContext())\n+                .inflate(R.layout.content_item, parent, false));\n+\n+        contentHolder.itemView.setOnClickListener(new View.OnClickListener() {\n+            @Override\n+            public void onClick(View v) {\n+                int newColor = ContentAdapter.this.getRandomColor();\n+                int position = contentHolder.getAdapterPosition();\n+\n+                if (position == NO_POSITION)\n+                    return;\n+\n+                ValueAnimator valueAnimator\n+                        = ValueAnimator.ofObject(new ArgbEvaluator(), colors.get(position), newColor);\n+                valueAnimator.addUpdateListener(animation ->\n+                        contentHolder.itemView.setBackgroundColor((Integer) animation.getAnimatedValue()));\n+                valueAnimator.setDuration(CHANGE_COLOR_DURATION);\n+                valueAnimator.start();\n+\n+                colors.set(position, newColor);\n+                notifyItemChanged(position);\n+            }\n+        });\n+        return contentHolder;\n+    }\n+\n+    @Override\n+    public void onBindViewHolder(ContentHolder holder, int position) {\n+        holder.bind(getColorForPosition(position));\n+    }\n+\n+    @Override\n+    public int getItemCount() {\n+        return Integer.MAX_VALUE;\n+    }\n+\n+    @Override\n+    public long getItemId(int position) {\n+        addIfNotExist(position);\n+        return colors.get(position);\n+    }\n+\n+    private Integer getColorForPosition(int position) {\n+        addIfNotExist(position);","path":"app/src/main/java/ru/yandex/yamblz/ui/recyclerstuff/ContentAdapter.java","position":79,"original_position":79,"commit_id":"279d340dea9546c9d8e7a05421c11b68e80a6328","original_commit_id":"279d340dea9546c9d8e7a05421c11b68e80a6328","user":{"login":"Tagakov","id":10127655,"avatar_url":"https://avatars.githubusercontent.com/u/10127655?v=3","gravatar_id":"","url":"https://api.github.com/users/Tagakov","html_url":"https://github.com/Tagakov","followers_url":"https://api.github.com/users/Tagakov/followers","following_url":"https://api.github.com/users/Tagakov/following{/other_user}","gists_url":"https://api.github.com/users/Tagakov/gists{/gist_id}","starred_url":"https://api.github.com/users/Tagakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tagakov/subscriptions","organizations_url":"https://api.github.com/users/Tagakov/orgs","repos_url":"https://api.github.com/users/Tagakov/repos","events_url":"https://api.github.com/users/Tagakov/events{/privacy}","received_events_url":"https://api.github.com/users/Tagakov/received_events","type":"User","site_admin":false},"body":"вышк точно такой же метод","created_at":"2016-08-09T09:15:53Z","updated_at":"2016-08-09T09:15:53Z","html_url":"https://github.com/yamblz-native/recycler-view/pull/22#discussion_r74024413","pull_request_url":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/comments/74024413"},"html":{"href":"https://github.com/yamblz-native/recycler-view/pull/22#discussion_r74024413"},"pull_request":{"href":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/22","id":80374005,"html_url":"https://github.com/yamblz-native/recycler-view/pull/22","diff_url":"https://github.com/yamblz-native/recycler-view/pull/22.diff","patch_url":"https://github.com/yamblz-native/recycler-view/pull/22.patch","issue_url":"https://api.github.com/repos/yamblz-native/recycler-view/issues/22","number":22,"state":"open","locked":false,"title":"@alexiv Иванов Алексей","user":{"login":"DAlexIV","id":9713132,"avatar_url":"https://avatars.githubusercontent.com/u/9713132?v=3","gravatar_id":"","url":"https://api.github.com/users/DAlexIV","html_url":"https://github.com/DAlexIV","followers_url":"https://api.github.com/users/DAlexIV/followers","following_url":"https://api.github.com/users/DAlexIV/following{/other_user}","gists_url":"https://api.github.com/users/DAlexIV/gists{/gist_id}","starred_url":"https://api.github.com/users/DAlexIV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DAlexIV/subscriptions","organizations_url":"https://api.github.com/users/DAlexIV/orgs","repos_url":"https://api.github.com/users/DAlexIV/repos","events_url":"https://api.github.com/users/DAlexIV/events{/privacy}","received_events_url":"https://api.github.com/users/DAlexIV/received_events","type":"User","site_admin":false},"body":"- [x] Поддержать изменение количества колонок.\r\n- [x]  Поддержать возможность перетаскивания элементов\r\n- [x] Поддержать возможность удалять элемент свайпом вправо\r\n- [x]  Поддержать анимированное изменение количества колонок\r\n- [x] Добавить возможность изменять стиль элементов с обычного на стиль в котором элементы будут чередоваться\r\n- [x]  Во время свайпа анимировать фон позади вью с белого на красный, в зависимости от дальности сдвига\r\n- [x]  Отмечать внешне два последних элемента которые были поменяны местами\r\n- [x]  Добавить возможность анимированно изменять непонравившийся цвет по клику\r\n- [ ]  Попробовать сделать анимацию появления. Желательно не через адаптер.\r\nв процессе осознания, как это сделать желательно\r\n- [ ]  Поддержать возможность отображать таблицу с 30-ю элементами в строке. Пробовал setHasFixedSize, менял размер вьюпула и другие твики, особого прироста не давало. Если просто убрать текст, получалось 20-30 фпс. Судя по стактрейсу, как минимум половину времени отнимет именно сама отрисовка вьюшек, поэтому есть подозрение, что чтобы что-то реально ускорить нужно делать свой LayoutManager.","created_at":"2016-08-07T18:25:31Z","updated_at":"2016-08-09T09:15:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4462295dd90213e3f7f47afe336346ea3508a835","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/22/commits","review_comments_url":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/22/comments","review_comment_url":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yamblz-native/recycler-view/issues/22/comments","statuses_url":"https://api.github.com/repos/yamblz-native/recycler-view/statuses/279d340dea9546c9d8e7a05421c11b68e80a6328","head":{"label":"DAlexIV:master","ref":"master","sha":"279d340dea9546c9d8e7a05421c11b68e80a6328","user":{"login":"DAlexIV","id":9713132,"avatar_url":"https://avatars.githubusercontent.com/u/9713132?v=3","gravatar_id":"","url":"https://api.github.com/users/DAlexIV","html_url":"https://github.com/DAlexIV","followers_url":"https://api.github.com/users/DAlexIV/followers","following_url":"https://api.github.com/users/DAlexIV/following{/other_user}","gists_url":"https://api.github.com/users/DAlexIV/gists{/gist_id}","starred_url":"https://api.github.com/users/DAlexIV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DAlexIV/subscriptions","organizations_url":"https://api.github.com/users/DAlexIV/orgs","repos_url":"https://api.github.com/users/DAlexIV/repos","events_url":"https://api.github.com/users/DAlexIV/events{/privacy}","received_events_url":"https://api.github.com/users/DAlexIV/received_events","type":"User","site_admin":false},"repo":{"id":64709098,"name":"recycler-view","full_name":"DAlexIV/recycler-view","owner":{"login":"DAlexIV","id":9713132,"avatar_url":"https://avatars.githubusercontent.com/u/9713132?v=3","gravatar_id":"","url":"https://api.github.com/users/DAlexIV","html_url":"https://github.com/DAlexIV","followers_url":"https://api.github.com/users/DAlexIV/followers","following_url":"https://api.github.com/users/DAlexIV/following{/other_user}","gists_url":"https://api.github.com/users/DAlexIV/gists{/gist_id}","starred_url":"https://api.github.com/users/DAlexIV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DAlexIV/subscriptions","organizations_url":"https://api.github.com/users/DAlexIV/orgs","repos_url":"https://api.github.com/users/DAlexIV/repos","events_url":"https://api.github.com/users/DAlexIV/events{/privacy}","received_events_url":"https://api.github.com/users/DAlexIV/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DAlexIV/recycler-view","description":"Recycler view home and classwork","fork":true,"url":"https://api.github.com/repos/DAlexIV/recycler-view","forks_url":"https://api.github.com/repos/DAlexIV/recycler-view/forks","keys_url":"https://api.github.com/repos/DAlexIV/recycler-view/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DAlexIV/recycler-view/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DAlexIV/recycler-view/teams","hooks_url":"https://api.github.com/repos/DAlexIV/recycler-view/hooks","issue_events_url":"https://api.github.com/repos/DAlexIV/recycler-view/issues/events{/number}","events_url":"https://api.github.com/repos/DAlexIV/recycler-view/events","assignees_url":"https://api.github.com/repos/DAlexIV/recycler-view/assignees{/user}","branches_url":"https://api.github.com/repos/DAlexIV/recycler-view/branches{/branch}","tags_url":"https://api.github.com/repos/DAlexIV/recycler-view/tags","blobs_url":"https://api.github.com/repos/DAlexIV/recycler-view/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DAlexIV/recycler-view/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DAlexIV/recycler-view/git/refs{/sha}","trees_url":"https://api.github.com/repos/DAlexIV/recycler-view/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DAlexIV/recycler-view/statuses/{sha}","languages_url":"https://api.github.com/repos/DAlexIV/recycler-view/languages","stargazers_url":"https://api.github.com/repos/DAlexIV/recycler-view/stargazers","contributors_url":"https://api.github.com/repos/DAlexIV/recycler-view/contributors","subscribers_url":"https://api.github.com/repos/DAlexIV/recycler-view/subscribers","subscription_url":"https://api.github.com/repos/DAlexIV/recycler-view/subscription","commits_url":"https://api.github.com/repos/DAlexIV/recycler-view/commits{/sha}","git_commits_url":"https://api.github.com/repos/DAlexIV/recycler-view/git/commits{/sha}","comments_url":"https://api.github.com/repos/DAlexIV/recycler-view/comments{/number}","issue_comment_url":"https://api.github.com/repos/DAlexIV/recycler-view/issues/comments{/number}","contents_url":"https://api.github.com/repos/DAlexIV/recycler-view/contents/{+path}","compare_url":"https://api.github.com/repos/DAlexIV/recycler-view/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DAlexIV/recycler-view/merges","archive_url":"https://api.github.com/repos/DAlexIV/recycler-view/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DAlexIV/recycler-view/downloads","issues_url":"https://api.github.com/repos/DAlexIV/recycler-view/issues{/number}","pulls_url":"https://api.github.com/repos/DAlexIV/recycler-view/pulls{/number}","milestones_url":"https://api.github.com/repos/DAlexIV/recycler-view/milestones{/number}","notifications_url":"https://api.github.com/repos/DAlexIV/recycler-view/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DAlexIV/recycler-view/labels{/name}","releases_url":"https://api.github.com/repos/DAlexIV/recycler-view/releases{/id}","deployments_url":"https://api.github.com/repos/DAlexIV/recycler-view/deployments","created_at":"2016-08-01T23:46:01Z","updated_at":"2016-08-01T23:46:02Z","pushed_at":"2016-08-07T18:24:29Z","git_url":"git://github.com/DAlexIV/recycler-view.git","ssh_url":"git@github.com:DAlexIV/recycler-view.git","clone_url":"https://github.com/DAlexIV/recycler-view.git","svn_url":"https://github.com/DAlexIV/recycler-view","homepage":null,"size":138,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yamblz-native:master","ref":"master","sha":"2ddadb0e4f82d2da47e48ca4f7961d21a145b418","user":{"login":"yamblz-native","id":20421172,"avatar_url":"https://avatars.githubusercontent.com/u/20421172?v=3","gravatar_id":"","url":"https://api.github.com/users/yamblz-native","html_url":"https://github.com/yamblz-native","followers_url":"https://api.github.com/users/yamblz-native/followers","following_url":"https://api.github.com/users/yamblz-native/following{/other_user}","gists_url":"https://api.github.com/users/yamblz-native/gists{/gist_id}","starred_url":"https://api.github.com/users/yamblz-native/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yamblz-native/subscriptions","organizations_url":"https://api.github.com/users/yamblz-native/orgs","repos_url":"https://api.github.com/users/yamblz-native/repos","events_url":"https://api.github.com/users/yamblz-native/events{/privacy}","received_events_url":"https://api.github.com/users/yamblz-native/received_events","type":"Organization","site_admin":false},"repo":{"id":63621292,"name":"recycler-view","full_name":"yamblz-native/recycler-view","owner":{"login":"yamblz-native","id":20421172,"avatar_url":"https://avatars.githubusercontent.com/u/20421172?v=3","gravatar_id":"","url":"https://api.github.com/users/yamblz-native","html_url":"https://github.com/yamblz-native","followers_url":"https://api.github.com/users/yamblz-native/followers","following_url":"https://api.github.com/users/yamblz-native/following{/other_user}","gists_url":"https://api.github.com/users/yamblz-native/gists{/gist_id}","starred_url":"https://api.github.com/users/yamblz-native/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yamblz-native/subscriptions","organizations_url":"https://api.github.com/users/yamblz-native/orgs","repos_url":"https://api.github.com/users/yamblz-native/repos","events_url":"https://api.github.com/users/yamblz-native/events{/privacy}","received_events_url":"https://api.github.com/users/yamblz-native/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yamblz-native/recycler-view","description":"Recycler view home and classwork","fork":false,"url":"https://api.github.com/repos/yamblz-native/recycler-view","forks_url":"https://api.github.com/repos/yamblz-native/recycler-view/forks","keys_url":"https://api.github.com/repos/yamblz-native/recycler-view/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yamblz-native/recycler-view/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yamblz-native/recycler-view/teams","hooks_url":"https://api.github.com/repos/yamblz-native/recycler-view/hooks","issue_events_url":"https://api.github.com/repos/yamblz-native/recycler-view/issues/events{/number}","events_url":"https://api.github.com/repos/yamblz-native/recycler-view/events","assignees_url":"https://api.github.com/repos/yamblz-native/recycler-view/assignees{/user}","branches_url":"https://api.github.com/repos/yamblz-native/recycler-view/branches{/branch}","tags_url":"https://api.github.com/repos/yamblz-native/recycler-view/tags","blobs_url":"https://api.github.com/repos/yamblz-native/recycler-view/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yamblz-native/recycler-view/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yamblz-native/recycler-view/git/refs{/sha}","trees_url":"https://api.github.com/repos/yamblz-native/recycler-view/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yamblz-native/recycler-view/statuses/{sha}","languages_url":"https://api.github.com/repos/yamblz-native/recycler-view/languages","stargazers_url":"https://api.github.com/repos/yamblz-native/recycler-view/stargazers","contributors_url":"https://api.github.com/repos/yamblz-native/recycler-view/contributors","subscribers_url":"https://api.github.com/repos/yamblz-native/recycler-view/subscribers","subscription_url":"https://api.github.com/repos/yamblz-native/recycler-view/subscription","commits_url":"https://api.github.com/repos/yamblz-native/recycler-view/commits{/sha}","git_commits_url":"https://api.github.com/repos/yamblz-native/recycler-view/git/commits{/sha}","comments_url":"https://api.github.com/repos/yamblz-native/recycler-view/comments{/number}","issue_comment_url":"https://api.github.com/repos/yamblz-native/recycler-view/issues/comments{/number}","contents_url":"https://api.github.com/repos/yamblz-native/recycler-view/contents/{+path}","compare_url":"https://api.github.com/repos/yamblz-native/recycler-view/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yamblz-native/recycler-view/merges","archive_url":"https://api.github.com/repos/yamblz-native/recycler-view/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yamblz-native/recycler-view/downloads","issues_url":"https://api.github.com/repos/yamblz-native/recycler-view/issues{/number}","pulls_url":"https://api.github.com/repos/yamblz-native/recycler-view/pulls{/number}","milestones_url":"https://api.github.com/repos/yamblz-native/recycler-view/milestones{/number}","notifications_url":"https://api.github.com/repos/yamblz-native/recycler-view/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yamblz-native/recycler-view/labels{/name}","releases_url":"https://api.github.com/repos/yamblz-native/recycler-view/releases{/id}","deployments_url":"https://api.github.com/repos/yamblz-native/recycler-view/deployments","created_at":"2016-07-18T16:59:14Z","updated_at":"2016-07-18T16:59:32Z","pushed_at":"2016-08-09T08:52:16Z","git_url":"git://github.com/yamblz-native/recycler-view.git","ssh_url":"git@github.com:yamblz-native/recycler-view.git","clone_url":"https://github.com/yamblz-native/recycler-view.git","svn_url":"https://github.com/yamblz-native/recycler-view","homepage":null,"size":122,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":22,"forks":26,"open_issues":22,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/22"},"html":{"href":"https://github.com/yamblz-native/recycler-view/pull/22"},"issue":{"href":"https://api.github.com/repos/yamblz-native/recycler-view/issues/22"},"comments":{"href":"https://api.github.com/repos/yamblz-native/recycler-view/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yamblz-native/recycler-view/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/yamblz-native/recycler-view/statuses/279d340dea9546c9d8e7a05421c11b68e80a6328"}}}}
{"actor":{"display_login":"Tagakov"}}