Java Code Examples for android.view.accessibility.AccessibilityManager#addAccessibilityStateChangeListener()

The following examples show how to use android.view.accessibility.AccessibilityManager#addAccessibilityStateChangeListener() . 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: KeyboardShortcutDialogPreference.java    From talkback with Apache License 2.0 6 votes vote down vote up
private void init() {
  setPersistent(true);
  setDialogLayoutResource(R.layout.keyboard_shortcut_dialog);

  if (TalkBackService.getInstance() != null) {
    keyComboManager = TalkBackService.getInstance().getKeyComboManager();
  } else {
    keyComboManager = KeyComboManager.create(getContext());
  }

  if (keyComboManager == null) {
    throw new IllegalStateException(
        "KeyboardShortcutDialogPreference should never appear "
            + "on systems where KeyComboManager is unavailable");
  }

  setTemporaryKeyComboCodeWithoutTriggerModifier(
      keyComboManager.getKeyComboModel().getKeyComboCodeForKey(getKey()));

  accessibilityManager =
      (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
  accessibilityManager.addAccessibilityStateChangeListener(this);

  updateAvailability();
}
 
Example 2
Source File: MemoryFragment.java    From FileManager with Apache License 2.0 5 votes vote down vote up
@Override
protected void initData() {

    mPresenter.getRunningAppInfo();
    mAccessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
    mAccessibilityManager.addAccessibilityStateChangeListener(this);
}
 
Example 3
Source File: MainActivity.java    From NewsPushMonitor with Apache License 2.0 4 votes vote down vote up
private void initAccessibilityService() {
    accessibilityManager = (AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE);
    accessibilityManager.addAccessibilityStateChangeListener(this);
}
 
Example 4
Source File: MainService.java    From pc-android-controller-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    if (!EventBus.getDefault().isRegistered(this)) {
        EventBus.getDefault().register(this);
    }

    accessibilityManager = (AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE);
    accessibilityManager.addAccessibilityStateChangeListener(this);

    motionClickIntent = new Intent(this, MotionClickService.class);

    screenRecodeIntent = new Intent(this, ScreenRecodeService.class);

    startAllService();

}
 
Example 5
Source File: ChromeActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@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();
    }

    // If a user had ALLOW_LOW_END_DEVICE_UI explicitly set to false then we manually override
    // SysUtils.isLowEndDevice() with a switch so that they continue to see the normal UI. This
    // 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
    getChromeApplication().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();
}
 
Example 6
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@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();
    }

    // If a user had ALLOW_LOW_END_DEVICE_UI explicitly set to false then we manually override
    // SysUtils.isLowEndDevice() with a switch so that they continue to see the normal UI. This
    // 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();
    initializeTabModels();
    if (!isFinishing() && getFullscreenManager() != null) {
        getFullscreenManager().initialize(
                (ControlContainer) findViewById(R.id.control_container),
                getTabModelSelector(),
                getControlContainerHeightResource());
    }
}
 
Example 7
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@SuppressLint("NewApi")
@Override
public void postInflationStartup() {
    super.postInflationStartup();

    mSnackbarManager = new SnackbarManager(this, null);
    mDataUseSnackbarController = new DataUseSnackbarController(this, getSnackbarManager());

    mAssistStatusHandler = createAssistStatusHandler();
    if (mAssistStatusHandler != null) {
        if (mTabModelSelector != null) {
            mAssistStatusHandler.setTabModelSelector(mTabModelSelector);
        }
        mAssistStatusHandler.updateAssistState();
    }

    // If a user had ALLOW_LOW_END_DEVICE_UI explicitly set to false then we manually override
    // SysUtils.isLowEndDevice() with a switch so that they continue to see the normal UI. This
    // is only the case for grandfathered-in svelte users. We no longer do so for newer users.
    if (!ChromePreferenceManager.getInstance().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);
    mDidAddPolicyChangeListener = true;

    // Set up the animation placeholder to be the SurfaceView. This disables the
    // SurfaceView's 'hole' clipping during animations that are notified to the window.
    getWindowAndroid().setAnimationPlaceholderView(mCompositorViewHolder.getCompositorView());

    // Inform the WindowAndroid of the keyboard accessory view.
    getWindowAndroid().setKeyboardAccessoryView(
            (ViewGroup) findViewById(R.id.keyboard_accessory));
    initializeToolbar();
    initializeTabModels();
    if (!isFinishing() && getFullscreenManager() != null) {
        getFullscreenManager().initialize(
                (ControlContainer) findViewById(R.id.control_container),
                getTabModelSelector(),
                getControlContainerHeightResource());
    }

    if (mBottomSheet != null) {
        mBottomSheet.setTabModelSelector(mTabModelSelector);
        mBottomSheet.setFullscreenManager(mFullscreenManager);

        mFadingBackgroundView = (FadingBackgroundView) findViewById(R.id.fading_focus_target);
        mBottomSheet.addObserver(new EmptyBottomSheetObserver() {
            @Override
            public void onTransitionPeekToHalf(float transitionFraction) {
                mFadingBackgroundView.setViewAlpha(transitionFraction);
            }
        });
        mFadingBackgroundView.addObserver(mBottomSheet);

        mBottomSheetContentController =
                (BottomSheetContentController) ((ViewStub) findViewById(R.id.bottom_nav_stub))
                        .inflate();
        int controlContainerHeight =
                ((ControlContainer) findViewById(R.id.control_container)).getView().getHeight();
        mBottomSheetContentController.init(
                mBottomSheet, controlContainerHeight, mTabModelSelector, this);
    }
    ((BottomContainer) findViewById(R.id.bottom_container)).initialize(mFullscreenManager);
}
 
Example 8
Source File: i.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public static boolean a(AccessibilityManager accessibilitymanager, Object obj)
{
    return accessibilitymanager.addAccessibilityStateChangeListener((android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener)obj);
}
 
Example 9
Source File: AccessibilityManagerCompatIcs.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static boolean addAccessibilityStateChangeListener(AccessibilityManager manager,
        Object listener) {
    return manager.addAccessibilityStateChangeListener(
            (AccessibilityStateChangeListener)listener);
}
 
Example 10
Source File: AccessibilityManagerCompatIcs.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static boolean addAccessibilityStateChangeListener(AccessibilityManager manager,
        Object listener) {
    return manager.addAccessibilityStateChangeListener(
            (AccessibilityStateChangeListener)listener);
}
 
Example 11
Source File: AccessibilityManagerCompatIcs.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public static boolean addAccessibilityStateChangeListener(AccessibilityManager manager,
        Object listener) {
    return manager.addAccessibilityStateChangeListener(
            (AccessibilityStateChangeListener)listener);
}
 
Example 12
Source File: AccessibilityManagerCompatIcs.java    From guideshow with MIT License 4 votes vote down vote up
public static boolean addAccessibilityStateChangeListener(AccessibilityManager manager,
        Object listener) {
    return manager.addAccessibilityStateChangeListener(
            (AccessibilityStateChangeListener)listener);
}