Android AccessibilityManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android AccessibilityManager class.

This code example shows how to use the following methods: isEnabled, isTouchExplorationEnabled
     * that the kill switch is off and system accessibility is turned on. 
     * 
     * @return {@code true} if accessibility is enabled. 
     */ 
    public boolean isAccessibilityEnabled() { 
        return ENABLE_ACCESSIBILITY && mAccessibilityManager.isEnabled();
    } 
 
    /** 
     * Returns {@code true} if touch exploration is enabled. Currently, this 
     * means that the kill switch is off, the device supports touch exploration, 
     * and system accessibility is turned on. 
     * 
     * @return {@code true} if touch exploration is enabled. 
     */ 
    public boolean isTouchExplorationEnabled() { 
        return isAccessibilityEnabled() && mAccessibilityManager.isTouchExplorationEnabled();
    } 
 
    /** 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isEnabled, isTouchExplorationEnabled
        Context context = getContext();
        // only send accessibility events if accessibility and exploration are 
        // on. 
        AccessibilityManager am = (AccessibilityManager) context
                .getSystemService(Service.ACCESSIBILITY_SERVICE);
        if (!am.isEnabled() || !am.isTouchExplorationEnabled()) {
            return super.onHoverEvent(event);
        } 
        if (event.getAction() != MotionEvent.ACTION_HOVER_EXIT) {
            Time hover = getDayFromLocation(event.getX());
            if (hover != null
                    && (mLastHoverTime == null || Time.compare(hover, mLastHoverTime) != 0)) {
                Long millis = hover.toMillis(true);
                String date = Utils.formatDateRange(context, millis, millis,
                        DateUtils.FORMAT_SHOW_DATE);
                AccessibilityEvent accessEvent =
                    AccessibilityEvent.obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
                accessEvent.getText().add(date);
                sendAccessibilityEventUnchecked(accessEvent);
                mLastHoverTime = hover;
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isEnabled, isTouchExplorationEnabled
 
    @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) {

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isEnabled, isTouchExplorationEnabled
 
    @Override 
    public boolean onHover(View v, MotionEvent event) {
        // When touch exploration is turned on, lifting a finger while 
        // inside the view 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 by setting the view as not clickable. 
                    mCachedClickableState = v.isClickable();
                    v.setClickable(false);
                    break; 
                case MotionEvent.ACTION_HOVER_EXIT:
                    final int x = (int) event.getX();
                    final int y = (int) event.getY();
                    if ((x > v.getPaddingLeft()) && (y > v.getPaddingTop())
                            && (x < v.getWidth() - v.getPaddingRight())
                            && (y < v.getHeight() - v.getPaddingBottom())) {
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isEnabled, isTouchExplorationEnabled
        Context context = getContext();
        // only send accessibility events if accessibility and exploration are 
        // on. 
        AccessibilityManager am = (AccessibilityManager) context
                .getSystemService(Service.ACCESSIBILITY_SERVICE);
        if (!am.isEnabled() || !am.isTouchExplorationEnabled()) {
            return super.onHoverEvent(event);
        } 
        if (event.getAction() != MotionEvent.ACTION_HOVER_EXIT) {
            Time hover = getDayFromLocation(event.getX());
            if (hover != null
                    && (mLastHoverTime == null || Time.compare(hover, mLastHoverTime) != 0)) {
                Long millis = hover.toMillis(true);
                String date = formatDateRange(context, millis, millis,
                        DateUtils.FORMAT_SHOW_DATE);
                AccessibilityEvent accessEvent =
                    AccessibilityEvent.obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
                accessEvent.getText().add(date);
                sendAccessibilityEventUnchecked(accessEvent);
                mLastHoverTime = hover;
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android AccessibilityManager Questions & Answers:

See Code Examples for Android AccessibilityManager Methods: