android.support.v4.view.AccessibilityDelegateCompat Java Examples

The following examples show how to use android.support.v4.view.AccessibilityDelegateCompat. 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 check out the related API usage on the sidebar.
Example #1
Source File: AccessibilityDelegateUtil.java    From react-native-GPay with MIT License 5 votes vote down vote up
public static void setDelegate(final View view) {
  final String accessibilityHint = (String) view.getTag(R.id.accessibility_hint);
  final AccessibilityRole accessibilityRole = (AccessibilityRole) view.getTag(R.id.accessibility_role);
  // if a view already has an accessibility delegate, replacing it could cause problems,
  // so leave it alone.
  if (!ViewCompat.hasAccessibilityDelegate(view) &&
    (accessibilityHint != null || accessibilityRole != null)) {
    ViewCompat.setAccessibilityDelegate(
      view,
      new AccessibilityDelegateCompat() {
        @Override
        public void onInitializeAccessibilityNodeInfo(
          View host, AccessibilityNodeInfoCompat info) {
          super.onInitializeAccessibilityNodeInfo(host, info);
          setRole(info, accessibilityRole, view.getContext());
          if (!(accessibilityHint == null)) {
            String contentDescription=(String)info.getContentDescription();
            if (contentDescription != null) {
              contentDescription = contentDescription + ", " + accessibilityHint;
              info.setContentDescription(contentDescription);
            } else {
              info.setContentDescription(accessibilityHint);
            }
          }
        }
      });
  }
}
 
Example #2
Source File: RecyclerViewAccessibilityDelegate.java    From letv with Apache License 2.0 4 votes vote down vote up
AccessibilityDelegateCompat getItemDelegate() {
    return this.mItemDelegate;
}
 
Example #3
Source File: RecyclerViewAccessibilityDelegate.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
AccessibilityDelegateCompat getItemDelegate() {
    return mItemDelegate;
}
 
Example #4
Source File: TouchExplorationHelper.java    From DateTimepicker with Apache License 2.0 4 votes vote down vote up
public AccessibilityDelegateCompat getAccessibilityDelegate() {
    return mDelegate;
}
 
Example #5
Source File: RecyclerViewAccessibilityDelegate.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Gets the AccessibilityDelegate for an individual item in the RecyclerView.
 * A basic item delegate is provided by default, but you can override this
 * method to provide a custom per-item delegate.
 */
public AccessibilityDelegateCompat getItemDelegate() {
    return mItemDelegate;
}
 
Example #6
Source File: RecyclerViewAccessibilityDelegate.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Gets the AccessibilityDelegate for an individual item in the RecyclerView.
 * A basic item delegate is provided by default, but you can override this
 * method to provide a custom per-item delegate.
 */
public AccessibilityDelegateCompat getItemDelegate() {
    return mItemDelegate;
}