use of org.chromium.chrome.browser.compositor.layouts.LayoutManagerChromeTablet in project AndroidChromium by JackyAndroid.
the class ChromeTabbedActivity method initializeUI.
private void initializeUI() {
try {
TraceEvent.begin("ChromeTabbedActivity.initializeUI");
CommandLine commandLine = CommandLine.getInstance();
commandLine.appendSwitch(ContentSwitches.ENABLE_INSTANT_EXTENDED_API);
CompositorViewHolder compositorViewHolder = getCompositorViewHolder();
if (DeviceFormFactor.isTablet(this)) {
boolean enableTabSwitcher = CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK);
mLayoutManager = new LayoutManagerChromeTablet(compositorViewHolder, enableTabSwitcher ? new StackLayoutFactory() : null);
} else {
mLayoutManager = new LayoutManagerChromePhone(compositorViewHolder, new StackLayoutFactory());
}
mLayoutManager.setEnableAnimations(DeviceClassManager.enableAnimations(this));
mLayoutManager.addOverviewModeObserver(this);
// TODO(yusufo): get rid of findViewById(R.id.url_bar).
initializeCompositorContent(mLayoutManager, findViewById(R.id.url_bar), mContentContainer, mControlContainer);
mTabModelSelectorImpl.setOverviewModeBehavior(mLayoutManager);
mUndoBarPopupController.initialize();
// Adjust the content container if we're not entering fullscreen mode.
if (getFullscreenManager() == null) {
float controlHeight = getResources().getDimension(R.dimen.control_container_height);
((FrameLayout.LayoutParams) mContentContainer.getLayoutParams()).topMargin = (int) controlHeight;
}
mFindToolbarManager = new FindToolbarManager(this, getToolbarManager().getActionModeController().getActionModeCallback());
if (getContextualSearchManager() != null) {
getContextualSearchManager().setFindToolbarManager(mFindToolbarManager);
}
OnClickListener tabSwitcherClickHandler = new OnClickListener() {
@Override
public void onClick(View v) {
if (getFullscreenManager() != null && getFullscreenManager().getPersistentFullscreenMode()) {
return;
}
toggleOverview();
}
};
OnClickListener newTabClickHandler = new OnClickListener() {
@Override
public void onClick(View v) {
getTabModelSelector().getModel(false).commitAllTabClosures();
// This assumes that the keyboard can not be seen at the same time as the
// newtab button on the toolbar.
getCurrentTabCreator().launchNTP();
mLocaleManager.showSearchEnginePromoIfNeeded(ChromeTabbedActivity.this);
}
};
OnClickListener bookmarkClickHandler = new OnClickListener() {
@Override
public void onClick(View v) {
addOrEditBookmark(getActivityTab());
}
};
getToolbarManager().initializeWithNative(mTabModelSelectorImpl, getFullscreenManager().getBrowserVisibilityDelegate(), mFindToolbarManager, mLayoutManager, mLayoutManager, tabSwitcherClickHandler, newTabClickHandler, bookmarkClickHandler, null);
if (isTablet()) {
EmptyBackgroundViewWrapper bgViewWrapper = new EmptyBackgroundViewWrapper(getTabModelSelector(), getTabCreator(false), ChromeTabbedActivity.this, getAppMenuHandler(), getSnackbarManager(), mLayoutManager);
bgViewWrapper.initialize();
}
mLayoutManager.hideOverview(false);
mUIInitialized = true;
} finally {
TraceEvent.end("ChromeTabbedActivity.initializeUI");
}
}
Aggregations