Java Code Examples for org.chromium.chrome.browser.compositor.layouts.Layout.Orientation#LANDSCAPE

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.Layout.Orientation#LANDSCAPE . 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: Stack.java    From delion with Apache License 2.0 6 votes vote down vote up
private void updateOverscrollOffset() {
    float clamped = MathUtils.clamp(mScrollOffset, getMinScroll(false), getMaxScroll(false));
    if (!allowOverscroll()) {
        mScrollOffset = clamped;
    }
    float overscroll = mScrollOffset - clamped;

    // Counts the number of overscroll push in the same direction in a row.
    int derivativeState = (int) Math.signum(Math.abs(mOverScrollOffset) - Math.abs(overscroll));
    if (derivativeState != mOverScrollDerivative && derivativeState == 1 && overscroll < 0) {
        mOverScrollCounter++;
    } else if (overscroll > 0 || mCurrentMode == Orientation.LANDSCAPE) {
        mOverScrollCounter = 0;
    }
    mOverScrollDerivative = derivativeState;

    mOverScrollOffset = overscroll;
}
 
Example 2
Source File: StackAnimation.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * The factory method that creates the particular factory method based on the orientation
 * parameter.
 *
 * @param width                       The width of the layout in dp.
 * @param height                      The height of the layout in dp.
 * @param heightMinusTopControls      The height of the layout minus the top controls in dp.
 * @param borderFramePaddingTop       The top padding of the border frame in dp.
 * @param borderFramePaddingTopOpaque The opaque top padding of the border frame in dp.
 * @param borderFramePaddingLeft      The left padding of the border frame in dp.
 * @param orientation                 The orientation that will be used to create the
 *                                    appropriate {@link StackAnimation}.
 * @return                            The TabSwitcherAnimationFactory instance.
 */
public static StackAnimation createAnimationFactory(float width, float height,
        float heightMinusTopControls, float borderFramePaddingTop,
        float borderFramePaddingTopOpaque, float borderFramePaddingLeft, int orientation) {
    StackAnimation factory = null;
    switch (orientation) {
        case Orientation.LANDSCAPE:
            factory = new StackAnimationLandscape(width, height, heightMinusTopControls,
                    borderFramePaddingTop, borderFramePaddingTopOpaque, borderFramePaddingLeft);
            break;
        case Orientation.PORTRAIT:
        default:
            factory = new StackAnimationPortrait(width, height, heightMinusTopControls,
                    borderFramePaddingTop, borderFramePaddingTopOpaque, borderFramePaddingLeft);
            break;
    }

    return factory;
}
 
Example 3
Source File: Stack.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void updateOverscrollOffset() {
    float clamped = MathUtils.clamp(mScrollOffset, getMinScroll(false), getMaxScroll(false));
    if (!allowOverscroll()) {
        mScrollOffset = clamped;
    }
    float overscroll = mScrollOffset - clamped;

    // Counts the number of overscroll push in the same direction in a row.
    int derivativeState = (int) Math.signum(Math.abs(mOverScrollOffset) - Math.abs(overscroll));
    if (derivativeState != mOverScrollDerivative && derivativeState == 1 && overscroll < 0) {
        mOverScrollCounter++;
    } else if (overscroll > 0 || mCurrentMode == Orientation.LANDSCAPE) {
        mOverScrollCounter = 0;
    }
    mOverScrollDerivative = derivativeState;

    mOverScrollOffset = overscroll;
}
 
Example 4
Source File: StackAnimation.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * The factory method that creates the particular factory method based on the orientation
 * parameter.
 *
 * @param width                       The width of the layout in dp.
 * @param height                      The height of the layout in dp.
 * @param heightMinusBrowserControls  The height of the layout minus the browser controls in dp.
 * @param borderFramePaddingTop       The top padding of the border frame in dp.
 * @param borderFramePaddingTopOpaque The opaque top padding of the border frame in dp.
 * @param borderFramePaddingLeft      The left padding of the border frame in dp.
 * @param orientation                 The orientation that will be used to create the
 *                                    appropriate {@link StackAnimation}.
 * @return                            The TabSwitcherAnimationFactory instance.
 */
