OlivierTD / team-rocket

Team Rocket working on OSS AntennaPod
MIT License
1 stars 1 forks source link

Refresh episodes Multiple Queues #148

Closed OlivierTD closed 6 years ago

OlivierTD commented 6 years ago

Alright so many things changed in the Multiple Queue part of the project, I will go over what I did step by step:

  1. I changed the ListView to a RecyclerView in order to use a RecyclerView Adapter. They are much more powerful than regular BaseAdapters and considering that we need to pull from the Database often to fetch episodes, a RecyclerView is much more appropriate in our case.

The refreshing of episodes was a bit tricky since the original app uses EventDistributor and EventBus for two separate things.

  1. EventBus is now used to update downloading episodes. I am using the DownloadEvent just like how it was used in the original QueueFragment class.

  2. EventDistributor updates episodes whenever there is an event on the fragment. So, whenever a user presses the play or pause button, the episodes in the RecyclerView will update. Unlike the DownloadEvent, these are not constantly loaded because they are not using EventBus!

The best thing to do would be to use EventBus for everything, but that would require further work. If I have time, I will try to change the EventDistributor to EventBus so that whenever an episode is being played, the episodes within the RecyclerView gets updated constantly.

For now, this PR will do for the issue #117 from the user story #39

OlivierTD commented 6 years ago

CodeClimate gave me issues to fix, I will refactor my code soon.

OlivierTD commented 6 years ago

@davidlegare yeah, I ALWAYS forget to reference my commits... :cry: