-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Merge player classes into a single one #5371
Conversation
This has been bugging you for a while, hasn't it? xD |
as your PR also modifies the VideoDetailFragment. Can you please remove the lines NewPipe/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java Line 1892 in d726546
and NewPipe/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java Line 1895 in d726546
that's from PR #5331. So I don't have to do that in another PR and force you to rebase / force push. |
I'm in favor of this :) It's always a struggle to "not breaking" stuff because of the |
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.
I just did a quick run down, i skipped Player
since there is no direct side-by-side comparison. But if you just pulled the methods upwards there shouldn't be much to look at.
PlayerHelper
i also just skimmed through for the same reason.
Only thing that i would change is making seperate commits for those points. When looked at afterwards it then shows that its intended and not accidental.
Fix wrong speed indicator in queue activity (finally I understood what ought to be done)
Remove viewpager hiding from #5331
@@ -33,61 +33,59 @@ | |||
public class PlayerGestureListener | |||
extends BasePlayerGestureListener | |||
implements View.OnTouchListener { | |||
private static final String TAG = ".PlayerGestureListener"; | |||
private static final boolean DEBUG = BasePlayer.DEBUG; | |||
private static final String TAG = PlayerGestureListener.class.getSimpleName(); |
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.
Is this done like this in other places too?
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.
Yes, this is the way to do it
@@ -129,6 +128,7 @@ public boolean onCreateOptionsMenu(final Menu m) { | |||
getMenuInflater().inflate(R.menu.menu_play_queue, m); | |||
getMenuInflater().inflate(getPlayerOptionMenuResource(), m); | |||
onMaybeMuteChanged(); | |||
onPlaybackParameterChanged(player.getPlaybackParameters()); |
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.
Where is this coming from?
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.
This fixes the issue with the speed on the button being wrong
Isn't it quite hard to navigate in 4k lines of code? |
Paging @XiangRongLin :) |
@TacoTheDank Seeing how my other refactoring&tests PR are still just lying around, I'm not going to touch this. Refactoring something big like this needs many iterations, which does not work if each iteration has a very long wait time just to get feedback. |
@XiangRongLin I separated the commits as you requested, and also merged and renamed |
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.
Looks ok to me. I trust you with merging those classes, since like many said 4k lines is too much to review.
Yes, this is a chronic problem because of general lack of free time on the team. Plus even when a dev gets some time to work on Newpipe, they might have their own priority regarding what to work on. @XiangRongLin @vkay94 You've both been given write access, so you can approve and merge PRs. Whenever you have the inclination, please go ahead and review/merge PRs that meet your standards. :) Also, @XiangRongLin could you please join the newpipe IRC channel (preferably with a Matrix account)? @vkay94 is already there. |
player.getPlayer() or player.isPlayerNull are looking a bit unfortunate. Maybe it should be renamed to exoInstance / playbackInstance or something like that? so it would become player.getExoInstance() and player.isExoInstanceNull |
I rebased onto view binding and tested again, everything seems to be working fine. @Redirion I renamed |
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.
lgtm
I will take the bold move to merge this. I think this should go into public testing with the new release. This will give us the opportunity to collect more broad feedback. |
Merge player classes into a single one
What is it?
Description of the changes in your PR
This PR merges the three files of the player, namely
BasePlayer
,VideoPlayer
andVideoPlayerImpl
, into only one. Having three files was totally useless since code randomly spanned across all three files without any clear distinction. Before unified player three different classes were needed to allow for extension, but now that's not needed anymore. Merging everything together also removes lines of code and makes the code simpler to read, since everything is in one place, as there are no overridden methods all over the place anymore.//region
and//endregion
comments before and after each section, allowing them to be folded by the IDE.enum
for player type, also for intents, and therefore useintvalue = type.ordinal()
andPlayerType.values()[intvalue]
PlayerHelper
checkPopupPositionBounds
so that it tries to clamp both x and y bounds and not only one at a timeplayer.xml
andplayer.xml (large-land)
, causing view binding to require conversions: see Use view binding in VideoPlayer. #5253 (comment)ServicePlayerActivity
andBackgroundPlayerActivity
into a singlePlayQueueActivity
and remove useless fieldsgetTag
andredraw
(which were not used)I'd like this to be merged soon, otherwise it will be a mess to rebase.
Due diligence