Пример #1
1
  public ViewComponentInfo projectAbsoluteCoordinateRecursively(Integer ix, Integer iy) {
    // Miss
    if (!checkHit(ix, iy)) return null;

    if (this.viewType.endsWith("Spinner")) {
      this.isSpinner = true;
      return this;
    }

    // I'm hit and has child.
    if (this.children != null) {
      // Assumption : children never intersect

      ViewComponentInfo projected_child;

      if (this.isContainer || this.viewType.equals("android.widget.TabWidget")) {
        Vector<ViewComponentInfo> views = new Vector<ViewComponentInfo>();
        for (ViewComponentInfo child : children) {
          if (child.checkHit(ix, iy)) {
            child.isCollectionMember = true;
            views.add(child);
          }
        }
        if (views.size() == 1) {
          return views.firstElement();
        }
      }
      if (this.viewType.endsWith(("FrameLayout"))) {
        LinkedList<ViewComponentInfo> chlist = new LinkedList<ViewComponentInfo>(children);
        ViewComponentInfo child = getFrameContent(children);
        projected_child = child.projectAbsoluteCoordinateRecursively(ix, iy);
        if (projected_child != null) return projected_child;
      } else {
        Vector<ViewComponentInfo> views = new Vector<ViewComponentInfo>();
        for (ViewComponentInfo child : children) {
          projected_child = child.projectAbsoluteCoordinateRecursively(ix, iy);
          if (projected_child != null) views.add(projected_child);
        }
        if (views.size() == 1) {
          return views.firstElement();
        }
      }
    }

    // The point hit no child.
    // Thus return my self.
    if (this.viewType.endsWith("Layout")
        || this.viewType.endsWith("TextView")
        || this.viewType.endsWith("ScrollView")
        || this.viewType.endsWith("ViewStub")
        || this.viewType.endsWith("DialogTitle")
        || this.viewType.endsWith("ImageView")) {
      if (this.hasOnClickListener()) return this;
      else return null;
    }
    return this;
  }