Java Code Examples for android.view.View#AccessibilityDelegate

The following examples show how to use android.view.View#AccessibilityDelegate . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void cleanup() {
    for (final Map.Entry<View, TrackingAccessibilityDelegate> entry :
            mWatching.entrySet()) {
        final View v = entry.getKey();
        final TrackingAccessibilityDelegate toCleanup = entry.getValue();
        final View.AccessibilityDelegate currentViewDelegate = getOldDelegate(v);
        if (currentViewDelegate == toCleanup) {
            v.setAccessibilityDelegate(toCleanup.getRealDelegate());
        } else if (currentViewDelegate instanceof TrackingAccessibilityDelegate) {
            final TrackingAccessibilityDelegate newChain =
                    (TrackingAccessibilityDelegate) currentViewDelegate;
            newChain.removeFromDelegateChain(toCleanup);
        } else {
            // Assume we've been replaced, zeroed out, or for some other reason we're
            // already gone.
            // (This isn't too weird, for example, it's expected when views get recycled)
        }
    }
    mWatching.clear();
}
 
Example 2
@Override
public void accumulate(View found) {
    final View.AccessibilityDelegate realDelegate = getOldDelegate(found);
    if (realDelegate instanceof TrackingAccessibilityDelegate) {
        final TrackingAccessibilityDelegate currentTracker =
                (TrackingAccessibilityDelegate) realDelegate;
        if (currentTracker.willFireEvent(UIHelper.textPropertyFromView(found),
                getEventName())) {
            return; // Don't double track
        }
    }

    // We aren't already in the tracking call chain of the view
    final TrackingAccessibilityDelegate newDelegate =
            new TrackingAccessibilityDelegate(realDelegate);
    found.setAccessibilityDelegate(newDelegate);
    mWatching.put(found, newDelegate);
}
 
Example 3
Source Project: litho   File: ComponentHost.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setAccessibilityDelegate(View.AccessibilityDelegate accessibilityDelegate) {
  super.setAccessibilityDelegate(accessibilityDelegate);

  // We cannot compare against mComponentAccessibilityDelegate directly, since it is not the
  // delegate that we receive here. Instead, we'll set this to true at the point that we set that
  // delegate explicitly.
  mIsComponentAccessibilityDelegateSet = false;
}
 
Example 4
public TrackingAccessibilityDelegate(View.AccessibilityDelegate realDelegate) {
    mRealDelegate = realDelegate;
}
 
Example 5
public View.AccessibilityDelegate getRealDelegate() {
    return mRealDelegate;
}
 
Example 6
Source Project: anvil   File: DSL.java    License: MIT License 4 votes vote down vote up
public static Void accessibilityDelegate(View.AccessibilityDelegate arg) {
  return BaseDSL.attr("accessibilityDelegate", arg);
}
 
Example 7
Source Project: anvil   File: DSL.java    License: MIT License 4 votes vote down vote up
public static Void accessibilityDelegate(View.AccessibilityDelegate arg) {
  return BaseDSL.attr("accessibilityDelegate", arg);
}