android.view.View#IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS源码实例Demo

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

源代码1 项目: delion   文件: Tab.java
/**
 * Update whether or not the current native tab and/or web contents are
 * currently visible (from an accessibility perspective), or whether
 * they're obscured by another view.
 */
public void updateAccessibilityVisibility() {
    View view = getView();
    if (view != null) {
        int importantForAccessibility = isObscuredByAnotherViewForAccessibility()
                ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
                : View.IMPORTANT_FOR_ACCESSIBILITY_YES;
        if (view.getImportantForAccessibility() != importantForAccessibility) {
            view.setImportantForAccessibility(importantForAccessibility);
            view.sendAccessibilityEvent(
                    AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        }
    }

    ContentViewCore cvc = getContentViewCore();
    if (cvc != null) {
        boolean isWebContentObscured = isObscuredByAnotherViewForAccessibility()
                || isShowingSadTab();
        cvc.setObscuredByAnotherView(isWebContentObscured);
    }
}
 
源代码2 项目: AndroidChromium   文件: Tab.java
/**
 * Update whether or not the current native tab and/or web contents are
 * currently visible (from an accessibility perspective), or whether
 * they're obscured by another view.
 */
public void updateAccessibilityVisibility() {
    View view = getView();
    if (view != null) {
        int importantForAccessibility = isObscuredByAnotherViewForAccessibility()
                ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
                : View.IMPORTANT_FOR_ACCESSIBILITY_YES;
        if (view.getImportantForAccessibility() != importantForAccessibility) {
            view.setImportantForAccessibility(importantForAccessibility);
            view.sendAccessibilityEvent(
                    AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        }
    }

    ContentViewCore cvc = getContentViewCore();
    if (cvc != null) {
        boolean isWebContentObscured = isObscuredByAnotherViewForAccessibility()
                || isShowingSadTab();
        cvc.setObscuredByAnotherView(isWebContentObscured);
    }
}
 
源代码3 项目: 365browser   文件: Tab.java
/**
 * Update whether or not the current native tab and/or web contents are
 * currently visible (from an accessibility perspective), or whether
 * they're obscured by another view.
 */
public void updateAccessibilityVisibility() {
    View view = getView();
    if (view != null) {
        int importantForAccessibility = isObscuredByAnotherViewForAccessibility()
                ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
                : View.IMPORTANT_FOR_ACCESSIBILITY_YES;
        if (view.getImportantForAccessibility() != importantForAccessibility) {
            view.setImportantForAccessibility(importantForAccessibility);
            view.sendAccessibilityEvent(
                    AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        }
    }

    ContentViewCore cvc = getContentViewCore();
    if (cvc != null) {
        boolean isWebContentObscured = isObscuredByAnotherViewForAccessibility()
                || isShowingSadTab();
        cvc.setObscuredByAnotherView(isWebContentObscured);
    }
}
 
/** See {@link View#isImportantForAccessibility()}. */
public static boolean isImportantForAccessibility(View view) {
  if (view == null) {
    return false;
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    return view.isImportantForAccessibility();
  } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
    // Prior to Jelly Bean, all Views were considered important for accessibility.
    return true;
  } else {
    // On APIs between 16 and 21, we must piece together accessibility importance from the
    // available properties. We return false incorrectly for some cases where unretrievable
    // listeners prevent us from determining importance.

    // If the developer marked the view as explicitly not important, it isn't.
    int mode = view.getImportantForAccessibility();
    if ((mode == View.IMPORTANT_FOR_ACCESSIBILITY_NO)
        || (mode == View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS)) {
      return false;
    }

    // No parent view can be hiding us. (APIs 19 to 21)
    ViewParent parent = view.getParent();
    while (parent instanceof View) {
      if (((View) parent).getImportantForAccessibility()
          == View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS) {
        return false;
      }
      parent = parent.getParent();
    }

    // Interrogate the view's other properties to determine importance.
    return (mode == View.IMPORTANT_FOR_ACCESSIBILITY_YES)
        || isActionableForAccessibility(view)
        || hasListenersForAccessibility(view)
        || (view.getAccessibilityNodeProvider() != null)
        || (ViewCompat.getAccessibilityLiveRegion(view)
            != ViewCompat.ACCESSIBILITY_LIVE_REGION_NONE);
  }
}
 
 方法所在类
 同类方法