Allow PlaybackControlView to be overridden in SimpleExoPlayerView

This commit is contained in:
Danny Brain 2017-07-26 11:30:02 +10:00
parent 13732fe618
commit be85da3a69
2 changed files with 14 additions and 1 deletions

View File

@ -168,6 +168,15 @@ import java.util.List;
* <li>Type: {@link View}</li>
* </ul>
* </li>
* <li><b>{@code exo_controller}</b> - An already inflated instance of
* {@link PlaybackControlView}. Allows you to use your own {@link PlaybackControlView} instead
* of default. Note: attrs such as rewind_increment will not be passed through to this
* instance and should be set at creation. {@code exo_controller_placeholder} will be ignored
* if this is set.
* <ul>
* <li>Type: {@link View}</li>
* </ul>
* </li>
* <li><b>{@code exo_overlay}</b> - A {@link FrameLayout} positioned on top of the player which
* the app can access via {@link #getOverlayFrameLayout()}, provided for convenience.
* <ul>
@ -315,8 +324,11 @@ public final class SimpleExoPlayerView extends FrameLayout {
}
// Playback control view.
PlaybackControlView customController = (PlaybackControlView) findViewById(R.id.exo_controller);
View controllerPlaceholder = findViewById(R.id.exo_controller_placeholder);
if (controllerPlaceholder != null) {
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);

View File

@ -20,6 +20,7 @@
<item name="exo_subtitles" type="id"/>
<item name="exo_artwork" type="id"/>
<item name="exo_controller_placeholder" type="id"/>
<item name="exo_controller" type="id"/>
<item name="exo_overlay" type="id"/>
<item name="exo_play" type="id"/>
<item name="exo_pause" type="id"/>