当前位置: 首页>>代码示例>>Java>>正文


Java PanelState.CLOSED属性代码示例

本文整理汇总了Java中org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState.CLOSED属性的典型用法代码示例。如果您正苦于以下问题:Java PanelState.CLOSED属性的具体用法?Java PanelState.CLOSED怎么用?Java PanelState.CLOSED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState的用法示例。


在下文中一共展示了PanelState.CLOSED属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updatePanelForHeight

/**
 * Updates the UI state for a given |height|.
 *
 * @param height The Overlay Panel height.
 */
private void updatePanelForHeight(float height) {
    PanelState endState = findLargestPanelStateFromHeight(height);
    PanelState startState = getPreviousPanelState(endState);
    float percentage = getStateCompletion(height, startState, endState);

    updatePanelSize(height);

    if (endState == PanelState.CLOSED || endState == PanelState.PEEKED) {
        updatePanelForCloseOrPeek(percentage);
    } else if (endState == PanelState.EXPANDED) {
        updatePanelForExpansion(percentage);
    } else if (endState == PanelState.MAXIMIZED) {
        updatePanelForMaximization(percentage);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:20,代码来源:OverlayPanelBase.java

示例2: findLargestPanelStateFromHeight

/**
 * Finds the largest Panel state which is being transitioned to/from.
 * Whenever the Panel is in between states, let's say, when resizing the
 * Panel from its peeked to expanded state, we need to know those two states
 * in order to calculate how closely we are from one of them. This method
 * will always return the nearest state with the largest height, and
 * together with the state preceding it, it's possible to calculate how far
 * the Panel is from them.
 *
 * @param panelHeight The height to compare to.
 * @return The panel state which is being transitioned to/from.
 */
private PanelState findLargestPanelStateFromHeight(float panelHeight) {
    PanelState stateFound = PanelState.CLOSED;

    // Iterate over all states and find the largest one which is being
    // transitioned to/from.
    for (PanelState state : PanelState.values()) {
        if (!isValidUiState(state)) {
            continue;
        }
        if (panelHeight <= getPanelHeightFromState(state)) {
            stateFound = state;
            break;
        }
    }

    return stateFound;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:29,代码来源:OverlayPanelBase.java

示例3: setPanelState

/**
 * 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;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:17,代码来源:OverlayPanelBase.java

示例4: findNearestPanelStateFromHeight

/**
 * Finds the state which has the nearest height compared to a given
 * |desiredPanelHeight|.
 *
 * @param desiredPanelHeight The height to compare to.
 * @param velocity The velocity of the swipe if applicable. The swipe is upward if less than 0.
 * @return The nearest panel state.
 */
protected PanelState findNearestPanelStateFromHeight(float desiredPanelHeight, float velocity) {
    // If the panel was flung hard enough to make the desired height negative, it's closed.
    if (desiredPanelHeight < 0) return PanelState.CLOSED;

    // First, find the two states that the desired panel height is between.
    PanelState nextState = PanelState.values()[0];
    PanelState prevState = nextState;
    for (PanelState state : PanelState.values()) {
        if (!isValidUiState(state)) {
            continue;
        }
        prevState = nextState;
        nextState = state;
        // The values in PanelState are ascending, they should be kept that way in order for
        // this to work.
        if (desiredPanelHeight >= getPanelHeightFromState(prevState)
                && desiredPanelHeight < getPanelHeightFromState(nextState)) {
            break;
        }
    }

    // If the desired height is close enough to a certain state, depending on the direction of
    // the velocity, move to that state.
    float lowerBound = getPanelHeightFromState(prevState);
    float distance = getPanelHeightFromState(nextState) - lowerBound;
    float thresholdToNextState = velocity < 0.0f
            ? getThresholdToNextState() : 1.0f - getThresholdToNextState();
    if ((desiredPanelHeight - lowerBound) / distance > thresholdToNextState) {
        return nextState;
    } else {
        return prevState;
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:41,代码来源:OverlayPanelBase.java

示例5: closePanel

@Override
protected void closePanel(StateChangeReason reason, boolean animate) {
    if (animate) {
        // Only animates the closing action if not doing that already.
        if (mAnimatingState != PanelState.CLOSED) {
            animatePanelToState(PanelState.CLOSED, reason);
        }
    } else {
        resizePanelToState(PanelState.CLOSED, reason);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:11,代码来源:OverlayPanelAnimation.java

示例6: isEndingContextualSearch

/**
 * Determine whether a contextual search is ending.
 * @param fromState The contextual search state that will be transitioned from.
 * @param toState The contextual search state that will be transitioned to.
 * @param isStartingSearch Whether a new contextual search is starting.
 * @return Whether a contextual search is ending.
 */
private boolean isEndingContextualSearch(PanelState fromState, PanelState toState,
        boolean isStartingSearch) {
    return isOngoingContextualSearch(fromState)
            && (toState == PanelState.CLOSED || isStartingSearch);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:12,代码来源:ContextualSearchPanelMetrics.java

示例7: isOngoingContextualSearch

/**
 * @param fromState The state the panel is transitioning from.
 * @return Whether there is an ongoing contextual search.
 */
private boolean isOngoingContextualSearch(PanelState fromState) {
    return fromState != PanelState.UNDEFINED && fromState != PanelState.CLOSED;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:7,代码来源:ContextualSearchPanelMetrics.java


注:本文中的org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState.CLOSED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。