Java Code Examples for org.chromium.content.browser.ContentViewCore#updateTextSelectionUI()

The following examples show how to use org.chromium.content.browser.ContentViewCore#updateTextSelectionUI() . 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: OverlayPanel.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Set the visibility of the base page text selection controls. This will also attempt to
 * remove focus from the base page to clear any open controls.
 * TODO(mdjones): This should be replaced with focusing the panel's ContentViewCore.
 * @param visible If the text controls are visible.
 */
protected void setBasePageTextControlsVisibility(boolean visible) {
    if (mActivity == null || mActivity.getActivityTab() == null) return;

    ContentViewCore baseContentView = mActivity.getActivityTab().getContentViewCore();
    if (baseContentView == null) return;

    // If the panel does not have focus or isn't open, return.
    if (isPanelOpened() && mDidClearTextControls && !visible) return;
    if (!isPanelOpened() && !mDidClearTextControls && visible) return;

    mDidClearTextControls = !visible;

    if (!visible) {
        baseContentView.preserveSelectionOnNextLossOfFocus();
        baseContentView.getContainerView().clearFocus();
    }

    baseContentView.updateTextSelectionUI(visible);
}
 
Example 2
Source File: OverlayPanel.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Set the visibility of the base page text selection controls. This will also attempt to
 * remove focus from the base page to clear any open controls.
 * TODO(mdjones): This should be replaced with focusing the panel's ContentViewCore.
 * @param visible If the text controls are visible.
 */
protected void setBasePageTextControlsVisibility(boolean visible) {
    if (mActivity == null || mActivity.getActivityTab() == null) return;

    ContentViewCore baseContentView = mActivity.getActivityTab().getContentViewCore();
    if (baseContentView == null) return;

    // If the panel does not have focus or isn't open, return.
    if (isPanelOpened() && mDidClearTextControls && !visible) return;
    if (!isPanelOpened() && !mDidClearTextControls && visible) return;

    mDidClearTextControls = !visible;

    if (!visible) {
        baseContentView.preserveSelectionOnNextLossOfFocus();
        baseContentView.getContainerView().clearFocus();
    }

    baseContentView.updateTextSelectionUI(visible);
}
 
Example 3
Source File: OverlayPanel.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Set the visibility of the base page text selection controls.
 * TODO(mdjones): This should be replaced be focusing the panel's ContentViewCore.
 * @param visible If the text controls are visible.
 */
protected void setBasePageTextControlsVisibility(boolean visible) {
    if (mActivity == null || mActivity.getActivityTab() == null) return;

    ContentViewCore baseContentView = mActivity.getActivityTab().getContentViewCore();
    if (baseContentView == null) return;

    // If the panel does not have focus or isn't open, return.
    if (isPanelOpened() && mDidClearTextControls && visible) return;
    if (!isPanelOpened() && !mDidClearTextControls && !visible) return;

    mDidClearTextControls = !visible;
    baseContentView.updateTextSelectionUI(visible);
}