/**
   * Show the controller on screen. It will go away automatically after 'timeout' milliseconds of
   * inactivity.
   *
   * @param timeout The timeout in milliseconds. Use 0 to show the controller until hide() is
   *     called.
   */
  public void show(int timeout) {

    if (!mShowing && mAnchor != null) {
      setProgress();

      int[] anchorpos = new int[2];
      mAnchor.getLocationOnScreen(anchorpos);

      WindowManager.LayoutParams p = new WindowManager.LayoutParams();
      p.gravity = Gravity.TOP;
      p.width = mAnchor.getWidth();
      p.height = LayoutParams.WRAP_CONTENT;
      p.x = 0;
      p.y = anchorpos[1] + mAnchor.getHeight() - p.height;
      p.format = PixelFormat.TRANSLUCENT;
      p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
      p.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
      p.token = null;
      p.windowAnimations = 0; // android.R.style.DropDownAnimationDown;
      mWindowManager.addView(mDecor, p);
      mShowing = true;
    }
    updatePausePlay();

    // cause the progress bar to be updated even if mShowing
    // was already true.  This happens, for example, if we're
    // paused with the progress bar showing the user hits play.
    mHandler.sendEmptyMessage(SHOW_PROGRESS);

    Message msg = mHandler.obtainMessage(FADE_OUT);
    if (timeout != 0) {
      mHandler.removeMessages(FADE_OUT);
      mHandler.sendMessageDelayed(msg, timeout);
    }
  }
예제 #2
0
        public void onClick(View v) {
          int pos = mPlayer.getCurrentPosition();
          pos += 15000; // milliseconds
          mPlayer.seekTo(pos);
          setProgress();

          show(sDefaultTimeout);
        }
예제 #3
0
        public void onStopTrackingTouch(SeekBar bar) {
          mDragging = false;
          setProgress();
          updatePausePlay();
          show(sDefaultTimeout);

          // Ensure that progress is properly updated in the future,
          // the call to show() does not guarantee this because it is a
          // no-op if we are already showing.
          mHandler.sendEmptyMessage(SHOW_PROGRESS);
        }
  /**
   * Show the controller on screen. It will go away automatically after 'timeout' milliseconds of
   * inactivity.
   *
   * @param timeout The timeout in milliseconds. Use 0 to show the controller until hide() is
   *     called.
   */
  public void show(int timeout) {
    if (!mShowing && mAnchor != null) {
      setProgress();
      if (mPauseButton != null) {
        mPauseButton.requestFocus();
      }
      disableUnsupportedButtons();
      updateFloatingWindowLayout();
      mWindowManager.addView(mDecor, mDecorLayoutParams);
      mShowing = true;
    }
    updatePausePlay();

    // cause the progress bar to be updated even if mShowing
    // was already true.  This happens, for example, if we're
    // paused with the progress bar showing the user hits play.
    mHandler.sendEmptyMessage(SHOW_PROGRESS);

    if (timeout != 0 && !mAccessibilityManager.isTouchExplorationEnabled()) {
      mHandler.removeMessages(FADE_OUT);
      Message msg = mHandler.obtainMessage(FADE_OUT);
      mHandler.sendMessageDelayed(msg, timeout);
    }
  }
 public void onStopTrackingTouch(SeekBar bar) {
   mDragging = false;
   setProgress();
   updatePausePlay();
   show(sDefaultTimeout);
 }