Пример #1
0
 @Override
 public void startTransition(
     LayoutTransition transition, ViewGroup container, View view, int transitionType) {
   if (view.getId() == TkR.id.tablet_back) {
     mBackTransitioning = true;
   } else if (view.getId() == TkR.id.tablet_home
       && transitionType == LayoutTransition.APPEARING) {
     mHomeAppearing = true;
     mStartDelay = transition.getStartDelay(transitionType);
     mDuration = transition.getDuration(transitionType);
     mInterpolator = transition.getInterpolator(transitionType);
   }
 }
Пример #2
0
  /** Show or hide the laps-list */
  private void showLaps() {
    if (DEBUG)
      Log.v(
          LOG_TAG, String.format("StopwatchFragment.showLaps: count=%d", mLapsAdapter.getCount()));

    boolean lapsVisible = mLapsAdapter.getCount() > 0;

    // Layout change animations will start upon the first add/hide view. Temporarily disable
    // the layout transition animation for the spacers, make the changes, then re-enable
    // the animation for the add/hide laps-list
    if (mSpacersUsed) {
      int spacersVisibility = lapsVisible ? View.GONE : View.VISIBLE;
      ViewGroup rootView = (ViewGroup) getView();
      if (rootView != null) {
        rootView.setLayoutTransition(null);
        if (mStartSpace != null) {
          mStartSpace.setVisibility(spacersVisibility);
        }
        if (mEndSpace != null) {
          mEndSpace.setVisibility(spacersVisibility);
        }
        rootView.setLayoutTransition(mLayoutTransition);
      }
    }

    if (lapsVisible) {
      // There are laps - show the laps-list
      // No delay for the CircleButtonsLayout changes - start immediately so that the
      // circle has shifted before the laps-list starts appearing.
      mCircleLayoutTransition.setStartDelay(LayoutTransition.CHANGING, 0);

      mLapsList.setVisibility(View.VISIBLE);
    } else {
      // There are no laps - hide the laps list

      // Delay the CircleButtonsLayout animation until after the laps-list disappears
      long startDelay =
          mLayoutTransition.getStartDelay(LayoutTransition.DISAPPEARING)
              + mLayoutTransition.getDuration(LayoutTransition.DISAPPEARING);
      mCircleLayoutTransition.setStartDelay(LayoutTransition.CHANGING, startDelay);
      mLapsList.setVisibility(View.GONE);
    }
  }