Search in sources :

Example 1 with TouchExplorationStateChangeListener

use of android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener in project AndroidChromium by JackyAndroid.

the class ChromeActivity method postInflationStartup.

@SuppressLint("NewApi")
@Override
public void postInflationStartup() {
    super.postInflationStartup();
    mSnackbarManager = new SnackbarManager(this);
    mDataUseSnackbarController = new DataUseSnackbarController(this, getSnackbarManager());
    mAssistStatusHandler = createAssistStatusHandler();
    if (mAssistStatusHandler != null) {
        if (mTabModelSelector != null) {
            mAssistStatusHandler.setTabModelSelector(mTabModelSelector);
        }
        mAssistStatusHandler.updateAssistState();
    }
    // is only the case for grandfathered-in svelte users. We no longer do so for newer users.
    if (!ChromePreferenceManager.getInstance(this).getAllowLowEndDeviceUi()) {
        CommandLine.getInstance().appendSwitch(BaseSwitches.DISABLE_LOW_END_DEVICE_MODE);
    }
    AccessibilityManager manager = (AccessibilityManager) getBaseContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
    manager.addAccessibilityStateChangeListener(this);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        mTouchExplorationStateChangeListener = new TouchExplorationStateChangeListener() {

            @Override
            public void onTouchExplorationStateChanged(boolean enabled) {
                checkAccessibility();
            }
        };
        manager.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
    }
    // Make the activity listen to policy change events
    CombinedPolicyProvider.get().addPolicyChangeListener(this);
    // Set up the animation placeholder to be the SurfaceView. This disables the
    // SurfaceView's 'hole' clipping during animations that are notified to the window.
    mWindowAndroid.setAnimationPlaceholderView(mCompositorViewHolder.getSurfaceView());
    // Inform the WindowAndroid of the keyboard accessory view.
    mWindowAndroid.setKeyboardAccessoryView((ViewGroup) findViewById(R.id.keyboard_accessory));
    initializeToolbar();
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) SnackbarManager(org.chromium.chrome.browser.snackbar.SnackbarManager) DataUseSnackbarController(org.chromium.chrome.browser.snackbar.DataUseSnackbarController) TouchExplorationStateChangeListener(android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 AccessibilityManager (android.view.accessibility.AccessibilityManager)1 TouchExplorationStateChangeListener (android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener)1 DataUseSnackbarController (org.chromium.chrome.browser.snackbar.DataUseSnackbarController)1 SnackbarManager (org.chromium.chrome.browser.snackbar.SnackbarManager)1