Conversation
This practically rebuilds the entire player, aimed to remove the FullScreenPlayer inheritance from ResultFragmentPhone, use BaseFragment for ResultFragmentPhone and the player, and make the player easier to maintain and expand in the future, as well overall cleanup to code readability and adding documentation to methods in the player.
|
This is mostly ready for review. Though there may still be a few bugs since I wrote a lot of the code from scratch in many places (some of the code is stuff I worked on ~6 months ago, for about two months but gave up as I ran into some issues I couldn't figure but finally finished it and expanded to all the new features since then now). If you feel this should be done a different way I could do that also, but this was just designed to make it easier in the future. |
fire-light42
left a comment
There was a problem hiding this comment.
I have not looked in-depth at each line yet, given the sheer magnitude of this diff. It is hard to keep track of what is refactored, moved or unchanged. However, I like what I see so far.
fire-light42
left a comment
There was a problem hiding this comment.
Very good pull request! I did not find any big glaring issues in the code or when testing.
The only bugs I found was:
- player_video_title_rez is not hidden when locked
- Brightness and volume sliders are still accessible when locked
- player_metadata_scrim is visible on trailers on phone
Please also note that while your formatting is great, it is not standard to android studio, and will cause the next person to touch the file to get +-500. Please format it with android studio or figure out some setting to disallow it on these files.
I have also noticed that you removed a lot of comments, I am fine if you reword it. However, functions like verifyVolume lose context of why it is done, similar for currentZoomMatrix, and for the comments in createScaleGestureDetector. You should never remove a "why" comment, as it makes it harder to read the code later and understand the decision, intent, and why something else is not done.
To be clear, doc comments that explain the "what" is done, e.g. functionally is entirely free to update, as they do not contain any inherit information that can not be gleaned from the code.
While the clean code book is not perfect, and has a lot of misguided advice, the comments sections is worth reading: https://bitsyncvortex.github.io/Books/pdfs/ComputerScience/CleanCode.pdf page 55+
| fun setupTouchGestures() { | ||
| val holder = playerView.playerHolder ?: return | ||
| @SuppressLint("ClickableViewAccessibility") | ||
| holder.setOnTouchListener { v, event -> handleGesture(v, event) } |
There was a problem hiding this comment.
holder.setOnTouchListener(::handleGesture)
| fun handleZoomPanGesture( | ||
| event: MotionEvent, | ||
| ctx: Context, | ||
| onFirstPointerDown: () -> Unit = {}, |
There was a problem hiding this comment.
No need to default it to {} when you have one callee.
|
Thank you for the review! I will try and finish this up tomorrow. |
This practically rebuilds the entire player (sans IPlayer/CS3IPlayer), aimed to remove the FullScreenPlayer inheritance from ResultFragmentPhone, use BaseFragment for ResultFragmentPhone and the player, and make the player easier to maintain and expand in the future, as well overall cleanup to code readability and adding documentation to methods in the player. Also aimed to not fully crash if the layouts have minor differences as well.
Eventually FullScreenPlayer could be entirely factored out into helper methods for GeneratorPlayer, and AbstractPlayerFragment removed completely, but to reduce the chance of harder to resolve merge conflicts with removed files, I decided to not do it in this PR.