Code example for AccessibilityManager

Methods: isEnabledisTouchExplorationEnabled

0
 
    @Override 
    public boolean performClick() { 
        // When accessibility is on, simulate press and release to preserve the 
        // semantic meaning of performClick(). Required for Braille support. 
        if (mAccessibilityManager.isEnabled()) {
            // Checking the press state prevents double activation. 
            if (!isPressed()) {
                setPressed(true); 
                setPressed(false); 
            } 
 
            return true; 
        } 
 
        return super.performClick(); 
    } 
 
    @Override 
    public boolean onHoverEvent(MotionEvent event) {
        // When touch exploration is turned on, lifting a finger while inside 
        // the button's hover target bounds should perform a click action. 
        if (mAccessibilityManager.isEnabled()
                && mAccessibilityManager.isTouchExplorationEnabled()) {
            switch (event.getActionMasked()) {
                case MotionEvent.ACTION_HOVER_ENTER:
                    // Lift-to-type temporarily disables double-tap activation. 
                    setClickable(false);
                    break; 
Stop searching for code, let great code find you!  Add Codota to your java IDE