-
-
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
PlayerHolder refactor #11867
PlayerHolder refactor #11867
Conversation
The player in playerHolder is exactly the player inside the `PlayerService`, which in turn is exactly passed through the IBinder interface. Thus we don’t have to pass both. Instead add `PlayerService.getPlayer()`. Also inline a few methods of `PlayerHolder` and simplify.
Only used once. Now the code looks weird … why is the service started twice??
Should make it easier to seperate the two further later, both of them are only implemented by VideoDetailFragment anyway, which is kind of a code smell!
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, overall.
if (binder instanceof PlayerService.LocalBinder localBinder) { | ||
final @Nullable PlayerService s = localBinder.getService(); | ||
if (s == null) { | ||
player = null; | ||
} else { | ||
player = s.getPlayer(); | ||
} | ||
} |
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.
if (binder instanceof PlayerService.LocalBinder localBinder) { | |
final @Nullable PlayerService s = localBinder.getService(); | |
if (s == null) { | |
player = null; | |
} else { | |
player = s.getPlayer(); | |
} | |
} | |
final var service = binder instanceof PlayerService.LocalBinder localBinder ? localBinder.getService() : null; | |
player = service != null ? service.getPlayer() : null; |
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.
That’s a lot more complicated to read than without tertiaries!
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 good to me, though please fix the format of all javadocs, they should be like this:
/**
* Text here.
* And here.
*/
That … is kinda silly, but ok |
Quality Gate passedIssues Measures |
This simplifies the PlayerHolder a bit.
What is it?
Description of the changes in your PR
Before/After Screenshots/Screen Record
Fixes the following issue(s)
Relies on the following changes
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.
Due diligence