예제 #1
0
  private void showControls() {
    if (mControlsVisible) return;
    mControlsVisible = true;
    int duration = getResources().getInteger(R.integer.animation_controls_showHide);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      // Landscape: tab containers slide from left / right
      mConTabsA
          .animate()
          .alpha(1)
          .translationX(0)
          .setInterpolator(new DecelerateInterpolator())
          .setDuration(duration);
      mConTabsB
          .animate()
          .alpha(1)
          .translationX(0)
          .setInterpolator(new DecelerateInterpolator())
          .setDuration(duration);
    } else {
      // Portrait: tab containers slide from top / bottom
      mConTabsA
          .animate()
          .alpha(1)
          .translationY(0)
          .setInterpolator(new DecelerateInterpolator())
          .setDuration(duration);
      mConTabsB
          .animate()
          .alpha(1)
          .translationY(0)
          .setInterpolator(new DecelerateInterpolator())
          .setDuration(duration);
    }

    // 'Compress' the main fragment, to make space for the tab containers
    PointF shrinkPercents = getShrinkPercents();
    mConFragments
        .animate()
        .scaleX(shrinkPercents.x)
        .scaleY(shrinkPercents.y)
        .setInterpolator(new DecelerateInterpolator())
        .setDuration(duration);

    // Record button
    mChkRecord
        .animate()
        .alpha(1)
        .translationY(0)
        .setInterpolator(new DecelerateInterpolator())
        .setDuration(duration);

    mTxtTitle.animate().alpha(0).setDuration(duration).setStartDelay(0);
  }
예제 #2
0
  private void hideControls() {
    mControlsVisible = false;
    int duration = getResources().getInteger(R.integer.animation_controls_showHide);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      // Landscape: tab containers slide to left / right
      mConTabsA
          .animate()
          .alpha(0)
          .translationX(-mConTabsA.getWidth())
          .setInterpolator(new AccelerateInterpolator())
          .setDuration(duration);
      mConTabsB
          .animate()
          .alpha(0)
          .translationX(mConTabsB.getWidth())
          .setInterpolator(new AccelerateInterpolator())
          .setDuration(duration);
    } else {
      // Portrait: tab containers slide to top / bottom
      mConTabsA
          .animate()
          .alpha(0)
          .translationY(-mConTabsA.getHeight())
          .setInterpolator(new AccelerateInterpolator())
          .setDuration(duration);
      mConTabsB
          .animate()
          .alpha(0)
          .translationY(mConTabsB.getHeight())
          .setInterpolator(new AccelerateInterpolator())
          .setDuration(duration);
    }

    // 'Uncompress' the main fragment
    mConFragments
        .animate()
        .scaleX(1f)
        .scaleY(1f)
        .setInterpolator(new AccelerateInterpolator())
        .setDuration(duration);

    // Record button
    mChkRecord
        .animate()
        .alpha(0)
        .translationY(-mChkRecord.getHeight())
        .setInterpolator(new AccelerateInterpolator())
        .setDuration(duration);

    // Show the title
    mTxtTitle.animate().alpha(1f).setDuration(duration).setStartDelay(duration);
  }