List of usage examples for android.view.accessibility AccessibilityNodeInfo equals
@Override public boolean equals(Object object)
From source file:com.android.switchaccess.test.ShadowAccessibilityNodeInfoCompat.java
@Implementation @Override//from ww w . jav a 2s . c om public boolean equals(Object object) { if (object == null) { return false; } final AccessibilityNodeInfoCompat compat = (AccessibilityNodeInfoCompat) object; final AccessibilityNodeInfo thisInfo = ((AccessibilityNodeInfo) mRealObject.getInfo()); final AccessibilityNodeInfo otherInfo = ((AccessibilityNodeInfo) compat.getInfo()); return thisInfo.equals(otherInfo); }
From source file:com.android.utils.WindowManager.java
/** * Gets the window whose anchor equals the given node. *//*from ww w .j a v a 2 s .c o m*/ public AccessibilityWindowInfo getAnchoredWindow(@Nullable AccessibilityNodeInfoCompat targetAnchor) { if (!BuildCompat.isAtLeastN() || targetAnchor == null) { return null; } int windowCount = mWindows.size(); for (int i = 0; i < windowCount; ++i) { AccessibilityWindowInfo window = mWindows.get(i); if (window != null) { AccessibilityNodeInfo anchor = window.getAnchor(); if (anchor != null) { try { if (anchor.equals(targetAnchor.getInfo())) { return window; } } finally { anchor.recycle(); } } } } return null; }
From source file:com.android.talkback.eventprocessor.ProcessorScrollPosition.java
private boolean shouldIgnoreUpdateListEvent(AccessibilityEvent event) { // Don't speak during full-screen read. if (mFullScreenReadController.isActive()) { return true; }// w w w . j a va 2 s .c om final int fromIndex = event.getFromIndex() + 1; final int itemCount = event.getItemCount(); if (itemCount <= 0 || fromIndex <= 0) { return true; } EventId eventId; try { eventId = new EventId(event); } catch (Exception e) { return true; } final Integer cachedFromIndex = mCachedFromValues.get(eventId); final Integer cachedItemCount = mCachedItemCounts.get(eventId); if ((cachedFromIndex != null) && (cachedFromIndex == fromIndex) && (cachedItemCount != null) && (cachedItemCount == itemCount)) { // The from index hasn't changed, which means the event is coming // from a re-layout or resize and should not be spoken. return true; } // The behavior of put() for an existing key is unspecified, so we can't // recycle the old or new key nodes. mCachedFromValues.put(eventId, fromIndex); mCachedItemCounts.put(eventId, itemCount); // Allow the list indices to be cached, but don't actually speak after auto-scroll. if (mAutoScrollNode != null) { AccessibilityNodeInfo source = event.getSource(); if (source != null) { try { if (source.equals(mAutoScrollNode.getInfo())) { mAutoScrollNode.recycle(); mAutoScrollNode = null; return true; } } finally { source.recycle(); } } } return false; }
From source file:com.googlecode.eyesfree.brailleback.TreeDebugNavigationMode.java
private AccessibilityNodeInfo getNextSibling(AccessibilityNodeInfo from) { AccessibilityNodeInfo parent = from.getParent(); if (parent == null) { return null; }/*from w w w .j av a 2 s .c o m*/ AccessibilityNodeInfo cur = null; try { int childCount = parent.getChildCount(); for (int i = 0; i < childCount - 1; ++i) { cur = parent.getChild(i); if (cur == null) { return null; } if (cur.equals(from)) { return parent.getChild(i + 1); } if (cur != null) { cur.recycle(); cur = null; } } } finally { parent.recycle(); if (cur != null) { cur.recycle(); } } return null; }
From source file:com.googlecode.eyesfree.brailleback.TreeDebugNavigationMode.java
private AccessibilityNodeInfo getPreviousSibling(AccessibilityNodeInfo from) { AccessibilityNodeInfo ret = null;//from w ww .j a va 2 s.c om AccessibilityNodeInfo parent = from.getParent(); if (parent == null) { return null; } AccessibilityNodeInfo prev = null; AccessibilityNodeInfo cur = null; try { int childCount = parent.getChildCount(); for (int i = 0; i < childCount; ++i) { cur = parent.getChild(i); if (cur == null) { return null; } if (cur.equals(from)) { ret = prev; prev = null; return ret; } if (prev != null) { prev.recycle(); } prev = cur; cur = null; } } finally { parent.recycle(); if (prev != null) { prev.recycle(); } if (cur != null) { cur.recycle(); } } return ret; }