package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
+import static com.android.ide.common.layout.LayoutConstants.FQCN_SPACE;
import static com.android.ide.common.layout.LayoutConstants.GESTURE_OVERLAY_VIEW;
import static com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors.VIEW_MERGE;
/**
* Returns all the children of the canvas view info where each child corresponds to a
- * unique node. This is intended for use by the outline for example, where only the
- * actual nodes are displayed, not the views themselves.
+ * unique node that the user can see and select. This is intended for use by the
+ * outline for example, where only the actual nodes are displayed, not the views
+ * themselves.
* <p>
* Most views have their own nodes, so this is generally the same as
* {@link #getChildren}, except in the case where you for example include a view that
* never null
*/
public List<CanvasViewInfo> getUniqueChildren() {
+ boolean haveHidden = false;
+
for (CanvasViewInfo info : mChildren) {
if (info.mNodeSiblings != null) {
// We have secondary children; must create a new collection containing
}
return children;
}
+
+ haveHidden |= info.isHidden();
+ }
+
+ if (haveHidden) {
+ List<CanvasViewInfo> children = new ArrayList<CanvasViewInfo>(mChildren.size());
+ for (CanvasViewInfo vi : mChildren) {
+ if (!vi.isHidden()) {
+ children.add(vi);
+ }
+ }
+
+ return children;
}
return mChildren;
* Returns the name of the {@link CanvasViewInfo}.
* Could be null, although unlikely.
* Experience shows this is the full qualified Java name of the View.
+ * TODO: Rename this method to getFqcn.
*
* @return the name of the view info, or null
*
* @return True if this is a tiny layout or invisible view
*/
public boolean isInvisible() {
+ if (isHidden()) {
+ // Don't expand and highlight hidden widgets
+ return false;
+ }
+
if (mAbsRect.width < SELECTION_MIN_SIZE || mAbsRect.height < SELECTION_MIN_SIZE) {
return mUiViewNode != null && (mUiViewNode.getDescriptor().hasChildren() ||
mAbsRect.width <= 0 || mAbsRect.height <= 0);
}
/**
+ * Returns true if this {@link CanvasViewInfo} represents a widget that should be
+ * hidden, such as a {@code <Space>} which are typically not manipulated by the user
+ * through dragging etc.
+ *
+ * @return true if this is a hidden view
+ */
+ public boolean isHidden() {
+ return FQCN_SPACE.equals(mName);
+ }
+
+ /**
* Is this {@link CanvasViewInfo} a view that has had its padding inflated in order to
* make it visible during selection or dragging? Note that this is NOT considered to
* be the case in the explode-all-views mode where all nodes have their padding