Example usage for android.view View ACCESSIBILITY_LIVE_REGION_NONE

List of usage examples for android.view View ACCESSIBILITY_LIVE_REGION_NONE

Introduction

In this page you can find the example usage for android.view View ACCESSIBILITY_LIVE_REGION_NONE.

Prototype

int ACCESSIBILITY_LIVE_REGION_NONE

To view the source code for android.view View ACCESSIBILITY_LIVE_REGION_NONE.

Click Source Link

Document

Live region mode specifying that accessibility services should not automatically announce changes to this view.

Usage

From source file:com.android.screenspeak.formatter.LiveViewFormatter.java

@Override
public boolean accept(AccessibilityEvent event, ScreenSpeakService context) {
    if (event.getEventType() != AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED)
        return false;

    AccessibilityNodeInfoCompat node = new AccessibilityNodeInfoCompat(event.getSource());
    if (node.getInfo() == null) {
        return false;
    }/*ww  w.j  av a 2  s  .c om*/

    int liveRegion = node.getLiveRegion();
    switch (liveRegion) {
    case View.ACCESSIBILITY_LIVE_REGION_POLITE:
        return true;
    case View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE:
        return true;
    case View.ACCESSIBILITY_LIVE_REGION_NONE:
        return false;
    default:
        return false;
    }
}

From source file:com.android.talkback.formatter.LiveViewFormatter.java

@Override
public boolean accept(AccessibilityEvent event, TalkBackService context) {
    if (event.getEventType() != AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED)
        return false;

    AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
    AccessibilityNodeInfoCompat node = record.getSource();
    if (node == null) {
        return false;
    }//  w  w  w.  java  2s .  c o m

    int liveRegion = node.getLiveRegion();
    node.recycle();

    switch (liveRegion) {
    case View.ACCESSIBILITY_LIVE_REGION_POLITE:
        return true;
    case View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE:
        return true;
    case View.ACCESSIBILITY_LIVE_REGION_NONE:
        return false;
    default:
        return false;
    }
}

From source file:com.android.screenspeak.formatter.LiveViewFormatter.java

@Override
public boolean format(AccessibilityEvent event, ScreenSpeakService context, Utterance utterance) {
    AccessibilityNodeInfoCompat node = new AccessibilityNodeInfoCompat(event.getSource());
    if (node.getInfo() == null) {
        return false;
    }/*from w ww .  j  a va  2 s  .com*/

    int liveRegion = node.getLiveRegion();
    switch (liveRegion) {
    case View.ACCESSIBILITY_LIVE_REGION_POLITE:
        break;
    case View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE:
        utterance.getMetadata().putInt(Utterance.KEY_METADATA_QUEUING, SpeechController.QUEUE_MODE_INTERRUPT);
        break;
    case View.ACCESSIBILITY_LIVE_REGION_NONE:
        return false;
    default:
        return false;
    }

    CharSequence text = NodeSpeechRuleProcessor.getInstance().getDescriptionForNode(node, event);

    if (TextUtils.isEmpty(text)) {
        return false;
    }

    utterance.addSpoken(text);
    utterance.addSpokenFlag(FeedbackItem.FLAG_SKIP_DUPLICATE);
    return true;
}

From source file:com.android.talkback.formatter.LiveViewFormatter.java

@Override
public boolean format(AccessibilityEvent event, TalkBackService context, Utterance utterance) {
    AccessibilityNodeInfoCompat node = new AccessibilityNodeInfoCompat(event.getSource());
    if (node.getInfo() == null) {
        return false;
    }// w w w.  j  a v  a2  s .  c o  m

    int liveRegion = node.getLiveRegion();
    switch (liveRegion) {
    case View.ACCESSIBILITY_LIVE_REGION_POLITE:
        break;
    case View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE:
        utterance.getMetadata().putInt(Utterance.KEY_METADATA_QUEUING, SpeechController.QUEUE_MODE_INTERRUPT);
        break;
    case View.ACCESSIBILITY_LIVE_REGION_NONE:
        return false;
    default:
        return false;
    }

    CharSequence text = NodeSpeechRuleProcessor.getInstance().getDescriptionForTree(node, event, node);

    if (TextUtils.isEmpty(text)) {
        return false;
    }

    utterance.addSpoken(text);
    utterance.addSpokenFlag(FeedbackItem.FLAG_SKIP_DUPLICATE);
    return true;
}

From source file:com.facebook.react.uimanager.BaseViewManager.java

@ReactProp(name = PROP_ACCESSIBILITY_LIVE_REGION)
public void setAccessibilityLiveRegion(T view, String liveRegion) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        if (liveRegion == null || liveRegion.equals("none")) {
            view.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE);
        } else if (liveRegion.equals("polite")) {
            view.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE);
        } else if (liveRegion.equals("assertive")) {
            view.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE);
        }/*  w w w  .  jav a  2  s  . c om*/
    }
}