org.chromium.chrome.browser.tab.EmptyTabObserver Java Examples

The following examples show how to use org.chromium.chrome.browser.tab.EmptyTabObserver. 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: CompositorViewHolder.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void internalInit() {
    mTabObserver = new EmptyTabObserver() {
        @Override
        public void onContentChanged(Tab tab) {
            CompositorViewHolder.this.onContentChanged();
        }
    };

    mEnableCompositorTabStrip = DeviceFormFactor.isTablet(getContext());

    addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            propagateViewportToLayouts(right - left, bottom - top);

            // If there's an event that needs to occur after the keyboard is hidden, post
            // it as a delayed event.  Otherwise this happens in the midst of the
            // ContentView's relayout, which causes the ContentView to relayout on top of the
            // stack view.  The 30ms is arbitrary, hoping to let the view get one repaint
            // in so the full page is shown.
            if (mPostHideKeyboardTask != null) {
                new Handler().postDelayed(mPostHideKeyboardTask, 30);
                mPostHideKeyboardTask = null;
            }
        }
    });

    mCompositorView = new CompositorView(getContext(), this);
    // mCompositorView should always be the first child.
    addView(mCompositorView, 0,
            new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
}