code: private boolean intersectVisibleToUser(Rect localRect) {
          // Missing or empty bounds mean this view is not visible.
          if ((localRect == null) || localRect.isEmpty()) {
              return false;
          }
  
          // Attached to invisible window means this view is not visible.
          if (mParentView.getWindowVisibility() != View.VISIBLE) {
              return false;
          }
  
          // An invisible predecessor or one with alpha zero means
          // that this view is not visible to the user.
          Object current = this;
          while (current instanceof View) {
              final View view = (View) current;
              // We have attach info so this view is attached and there is no
              // need to check whether we reach to ViewRootImpl on the way up.
  
              if ((ViewHelper.getAlpha(view) <= 0) || (view.getVisibility() != View.VISIBLE)) {
                  return false;
              }
              current = view.getParent();
          }
  
          // If no portion of the parent is visible, this view is not visible.
          if (!mParentView.getLocalVisibleRect(mTempVisibleRect)) {
              return false;
          }
  
          // Check if the view intersects the visible portion of the parent.
          return localRect.intersect(mTempVisibleRect);
      }
docs: Computes whether the specified {@link Rect} intersects with the visible
  portion of its parent {@link View}. Modifies {@code localRect} to
  contain only the visible portion.
  
  @param localRect A rectangle in local (parent) coordinates.
  @return Whether the specified {@link Rect} is visible on the screen.