Java Code Examples for org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChangeReason#TEXT_SELECT_TAP

The following examples show how to use org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChangeReason#TEXT_SELECT_TAP . 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 delion with Apache License 2.0 6 votes vote down vote up
@Override
public void handleSelection(String selection, boolean selectionValid, SelectionType type,
        float x, float y) {
    if (mIsAccessibilityModeEnabled) return;

    if (!selection.isEmpty()) {
        StateChangeReason stateChangeReason = type == SelectionType.TAP
                ? StateChangeReason.TEXT_SELECT_TAP : StateChangeReason.TEXT_SELECT_LONG_PRESS;
        ContextualSearchUma.logSelectionIsValid(selectionValid);
        if (selectionValid) {
            mSearchPanel.updateBasePageSelectionYPx(y);
            showContextualSearch(stateChangeReason);
        } else {
            hideContextualSearch(stateChangeReason);
        }
    }
}
 
Example 2
Source File: ContextualSearchManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void handleSelection(String selection, boolean selectionValid, SelectionType type,
        float x, float y) {
    if (mIsAccessibilityModeEnabled) return;

    if (!selection.isEmpty()) {
        StateChangeReason stateChangeReason = type == SelectionType.TAP
                ? StateChangeReason.TEXT_SELECT_TAP : StateChangeReason.TEXT_SELECT_LONG_PRESS;
        ContextualSearchUma.logSelectionIsValid(selectionValid);
        if (selectionValid) {
            mSearchPanel.updateBasePageSelectionYPx(y);
            mSearchPanel.getPanelMetrics().onSelectionEstablished(selection);
            showContextualSearch(stateChangeReason);
        } else {
            hideContextualSearch(stateChangeReason);
        }
    }
}
 
Example 3
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Logs a user action for a change to the Panel state, which allows sequencing of actions.
 * @param toState The state to transition to.
 * @param reason The reason for the state transition.
 */
public static void logPanelStateUserAction(PanelState toState, StateChangeReason reason) {
    switch (toState) {
        case CLOSED:
            if (reason == StateChangeReason.BACK_PRESS) {
                RecordUserAction.record("ContextualSearch.BackPressClose");
            } else if (reason == StateChangeReason.CLOSE_BUTTON) {
                RecordUserAction.record("ContextualSearch.CloseButtonClose");
            } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingClose");
            } else if (reason == StateChangeReason.TAB_PROMOTION) {
                RecordUserAction.record("ContextualSearch.TabPromotionClose");
            } else if (reason == StateChangeReason.BASE_PAGE_TAP) {
                RecordUserAction.record("ContextualSearch.BasePageTapClose");
            } else if (reason == StateChangeReason.BASE_PAGE_SCROLL) {
                RecordUserAction.record("ContextualSearch.BasePageScrollClose");
            } else if (reason == StateChangeReason.SEARCH_BAR_TAP) {
                RecordUserAction.record("ContextualSearch.SearchBarTapClose");
            } else if (reason == StateChangeReason.SERP_NAVIGATION) {
                RecordUserAction.record("ContextualSearch.NavigationClose");
            } else {
                RecordUserAction.record("ContextualSearch.UncommonClose");
            }
            break;
        case PEEKED:
            if (reason == StateChangeReason.TEXT_SELECT_TAP) {
                RecordUserAction.record("ContextualSearch.TapPeek");
            } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingPeek");
            } else if (reason == StateChangeReason.TEXT_SELECT_LONG_PRESS) {
                RecordUserAction.record("ContextualSearch.LongpressPeek");
            }
            break;
        case EXPANDED:
            if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingExpand");
            } else if (reason == StateChangeReason.SEARCH_BAR_TAP) {
                RecordUserAction.record("ContextualSearch.SearchBarTapExpand");
            }
            break;
        case MAXIMIZED:
            if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingMaximize");
            } else if (reason == StateChangeReason.SERP_NAVIGATION) {
                RecordUserAction.record("ContextualSearch.NavigationMaximize");
            }
            break;
        default:
            break;
    }
}
 
Example 4
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Logs a user action for a change to the Panel state, which allows sequencing of actions.
 * @param toState The state to transition to.
 * @param reason The reason for the state transition.
 */
