org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChangeReason Java Examples

The following examples show how to use org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChangeReason. 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: ContextualSearchManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes this manager.
 * @param parentView The parent view to attach Contextual Search UX to.
 */
public void initialize(ViewGroup parentView) {
    mNativeContextualSearchManagerPtr = nativeInit();

    mParentView = parentView;
    mParentView.getViewTreeObserver().addOnGlobalFocusChangeListener(mOnFocusChangeListener);

    mTabRedirectHandler = new TabRedirectHandler(mActivity);

    mIsShowingPromo = false;
    mDidLogPromoOutcome = false;
    mDidStartLoadingResolvedSearchRequest = false;
    mWereSearchResultsSeen = false;
    mIsInitialized = true;

    mInternalStateController.reset(StateChangeReason.UNKNOWN);

    listenForTabModelSelectorNotifications();
}
 
Example #2
Source File: OverlayPanelManager.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Request that a panel with the specified ID be shown. This does not necessarily mean the
 * panel will be shown.
 * @param panel The panel to show.
 * @param reason The reason the panel is going to be shown.
 */
public void requestPanelShow(OverlayPanel panel, StateChangeReason reason) {
    if (panel == null || panel == mActivePanel) return;

    if (mActivePanel == null) {
        // If no panel is currently showing, simply show the requesting panel.
        mActivePanel = panel;
        // TODO(mdjones): peekPanel should not be exposed publicly since the manager
        // controls if a panel should show or not.
        mActivePanel.peekPanel(reason);

    } else if (panel.getPriority().ordinal() > mActivePanel.getPriority().ordinal()) {
        // If a panel with higher priority than the active one requests to be shown, suppress
        // the active panel and show the requesting one.
        // NOTE(mdjones): closePanel will trigger notifyPanelClosed.
        mPendingPanel = panel;
        mPendingReason = reason;
        mActivePanel.closePanel(StateChangeReason.SUPPRESS, true);

    } else if (panel.canBeSuppressed()) {
        // If a panel was showing and the requesting panel has a lower priority, suppress it
        // if possible.
        mSuppressedPanel = panel;
    }
}
 
Example #3
Source File: OverlayPanelManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Request that a panel with the specified ID be shown. This does not necessarily mean the
 * panel will be shown.
 * @param panel The panel to show.
 * @param reason The reason the panel is going to be shown.
 */
public void requestPanelShow(OverlayPanel panel, StateChangeReason reason) {
    if (panel == null || panel == mActivePanel) return;

    if (mActivePanel == null) {
        // If no panel is currently showing, simply show the requesting panel.
        mActivePanel = panel;
        // TODO(mdjones): peekPanel should not be exposed publicly since the manager
        // controls if a panel should show or not.
        mActivePanel.peekPanel(reason);

    } else if (panel.getPriority().ordinal() > mActivePanel.getPriority().ordinal()) {
        // If a panel with higher priority than the active one requests to be shown, suppress
        // the active panel and show the requesting one. closePanel will trigger
        // notifyPanelClosed.
        mPendingPanel = panel;
        mPendingReason = reason;
        mActivePanel.closePanel(StateChangeReason.SUPPRESS, true);

    } else if (panel.canBeSuppressed()) {
        // If a panel was showing and the requesting panel has a lower priority, suppress it
        // if possible.
        if (!mSuppressedPanels.contains(panel)) mSuppressedPanels.add(panel);
    }
}
 
Example #4
Source File: OverlayPanelAnimation.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Called when layout-specific actions are needed after the animation finishes.
 */
protected void onAnimationFinished() {
    // If animating to a particular PanelState, and after completing
    // resizing the Panel to its desired state, then the Panel's state
    // should be updated. This method also is called when an animation
    // is cancelled (which can happen by a subsequent gesture while
    // an animation is happening). That's why the actual height should
    // be checked.
    // TODO(mdjones): Move animations not directly related to the panel's state into their
    // own animation handler (i.e. peek promo, G sprite, etc.). See https://crbug.com/617307.
    if (mAnimatingState != null && mAnimatingState != PanelState.UNDEFINED
            && getHeight() == getPanelHeightFromState(mAnimatingState)) {
        setPanelState(mAnimatingState, mAnimatingStateReason);
    }

    mAnimatingState = PanelState.UNDEFINED;
    mAnimatingStateReason = StateChangeReason.UNKNOWN;
}
 
