android.view.View#getAccessibilityViewId ( )源码实例Demo

下面列出了android.view.View#getAccessibilityViewId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: AutofillPopupWindow.java
@Override
public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) {
    if (sVerbose) {
        Log.v(TAG, "showAsDropDown(): anchor=" + anchor + ", xoff=" + xoff + ", yoff=" + yoff
                + ", isShowing(): " + isShowing());
    }
    if (isShowing()) {
        return;
    }

    setShowing(true);
    setDropDown(true);
    attachToAnchor(anchor, xoff, yoff, gravity);
    final WindowManager.LayoutParams p = mWindowLayoutParams = createPopupLayoutParams(
            anchor.getWindowToken());
    final boolean aboveAnchor = findDropDownPosition(anchor, p, xoff, yoff,
            p.width, p.height, gravity, getAllowScrollingAnchorParent());
    updateAboveAnchor(aboveAnchor);
    p.accessibilityIdOfAnchor = anchor.getAccessibilityViewId();
    p.packageName = anchor.getContext().getPackageName();
    mWindowPresenter.show(p, getTransitionEpicenter(), isLayoutInsetDecor(),
            anchor.getLayoutDirection());
}
 
源代码2 项目: android_9.0.0_r45   文件: AccessibilityNodeInfo.java
/**
 * Removes a virtual child which is a descendant of the given
 * <code>root</code>. If the child was not previously added to the node,
 * calling this method has no effect.
 *
 * @param root The root of the virtual subtree.
 * @param virtualDescendantId The id of the virtual child.
 * @return true if the child was present
 * @see #addChild(View, int)
 */
public boolean removeChild(View root, int virtualDescendantId) {
    enforceNotSealed();
    final LongArray childIds = mChildNodeIds;
    if (childIds == null) {
        return false;
    }
    final int rootAccessibilityViewId =
            (root != null) ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
    final long childNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
    final int index = childIds.indexOf(childNodeId);
    if (index < 0) {
        return false;
    }
    childIds.remove(index);
    return true;
}
 
源代码3 项目: android_9.0.0_r45   文件: PopupWindow.java
/**
 * Displays the content view in a popup window anchored to the corner of
 * another view. The window is positioned according to the specified
 * gravity and offset by the specified x and y coordinates.
 * <p>
 * If there is not enough room on screen to show the popup in its entirety,
 * this method tries to find a parent scroll view to scroll. If no parent
 * view can be scrolled, the specified vertical gravity will be ignored and
 * the popup will anchor itself such that it is visible.
 * <p>
 * If the view later scrolls to move <code>anchor</code> to a different
 * location, the popup will be moved correspondingly.
 *
 * @param anchor the view on which to pin the popup window
 * @param xoff A horizontal offset from the anchor in pixels
 * @param yoff A vertical offset from the anchor in pixels
 * @param gravity Alignment of the popup relative to the anchor
 *
 * @see #dismiss()
 */
public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) {
    if (isShowing() || !hasContentView()) {
        return;
    }

    TransitionManager.endTransitions(mDecorView);

    attachToAnchor(anchor, xoff, yoff, gravity);

    mIsShowing = true;
    mIsDropdown = true;

    final WindowManager.LayoutParams p =
            createPopupLayoutParams(anchor.getApplicationWindowToken());
    preparePopup(p);

    final boolean aboveAnchor = findDropDownPosition(anchor, p, xoff, yoff,
            p.width, p.height, gravity, mAllowScrollingAnchorParent);
    updateAboveAnchor(aboveAnchor);
    p.accessibilityIdOfAnchor = (anchor != null) ? anchor.getAccessibilityViewId() : -1;

    invokePopup(p);
}
 
源代码4 项目: android_9.0.0_r45   文件: AccessibilityNodeInfo.java
private void addChildInternal(View root, int virtualDescendantId, boolean checked) {
    enforceNotSealed();
    if (mChildNodeIds == null) {
        mChildNodeIds = new LongArray();
    }
    final int rootAccessibilityViewId =
        (root != null) ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
    final long childNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
    // If we're checking uniqueness and the ID already exists, abort.
    if (checked && mChildNodeIds.indexOf(childNodeId) >= 0) {
        return;
    }
    mChildNodeIds.add(childNodeId);
}
 
