Ejemplo n.º 1
0
 @Override
 public boolean onKeyUp(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK) {
     exitFullscreen(false);
     return true;
   }
   return super.onKeyUp(keyCode, event);
 }
Ejemplo n.º 2
0
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
     exitFullscreen(false);
     return true;
   }
   return super.onKeyDown(keyCode, event);
 }
 @Override
 public void toggleFullscreen(boolean enterFullscreen) {
   if (!enterFullscreen) {
     ContentVideoView videoView = ContentVideoView.getContentVideoView();
     if (videoView != null) videoView.exitFullscreen(false);
   }
   if (mXWalkContentsClient != null) mXWalkContentsClient.onToggleFullscreen(enterFullscreen);
 }
Ejemplo n.º 4
0
 @Override
 public boolean onKey(View v, int keyCode, KeyEvent event) {
   boolean isKeyCodeSupported =
       keyCode != KeyEvent.KEYCODE_BACK
           && keyCode != KeyEvent.KEYCODE_VOLUME_UP
           && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN
           && keyCode != KeyEvent.KEYCODE_VOLUME_MUTE
           && keyCode != KeyEvent.KEYCODE_CALL
           && keyCode != KeyEvent.KEYCODE_MENU
           && keyCode != KeyEvent.KEYCODE_SEARCH
           && keyCode != KeyEvent.KEYCODE_ENDCALL;
   if (isInPlaybackState() && isKeyCodeSupported && mControls != null) {
     if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
       if (isPlaying()) {
         pause();
         mControls.show();
       } else {
         start();
         mControls.hide();
       }
       return true;
     } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) {
       if (!isPlaying()) {
         start();
         mControls.hide();
       }
       return true;
     } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP
         || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) {
       if (isPlaying()) {
         pause();
         mControls.show();
       }
       return true;
     } else {
       toggleMediaControlsVisiblity();
     }
   } else if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
     exitFullscreen(false);
     return true;
   } else if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEvent.KEYCODE_SEARCH) {
     return true;
   }
   return super.onKeyDown(keyCode, event);
 }
Ejemplo n.º 5
0
 @CalledByNative
 private void onExitFullscreen() {
   exitFullscreen(false);
 }
Ejemplo n.º 6
0
 @Override
 public void run() {
   exitFullscreen(true);
 }