Example #5
Source File: OverlayPanelAnimation.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Called when layout-specific actions are needed after the animation finishes.
 */
protected void onAnimationFinished() {
    // If animating to a particular PanelState, and after completing
    // resizing the Panel to its desired state, then the Panel's state
    // should be updated. This method also is called when an animation
    // is cancelled (which can happen by a subsequent gesture while
    // an animation is happening). That's why the actual height should
    // be checked.
    // TODO(mdjones): Move animations not directly related to the panel's state into their
    // own animation handler (i.e. peek promo, G sprite, etc.). See https://crbug.com/617307.
    if (mAnimatingState != null && mAnimatingState != PanelState.UNDEFINED
            && getHeight() == getPanelHeightFromState(mAnimatingState)) {
        setPanelState(mAnimatingState, mAnimatingStateReason);
    }

    mAnimatingState = PanelState.UNDEFINED;
    mAnimatingStateReason = StateChangeReason.UNKNOWN;
}
 
Example #6
Source File: ReaderModeManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * @return A FindToolbarObserver capable of hiding the Reader Mode panel.
 */
public FindToolbarObserver getFindToolbarObserver() {
    return new FindToolbarObserver() {
        @Override
        public void onFindToolbarShown() {
            mIsFindToolbarShowing = true;
            closeReaderPanel(StateChangeReason.UNKNOWN, true);
        }

        @Override
        public void onFindToolbarHidden() {
            mIsFindToolbarShowing = false;
            requestReaderPanelShow(StateChangeReason.UNKNOWN);
        }
    };
}
 
Example #7
Source File: ReaderModeManager.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * This is a wrapper for "requestPanelShow" that checks if reader mode is possible before
 * showing.
 * @param reason The reason the panel is requesting to be shown.
 */
protected void requestReaderPanelShow(StateChangeReason reason) {
    if (mTabModelSelector == null) return;

    int currentTabId = mTabModelSelector.getCurrentTabId();
    if (currentTabId == Tab.INVALID_TAB_ID) return;

    if (mReaderModePanel == null || !mTabStatusMap.containsKey(currentTabId)
            || mTabStatusMap.get(currentTabId).getStatus() != POSSIBLE
            || mTabStatusMap.get(currentTabId).isDismissed()
            || mIsInfoBarContainerShown
            || mIsFindToolbarShowing
            || mIsFullscreenModeEntered
            || mIsKeyboardShowing
            || DeviceClassManager.isAccessibilityModeEnabled(mChromeActivity)) {
        return;
    }

    mReaderModePanel.requestPanelShow(reason);
}
 
Example #8
Source File: ReaderModeManager.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * @return A FindToolbarObserver capable of hiding the Reader Mode panel.
 */
public FindToolbarObserver getFindToolbarObserver() {
    return new FindToolbarObserver() {
        @Override
        public void onFindToolbarShown() {
            mIsFindToolbarShowing = true;
            closeReaderPanel(StateChangeReason.UNKNOWN, true);
        }

        @Override
        public void onFindToolbarHidden() {
            mIsFindToolbarShowing = false;
            requestReaderPanelShow(StateChangeReason.UNKNOWN);
        }
    };
}
 
Example #9
Source File: ContextualSearchManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public boolean shouldInterceptNavigation(ExternalNavigationHandler externalNavHandler,
        NavigationParams navigationParams) {
    mTabRedirectHandler.updateNewUrlLoading(navigationParams.pageTransitionType,
            navigationParams.isRedirect,
            navigationParams.hasUserGesture || navigationParams.hasUserGestureCarryover,
            mActivity.getLastUserInteractionTime(), TabRedirectHandler.INVALID_ENTRY_INDEX);
    ExternalNavigationParams params = new ExternalNavigationParams.Builder(
            navigationParams.url, false, navigationParams.referrer,
            navigationParams.pageTransitionType, navigationParams.isRedirect)
            .setApplicationMustBeInForeground(true)
            .setRedirectHandler(mTabRedirectHandler)
            .setIsMainFrame(navigationParams.isMainFrame)
            .build();
    if (externalNavHandler.shouldOverrideUrlLoading(params)
            != OverrideUrlLoadingResult.NO_OVERRIDE) {
        mSearchPanel.maximizePanelThenPromoteToTab(StateChangeReason.TAB_PROMOTION,
                INTERCEPT_NAVIGATION_PROMOTION_ANIMATION_DURATION_MS);
        return false;
    }
    if (navigationParams.isExternalProtocol) {
        return false;
    }
    return true;
}
 