public static void logPanelStateUserAction(PanelState toState, StateChangeReason reason) {
    switch (toState) {
        case CLOSED:
            if (reason == StateChangeReason.BACK_PRESS) {
                RecordUserAction.record("ContextualSearch.BackPressClose");
            } else if (reason == StateChangeReason.CLOSE_BUTTON) {
                RecordUserAction.record("ContextualSearch.CloseButtonClose");
            } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingClose");
            } else if (reason == StateChangeReason.TAB_PROMOTION) {
                RecordUserAction.record("ContextualSearch.TabPromotionClose");
            } else if (reason == StateChangeReason.BASE_PAGE_TAP) {
                RecordUserAction.record("ContextualSearch.BasePageTapClose");
            } else if (reason == StateChangeReason.BASE_PAGE_SCROLL) {
                RecordUserAction.record("ContextualSearch.BasePageScrollClose");
            } else if (reason == StateChangeReason.SEARCH_BAR_TAP) {
                RecordUserAction.record("ContextualSearch.SearchBarTapClose");
            } else if (reason == StateChangeReason.SERP_NAVIGATION) {
                RecordUserAction.record("ContextualSearch.NavigationClose");
            } else {
                RecordUserAction.record("ContextualSearch.UncommonClose");
            }
            break;
        case PEEKED:
            if (reason == StateChangeReason.TEXT_SELECT_TAP) {
                RecordUserAction.record("ContextualSearch.TapPeek");
            } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingPeek");
            } else if (reason == StateChangeReason.TEXT_SELECT_LONG_PRESS) {
                RecordUserAction.record("ContextualSearch.LongpressPeek");
            }
            break;
        case EXPANDED:
            if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingExpand");
            } else if (reason == StateChangeReason.SEARCH_BAR_TAP) {
                RecordUserAction.record("ContextualSearch.SearchBarTapExpand");
            }
            break;
        case MAXIMIZED:
            if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingMaximize");
            } else if (reason == StateChangeReason.SERP_NAVIGATION) {
                RecordUserAction.record("ContextualSearch.NavigationMaximize");
            }
            break;
        default:
            break;
    }
}
 
Example 5
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Logs a user action for a change to the Panel state, which allows sequencing of actions.
 * @param toState The state to transition to.
 * @param reason The reason for the state transition.
 */
public static void logPanelStateUserAction(PanelState toState, StateChangeReason reason) {
    switch (toState) {
        case CLOSED:
            if (reason == StateChangeReason.BACK_PRESS) {
                RecordUserAction.record("ContextualSearch.BackPressClose");
            } else if (reason == StateChangeReason.CLOSE_BUTTON) {
                RecordUserAction.record("ContextualSearch.CloseButtonClose");
            } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingClose");
            } else if (reason == StateChangeReason.TAB_PROMOTION) {
                RecordUserAction.record("ContextualSearch.TabPromotionClose");
            } else if (reason == StateChangeReason.BASE_PAGE_TAP) {
                RecordUserAction.record("ContextualSearch.BasePageTapClose");
            } else if (reason == StateChangeReason.BASE_PAGE_SCROLL) {
                RecordUserAction.record("ContextualSearch.BasePageScrollClose");
            } else if (reason == StateChangeReason.SEARCH_BAR_TAP) {
                RecordUserAction.record("ContextualSearch.SearchBarTapClose");
            } else if (reason == StateChangeReason.SERP_NAVIGATION) {
                RecordUserAction.record("ContextualSearch.NavigationClose");
            } else {
                RecordUserAction.record("ContextualSearch.UncommonClose");
            }
            break;
        case PEEKED:
            if (reason == StateChangeReason.TEXT_SELECT_TAP) {
                RecordUserAction.record("ContextualSearch.TapPeek");
            } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingPeek");
            } else if (reason == StateChangeReason.TEXT_SELECT_LONG_PRESS) {
                RecordUserAction.record("ContextualSearch.LongpressPeek");
            }
            break;
        case EXPANDED:
            if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingExpand");
            } else if (reason == StateChangeReason.SEARCH_BAR_TAP) {
                RecordUserAction.record("ContextualSearch.SearchBarTapExpand");
            }
            break;
        case MAXIMIZED:
            if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) {
                RecordUserAction.record("ContextualSearch.SwipeOrFlingMaximize");
            } else if (reason == StateChangeReason.SERP_NAVIGATION) {
                RecordUserAction.record("ContextualSearch.NavigationMaximize");
            }
            break;
        default:
            break;
    }
}
 
Example 6
Source File: ContextualSearchPanelMetrics.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Determine whether a new contextual search is starting.
 * @param toState The contextual search state that will be transitioned to.
 * @param reason The reason for the search state transition.
 * @return Whether a new contextual search is starting.
 */
private boolean isStartingNewContextualSearch(PanelState toState, StateChangeReason reason) {
    return toState == PanelState.PEEKED
            && (reason == StateChangeReason.TEXT_SELECT_TAP
                    || reason == StateChangeReason.TEXT_SELECT_LONG_PRESS);
}
 
Example 7
Source File: ContextualSearchPanelMetrics.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * Determine whether a new contextual search is starting.
 * @param toState The contextual search state that will be transitioned to.
 * @param reason The reason for the search state transition.
 * @return Whether a new contextual search is starting.
 */
private boolean isStartingNewContextualSearch(PanelState toState, StateChangeReason reason) {
    return toState == PanelState.PEEKED
            && (reason == StateChangeReason.TEXT_SELECT_TAP
                    || reason == StateChangeReason.TEXT_SELECT_LONG_PRESS);
}
 
Example 8
Source File: ContextualSearchPanelMetrics.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Determine whether a new contextual search is starting.
 * @param toState The contextual search state that will be transitioned to.
 * @param reason The reason for the search state transition.
 * @return Whether a new contextual search is starting.
 */
private boolean isStartingNewContextualSearch(PanelState toState, StateChangeReason reason) {
    return toState == PanelState.PEEKED
            && (reason == StateChangeReason.TEXT_SELECT_TAP
                    || reason == StateChangeReason.TEXT_SELECT_LONG_PRESS);
}