Java Code Examples for org.chromium.chrome.browser.device.DeviceClassManager#enableAccessibilityLayout()

The following examples show how to use org.chromium.chrome.browser.device.DeviceClassManager#enableAccessibilityLayout() . 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: LayoutManagerChrome.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Show the overview {@link Layout}.  This is generally a {@link Layout} that visibly represents
 * all of the {@link Tab}s opened by the user.
 * @param animate Whether or not to animate the transition to overview mode.
 */
public void showOverview(boolean animate) {
    boolean useAccessibility = DeviceClassManager.enableAccessibilityLayout();

    boolean accessibilityIsVisible =
            useAccessibility && getActiveLayout() == mOverviewListLayout;
    boolean normalIsVisible = getActiveLayout() == mOverviewLayout && mOverviewLayout != null;

    // We only want to use the AccessibilityOverviewLayout if the following are all valid:
    // 1. We're already showing the AccessibilityOverviewLayout OR we're using accessibility.
    // 2. We're not already showing the normal OverviewLayout (or we are on a tablet, in which
    //    case the normal layout is always visible).
    if ((accessibilityIsVisible || useAccessibility) && !normalIsVisible) {
        startShowing(mOverviewListLayout, animate);
    } else if (mOverviewLayout != null) {
        startShowing(mOverviewLayout, animate);
    }
}
 
Example 2
Source File: LayoutManagerChromePhone.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
protected void tabClosed(int id, int nextId, boolean incognito, boolean tabRemoved) {
    boolean showOverview = nextId == Tab.INVALID_TAB_ID;
    Layout overviewLayout = DeviceClassManager.enableAccessibilityLayout() ? mOverviewListLayout
                                                                           : mOverviewLayout;
    if (getActiveLayout() != overviewLayout && showOverview) {
        // Since there will be no 'next' tab to display, switch to
        // overview mode when the animation is finished.
        setNextLayout(overviewLayout);
    }
    getActiveLayout().onTabClosed(time(), id, nextId, incognito);
    Tab nextTab = getTabById(nextId);
    if (nextTab != null) nextTab.requestFocus();
    boolean animate = !tabRemoved && animationsEnabled();
    if (getActiveLayout() != overviewLayout && showOverview && !animate) {
        startShowing(overviewLayout, false);
    }
}
 
Example 3
Source File: BottomToolbarPhone.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
protected void drawTabSwitcherFadeAnimation(boolean animationFinished, float progress) {
    mNewTabButton.setAlpha(progress);

    mLocationBar.setAlpha(1f - progress);
    if (mUseToolbarHandle) mToolbarHandleView.setAlpha(1f - progress);

    int tabSwitcherThemeColor = getToolbarColorForVisualState(VisualState.TAB_SWITCHER_NORMAL);

    updateToolbarBackground(ColorUtils.getColorWithOverlay(
            getTabThemeColor(), tabSwitcherThemeColor, progress));

    // Don't use transparency for accessibility mode or low-end devices since the
    // {@link OverviewListLayout} will be used instead of the normal tab switcher.
    if (!DeviceClassManager.enableAccessibilityLayout()) {
        float alphaTransition = 1f - TAB_SWITCHER_TOOLBAR_ALPHA;
        mToolbarBackground.setAlpha((int) ((1f - (alphaTransition * progress)) * 255));
    }
}
 
Example 4
Source File: LayoutManagerDocumentTabSwitcher.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @return Whether or not to use the accessibility layout.
 */
private boolean useAccessibilityLayout() {
    return DeviceClassManager.isAccessibilityModeEnabled(mHost.getContext())
            || DeviceClassManager.enableAccessibilityLayout();
}
 
Example 5
Source File: LayoutManagerChrome.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @return Whether or not to use the accessibility layout.
 */
protected boolean useAccessibilityLayout() {
    return DeviceClassManager.isAccessibilityModeEnabled(mHost.getContext())
            || DeviceClassManager.enableAccessibilityLayout();
}
 
Example 6
Source File: LayoutManagerChrome.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @return Whether or not to use the accessibility layout.
 */
protected boolean useAccessibilityLayout() {
    return DeviceClassManager.isAccessibilityModeEnabled(mHost.getContext())
            || DeviceClassManager.enableAccessibilityLayout();
}
 
Example 7
Source File: ToolbarPhone.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * See {@link #setTabSwitcherMode(boolean, boolean, boolean)}.
 */
protected void setTabSwitcherMode(boolean inTabSwitcherMode, boolean showToolbar,
        boolean delayAnimation, boolean animate) {
    // If setting tab switcher mode to true and the browser is already animating or in the tab
    // switcher skip.
    if (inTabSwitcherMode && (mTabSwitcherState == TAB_SWITCHER
            || mTabSwitcherState == ENTERING_TAB_SWITCHER)) {
        return;
    }

    // Likewise if exiting the tab switcher.
    if (!inTabSwitcherMode && (mTabSwitcherState == STATIC_TAB
            || mTabSwitcherState == EXITING_TAB_SWITCHER)) {
        return;
    }
    mTabSwitcherState = inTabSwitcherMode ? ENTERING_TAB_SWITCHER : EXITING_TAB_SWITCHER;

    mLocationBar.setUrlBarFocusable(false);

    finishAnimations();

    mDelayingTabSwitcherAnimation = delayAnimation;

    if (inTabSwitcherMode) {
        if (mUrlFocusLayoutAnimator != null && mUrlFocusLayoutAnimator.isRunning()) {
            mUrlFocusLayoutAnimator.end();
            mUrlFocusLayoutAnimator = null;
            // After finishing the animation, force a re-layout of the location bar,
            // so that the final translation position is correct (since onMeasure updates
            // won't happen in tab switcher mode). crbug.com/518795.
            layoutLocationBar(getMeasuredWidth());
            updateUrlExpansionAnimation();
        }
        mNewTabButton.setEnabled(true);
        updateViewsForTabSwitcherMode();
        mTabSwitcherModeAnimation = createEnterTabSwitcherModeAnimation();
    } else {
        if (!mDelayingTabSwitcherAnimation) {
            mTabSwitcherModeAnimation = createExitTabSwitcherAnimation(showToolbar);
        }
    }

    updateButtonsTranslationY();
    mAnimateNormalToolbar = showToolbar;
    if (mTabSwitcherModeAnimation != null) mTabSwitcherModeAnimation.start();

    if (DeviceClassManager.enableAccessibilityLayout() || !animate) finishAnimations();

    postInvalidateOnAnimation();
}