Example #10
Source File: OverlayPanelManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Notify the manager that some other object hid the panel.
 * NOTE(mdjones): It is possible that a panel other than the one currently showing was hidden.
 * @param panel The panel that was closed.
 */
public void notifyPanelClosed(OverlayPanel panel, StateChangeReason reason) {
    // TODO(mdjones): Close should behave like "requestShowPanel". The reason it currently does
    // not is because closing will cancel animation for that panel. This method waits for the
    // panel's "onClosed" event to fire, thus preserving the animation.
    if (panel == null) return;

    // If the reason to close was to suppress, only suppress the panel.
    if (reason == StateChangeReason.SUPPRESS) {
        if (mActivePanel == panel) {
            if (mActivePanel.canBeSuppressed()) {
                mSuppressedPanels.add(mActivePanel);
            }
            mActivePanel = mPendingPanel;
            mActivePanel.peekPanel(mPendingReason);
            mPendingPanel = null;
            mPendingReason = StateChangeReason.UNKNOWN;
        }
    } else {
        // Normal close panel flow.
        if (panel == mActivePanel) {
            mActivePanel = null;
            if (!mSuppressedPanels.isEmpty()) {
                mActivePanel = mSuppressedPanels.poll();
                mActivePanel.peekPanel(StateChangeReason.UNSUPPRESS);
            }
        } else {
            mSuppressedPanels.remove(panel);
        }
    }
}
 
Example #11
Source File: ContextualSearchManager.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Called to check if an external navigation is being done and take the appropriate action:
 * Auto-promotes the panel into a separate tab if that's not already being done.
 * @param url The URL we are navigating to.
 */
public void onExternalNavigation(String url) {
    if (!mDidPromoteSearchNavigation
            && !BLACKLISTED_URL.equals(url)
            && !url.startsWith(INTENT_URL_PREFIX)
            && shouldPromoteSearchNavigation()) {
        // Do not promote to a regular tab if we're loading our Resolved Search
        // URL, otherwise we'll promote it when prefetching the Serp.
        // Don't promote URLs when they are navigating to an intent - this is
        // handled by the InterceptNavigationDelegate which uses a faster
        // maximizing animation.
        mDidPromoteSearchNavigation = true;
        mSearchPanel.maximizePanelThenPromoteToTab(StateChangeReason.SERP_NAVIGATION);
    }
}
 
Example #12
Source File: OverlayPanelAnimation.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the Overlay Panel to a given |state| with a custom |duration|.
 *
 * @param state The state to animate to.
 * @param reason The reason for the change of panel state.
 * @param duration The animation duration in milliseconds.
 */
protected void animatePanelToState(PanelState state, StateChangeReason reason, long duration) {
    mAnimatingState = state;
    mAnimatingStateReason = reason;

    final float height = getPanelHeightFromState(state);
    animatePanelTo(height, duration);
}
 
Example #13
Source File: ReaderModeManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onAddInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isFirst) {
    mIsInfoBarContainerShown = true;
    // If the panel is opened past the peeking state, obscure the infobar.
    if (mReaderModePanel != null && mReaderModePanel.isPanelOpened() && container != null) {
        container.setIsObscuredByOtherView(true);
    } else if (isFirst) {
        // Temporarily hides the reader mode button while the infobars are shown.
        closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
    }
}
 
Example #14
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Logs how a state was exited for the first time within a Contextual Search.
 * @param fromState The state to transition from.
 * @param toState The state to transition to.
 * @param reason The reason for the state transition.
 */
