private void removeOneComponent(GLView component) { if (mMotionTarget == component) { long now = SystemClock.uptimeMillis(); MotionEvent cancelEvent = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0, 0, 0); dispatchTouchEvent(cancelEvent); cancelEvent.recycle(); } component.onDetachFromRoot(); component.mParent = null; }
// Adds a child to this GLView. public void addComponent(GLView component) { // Make sure the component doesn't have a parent currently. if (component.mParent != null) throw new IllegalStateException(); // Build parent-child links if (mComponents == null) { mComponents = new ArrayList<GLView>(); } mComponents.add(component); component.mParent = this; // If this is added after we have a root, tell the component. if (mRoot != null) { component.onAttachToRoot(mRoot); } }