源代码5 项目: android_9.0.0_r45   文件: AccessibilityNodeInfo.java
/**
 * Sets the source to be a virtual descendant of the given <code>root</code>.
 * If <code>virtualDescendantId</code> is {@link View#NO_ID} the root
 * is set as the source.
 * <p>
 * A virtual descendant is an imaginary View that is reported as a part of the view
 * hierarchy for accessibility purposes. This enables custom views that draw complex
 * content to report themselves as a tree of virtual views, thus conveying their
 * logical structure.
 * </p>
 * <p>
 *   <strong>Note:</strong> Cannot be called from an
 *   {@link android.accessibilityservice.AccessibilityService}.
 *   This class is made immutable before being delivered to an AccessibilityService.
 * </p>
 *
 * @param root The root of the virtual subtree.
 * @param virtualDescendantId The id of the virtual descendant.
 */
public void setSource(View root, int virtualDescendantId) {
    enforceNotSealed();
    mWindowId = (root != null) ? root.getAccessibilityWindowId() : UNDEFINED_ITEM_ID;
    final int rootAccessibilityViewId =
        (root != null) ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
    mSourceNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
}
 
源代码6 项目: android_9.0.0_r45   文件: AccessibilityNodeInfo.java
/**
 * Sets the node before which this one is visited during traversal. A screen-reader
 * must visit the content of this node before the content of the one it precedes.
 * The successor is a virtual descendant of the given <code>root</code>. If
 * <code>virtualDescendantId</code> equals to {@link View#NO_ID} the root is set
 * as the successor.
 * <p>
 * A virtual descendant is an imaginary View that is reported as a part of the view
 * hierarchy for accessibility purposes. This enables custom views that draw complex
 * content to report them selves as a tree of virtual views, thus conveying their
 * logical structure.
 * </p>
 * <p>
 *   <strong>Note:</strong> Cannot be called from an
 *   {@link android.accessibilityservice.AccessibilityService}.
 *   This class is made immutable before being delivered to an AccessibilityService.
 * </p>
 *
 * @param root The root of the virtual subtree.
 * @param virtualDescendantId The id of the virtual descendant.
 */
public void setTraversalBefore(View root, int virtualDescendantId) {
    enforceNotSealed();
    final int rootAccessibilityViewId = (root != null)
            ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
    mTraversalBefore = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
}
 
源代码7 项目: android_9.0.0_r45   文件: AccessibilityNodeInfo.java
/**
 * Sets the node after which this one is visited in accessibility traversal.
 * A screen-reader must visit the content of the other node before the content
 * of this one. If <code>virtualDescendantId</code> equals to {@link View#NO_ID}
 * the root is set as the predecessor.
 * <p>
 * A virtual descendant is an imaginary View that is reported as a part of the view
 * hierarchy for accessibility purposes. This enables custom views that draw complex
 * content to report them selves as a tree of virtual views, thus conveying their
 * logical structure.
 * </p>
 * <p>
 *   <strong>Note:</strong> Cannot be called from an
 *   {@link android.accessibilityservice.AccessibilityService}.
 *   This class is made immutable before being delivered to an AccessibilityService.
 * </p>
 *
 * @param root The root of the virtual subtree.
 * @param virtualDescendantId The id of the virtual descendant.
 */
public void setTraversalAfter(View root, int virtualDescendantId) {
    enforceNotSealed();
    final int rootAccessibilityViewId = (root != null)
            ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
    mTraversalAfter = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
}
 
源代码8 项目: android_9.0.0_r45   文件: AccessibilityNodeInfo.java
/**
 * Sets the parent to be a virtual descendant of the given <code>root</code>.
 * If <code>virtualDescendantId</code> equals to {@link View#NO_ID} the root
 * is set as the parent.
 * <p>
 * A virtual descendant is an imaginary View that is reported as a part of the view
 * hierarchy for accessibility purposes. This enables custom views that draw complex
 * content to report them selves as a tree of virtual views, thus conveying their
 * logical structure.
 * </p>
 * <p>
 *   <strong>Note:</strong> Cannot be called from an
 *   {@link android.accessibilityservice.AccessibilityService}.
 *   This class is made immutable before being delivered to an AccessibilityService.
 * </p>
 *
 * @param root The root of the virtual subtree.
 * @param virtualDescendantId The id of the virtual descendant.
 */
