@SuppressLint("NewApi") void setupVideoControlsToggler() { if (videoControlsToggler != null) { videoControlsToggler.cancel(true); } videoControlsToggler = new VideoControlsHider(); if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { videoControlsToggler.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { videoControlsToggler.execute(); } }
@Override public void onStartTrackingTouch(SeekBar seekBar) { super.onStartTrackingTouch(seekBar); if (videoControlsToggler != null) { videoControlsToggler.cancel(true); } }
@Override protected void onPause() { super.onPause(); if (videoControlsToggler != null) { videoControlsToggler.cancel(true); } if (controller != null && controller.getStatus() == PlayerStatus.PLAYING) { controller.pause(); } }
@Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { if (videoControlsToggler != null) { videoControlsToggler.cancel(true); } toggleVideoControlsVisibility(); if (videoControlsShowing) { setupVideoControlsToggler(); } return true; } else { return false; } }