-
Notifications
You must be signed in to change notification settings - Fork 20
Чаркин Константин(@kostya_charkin), HW background #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Держи |
| return genres; | ||
| } | ||
|
|
||
| public Artist(JSONObject jsonObject) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вообще очень плохая практика парсить джейсон внутри конструктора
Ты ведь даже не сможешь понять нормально обьект создался или с ошибкой, придется создать обьект в любом случае, плюс это еще возможно тяжелая операция, конструктор должен быть легким
| Log.d("onBindViewHolder,pos = ", Integer.toString(position)); | ||
| Genre genre = genres.get(position); | ||
| holder.textInList.setText(genre.getDescription()); | ||
| new Thread(() -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
На каждый onBindViewHolder новый поток? не надо так
Хочется чтобы было также легко использовать как пикассо или подобное. А тут ты все делаешь на потоке из которого запустили функцию loadCollage, да и еще количество этих потоков никак не контролируешь. Операции не отменяешь (Как минимум не вижу этого) на новый onBindViewHolder
add task 2 (handler).
upd:
добавил задание с loader-ом, коллажи делает, но периодически картинки сетятся не в те вьюхи, почему - не знаю😕.
upd:
Добавил отмену старого таска, если на туже вьюху приходит новый.
upd:
добавил
ExecutorServiceдля ограничения кол-ва потоков, убрал создание потоков в реализациюCollageLoader