Fix attr inheritance in SimpleExoPlayerView
When creating PlaybackControlView inside SimpleExoPlayerView, we want certain attributes to be passed through. This lets you set control attributes on the SimpleExoPlayerView directly. We don't want all attributes to be propagated though; only our own custom ones. Not sure if there's a cleaner way to do this. Pragmatically this solution seems ... ok :)? ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167619801
This commit is contained in:
parent
b62eab63a4
commit
fb023da529
@ -298,16 +298,20 @@ public class PlaybackControlView extends FrameLayout {
|
||||
}
|
||||
|
||||
public PlaybackControlView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this(context, attrs, defStyleAttr, attrs);
|
||||
}
|
||||
|
||||
public PlaybackControlView(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
AttributeSet playbackAttrs) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
int controllerLayoutId = R.layout.exo_playback_control_view;
|
||||
rewindMs = DEFAULT_REWIND_MS;
|
||||
fastForwardMs = DEFAULT_FAST_FORWARD_MS;
|
||||
showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;
|
||||
repeatToggleModes = DEFAULT_REPEAT_TOGGLE_MODES;
|
||||
showShuffleButton = false;
|
||||
if (attrs != null) {
|
||||
TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
|
||||
if (playbackAttrs != null) {
|
||||
TypedArray a = context.getTheme().obtainStyledAttributes(playbackAttrs,
|
||||
R.styleable.PlaybackControlView, 0, 0);
|
||||
try {
|
||||
rewindMs = a.getInt(R.styleable.PlaybackControlView_rewind_increment, rewindMs);
|
||||
|
@ -240,7 +240,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
|
||||
controller = null;
|
||||
componentListener = null;
|
||||
overlayFrameLayout = null;
|
||||
ImageView logo = new ImageView(context, attrs);
|
||||
ImageView logo = new ImageView(context);
|
||||
if (Util.SDK_INT >= 23) {
|
||||
configureEditModeLogoV23(getResources(), logo);
|
||||
} else {
|
||||
@ -330,9 +330,9 @@ public final class SimpleExoPlayerView extends FrameLayout {
|
||||
if (customController != null) {
|
||||
this.controller = customController;
|
||||
} else if (controllerPlaceholder != null) {
|
||||
// Note: rewindMs and fastForwardMs are passed via attrs, so we don't need to make explicit
|
||||
// calls to set them.
|
||||
this.controller = new PlaybackControlView(context, attrs);
|
||||
// Propagate attrs as playbackAttrs so that PlaybackControlView's custom attributes are
|
||||
// transferred, but standard FrameLayout attributes (e.g. background) are not.
|
||||
this.controller = new PlaybackControlView(context, null, 0, attrs);
|
||||
controller.setLayoutParams(controllerPlaceholder.getLayoutParams());
|
||||
ViewGroup parent = ((ViewGroup) controllerPlaceholder.getParent());
|
||||
int controllerIndex = parent.indexOfChild(controllerPlaceholder);
|
||||
|
Loading…
x
Reference in New Issue
Block a user