use of android.view.accessibility.AccessibilityEvent in project snackbar by nispok.
the class Snackbar method focusForAccessibility.
private void focusForAccessibility(View view) {
final AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
AccessibilityEventCompat.asRecord(event).setSource(view);
try {
view.sendAccessibilityEventUnchecked(event);
} catch (IllegalStateException e) {
// accessibility is off.
}
}
use of android.view.accessibility.AccessibilityEvent in project XobotOS by xamarin.
the class TextView method sendAccessibilityEventTypeViewTextChanged.
void sendAccessibilityEventTypeViewTextChanged(CharSequence beforeText, int fromIndex, int removedCount, int addedCount) {
AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
event.setFromIndex(fromIndex);
event.setRemovedCount(removedCount);
event.setAddedCount(addedCount);
event.setBeforeText(beforeText);
sendAccessibilityEventUnchecked(event);
}
use of android.view.accessibility.AccessibilityEvent in project android_frameworks_base by ResurrectionRemix.
the class PhoneStatusBarView method onRequestSendAccessibilityEventInternal.
@Override
public boolean onRequestSendAccessibilityEventInternal(View child, AccessibilityEvent event) {
if (super.onRequestSendAccessibilityEventInternal(child, event)) {
// The status bar is very small so augment the view that the user is touching
// with the content of the status bar a whole. This way an accessibility service
// may announce the current item as well as the entire content if appropriate.
AccessibilityEvent record = AccessibilityEvent.obtain();
onInitializeAccessibilityEvent(record);
dispatchPopulateAccessibilityEvent(record);
event.appendRecord(record);
return true;
}
return false;
}
use of android.view.accessibility.AccessibilityEvent in project android_frameworks_base by ResurrectionRemix.
the class ExploreByTouchHelper method invalidateVirtualView.
/**
* Notifies the accessibility framework that the properties of a particular
* item have changed.
* <p>
* You <b>must</b> call this method after changing any of the properties set
* in {@link #onPopulateNodeForVirtualView}.
*
* @param virtualViewId The virtual view id to invalidate, or
* {@link #HOST_ID} to invalidate the root view.
* @param changeTypes The bit mask of change types. May be {@code 0} for the
* default (undefined) change type or one or more of:
* <ul>
* <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION}
* <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_SUBTREE}
* <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_TEXT}
* <li>{@link AccessibilityEvent#CONTENT_CHANGE_TYPE_UNDEFINED}
* </ul>
*/
public void invalidateVirtualView(int virtualViewId, int changeTypes) {
if (virtualViewId != INVALID_ID && mManager.isEnabled()) {
final ViewParent parent = mView.getParent();
if (parent != null) {
final AccessibilityEvent event = createEvent(virtualViewId, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
event.setContentChangeTypes(changeTypes);
parent.requestSendAccessibilityEvent(mView, event);
}
}
}
use of android.view.accessibility.AccessibilityEvent in project android_frameworks_base by ResurrectionRemix.
the class AdapterView method onRequestSendAccessibilityEventInternal.
/** @hide */
@Override
public boolean onRequestSendAccessibilityEventInternal(View child, AccessibilityEvent event) {
if (super.onRequestSendAccessibilityEventInternal(child, event)) {
// Add a record for ourselves as well.
AccessibilityEvent record = AccessibilityEvent.obtain();
onInitializeAccessibilityEvent(record);
// Populate with the text of the requesting child.
child.dispatchPopulateAccessibilityEvent(record);
event.appendRecord(record);
return true;
}
return false;
}
Aggregations