public void setParent(View root, int virtualDescendantId) {
    enforceNotSealed();
    final int rootAccessibilityViewId =
        (root != null) ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
    mParentNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
}
 
源代码9 项目: android_9.0.0_r45   文件: AccessibilityNodeInfo.java
/**
 * Sets the view for which the view represented by this info serves as a
 * label for accessibility purposes. If <code>virtualDescendantId</code>
 * is {@link View#NO_ID} the root is set as the labeled.
 * <p>
 * A virtual descendant is an imaginary View that is reported as a part of the view
 * hierarchy for accessibility purposes. This enables custom views that draw complex
 * content to report themselves as a tree of virtual views, thus conveying their
 * logical structure.
 * </p>
 * <p>
 *   <strong>Note:</strong> Cannot be called from an
 *   {@link android.accessibilityservice.AccessibilityService}.
 *   This class is made immutable before being delivered to an AccessibilityService.
 * </p>
 *
 * @param root The root whose virtual descendant serves as a label.
 * @param virtualDescendantId The id of the virtual descendant.
 */
public void setLabelFor(View root, int virtualDescendantId) {
    enforceNotSealed();
    final int rootAccessibilityViewId = (root != null)
            ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
    mLabelForId = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
}
 
源代码10 项目: android_9.0.0_r45   文件: AccessibilityNodeInfo.java
/**
 * Sets the view which serves as the label of the view represented by
 * this info for accessibility purposes. If <code>virtualDescendantId</code>
 * is {@link View#NO_ID} the root is set as the label.
 * <p>
 * A virtual descendant is an imaginary View that is reported as a part of the view
 * hierarchy for accessibility purposes. This enables custom views that draw complex
 * content to report themselves as a tree of virtual views, thus conveying their
 * logical structure.
 * </p>
 * <p>
 *   <strong>Note:</strong> Cannot be called from an
 *   {@link android.accessibilityservice.AccessibilityService}.
 *   This class is made immutable before being delivered to an AccessibilityService.
 * </p>
 *
 * @param root The root whose virtual descendant labels this node's source.
 * @param virtualDescendantId The id of the virtual descendant.
 */
public void setLabeledBy(View root, int virtualDescendantId) {
    enforceNotSealed();
    final int rootAccessibilityViewId = (root != null)
            ? root.getAccessibilityViewId() : UNDEFINED_ITEM_ID;
    mLabeledById = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
}
 
源代码11 项目: android_9.0.0_r45   文件: AccessibilityRecord.java
/**
 * Sets the source to be a virtual descendant of the given <code>root</code>.
 * If <code>virtualDescendantId</code> equals to {@link View#NO_ID} the root
 * is set as the source.
 * <p>
 * A virtual descendant is an imaginary View that is reported as a part of the view
 * hierarchy for accessibility purposes. This enables custom views that draw complex
 * content to report them selves as a tree of virtual views, thus conveying their
 * logical structure.
 * </p>
 *
 * @param root The root of the virtual subtree.
 * @param virtualDescendantId The id of the virtual descendant.
 */
public void setSource(@Nullable View root, int virtualDescendantId) {
    enforceNotSealed();
    boolean important = true;
    int rootViewId = AccessibilityNodeInfo.UNDEFINED_ITEM_ID;
    mSourceWindowId = AccessibilityWindowInfo.UNDEFINED_WINDOW_ID;
    if (root != null) {
        important = root.isImportantForAccessibility();
        rootViewId = root.getAccessibilityViewId();
        mSourceWindowId = root.getAccessibilityWindowId();
    }
    setBooleanProperty(PROPERTY_IMPORTANT_FOR_ACCESSIBILITY, important);
    mSourceNodeId = AccessibilityNodeInfo.makeNodeId(rootViewId, virtualDescendantId);
}
 
 方法所在类
 同类方法