* Add offline playback
* Remove unused values
* Replace downloadutilities extension functions with normal functions
This is to not polute the namespace of fragment and context.
* Replace default Android icons with those from lucide
* Fix deleting downloaded movie
Co-authored-by: Jarne Demeulemeester <32322857+jarnedemeulemeester@users.noreply.github.com>
* Refactor playback code
* Fix back state when playing media and rotating device
Problem was playerItems were re-emitted on fragment creation after config change. LiveData by design emit on every subscribe (observe) so to avoid that there are several possibilities.
1) easiest, observe playerItems not in onCreate but in playButton.clickListener. Stupid, since then we need to remember to only observe in this special place.
2) SingleLiveData - kind of hacky since LiveData were designed to behave this way so we don't want to go against their design.
3) Use Kotlin flow instead.
I chose the flow approach since it's Kotlin native and modern way to do things and behaves much more Rx-like. Since now we need to call collect instead of observe and launch in coroutine, I added utility method to make this easier. Also, in the future we might want to improve this further, either by coming up with new way entirely or by at least moving this to parent fragment from which all fragments that want to play media will inherit and thus making it easy to use and maintain.
Co-authored-by: Jarne Demeulemeester <32322857+jarnedemeulemeester@users.noreply.github.com>
* Add ability to swipe up and down to adjust volume
Created AudioController to adjust global volume for media channel. Alarm, system and other volume levels are unaffected. This way it doesn't need specific implementation for separate players. During swiping system volume slider is shown and it is possible to change direction mid-swipe.
AudioController should probably be singleton and provided by DI but currently PlayerActivity is handling all the playback so it seemed unnecessarily complicated.
Sensitivity can be adjusted by threshold value in VerticalSwipeListener.
* Add audio controller class
Co-authored-by: Jarne Demeulemeester <32322857+jarnedemeulemeester@users.noreply.github.com>
* Add person detail screen
Displays actor/actresses portrait and text info + list of movies/show this person starred in. Text info is max 5 lines with View More button if ellipsized. View More toggle is reset upon orientation change since in landscape mode ellipsize might not be necessary.
* Remove useless StarredInAdapter.kt
* Fix image view shape
* Improve UI
Not exactly how I would like it but will do for now
* Add error handling
Adds a lot of LiveData which may not be ideal, but is better than crashing due to connection errors.
Co-authored-by: jarnedemeulemeester <jarnedemeulemeester@gmail.com>
* add playback speed control to MPV player
* add playback speed control to exoplayer
* remove unnecessary method
* remove unused import
* use gauge icon from lucide
* use gauge icon from lucide
* fix the gauge icon