@Override
  public void onStop() {
    super.onStop();
    mPaused = true;

    // mGetter could be null if we call finish() and leave early in
    // onStart().
    if (mGetter != null) {
      mGetter.cancelCurrent();
      mGetter.stop();
      mGetter = null;
    }
    setMode(MODE_NORMAL);

    // removing all callback in the message queue
    mHandler.removeAllGetterCallbacks();

    if (mAllImages != null) {
      mSavedUri = getCurrentUri();
      mAllImages.close();
      mAllImages = null;
    }

    hideOnScreenControls();
    mImageView.clear();
    mCache.clear();

    for (ImageViewTouchBase iv : mSlideShowImageViews) {
      iv.clear();
    }
  }
  private void showOnScreenControls() {
    if (mPaused) return;
    // If the view has not been attached to the window yet, the
    // zoomButtonControls will not able to show up. So delay it until the
    // view has attached to window.
    if (mActionIconPanel.getWindowToken() == null) {
      mHandler.postGetterCallback(
          new Runnable() {
            public void run() {
              showOnScreenControls();
            }
          });
      return;
    }
    updateNextPrevControls();

    IImage image = mAllImages.getImageAt(mCurrentPosition);
    if (image instanceof VideoObject) {
      mZoomButtonsController.setVisible(false);
    } else {
      updateZoomButtonsEnabled();
      mZoomButtonsController.setVisible(true);
    }

    if (mShowActionIcons && mActionIconPanel.getVisibility() != View.VISIBLE) {
      Animation animation = new AlphaAnimation(0, 1);
      animation.setDuration(500);
      mActionIconPanel.startAnimation(animation);
      mActionIconPanel.setVisibility(View.VISIBLE);
    }
  }
Exemplo n.º 3
0
    private void showOnScreenControls() {

        // If the view has not been attached to the window yet, the
        // zoomButtonControls will not able to show up. So delay it until the
        // view has attached to window.
        if (mRootView.getWindowToken() == null) {
            mHandler.postGetterCallback(new Runnable() {
                public void run() {
                    showOnScreenControls();
                }
            });
            return;
        }

        // we may need to update the next/prev button due to index changing
        updateNextPrevControls();

        if (ImageManager.isImage(mAllImages.getImageAt(mCurrentPosition))) {
            updateZoomButtonsEnabled();
            mZoomButtonsController.setVisible(true);
        } else {
            mZoomButtonsController.setVisible(false);
        }
    }
 private void scheduleDismissOnScreenControls() {
   mHandler.removeCallbacks(mDismissOnScreenControlRunner);
   mHandler.postDelayed(mDismissOnScreenControlRunner, 2000);
 }