Search in sources :

Example 1 with FullscreenManager

use of org.chromium.chrome.browser.fullscreen.FullscreenManager in project AndroidChromium by JackyAndroid.

the class TabWebContentsObserver method didNavigateMainFrame.

@Override
public void didNavigateMainFrame(String url, String baseUrl, boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
    FullscreenManager fullscreenManager = mTab.getFullscreenManager();
    if (isNavigationToDifferentPage && fullscreenManager != null) {
        fullscreenManager.setPersistentFullscreenMode(false);
    }
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidNavigateMainFrame(mTab, url, baseUrl, isNavigationToDifferentPage, isFragmentNavigation, statusCode);
    }
    mTab.stopSwipeRefreshHandler();
}
Also used : FullscreenManager(org.chromium.chrome.browser.fullscreen.FullscreenManager)

Example 2 with FullscreenManager

use of org.chromium.chrome.browser.fullscreen.FullscreenManager in project AndroidChromium by JackyAndroid.

the class Tab method createGestureStateListener.

private GestureStateListener createGestureStateListener() {
    return new GestureStateListener() {

        @Override
        public void onFlingStartGesture(int scrollOffsetY, int scrollExtentY) {
            onScrollingStateChanged();
        }

        @Override
        public void onFlingEndGesture(int scrollOffsetY, int scrollExtentY) {
            onScrollingStateChanged();
        }

        @Override
        public void onScrollStarted(int scrollOffsetY, int scrollExtentY) {
            onScrollingStateChanged();
        }

        @Override
        public void onScrollEnded(int scrollOffsetY, int scrollExtentY) {
            onScrollingStateChanged();
        }

        private void onScrollingStateChanged() {
            FullscreenManager fullscreenManager = getFullscreenManager();
            if (fullscreenManager == null)
                return;
            fullscreenManager.onContentViewScrollingStateChanged(getContentViewCore() != null && getContentViewCore().isScrollInProgress());
        }
    };
}
Also used : GestureStateListener(org.chromium.content_public.browser.GestureStateListener) FullscreenManager(org.chromium.chrome.browser.fullscreen.FullscreenManager)

Example 3 with FullscreenManager

use of org.chromium.chrome.browser.fullscreen.FullscreenManager in project AndroidChromium by JackyAndroid.

the class Tab method showSadTab.

/**
     * Constructs and shows a sad tab (Aw, Snap!).
     */
protected void showSadTab() {
    if (getContentViewCore() != null) {
        OnClickListener suggestionAction = new OnClickListener() {

            @Override
            public void onClick(View view) {
                Activity activity = mWindowAndroid.getActivity().get();
                assert activity != null;
                HelpAndFeedback.getInstance(activity).show(activity, activity.getString(R.string.help_context_sad_tab), Profile.getLastUsedProfile(), null);
            }
        };
        OnClickListener reloadButtonAction = new OnClickListener() {

            @Override
            public void onClick(View view) {
                reload();
            }
        };
        // Make sure we are not adding the "Aw, snap" view over an existing one.
        assert mSadTabView == null;
        mSadTabView = SadTabViewFactory.createSadTabView(mThemedApplicationContext, suggestionAction, reloadButtonAction);
        // Show the sad tab inside ContentView.
        getContentViewCore().getContainerView().addView(mSadTabView, new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        notifyContentChanged();
    }
    FullscreenManager fullscreenManager = getFullscreenManager();
    if (fullscreenManager != null) {
        fullscreenManager.setPositionsForTabToNonFullscreen();
    }
}
Also used : FullscreenManager(org.chromium.chrome.browser.fullscreen.FullscreenManager) LayoutParams(android.widget.FrameLayout.LayoutParams) FrameLayout(android.widget.FrameLayout) OnClickListener(android.view.View.OnClickListener) ChromeLauncherActivity(org.chromium.chrome.browser.document.ChromeLauncherActivity) ChromeActivity(org.chromium.chrome.browser.ChromeActivity) CustomTabActivity(org.chromium.chrome.browser.customtabs.CustomTabActivity) Activity(android.app.Activity) ContentView(org.chromium.content.browser.ContentView) View(android.view.View)

Example 4 with FullscreenManager

use of org.chromium.chrome.browser.fullscreen.FullscreenManager in project AndroidChromium by JackyAndroid.

the class TabWebContentsDelegateAndroid method getContentVideoViewEmbedder.

@Override
public ContentVideoViewEmbedder getContentVideoViewEmbedder() {
    return new ActivityContentVideoViewEmbedder(mTab.getActivity()) {

        @Override
        public void enterFullscreenVideo(View view, boolean isVideoLoaded) {
            super.enterFullscreenVideo(view, isVideoLoaded);
            FullscreenManager fullscreenManager = mTab.getFullscreenManager();
            if (fullscreenManager != null) {
                fullscreenManager.setOverlayVideoMode(true);
                // Disable double tap for video.
                ContentViewCore cvc = mTab.getContentViewCore();
                if (cvc != null) {
                    cvc.updateDoubleTapSupport(false);
                }
            }
        }

        @Override
        public void exitFullscreenVideo() {
            FullscreenManager fullscreenManager = mTab.getFullscreenManager();
            if (fullscreenManager != null) {
                fullscreenManager.setOverlayVideoMode(false);
                // Disable double tap for video.
                ContentViewCore cvc = mTab.getContentViewCore();
                if (cvc != null) {
                    cvc.updateDoubleTapSupport(true);
                }
            }
            super.exitFullscreenVideo();
        }
    };
}
Also used : FullscreenManager(org.chromium.chrome.browser.fullscreen.FullscreenManager) ContentViewCore(org.chromium.content.browser.ContentViewCore) ActivityContentVideoViewEmbedder(org.chromium.content.browser.ActivityContentVideoViewEmbedder) View(android.view.View)

Aggregations

FullscreenManager (org.chromium.chrome.browser.fullscreen.FullscreenManager)4 View (android.view.View)2 Activity (android.app.Activity)1 OnClickListener (android.view.View.OnClickListener)1 FrameLayout (android.widget.FrameLayout)1 LayoutParams (android.widget.FrameLayout.LayoutParams)1 ChromeActivity (org.chromium.chrome.browser.ChromeActivity)1 CustomTabActivity (org.chromium.chrome.browser.customtabs.CustomTabActivity)1 ChromeLauncherActivity (org.chromium.chrome.browser.document.ChromeLauncherActivity)1 ActivityContentVideoViewEmbedder (org.chromium.content.browser.ActivityContentVideoViewEmbedder)1 ContentView (org.chromium.content.browser.ContentView)1 ContentViewCore (org.chromium.content.browser.ContentViewCore)1 GestureStateListener (org.chromium.content_public.browser.GestureStateListener)1