public static StackAnimation createAnimationFactory(float width, float height,
        float heightMinusBrowserControls, float borderFramePaddingTop,
        float borderFramePaddingTopOpaque, float borderFramePaddingLeft, int orientation) {
    StackAnimation factory = null;
    switch (orientation) {
        case Orientation.LANDSCAPE:
            factory = new StackAnimationLandscape(width, height, heightMinusBrowserControls,
                    borderFramePaddingTop, borderFramePaddingTopOpaque, borderFramePaddingLeft);
            break;
        case Orientation.PORTRAIT:
        default:
            factory = new StackAnimationPortrait(width, height, heightMinusBrowserControls,
                    borderFramePaddingTop, borderFramePaddingTopOpaque, borderFramePaddingLeft);
            break;
    }

    return factory;
}
 
Example 5
Source File: Stack.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void updateOverscrollOffset() {
    float clamped = MathUtils.clamp(mScrollOffset, getMinScroll(false), getMaxScroll(false));
    if (!allowOverscroll()) {
        mScrollOffset = clamped;
    }
    float overscroll = mScrollOffset - clamped;

    // Counts the number of overscroll push in the same direction in a row.
    int derivativeState = (int) Math.signum(Math.abs(mOverScrollOffset) - Math.abs(overscroll));
    if (derivativeState != mOverScrollDerivative && derivativeState == 1 && overscroll < 0) {
        mOverScrollCounter++;
    } else if (overscroll > 0 || mCurrentMode == Orientation.LANDSCAPE) {
        mOverScrollCounter = 0;
    }
    mOverScrollDerivative = derivativeState;

    mOverScrollOffset = overscroll;
}
 
Example 6
Source File: StackAnimation.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * The factory method that creates the particular factory method based on the orientation
 * parameter.
 *
 * @param stack                       The stack of tabs being animated.
 * @param width                       The width of the layout in dp.
 * @param height                      The height of the layout in dp.
 * @param heightMinusBrowserControls  The height of the layout minus the browser controls in dp.
 * @param borderFramePaddingTop       The top padding of the border frame in dp.
 * @param borderFramePaddingTopOpaque The opaque top padding of the border frame in dp.
 * @param borderFramePaddingLeft      The left padding of the border frame in dp.
 * @param orientation                 The orientation that will be used to create the
 *                                    appropriate {@link StackAnimation}.
 * @return                            The TabSwitcherAnimationFactory instance.
 */
public static StackAnimation createAnimationFactory(Stack stack, float width, float height,
        float heightMinusBrowserControls, float borderFramePaddingTop,
        float borderFramePaddingTopOpaque, float borderFramePaddingLeft, int orientation) {
    StackAnimation factory = null;
    switch (orientation) {
        case Orientation.LANDSCAPE:
            factory = new StackAnimationLandscape(stack, width, height,
                    heightMinusBrowserControls, borderFramePaddingTop,
                    borderFramePaddingTopOpaque, borderFramePaddingLeft);
            break;
        case Orientation.PORTRAIT:
        default:
            factory = new StackAnimationPortrait(stack, width, height,
                    heightMinusBrowserControls, borderFramePaddingTop,
                    borderFramePaddingTopOpaque, borderFramePaddingLeft);
            break;
    }

    return factory;
}
 
Example 7
Source File: LayoutManager.java    From delion with Apache License 2.0 5 votes vote down vote up
private int getOrientation() {
    if (mLastContentWidthDp > mLastContentHeightDp) {
        return Orientation.LANDSCAPE;
    } else {
        return Orientation.PORTRAIT;
    }
}
 
Example 8
Source File: LayoutManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private int getOrientation() {
    if (mLastContentWidthDp > mLastContentHeightDp) {
        return Orientation.LANDSCAPE;
    } else {
        return Orientation.PORTRAIT;
    }
}
 
Example 9
Source File: LayoutManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private int getOrientation() {
    if (mHost.getWidth() > mHost.getHeight()) {
        return Orientation.LANDSCAPE;
    } else {
        return Orientation.PORTRAIT;
    }
}
 
Example 10
Source File: Stack.java    From delion with Apache License 2.0 4 votes vote down vote up
private float getDefaultDiscardDirection() {
    return (mCurrentMode == Orientation.LANDSCAPE && LocalizationUtils.isLayoutRtl()) ? -1.0f
                                                                                      : 1.0f;
}
 
Example 11
Source File: Stack.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private float getDefaultDiscardDirection() {
    return (mCurrentMode == Orientation.LANDSCAPE && LocalizationUtils.isLayoutRtl()) ? -1.0f
                                                                                      : 1.0f;
}
 
Example 12
Source File: Stack.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private float getDefaultDiscardDirection() {
    return (mCurrentMode == Orientation.LANDSCAPE && LocalizationUtils.isLayoutRtl()) ? -1.0f
                                                                                      : 1.0f;
}