@Test public void usingDefaultRowAndPresenter() { mContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mGlue = Mockito.spy(new PlaybackControlGlueImpl(mContext)); } }); PlaybackGlueHostImpl host = new PlaybackGlueHostImpl(); mGlue.setHost(host); Mockito.verify(mGlue, times(1)).onAttachedToHost(host); assertSame(mGlue, host.mGlue); assertSame(host, mGlue.getHost()); assertTrue(host.mPlaybackRowPresenter instanceof PlaybackControlsRowPresenter); assertTrue(host.mRow instanceof PlaybackControlsRow); }
@Override protected void onAttachedToHost(PlaybackGlueHost host) { super.onAttachedToHost(host); host.setOnKeyInterceptListener(this); host.setOnActionClickedListener(this); if (getControlsRow() == null || getPlaybackRowPresenter() == null) { onCreateControlsRowAndPresenter(); } host.setPlaybackRowPresenter(getPlaybackRowPresenter()); host.setPlaybackRow(getControlsRow()); }
PlaybackControlGlue extends PlaybackGlue implements OnActionClickedListener, View.OnKeyListener { @Override protected void onAttachedToHost(PlaybackGlueHost host) { super.onAttachedToHost(host); host.setOnKeyInterceptListener(this); host.setOnActionClickedListener(this); if (getControlsRow() == null || getPlaybackRowPresenter() == null) { onCreateControlsRowAndPresenter(); } host.setPlaybackRowPresenter(getPlaybackRowPresenter()); host.setPlaybackRow(getControlsRow()); } }
PlaybackControlGlue extends PlaybackGlue implements OnActionClickedListener, View.OnKeyListener { @Override protected void onAttachedToHost(PlaybackGlueHost host) { super.onAttachedToHost(host); host.setOnKeyInterceptListener(this); host.setOnActionClickedListener(this); if (getControlsRow() == null || getPlaybackRowPresenter() == null) { onCreateControlsRowAndPresenter(); } host.setPlaybackRowPresenter(getPlaybackRowPresenter()); host.setPlaybackRow(getControlsRow()); } PlaybackControlGlue(Context context, int[] seekSpeeds);  PlaybackControlGlue(Context context,
                               int[] fastForwardSpeeds,
                               int[] rewindSpeeds); }
PlaybackControlGlue extends PlaybackGlue implements OnActionClickedListener, View.OnKeyListener { @Override protected void onAttachedToHost(PlaybackGlueHost host) { super.onAttachedToHost(host); host.setOnKeyInterceptListener(this); host.setOnActionClickedListener(this); if (getControlsRow() == null || getPlaybackRowPresenter() == null) { onCreateControlsRowAndPresenter(); } host.setPlaybackRowPresenter(getPlaybackRowPresenter()); host.setPlaybackRow(getControlsRow()); } PlaybackControlGlue(Context context, int[] seekSpeeds);  PlaybackControlGlue(Context context,
                               int[] fastForwardSpeeds,
                               int[] rewindSpeeds); int[] getFastForwardSpeeds(); int[] getRewindSpeeds(); void setFadingEnabled(boolean enable); boolean isFadingEnabled(); void setControlsRow(PlaybackControlsRow controlsRow); @Deprecated void setControlsRowPresenter(PlaybackControlsRowPresenter presenter); PlaybackControlsRow getControlsRow(); @Deprecated PlaybackControlsRowPresenter getControlsRowPresenter(); void setPlaybackRowPresenter(PlaybackRowPresenter presenter); PlaybackRowPresenter getPlaybackRowPresenter(); void enableProgressUpdating(boolean enable); int getUpdatePeriod(); void updateProgress(); @Override void onActionClicked(Action action); @Override boolean onKey(View v, int keyCode, KeyEvent event); void play(int speed); @Override final void play(); abstract boolean hasValidMedia(); abstract boolean isMediaPlaying(); @Override boolean isPlaying(); abstract CharSequence getMediaTitle(); abstract CharSequence getMediaSubtitle(); abstract int getMediaDuration(); abstract Drawable getMediaArt(); abstract long getSupportedActions(); abstract int getCurrentSpeedId(); abstract int getCurrentPosition(); }
PlaybackControlGlue extends PlaybackGlue implements OnActionClickedListener, View.OnKeyListener { @Override protected void onAttachedToHost(PlaybackGlueHost host) { super.onAttachedToHost(host); host.setOnKeyInterceptListener(this); host.setOnActionClickedListener(this); if (getControlsRow() == null || getPlaybackRowPresenter() == null) { onCreateControlsRowAndPresenter(); } host.setPlaybackRowPresenter(getPlaybackRowPresenter()); host.setPlaybackRow(getControlsRow()); } PlaybackControlGlue(Context context, int[] seekSpeeds);  PlaybackControlGlue(Context context,
                               int[] fastForwardSpeeds,
                               int[] rewindSpeeds); int[] getFastForwardSpeeds(); int[] getRewindSpeeds(); void setFadingEnabled(boolean enable); boolean isFadingEnabled(); void setControlsRow(PlaybackControlsRow controlsRow); @Deprecated void setControlsRowPresenter(PlaybackControlsRowPresenter presenter); PlaybackControlsRow getControlsRow(); @Deprecated PlaybackControlsRowPresenter getControlsRowPresenter(); void setPlaybackRowPresenter(PlaybackRowPresenter presenter); PlaybackRowPresenter getPlaybackRowPresenter(); void enableProgressUpdating(boolean enable); int getUpdatePeriod(); void updateProgress(); @Override void onActionClicked(Action action); @Override boolean onKey(View v, int keyCode, KeyEvent event); void play(int speed); @Override final void play(); abstract boolean hasValidMedia(); abstract boolean isMediaPlaying(); @Override boolean isPlaying(); abstract CharSequence getMediaTitle(); abstract CharSequence getMediaSubtitle(); abstract int getMediaDuration(); abstract Drawable getMediaArt(); abstract long getSupportedActions(); abstract int getCurrentSpeedId(); abstract int getCurrentPosition(); static final int ACTION_CUSTOM_LEFT_FIRST; static final int ACTION_SKIP_TO_PREVIOUS; static final int ACTION_REWIND; static final int ACTION_PLAY_PAUSE; static final int ACTION_FAST_FORWARD; static final int ACTION_SKIP_TO_NEXT; static final int ACTION_CUSTOM_RIGHT_FIRST; static final int PLAYBACK_SPEED_INVALID; static final int PLAYBACK_SPEED_PAUSED; static final int PLAYBACK_SPEED_NORMAL; static final int PLAYBACK_SPEED_FAST_L0; static final int PLAYBACK_SPEED_FAST_L1; static final int PLAYBACK_SPEED_FAST_L2; static final int PLAYBACK_SPEED_FAST_L3; static final int PLAYBACK_SPEED_FAST_L4; }