List of usage examples for android.view View ACCESSIBILITY_LIVE_REGION_POLITE
int ACCESSIBILITY_LIVE_REGION_POLITE
To view the source code for android.view View ACCESSIBILITY_LIVE_REGION_POLITE.
Click Source Link
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; }//from ww w .j a va 2 s . c o m 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 ww. j av a 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 ww w. j av a 2s.co 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().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; }//from ww w. j a v a 2s . c om 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.android.screenspeak.eventprocessor.ProcessorEventQueue.java
/** * Computes the queuing mode for the current utterance. * * @param utterance to compute queuing from * @return A queuing mode, one of://from w ww . j av a2 s. co m * <ul> * <li>{@link SpeechController#QUEUE_MODE_INTERRUPT} * <li>{@link SpeechController#QUEUE_MODE_QUEUE} * <li>{@link SpeechController#QUEUE_MODE_UNINTERRUPTIBLE} * </ul> */ private int computeQueuingMode(Utterance utterance, AccessibilityEvent event) { final Bundle metadata = utterance.getMetadata(); final int eventType = event.getEventType(); // Queue events that occur automatically after window state changes. if (((event.getEventType() & AccessibilityEventProcessor.AUTOMATIC_AFTER_STATE_CHANGE) != 0) && ((event.getEventTime() - mLastWindowStateChanged) < AccessibilityEventProcessor.DELAY_AUTO_AFTER_STATE)) { return SpeechController.QUEUE_MODE_QUEUE; } if (eventType == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED) { AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event); AccessibilityNodeInfoCompat node = record.getSource(); if (node != null) { int liveRegionMode = node.getLiveRegion(); if (liveRegionMode == View.ACCESSIBILITY_LIVE_REGION_POLITE) { return SpeechController.QUEUE_MODE_QUEUE; } } } int queueMode = metadata.getInt(Utterance.KEY_METADATA_QUEUING, SpeechController.QUEUE_MODE_INTERRUPT); // Always collapse events of the same type. if (mLastEventType == eventType && queueMode != SpeechController.QUEUE_MODE_UNINTERRUPTIBLE) { return SpeechController.QUEUE_MODE_INTERRUPT; } mLastEventType = eventType; return queueMode; }
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); }//from w ww. j a v a 2 s . c o m } }