@Test public void pauseStateReceivePlay() { setupWithMockAdapterAndViewHolder(); mGlue.onKey(null, KeyEvent.KEYCODE_MEDIA_PLAY, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PLAY)); Mockito.verify(mAdapter, times(1)).play(); }
@Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_ESCAPE: return false; } final ObjectAdapter primaryActionsAdapter = mControlsRow.getPrimaryActionsAdapter(); Action action = mControlsRow.getActionForKeyCode(primaryActionsAdapter, keyCode); if (action == null) { action = mControlsRow.getActionForKeyCode(mControlsRow.getSecondaryActionsAdapter(), keyCode); } if (action != null) { if (event.getAction() == KeyEvent.ACTION_DOWN) { dispatchAction(action, event); } return true; } return false; }
PlaybackTransportControlGlue extends PlaybackBaseControlGlue<T> { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_ESCAPE: return false; } final ObjectAdapter primaryActionsAdapter = mControlsRow.getPrimaryActionsAdapter(); Action action = mControlsRow.getActionForKeyCode(primaryActionsAdapter, keyCode); if (action == null) { action = mControlsRow.getActionForKeyCode(mControlsRow.getSecondaryActionsAdapter(), keyCode); } if (action != null) { if (event.getAction() == KeyEvent.ACTION_DOWN) { dispatchAction(action, event); } return true; } return false; } }
PlaybackTransportControlGlue extends PlaybackBaseControlGlue<T> { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_ESCAPE: return false; } final ObjectAdapter primaryActionsAdapter = mControlsRow.getPrimaryActionsAdapter(); Action action = mControlsRow.getActionForKeyCode(primaryActionsAdapter, keyCode); if (action == null) { action = mControlsRow.getActionForKeyCode(mControlsRow.getSecondaryActionsAdapter(), keyCode); } if (action != null) { if (event.getAction() == KeyEvent.ACTION_DOWN) { dispatchAction(action, event); } return true; } return false; } PlaybackTransportControlGlue(Context context, T impl); }
PlaybackTransportControlGlue extends PlaybackBaseControlGlue<T> { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_ESCAPE: return false; } final ObjectAdapter primaryActionsAdapter = mControlsRow.getPrimaryActionsAdapter(); Action action = mControlsRow.getActionForKeyCode(primaryActionsAdapter, keyCode); if (action == null) { action = mControlsRow.getActionForKeyCode(mControlsRow.getSecondaryActionsAdapter(), keyCode); } if (action != null) { if (event.getAction() == KeyEvent.ACTION_DOWN) { dispatchAction(action, event); } return true; } return false; } PlaybackTransportControlGlue(Context context, T impl); @Override void setControlsRow(PlaybackControlsRow controlsRow); @Override void onActionClicked(Action action); @Override boolean onKey(View v, int keyCode, KeyEvent event); final void setSeekProvider(PlaybackSeekDataProvider seekProvider); final PlaybackSeekDataProvider getSeekProvider(); final void setSeekEnabled(boolean seekEnabled); final boolean isSeekEnabled(); }
PlaybackTransportControlGlue extends PlaybackBaseControlGlue<T> { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_ESCAPE: return false; } final ObjectAdapter primaryActionsAdapter = mControlsRow.getPrimaryActionsAdapter(); Action action = mControlsRow.getActionForKeyCode(primaryActionsAdapter, keyCode); if (action == null) { action = mControlsRow.getActionForKeyCode(mControlsRow.getSecondaryActionsAdapter(), keyCode); } if (action != null) { if (event.getAction() == KeyEvent.ACTION_DOWN) { dispatchAction(action, event); } return true; } return false; } PlaybackTransportControlGlue(Context context, T impl); @Override void setControlsRow(PlaybackControlsRow controlsRow); @Override void onActionClicked(Action action); @Override boolean onKey(View v, int keyCode, KeyEvent event); final void setSeekProvider(PlaybackSeekDataProvider seekProvider); final PlaybackSeekDataProvider getSeekProvider(); final void setSeekEnabled(boolean seekEnabled); final boolean isSeekEnabled();  }