-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Can't apply defStyleAttr to PlayerView #9024
Comments
Hi! Please provide complete information as requested in the issue template. The issue template can |
If you try to call the constructor with default style I personally need it for the case to extend PlayerView and have a view that sets TextureView by default instead of SurfaceView. To solve this I can pass a style So the fixed line will look like this: There's also one missed override with That also should be used with obtainStyledAttributes, we again should pass defStyleRes instead of 0 to the last parameter. So the fixed line will look like this: |
It actually looks pretty awkward to support this until our minimum API version has increased to 21. Until then, it's not possible for us to do:
because the 4-arg constructor in the super class only exists on API level 21 and higher. I think the implication is that we'd have to either (a) duplicate a lot of initialization code in the 3-arg and 4-arg constructors, or (b) call an initialization method from both constructors and make all of the member variables that are initialized at construction time non-final. Both options seem not that great to me. We could alternatively call 3-arg super class method from our 4-arg method, but that's pretty confusing (and technically wrong, since Do you need the 4-arg constructor, or were you just noting that for completeness? If not, I think we should just fix the problem where |
#minor-release #exofixit Issue #9024 PiperOrigin-RevId: 395224661
The change referenced above makes use of |
The case we faced is having your own inheritor of PlayerView with predefined parameters (surface type in our case). We solved it with composition, but this has a drawback of adding additional layer to the hierarchy. |
Issue #9024 PiperOrigin-RevId: 395224661
ExoPlayer/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
Line 375 in 9be5ece
defStyleAttr
is not passed to obtainStyledAttributes and a default style can't be applied to PlayerView.The text was updated successfully, but these errors were encountered: