Example #1
0
  private void showButtons() {
    if (core == null) return;
    if (!mButtonsVisible) {
      mButtonsVisible = true;
      // Update page number text and slider
      int index = mDocView.getDisplayedViewIndex();
      updatePageNumView(index);
      mPageSlider.setMax((core.countPages() - 1) * mPageSliderRes);
      mPageSlider.setProgress(index * mPageSliderRes);
      if (mTopBarMode == TopBarMode.Search) {
        mSearchText.requestFocus();
        showKeyboard();
      }

      Animation anim = new TranslateAnimation(0, 0, -mTopBarSwitcher.getHeight(), 0);
      anim.setDuration(200);
      anim.setAnimationListener(
          new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
              mTopBarSwitcher.setVisibility(View.VISIBLE);
            }

            public void onAnimationRepeat(Animation animation) {}

            public void onAnimationEnd(Animation animation) {}
          });
      mTopBarSwitcher.startAnimation(anim);

      anim = new TranslateAnimation(0, 0, mPageSlider.getHeight(), 0);
      anim.setDuration(200);
      anim.setAnimationListener(
          new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
              mPageSlider.setVisibility(View.VISIBLE);
            }

            public void onAnimationRepeat(Animation animation) {}

            public void onAnimationEnd(Animation animation) {
              mPageNumberView.setVisibility(View.VISIBLE);
            }
          });
      mPageSlider.startAnimation(anim);
    }
  }
Example #2
0
  private void hideButtons() {
    if (mButtonsVisible) {
      mButtonsVisible = false;
      hideKeyboard();

      Animation anim = new TranslateAnimation(0, 0, 0, -mTopBarSwitcher.getHeight());
      anim.setDuration(200);
      anim.setAnimationListener(
          new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {}

            public void onAnimationRepeat(Animation animation) {}

            public void onAnimationEnd(Animation animation) {
              mTopBarSwitcher.setVisibility(View.INVISIBLE);
            }
          });
      mTopBarSwitcher.startAnimation(anim);

      anim = new TranslateAnimation(0, 0, 0, mPageSlider.getHeight());
      anim.setDuration(200);
      anim.setAnimationListener(
          new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
              mPageNumberView.setVisibility(View.INVISIBLE);
            }

            public void onAnimationRepeat(Animation animation) {}

            public void onAnimationEnd(Animation animation) {
              mPageSlider.setVisibility(View.INVISIBLE);
            }
          });
      mPageSlider.startAnimation(anim);
    }
  }