/** * 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)); } }
/** * Creates the Base Page's LayoutTab to be presented in the screen. * * @param layoutTab The {@link Layout} instance. */ private void createBaseLayoutTab(LayoutTab layoutTab) { if (mTabModelSelector == null) return; int baseTabId = mTabModelSelector.getCurrentTabId(); if (baseTabId == Tab.INVALID_TAB_ID) return; mBaseTab = createLayoutTab( baseTabId, mTabModelSelector.isIncognitoSelected(), NO_CLOSE_BUTTON, NO_TITLE); assert mBaseTab != null; mBaseTab.setScale(1.f); mBaseTab.setBorderScale(1.f); mBaseTab.setBorderAlpha(0.f); mLayoutTabs = new LayoutTab[] {mBaseTab}; }