@Override
  protected void updateLayout(long time, long dt) {
    super.updateLayout(time, dt);
    if (mBaseTab == null) return;

    mBaseTab.setY(mSearchPanel.getBasePageY());
    mBaseTab.setBrightness(mSearchPanel.getBasePageBrightness());

    boolean needUpdate = mBaseTab.updateSnap(dt);
    if (needUpdate) requestUpdate();
  }
Exemplo n.º 2
0
  /**
   * Updates the position, scale, rotation and alpha values of mAnimatedTab.
   *
   * @param discard The value that specify how far along are we in the discard animation. 0 is
   *     filling the screen. Valid values are [-range .. range] where range is computed by {@link
   *     SimpleAnimationLayout#getDiscardRange()}.
   */
  private void setDiscardAmount(float discard) {
    if (mAnimatedTab != null) {
      final float range = getDiscardRange();
      final float scale = Stack.computeDiscardScale(discard, range, true);

      final float deltaX = mAnimatedTab.getOriginalContentWidth();
      final float deltaY = mAnimatedTab.getOriginalContentHeight() / 2.f;
      mAnimatedTab.setX(deltaX * (1.f - scale));
      mAnimatedTab.setY(deltaY * (1.f - scale));
      mAnimatedTab.setScale(scale);
      mAnimatedTab.setBorderScale(scale);
      mAnimatedTab.setAlpha(Stack.computeDiscardAlpha(discard, range));
    }
  }