Search in sources :

Example 1 with CompositorViewHolder

use of org.chromium.chrome.browser.compositor.CompositorViewHolder 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;
        }
        // fullscreen manager.
        if (mTabModelSelectorImpl != null && mTabModelSelectorImpl.getCurrentTab() != null) {
            mTabModelSelectorImpl.getCurrentTab().setFullscreenManager(getFullscreenManager());
        }
        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(), 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");
    }
}
Also used : CommandLine(org.chromium.base.CommandLine) LayoutManagerChromePhone(org.chromium.chrome.browser.compositor.layouts.LayoutManagerChromePhone) EmptyBackgroundViewWrapper(org.chromium.chrome.browser.widget.emptybackground.EmptyBackgroundViewWrapper) CompositorViewHolder(org.chromium.chrome.browser.compositor.CompositorViewHolder) FindToolbarManager(org.chromium.chrome.browser.widget.findinpage.FindToolbarManager) FrameLayout(android.widget.FrameLayout) LayoutManagerChromeTablet(org.chromium.chrome.browser.compositor.layouts.LayoutManagerChromeTablet) OnClickListener(android.view.View.OnClickListener) View(android.view.View) ContentVideoView(org.chromium.content.browser.ContentVideoView)

Aggregations

View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 FrameLayout (android.widget.FrameLayout)1 CommandLine (org.chromium.base.CommandLine)1 CompositorViewHolder (org.chromium.chrome.browser.compositor.CompositorViewHolder)1 LayoutManagerChromePhone (org.chromium.chrome.browser.compositor.layouts.LayoutManagerChromePhone)1 LayoutManagerChromeTablet (org.chromium.chrome.browser.compositor.layouts.LayoutManagerChromeTablet)1 EmptyBackgroundViewWrapper (org.chromium.chrome.browser.widget.emptybackground.EmptyBackgroundViewWrapper)1 FindToolbarManager (org.chromium.chrome.browser.widget.findinpage.FindToolbarManager)1 ContentVideoView (org.chromium.content.browser.ContentVideoView)1