public static void logFirstStateExit(PanelState fromState, PanelState toState,
        StateChangeReason reason) {
    int code;
    switch (fromState) {
        case UNDEFINED:
        case CLOSED:
            code = getStateChangeCode(toState, reason,
                    EXIT_CLOSED_TO_STATE_CHANGE_CODES, EXIT_CLOSED_TO_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchExitClosed", code, EXIT_CLOSED_TO_BOUNDARY);
            break;
        case PEEKED:
            code = getStateChangeCode(toState, reason,
                    EXIT_PEEKED_TO_STATE_CHANGE_CODES, EXIT_PEEKED_TO_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchExitPeeked", code, EXIT_PEEKED_TO_BOUNDARY);
            break;
        case EXPANDED:
            code = getStateChangeCode(toState, reason,
                    EXIT_EXPANDED_TO_STATE_CHANGE_CODES, EXIT_EXPANDED_TO_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchExitExpanded", code, EXIT_EXPANDED_TO_BOUNDARY);
            break;
        case MAXIMIZED:
            code = getStateChangeCode(toState, reason,
                    EXIT_MAXIMIZED_TO_STATE_CHANGE_CODES, EXIT_MAXIMIZED_TO_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchExitMaximized", code, EXIT_MAXIMIZED_TO_BOUNDARY);
            break;
        default:
            break;
    }
}
 
Example #15
Source File: ContextualSearchManager.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void handleSelectionDismissal() {
    if (mIsAccessibilityModeEnabled) return;

    if (mSearchPanel.isShowing()
            && !mIsPromotingToTab
            // If the selection is dismissed when the Panel is not peeking anymore,
            // which means the Panel is at least partially expanded, then it means
            // the selection was cleared by an external source (like JavaScript),
            // so we should not dismiss the UI in here.
            // See crbug.com/516665
            && mSearchPanel.isPeeking()) {
        hideContextualSearch(StateChangeReason.CLEARED_SELECTION);
    }
}
 
Example #16
Source File: ReaderModePanel.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void handleBarClick(long time, float x, float y) {
    super.handleBarClick(time, x, y);
    if (isCoordinateInsideCloseButton(x)) {
        closePanel(StateChangeReason.CLOSE_BUTTON, true);
    } else {
        maximizePanel(StateChangeReason.SEARCH_BAR_TAP);
    }
}
 
Example #17
Source File: ReaderModeManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onInfoBarContainerAttachedToWindow(boolean hasInfoBars) {
    mIsInfoBarContainerShown = hasInfoBars;
    if (mIsInfoBarContainerShown) {
        closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
    } else {
        requestReaderPanelShow(StateChangeReason.INFOBAR_HIDDEN);
    }
}
 
Example #18
Source File: OverlayPanelBase.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the panel's state.
 * @param state The panel state to transition to.
 * @param reason The reason for a change in the panel's state.
 */
protected void setPanelState(PanelState state, StateChangeReason reason) {
    if (state == PanelState.CLOSED) {
        mHeight = 0;
        onClosed(reason);
    }

    // We should only set the state at the end of this method, in oder to make sure that
    // all callbacks will be fired before changing the state of the Panel. This prevents
    // some flakiness on tests since they rely on changes of state to determine when a
    // particular action has been completed.
    mPanelState = state;
}
 
Example #19
Source File: ReaderModeManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onAddInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isFirst) {
    mIsInfoBarContainerShown = true;
    // If the panel is opened past the peeking state, obscure the infobar.
    if (mReaderModePanel != null && mReaderModePanel.isPanelOpened() && container != null) {
        container.setIsObscuredByOtherView(true);
    } else if (isFirst) {
        // Temporarily hides the reader mode button while the infobars are shown.
        closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
    }
}
 
Example #20
Source File: OverlayPanelAnimation.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the Panel to its projected state, given a particular vertical |velocity|.
 *
 * @param velocity The velocity of the gesture in dps per second.
 */
protected void animateToProjectedState(float velocity) {
    PanelState projectedState = getProjectedState(velocity);

    final float displacement = getPanelHeightFromState(projectedState) - getHeight();
    final long duration = calculateAnimationDuration(velocity, displacement);

    animatePanelToState(projectedState, StateChangeReason.FLING, duration);
}
 
Example #21
Source File: ContextualSearchManager.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Hides the Contextual Search UX.
 * @param reason The {@link StateChangeReason} for hiding Contextual Search.
 */
public void hideContextualSearch(StateChangeReason reason) {
    if (mSearchPanel == null) return;

    if (mSearchPanel.isShowing()) {
        mSearchPanel.closePanel(reason, false);
    } else {
        if (mSelectionController.getSelectionType() == SelectionType.TAP) {
            mSelectionController.clearSelection();
        }
    }
}
 
Example #22
Source File: ReaderModeManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onToggleFullscreenMode(Tab tab, boolean enable) {
    // Temporarily hide the reader mode panel while fullscreen is enabled.
    if (enable) {
        mIsFullscreenModeEntered = true;
        closeReaderPanel(StateChangeReason.FULLSCREEN_ENTERED, false);
    } else {
        mIsFullscreenModeEntered = false;
        requestReaderPanelShow(StateChangeReason.FULLSCREEN_EXITED);
    }
}
 
Example #23
Source File: ContextualSearchManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Called to check if an external navigation is being done and take the appropriate action:
 * Auto-promotes the panel into a separate tab if that's not already being done.
 * @param url The URL we are navigating to.
 */
public void onExternalNavigation(String url) {
    if (!mDidPromoteSearchNavigation
            && !BLACKLISTED_URL.equals(url)
            && !url.startsWith(INTENT_URL_PREFIX)
            && shouldPromoteSearchNavigation()) {
        // Do not promote to a regular tab if we're loading our Resolved Search
        // URL, otherwise we'll promote it when prefetching the Serp.
        // Don't promote URLs when they are navigating to an intent - this is
        // handled by the InterceptNavigationDelegate which uses a faster
        // maximizing animation.
        mDidPromoteSearchNavigation = true;
        mSearchPanel.maximizePanelThenPromoteToTab(StateChangeReason.SERP_NAVIGATION);
    }
}
 
Example #24
Source File: OverlayPanelAnimation.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the Panel to its projected state, given a particular vertical |velocity|.
 *
 * @param velocity The velocity of the gesture in dps per second.
 */
protected void animateToProjectedState(float velocity) {
    PanelState projectedState = getProjectedState(velocity);

    final float displacement = getPanelHeightFromState(projectedState) - getHeight();
    final long duration = calculateAnimationDuration(velocity, displacement);

    animatePanelToState(projectedState, StateChangeReason.FLING, duration);
}
 
Example #25
Source File: ContextualSearchManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public boolean shouldInterceptNavigation(
        ExternalNavigationHandler externalNavHandler, NavigationParams navigationParams) {
    mTabRedirectHandler.updateNewUrlLoading(navigationParams.pageTransitionType,
            navigationParams.isRedirect,
            navigationParams.hasUserGesture || navigationParams.hasUserGestureCarryover,
            mActivity.getLastUserInteractionTime(), TabRedirectHandler.INVALID_ENTRY_INDEX);
    ExternalNavigationParams params =
            new ExternalNavigationParams
                    .Builder(navigationParams.url, false, navigationParams.referrer,
                            navigationParams.pageTransitionType,
                            navigationParams.isRedirect)
                    .setApplicationMustBeInForeground(true)
                    .setRedirectHandler(mTabRedirectHandler)
                    .setIsMainFrame(navigationParams.isMainFrame)
                    .build();
    if (externalNavHandler.shouldOverrideUrlLoading(params)
            != OverrideUrlLoadingResult.NO_OVERRIDE) {
        mSearchPanel.maximizePanelThenPromoteToTab(StateChangeReason.TAB_PROMOTION,
                INTERCEPT_NAVIGATION_PROMOTION_ANIMATION_DURATION_MS);
        return false;
    }
    if (navigationParams.isExternalProtocol) {
        return false;
    }
    return true;
}
 
Example #26
Source File: ReaderModeManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onRemoveInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isLast) {
    // Re-shows the reader mode button if necessary once the infobars are dismissed.
    if (isLast) {
        mIsInfoBarContainerShown = false;
        requestReaderPanelShow(StateChangeReason.INFOBAR_HIDDEN);
    }
}
 
Example #27
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Logs how a state was entered for the first time within a Contextual Search.
 * @param fromState The state to transition from.
 * @param toState The state to transition to.
 * @param reason The reason for the state transition.
 */
public static void logFirstStateEntry(PanelState fromState, PanelState toState,
        StateChangeReason reason) {
    int code;
    switch (toState) {
        case CLOSED:
            code = getStateChangeCode(fromState, reason,
                    ENTER_CLOSED_STATE_CHANGE_CODES, ENTER_CLOSED_FROM_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchEnterClosed",
                    code, ENTER_CLOSED_FROM_BOUNDARY);
            break;
        case PEEKED:
            code = getStateChangeCode(fromState, reason,
                    ENTER_PEEKED_STATE_CHANGE_CODES, ENTER_PEEKED_FROM_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchEnterPeeked",
                    code, ENTER_PEEKED_FROM_BOUNDARY);
            break;
        case EXPANDED:
            code = getStateChangeCode(fromState, reason,
                    ENTER_EXPANDED_STATE_CHANGE_CODES, ENTER_EXPANDED_FROM_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchEnterExpanded",
                    code, ENTER_EXPANDED_FROM_BOUNDARY);
            break;
        case MAXIMIZED:
            code = getStateChangeCode(fromState, reason,
                    ENTER_MAXIMIZED_STATE_CHANGE_CODES, ENTER_MAXIMIZED_FROM_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchEnterMaximized",
                    code, ENTER_MAXIMIZED_FROM_BOUNDARY);
            break;
        default:
            break;
    }
}
 
Example #28
Source File: OverlayPanelAnimation.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the Overlay Panel to its peeked state.
 *
 * @param reason The reason for the change of panel state.
 */
protected void peekPanel(StateChangeReason reason) {
    updateBasePageTargetY();

    // TODO(pedrosimonetti): Implement custom animation with the following values.
    // int SEARCH_BAR_ANIMATION_DURATION_MS = 218;
    // float SEARCH_BAR_SLIDE_OFFSET_DP = 40;
    // float mSearchBarHeightDp;
    // setTranslationY(mIsShowingFirstRunFlow
    //      ? mSearchBarHeightDp : SEARCH_BAR_SLIDE_OFFSET_DP);
    // setInterpolator(BakedBezierInterpolator.FADE_IN_CURVE);
    animatePanelToState(PanelState.PEEKED, reason);
}
 
Example #29
Source File: ContextualSearchManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void handleSelectionDismissal() {
    if (mIsAccessibilityModeEnabled) return;

    if (mSearchPanel.isShowing()
            && !mIsPromotingToTab
            // If the selection is dismissed when the Panel is not peeking anymore,
            // which means the Panel is at least partially expanded, then it means
            // the selection was cleared by an external source (like JavaScript),
            // so we should not dismiss the UI in here.
            // See crbug.com/516665
            && mSearchPanel.isPeeking()) {
        hideContextualSearch(StateChangeReason.CLEARED_SELECTION);
    }
}
 
Example #30
Source File: OverlayPanelAnimation.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the Overlay Panel to its peeked state.
 *
 * @param reason The reason for the change of panel state.
 */
protected void peekPanel(StateChangeReason reason) {
    updateBasePageTargetY();

    // TODO(pedrosimonetti): Implement custom animation with the following values.
    // int SEARCH_BAR_ANIMATION_DURATION_MS = 218;
    // float SEARCH_BAR_SLIDE_OFFSET_DP = 40;
    // float mSearchBarHeightDp;
    // setTranslationY(mIsShowingFirstRunFlow
    //      ? mSearchBarHeightDp : SEARCH_BAR_SLIDE_OFFSET_DP);
    // setInterpolator(BakedBezierInterpolator.FADE_IN_CURVE);
    animatePanelToState(PanelState.PEEKED, reason);
}