Java Code Examples for androidx.core.view.accessibility.AccessibilityNodeInfoCompat#hashCode()

The following examples show how to use androidx.core.view.accessibility.AccessibilityNodeInfoCompat#hashCode() . 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: NodePathDescription.java    From talkback with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if we can find a node in path with the same hash code and identity information of
 * {@code target}.
 */
public boolean containsNodeByHashAndIdentity(AccessibilityNodeInfoCompat target) {
  if (target == null) {
    return false;
  }
  int hashCode = target.hashCode();
  // Compare from root to leaf, because root node is more immutable.
  for (NodeDescription description : nodeDescriptions) {
    if ((description.nodeInfoHashCode == hashCode) && description.identityMatches(target)) {
      return true;
    }
  }

  return false;
}
 
Example 2
Source File: NodeDescription.java    From talkback with Apache License 2.0 5 votes vote down vote up
static NodeDescription obtain(AccessibilityNodeInfoCompat node) {
  CollectionItemInfoCompat itemInfo = node.getCollectionItemInfo();
  return new NodeDescription(
      node.getClassName(),
      node.getViewIdResourceName(),
      itemInfo == null ? INDEX_TYPE_RAW : INDEX_TYPE_COLLECTION,
      itemInfo == null ? UNDEFINED_INDEX : itemInfo.getRowIndex(),
      itemInfo == null ? UNDEFINED_INDEX : itemInfo.getColumnIndex(),
      getRawIndexInParent(node),
      node.hashCode());
}