コード例 #1
0
ファイル: DeckView.java プロジェクト: wangzhen90/Deck
  /** Handler for the first layout. */
  void onFirstLayout() {
    int offscreenY =
        mLayoutAlgorithm.mViewRect.bottom
            - (mLayoutAlgorithm.mTaskRect.top - mLayoutAlgorithm.mViewRect.top);

    int childCount = getChildCount();

    // Prepare the first view for its enter animation
    for (int i = childCount - 1; i >= 0; i--) {
      DeckChildView tv = (DeckChildView) getChildAt(i);
      // TODO: The false needs to go!
      tv.prepareEnterRecentsAnimation(i == childCount - 1, false, offscreenY);
    }

    // If the enter animation started already and we haven't completed a layout yet, do the
    // enter animation now
    if (mStartEnterAnimationRequestedAfterLayout) {
      startEnterRecentsAnimation(mStartEnterAnimationContext);
      mStartEnterAnimationRequestedAfterLayout = false;
      mStartEnterAnimationContext = null;
    }

    // When Alt-Tabbing, focus the previous task (but leave the animation until we finish the
    // enter animation).
    if (mConfig.launchedWithAltTab) {
      if (mConfig.launchedFromAppWithThumbnail) {
        focusTask(
            Math.max(0, mCallback.getData().size() - 2),
            false,
            mConfig.launchedHasConfigurationChanged);
      } else {
        focusTask(
            Math.max(0, mCallback.getData().size() - 1),
            false,
            mConfig.launchedHasConfigurationChanged);
      }
    }

    // Start dozing
    mUIDozeTrigger.startDozing();
  }