org.chromium.chrome.browser.compositor.layouts.Layout Java Examples
The following examples show how to use
org.chromium.chrome.browser.compositor.layouts.Layout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChromeTabbedActivity.java From delion with Apache License 2.0 | 5 votes |
private void toggleOverview() { Tab currentTab = getActivityTab(); ContentViewCore contentViewCore = currentTab != null ? currentTab.getContentViewCore() : null; if (!mLayoutManager.overviewVisible()) { getCompositorViewHolder().hideKeyboard(new Runnable() { @Override public void run() { mLayoutManager.showOverview(true); } }); if (contentViewCore != null) { contentViewCore.setAccessibilityState(false); } } else { Layout activeLayout = mLayoutManager.getActiveLayout(); if (activeLayout instanceof StackLayout) { ((StackLayout) activeLayout).commitOutstandingModelState(LayoutManager.time()); } if (getCurrentTabModel().getCount() != 0) { // Don't hide overview if current tab stack is empty() mLayoutManager.hideOverview(true); // hideOverview could change the current tab. Update the local variables. currentTab = getActivityTab(); contentViewCore = currentTab != null ? currentTab.getContentViewCore() : null; if (contentViewCore != null) { contentViewCore.setAccessibilityState(true); } } } }
Example #2
Source File: CompositorView.java From 365browser with Apache License 2.0 | 5 votes |
/** * Converts the layout into compositor layers. This is to be called on every frame the layout * is changing. * @param provider Provides the layout to be rendered. * @param forRotation Whether or not this is a special draw during a rotation. */ public void finalizeLayers(final LayoutProvider provider, boolean forRotation, final DrawingInfo progressBarDrawingInfo) { TraceEvent.begin("CompositorView:finalizeLayers"); Layout layout = provider.getActiveLayout(); if (layout == null || mNativeCompositorView == 0) { TraceEvent.end("CompositorView:finalizeLayers"); return; } if (!mPreloadedResources) { // Attempt to prefetch any necessary resources mResourceManager.preloadResources(AndroidResourceType.STATIC, StaticResourcePreloads.getSynchronousResources(getContext()), StaticResourcePreloads.getAsynchronousResources(getContext())); mPreloadedResources = true; } // IMPORTANT: Do not do anything that impacts the compositor layer tree before this line. // If you do, you could inadvertently trigger follow up renders. For further information // see dtrainor@, tedchoc@, or klobag@. nativeSetLayoutBounds(mNativeCompositorView); SceneLayer sceneLayer = provider.getUpdatedActiveSceneLayer(mLayerTitleCache, mTabContentManager, mResourceManager, provider.getFullscreenManager()); nativeSetSceneLayer(mNativeCompositorView, sceneLayer); TabModelImpl.flushActualTabSwitchLatencyMetric(); nativeFinalizeLayers(mNativeCompositorView); TraceEvent.end("CompositorView:finalizeLayers"); }
Example #3
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 5 votes |
private void toggleOverview() { Tab currentTab = getActivityTab(); ContentViewCore contentViewCore = currentTab != null ? currentTab.getContentViewCore() : null; if (!mLayoutManager.overviewVisible()) { getCompositorViewHolder().hideKeyboard(new Runnable() { @Override public void run() { mLayoutManager.showOverview(true); } }); if (contentViewCore != null) { contentViewCore.setAccessibilityState(false); } } else { Layout activeLayout = mLayoutManager.getActiveLayout(); if (activeLayout instanceof StackLayout) { ((StackLayout) activeLayout).commitOutstandingModelState(LayoutManager.time()); } if (getCurrentTabModel().getCount() != 0) { // Don't hide overview if current tab stack is empty() mLayoutManager.hideOverview(true); // hideOverview could change the current tab. Update the local variables. currentTab = getActivityTab(); contentViewCore = currentTab != null ? currentTab.getContentViewCore() : null; if (contentViewCore != null) { contentViewCore.setAccessibilityState(true); } } } }
Example #4
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 5 votes |
private void toggleOverview() { Tab currentTab = getActivityTab(); ContentViewCore contentViewCore = currentTab != null ? currentTab.getContentViewCore() : null; if (!mLayoutManager.overviewVisible()) { getCompositorViewHolder().hideKeyboard(new Runnable() { @Override public void run() { mLayoutManager.showOverview(true); } }); if (contentViewCore != null) { contentViewCore.setAccessibilityState(false); } } else { Layout activeLayout = mLayoutManager.getActiveLayout(); if (activeLayout instanceof StackLayout) { ((StackLayout) activeLayout).commitOutstandingModelState(LayoutManager.time()); } if (getCurrentTabModel().getCount() != 0) { // Don't hide overview if current tab stack is empty() mLayoutManager.hideOverview(true); // hideOverview could change the current tab. Update the local variables. currentTab = getActivityTab(); contentViewCore = currentTab != null ? currentTab.getContentViewCore() : null; if (contentViewCore != null) { contentViewCore.setAccessibilityState(true); } } } }
Example #5
Source File: CompositorView.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Converts the layout into compositor layers. This is to be called on every frame the layout * is changing. * @param provider Provides the layout to be rendered. * @param forRotation Whether or not this is a special draw during a rotation. */ public void finalizeLayers(final LayoutProvider provider, boolean forRotation, final DrawingInfo progressBarDrawingInfo) { TraceEvent.begin("CompositorView:finalizeLayers"); Layout layout = provider.getActiveLayout(); if (layout == null || mNativeCompositorView == 0) { TraceEvent.end("CompositorView:finalizeLayers"); return; } if (!mPreloadedResources) { // Attempt to prefetch any necessary resources mResourceManager.preloadResources(AndroidResourceType.STATIC, StaticResourcePreloads.getSynchronousResources(getContext()), StaticResourcePreloads.getAsynchronousResources(getContext())); mPreloadedResources = true; } // IMPORTANT: Do not do anything that impacts the compositor layer tree before this line. // If you do, you could inadvertently trigger follow up renders. For further information // see dtrainor@, tedchoc@, or klobag@. provider.getViewportPixel(mCacheViewport); nativeSetLayoutBounds(mNativeCompositorView); SceneLayer sceneLayer = provider.getUpdatedActiveSceneLayer(mCacheViewport, mLayerTitleCache, mTabContentManager, mResourceManager, provider.getFullscreenManager()); nativeSetSceneLayer(mNativeCompositorView, sceneLayer); final LayoutTab[] tabs = layout.getLayoutTabsToRender(); final int tabsCount = tabs != null ? tabs.length : 0; mLastLayerCount = tabsCount; TabModelImpl.flushActualTabSwitchLatencyMetric(); nativeFinalizeLayers(mNativeCompositorView); TraceEvent.end("CompositorView:finalizeLayers"); }
Example #6
Source File: ChromeActivity.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void onSceneChange(Layout layout) { }
Example #7
Source File: ChromeTabbedActivity.java From delion with Apache License 2.0 | 4 votes |
@Override public Layout createOverviewLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost, EventFilter eventFilter) { return new StackLayout(context, updateHost, renderHost, eventFilter); }
Example #8
Source File: TabListSceneLayer.java From 365browser with Apache License 2.0 | 4 votes |
/** * Pushes all relevant {@link LayoutTab}s from a {@link Layout} to the CC Layer tree. This will * let them be rendered on the screen. This should only be called when the Compositor has * disabled ScheduleComposite calls as this will change the tree and could subsequently cause * unnecessary follow up renders. * @param context The {@link Context} to use to query device information. * @param viewport The viewport for the screen. * @param contentViewport The visible viewport. * @param layout The {@link Layout} to push to the screen. * @param layerTitleCache An object for accessing tab layer titles. * @param tabContentManager An object for accessing tab content. * @param resourceManager An object for accessing static and dynamic resources. * @param fullscreenManager The fullscreen manager for browser controls information. */ public void pushLayers(Context context, RectF viewport, RectF contentViewport, Layout layout, LayerTitleCache layerTitleCache, TabContentManager tabContentManager, ResourceManager resourceManager, ChromeFullscreenManager fullscreenManager) { if (mNativePtr == 0) return; Resources res = context.getResources(); final float dpToPx = res.getDisplayMetrics().density; LayoutTab[] tabs = layout.getLayoutTabsToRender(); int tabsCount = tabs != null ? tabs.length : 0; nativeBeginBuildingFrame(mNativePtr); nativeUpdateLayer(mNativePtr, getTabListBackgroundColor(context), viewport.left, viewport.top, viewport.width(), viewport.height(), layerTitleCache, tabContentManager, resourceManager); for (int i = 0; i < tabsCount; i++) { LayoutTab t = tabs[i]; assert t.isVisible() : "LayoutTab in that list should be visible"; final float decoration = t.getDecorationAlpha(); int defaultThemeColor = t.isIncognito() ? ApiCompatibilityUtils.getColor(res, R.color.incognito_primary_color) : ApiCompatibilityUtils.getColor(res, R.color.default_primary_color); int toolbarBackgroundColor = t.getToolbarBackgroundColor(); int textBoxBackgroundColor = t.getTextBoxBackgroundColor(); float textBoxAlpha = t.getTextBoxAlpha(); if (t.getForceDefaultThemeColor()) { toolbarBackgroundColor = defaultThemeColor; textBoxBackgroundColor = ColorUtils.getTextBoxColorForToolbarBackground( res, false, toolbarBackgroundColor); textBoxAlpha = t.isIncognito() ? textBoxAlpha : 1f; } int closeButtonColor = ColorUtils.getThemedAssetColor(toolbarBackgroundColor, t.isIncognito()); int borderColorResource = t.isIncognito() ? R.color.tab_back_incognito : R.color.tab_back; // TODO(dtrainor, clholgat): remove "* dpToPx" once the native part fully supports dp. nativePutTabLayer(mNativePtr, t.getId(), R.id.control_container, R.drawable.btn_tab_close, R.drawable.tabswitcher_border_frame_shadow, R.drawable.tabswitcher_border_frame_decoration, R.drawable.logo_card_back, R.drawable.tabswitcher_border_frame, R.drawable.tabswitcher_border_frame_inner_shadow, t.canUseLiveTexture(), fullscreenManager.areBrowserControlsAtBottom(), t.getBackgroundColor(), ApiCompatibilityUtils.getColor(res, borderColorResource), t.isIncognito(), layout.getOrientation() == Orientation.PORTRAIT, t.getRenderX() * dpToPx, t.getRenderY() * dpToPx, t.getScaledContentWidth() * dpToPx, t.getScaledContentHeight() * dpToPx, t.getOriginalContentWidth() * dpToPx, t.getOriginalContentHeight() * dpToPx, contentViewport.height(), t.getClippedX() * dpToPx, t.getClippedY() * dpToPx, Math.min(t.getClippedWidth(), t.getScaledContentWidth()) * dpToPx, Math.min(t.getClippedHeight(), t.getScaledContentHeight()) * dpToPx, t.getTiltXPivotOffset() * dpToPx, t.getTiltYPivotOffset() * dpToPx, t.getTiltX(), t.getTiltY(), t.getAlpha(), t.getBorderAlpha() * decoration, t.getBorderInnerShadowAlpha() * decoration, decoration, t.getShadowOpacity() * decoration, t.getBorderCloseButtonAlpha() * decoration, LayoutTab.CLOSE_BUTTON_WIDTH_DP * dpToPx, t.getStaticToViewBlend(), t.getBorderScale(), t.getSaturation(), t.getBrightness(), t.showToolbar(), defaultThemeColor, toolbarBackgroundColor, closeButtonColor, t.anonymizeToolbar(), t.isTitleNeeded(), R.drawable.card_single, textBoxBackgroundColor, textBoxAlpha, t.getToolbarAlpha(), t.getToolbarYOffset() * dpToPx, t.getSideBorderScale(), t.insetBorderVertical()); } nativeFinishBuildingFrame(mNativePtr); }
Example #9
Source File: Stack.java From 365browser with Apache License 2.0 | 4 votes |
/** * Creates the {@link StackTab}s needed for display and populates {@link #mStackTabs}. * It is called from show() at the beginning of every new draw phase. It tries to reuse old * {@link StackTab} instead of creating new ones every time. * @param restoreState Whether or not to restore the {@link LayoutTab} state when we rebuild the * {@link StackTab}s. There are some properties like maximum content size * or whether or not to show the toolbar that might have to be restored if * we're calling this while the switcher is already visible. */ private void createStackTabs(boolean restoreState) { final int count = mTabModel.getCount(); if (count == 0) { cleanupTabs(); } else { StackTab[] oldTabs = mStackTabs; mStackTabs = new StackTab[count]; final boolean isIncognito = mTabModel.isIncognito(); final boolean needTitle = !mLayout.isHiding(); for (int i = 0; i < count; ++i) { Tab tab = mTabModel.getTabAt(i); int tabId = tab != null ? tab.getId() : Tab.INVALID_TAB_ID; mStackTabs[i] = findTabById(oldTabs, tabId); float maxContentWidth = -1.f; float maxContentHeight = -1.f; if (mStackTabs[i] != null && mStackTabs[i].getLayoutTab() != null && restoreState) { maxContentWidth = mStackTabs[i].getLayoutTab().getMaxContentWidth(); maxContentHeight = mStackTabs[i].getLayoutTab().getMaxContentHeight(); } LayoutTab layoutTab = mLayout.createLayoutTab(tabId, isIncognito, Layout.SHOW_CLOSE_BUTTON, needTitle, maxContentWidth, maxContentHeight); layoutTab.setInsetBorderVertical(true); layoutTab.setShowToolbar(!FeatureUtilities.isChromeHomeEnabled()); layoutTab.setToolbarAlpha(0.f); layoutTab.setAnonymizeToolbar(!mIsStackForCurrentTabModel || mTabModel.index() != i); if (mStackTabs[i] == null) { mStackTabs[i] = new StackTab(layoutTab); } else { mStackTabs[i].setLayoutTab(layoutTab); } mStackTabs[i].setNewIndex(i); // The initial enterStack animation will take care of // positioning, scaling, etc. } } }
Example #10
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void onSceneChange(Layout layout) { super.onSceneChange(layout); if (!layout.shouldDisplayContentOverlay()) mTabModelSelectorImpl.onTabsViewShown(); }
Example #11
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 4 votes |
@VisibleForTesting public Layout getOverviewListLayout() { return getLayoutManager().getOverviewListLayout(); }
Example #12
Source File: ChromeActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
@Override public void onSceneChange(Layout layout) { }
Example #13
Source File: TabListSceneLayer.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Pushes all relevant {@link LayoutTab}s from a {@link Layout} to the CC Layer tree. This will * let them be rendered on the screen. This should only be called when the Compositor has * disabled ScheduleComposite calls as this will change the tree and could subsequently cause * unnecessary follow up renders. * @param context The {@link Context} to use to query device information. * @param viewport The viewport for the screen. * @param contentViewport The visible viewport. * @param layout The {@link Layout} to push to the screen. * @param layerTitleCache An object for accessing tab layer titles. * @param tabContentManager An object for accessing tab content. * @param resourceManager An object for accessing static and dynamic resources. * @param fullscreenManager The fullscreen manager for browser controls information. */ public void pushLayers(Context context, Rect viewport, Rect contentViewport, Layout layout, LayerTitleCache layerTitleCache, TabContentManager tabContentManager, ResourceManager resourceManager, ChromeFullscreenManager fullscreenManager) { if (mNativePtr == 0) return; Resources res = context.getResources(); final float dpToPx = res.getDisplayMetrics().density; LayoutTab[] tabs = layout.getLayoutTabsToRender(); int tabsCount = tabs != null ? tabs.length : 0; nativeBeginBuildingFrame(mNativePtr); nativeUpdateLayer(mNativePtr, getTabListBackgroundColor(context), viewport.left, viewport.top, viewport.width(), viewport.height(), layerTitleCache, tabContentManager, resourceManager); for (int i = 0; i < tabsCount; i++) { LayoutTab t = tabs[i]; assert t.isVisible() : "LayoutTab in that list should be visible"; final float decoration = t.getDecorationAlpha(); int defaultThemeColor = t.isIncognito() ? ApiCompatibilityUtils.getColor(res, R.color.incognito_primary_color) : ApiCompatibilityUtils.getColor(res, R.color.default_primary_color); int closeButtonColor = ColorUtils.getThemedAssetColor(t.getToolbarBackgroundColor(), t.isIncognito()); int borderColorResource = t.isIncognito() ? R.color.tab_back_incognito : R.color.tab_back; // TODO(dtrainor, clholgat): remove "* dpToPx" once the native part fully supports dp. nativePutTabLayer(mNativePtr, t.getId(), R.id.control_container, R.drawable.btn_tab_close, R.drawable.tabswitcher_border_frame_shadow, R.drawable.tabswitcher_border_frame_decoration, R.drawable.logo_card_back, R.drawable.tabswitcher_border_frame, R.drawable.tabswitcher_border_frame_inner_shadow, t.canUseLiveTexture(), fullscreenManager.areBrowserControlsAtBottom(), t.getBackgroundColor(), ApiCompatibilityUtils.getColor(res, borderColorResource), t.isIncognito(), layout.getOrientation() == Orientation.PORTRAIT, t.getRenderX() * dpToPx, t.getRenderY() * dpToPx, t.getScaledContentWidth() * dpToPx, t.getScaledContentHeight() * dpToPx, t.getOriginalContentWidth() * dpToPx, t.getOriginalContentHeight() * dpToPx, contentViewport.height(), t.getClippedX() * dpToPx, t.getClippedY() * dpToPx, Math.min(t.getClippedWidth(), t.getScaledContentWidth()) * dpToPx, Math.min(t.getClippedHeight(), t.getScaledContentHeight()) * dpToPx, t.getTiltXPivotOffset() * dpToPx, t.getTiltYPivotOffset() * dpToPx, t.getTiltX(), t.getTiltY(), t.getAlpha(), t.getBorderAlpha() * decoration, t.getBorderInnerShadowAlpha() * decoration, decoration, t.getShadowOpacity() * decoration, t.getBorderCloseButtonAlpha() * decoration, LayoutTab.CLOSE_BUTTON_WIDTH_DP * dpToPx, t.getStaticToViewBlend(), t.getBorderScale(), t.getSaturation(), t.getBrightness(), t.showToolbar(), defaultThemeColor, t.getToolbarBackgroundColor(), closeButtonColor, t.anonymizeToolbar(), R.drawable.textbox, t.getTextBoxBackgroundColor(), t.getTextBoxAlpha(), t.getToolbarAlpha(), t.getToolbarYOffset() * dpToPx, t.getSideBorderScale(), t.insetBorderVertical()); } nativeFinishBuildingFrame(mNativePtr); }
Example #14
Source File: Stack.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Creates the {@link StackTab}s needed for display and populates {@link #mStackTabs}. * It is called from show() at the beginning of every new draw phase. It tries to reuse old * {@link StackTab} instead of creating new ones every time. * @param restoreState Whether or not to restore the {@link LayoutTab} state when we rebuild the * {@link StackTab}s. There are some properties like maximum content size * or whether or not to show the toolbar that might have to be restored if * we're calling this while the switcher is already visible. */ private void createStackTabs(boolean restoreState) { final int count = mTabModel.getCount(); if (count == 0) { cleanupTabs(); } else { StackTab[] oldTabs = mStackTabs; mStackTabs = new StackTab[count]; final boolean isIncognito = mTabModel.isIncognito(); final boolean needTitle = !mLayout.isHiding(); for (int i = 0; i < count; ++i) { Tab tab = mTabModel.getTabAt(i); int tabId = tab != null ? tab.getId() : Tab.INVALID_TAB_ID; mStackTabs[i] = findTabById(oldTabs, tabId); float maxContentWidth = -1.f; float maxContentHeight = -1.f; if (mStackTabs[i] != null && mStackTabs[i].getLayoutTab() != null && restoreState) { maxContentWidth = mStackTabs[i].getLayoutTab().getMaxContentWidth(); maxContentHeight = mStackTabs[i].getLayoutTab().getMaxContentHeight(); } LayoutTab layoutTab = mLayout.createLayoutTab(tabId, isIncognito, Layout.SHOW_CLOSE_BUTTON, needTitle, maxContentWidth, maxContentHeight); layoutTab.setInsetBorderVertical(true); layoutTab.setShowToolbar(true); layoutTab.setToolbarAlpha(0.f); layoutTab.setAnonymizeToolbar(!mIsStackForCurrentTabModel || mTabModel.index() != i); if (mStackTabs[i] == null) { mStackTabs[i] = new StackTab(layoutTab); } else { mStackTabs[i].setLayoutTab(layoutTab); } mStackTabs[i].setNewIndex(i); // The initial enterStack animation will take care of // positioning, scaling, etc. } } }
Example #15
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
@Override public void onSceneChange(Layout layout) { super.onSceneChange(layout); if (!layout.shouldDisplayContentOverlay()) mTabModelSelectorImpl.onTabsViewShown(); }
Example #16
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
@VisibleForTesting public Layout getOverviewListLayout() { return getLayoutManager().getOverviewListLayout(); }
Example #17
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
@Override public Layout createOverviewLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost, EventFilter eventFilter) { return new StackLayout(context, updateHost, renderHost, eventFilter); }
Example #18
Source File: ChromeActivity.java From delion with Apache License 2.0 | 4 votes |
@Override public void onSceneChange(Layout layout) { }
Example #19
Source File: TabListSceneLayer.java From delion with Apache License 2.0 | 4 votes |
/** * Pushes all relevant {@link LayoutTab}s from a {@link Layout} to the CC Layer tree. This will * let them be rendered on the screen. This should only be called when the Compositor has * disabled ScheduleComposite calls as this will change the tree and could subsequently cause * unnecessary follow up renders. * @param context The {@link Context} to use to query device information. * @param layout The {@link Layout} to push to the screen. */ public void pushLayers(Context context, Rect viewport, Rect contentViewport, Layout layout, LayerTitleCache layerTitleCache, TabContentManager tabContentManager, ResourceManager resourceManager) { if (mNativePtr == 0) return; Resources res = context.getResources(); final float dpToPx = res.getDisplayMetrics().density; LayoutTab[] tabs = layout.getLayoutTabsToRender(); int tabsCount = tabs != null ? tabs.length : 0; nativeBeginBuildingFrame(mNativePtr); nativeUpdateLayer(mNativePtr, getTabListBackgroundColor(context), viewport.left, viewport.top, viewport.width(), viewport.height(), layerTitleCache, tabContentManager, resourceManager); for (int i = 0; i < tabsCount; i++) { LayoutTab t = tabs[i]; assert t.isVisible() : "LayoutTab in that list should be visible"; final float decoration = t.getDecorationAlpha(); int defaultThemeColor = t.isIncognito() ? ApiCompatibilityUtils.getColor(res, R.color.incognito_primary_color) : ApiCompatibilityUtils.getColor(res, R.color.default_primary_color); // If theme colors are enabled in the tab switcher, the theme might require lighter // text. boolean isDarkTheme = t.isIncognito(); if (FeatureUtilities.areTabSwitcherThemeColorsEnabled()) { isDarkTheme |= ColorUtils.shouldUseLightForegroundOnBackground( t.getToolbarBackgroundColor()); } int closeBtnResource = isDarkTheme ? R.drawable.btn_tab_close_white_normal : R.drawable.btn_tab_close_normal; int borderColorResource = t.isIncognito() ? R.color.tab_back_incognito : R.color.tab_back; // TODO(dtrainor, clholgat): remove "* dpToPx" once the native part fully supports dp. nativePutTabLayer(mNativePtr, t.getId(), R.id.control_container, closeBtnResource, R.drawable.tabswitcher_border_frame_shadow, R.drawable.tabswitcher_border_frame_decoration, R.drawable.logo_card_back, R.drawable.tabswitcher_border_frame, R.drawable.tabswitcher_border_frame_inner_shadow, t.canUseLiveTexture(), t.getBackgroundColor(), ApiCompatibilityUtils.getColor(res, borderColorResource), t.isIncognito(), layout.getOrientation() == Orientation.PORTRAIT, t.getRenderX() * dpToPx, t.getRenderY() * dpToPx, t.getScaledContentWidth() * dpToPx, t.getScaledContentHeight() * dpToPx, t.getOriginalContentWidth() * dpToPx, t.getOriginalContentHeight() * dpToPx, contentViewport.height(), t.getClippedX() * dpToPx, t.getClippedY() * dpToPx, Math.min(t.getClippedWidth(), t.getScaledContentWidth()) * dpToPx, Math.min(t.getClippedHeight(), t.getScaledContentHeight()) * dpToPx, t.getTiltXPivotOffset() * dpToPx, t.getTiltYPivotOffset() * dpToPx, t.getTiltX(), t.getTiltY(), t.getAlpha(), t.getBorderAlpha() * decoration, t.getBorderInnerShadowAlpha() * decoration, decoration, t.getShadowOpacity() * decoration, t.getBorderCloseButtonAlpha() * decoration, LayoutTab.CLOSE_BUTTON_WIDTH_DP * dpToPx, t.getStaticToViewBlend(), t.getBorderScale(), t.getSaturation(), t.getBrightness(), t.showToolbar(), defaultThemeColor, t.getToolbarBackgroundColor(), t.anonymizeToolbar(), R.drawable.textbox, t.getTextBoxBackgroundColor(), t.getTextBoxAlpha(), t.getToolbarAlpha(), t.getToolbarYOffset() * dpToPx, t.getSideBorderScale(), true, t.insetBorderVertical()); } nativeFinishBuildingFrame(mNativePtr); }
Example #20
Source File: Stack.java From delion with Apache License 2.0 | 4 votes |
/** * Creates the {@link StackTab}s needed for display and populates {@link #mStackTabs}. * It is called from show() at the beginning of every new draw phase. It tries to reuse old * {@link StackTab} instead of creating new ones every time. * @param restoreState Whether or not to restore the {@link LayoutTab} state when we rebuild the * {@link StackTab}s. There are some properties like maximum content size * or whether or not to show the toolbar that might have to be restored if * we're calling this while the switcher is already visible. */ private void createStackTabs(boolean restoreState) { final int count = mTabModel.getCount(); if (count == 0) { cleanupTabs(); } else { StackTab[] oldTabs = mStackTabs; mStackTabs = new StackTab[count]; final boolean isIncognito = mTabModel.isIncognito(); final boolean needTitle = !mLayout.isHiding(); for (int i = 0; i < count; ++i) { Tab tab = mTabModel.getTabAt(i); int tabId = tab != null ? tab.getId() : Tab.INVALID_TAB_ID; mStackTabs[i] = findTabById(oldTabs, tabId); float maxContentWidth = -1.f; float maxContentHeight = -1.f; if (mStackTabs[i] != null && mStackTabs[i].getLayoutTab() != null && restoreState) { maxContentWidth = mStackTabs[i].getLayoutTab().getMaxContentWidth(); maxContentHeight = mStackTabs[i].getLayoutTab().getMaxContentHeight(); } LayoutTab layoutTab = mLayout.createLayoutTab(tabId, isIncognito, Layout.SHOW_CLOSE_BUTTON, needTitle, maxContentWidth, maxContentHeight); layoutTab.setInsetBorderVertical(true); layoutTab.setShowToolbar(true); layoutTab.setToolbarAlpha(0.f); layoutTab.setAnonymizeToolbar(!mIsStackForCurrentTabModel || mTabModel.index() != i); if (mStackTabs[i] == null) { mStackTabs[i] = new StackTab(layoutTab); } else { mStackTabs[i].setLayoutTab(layoutTab); } mStackTabs[i].setNewIndex(i); // The initial enterStack animation will take care of // positioning, scaling, etc. } } }
Example #21
Source File: CompositorView.java From delion with Apache License 2.0 | 4 votes |
/** * Converts the layout into compositor layers. This is to be called on every frame the layout * is changing. * @param provider Provides the layout to be rendered. * @param forRotation Whether or not this is a special draw during a rotation. */ public void finalizeLayers(final LayoutProvider provider, boolean forRotation, final DrawingInfo progressBarDrawingInfo) { TraceEvent.begin("CompositorView:finalizeLayers"); Layout layout = provider.getActiveLayout(); if (layout == null || mNativeCompositorView == 0) { TraceEvent.end("CompositorView:finalizeLayers"); return; } if (!mPreloadedResources) { // Attempt to prefetch any necessary resources mResourceManager.preloadResources(AndroidResourceType.STATIC, StaticResourcePreloads.getSynchronousResources(getContext()), StaticResourcePreloads.getAsynchronousResources(getContext())); mPreloadedResources = true; } // IMPORTANT: Do not do anything that impacts the compositor layer tree before this line. // If you do, you could inadvertently trigger follow up renders. For further information // see dtrainor@, tedchoc@, or klobag@. // TODO(jscholler): change 1.0f to dpToPx once the native part is fully supporting dp. mRenderHost.getVisibleViewport(mCacheVisibleViewport); mCacheVisibleViewport.right = mCacheVisibleViewport.left + mSurfaceWidth; mCacheVisibleViewport.bottom = mCacheVisibleViewport.top + mSurfaceHeight; provider.getViewportPixel(mCacheViewport); nativeSetLayoutViewport(mNativeCompositorView, mCacheViewport.left, mCacheViewport.top, mCacheViewport.width(), mCacheViewport.height(), mCacheVisibleViewport.left, mCacheVisibleViewport.top, 1.0f); SceneLayer sceneLayer = provider.getUpdatedActiveSceneLayer(mCacheViewport, mCacheVisibleViewport, mLayerTitleCache, mTabContentManager, mResourceManager, provider.getFullscreenManager()); nativeSetSceneLayer(mNativeCompositorView, sceneLayer); final LayoutTab[] tabs = layout.getLayoutTabsToRender(); final int tabsCount = tabs != null ? tabs.length : 0; mLastLayerCount = tabsCount; TabModelImpl.flushActualTabSwitchLatencyMetric(); nativeFinalizeLayers(mNativeCompositorView); TraceEvent.end("CompositorView:finalizeLayers"); }
Example #22
Source File: ChromeTabbedActivity.java From delion with Apache License 2.0 | 4 votes |
@Override public void onSceneChange(Layout layout) { super.onSceneChange(layout); if (!layout.shouldDisplayContentOverlay()) mTabModelSelectorImpl.onTabsViewShown(); }
Example #23
Source File: ChromeTabbedActivity.java From delion with Apache License 2.0 | 4 votes |
@VisibleForTesting public Layout getOverviewListLayout() { return getLayoutManager().getOverviewListLayout(); }