/** * Non-Android method that dumps the state of this {@code ViewGroup} to {@code System.out} */ @Override public void dump(PrintStream out, int indent) { dumpFirstPart(out, indent); if (children.size() > 0) { out.println(">"); for (View child : children) { shadowOf(child).dump(out, indent + 2); } dumpIndent(out, indent); out.println("</" + realView.getClass().getSimpleName() + ">"); } else { out.println("/>"); } }
/** * Returns a string representation of this {@code ViewGroup} by concatenating all of the strings contained in all * of the descendants of this {@code ViewGroup}. * <p/> * Robolectric extension. */ @Override public String innerText() { String innerText = ""; String delimiter = ""; for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); String childText = shadowOf(child).innerText(); if (childText.length() > 0) { innerText += delimiter; delimiter = " "; } innerText += childText; } return innerText; }
@Implementation @Override public View findViewById(int id) { if (id == getId()) { return realView; } for (View child : children) { View found = child.findViewById(id); if (found != null) { return found; } } return null; }
public void __constructor__(Context context, AttributeSet attributeSet, int defStyle) { setLayoutParams(new ViewGroup.MarginLayoutParams(0, 0)); super.__constructor__(context, attributeSet, defStyle); } }
@Implementation public int indexOfChild(View child) { int count = getChildCount(); for (int i = 0; i < count; i++) { if (children.get(i) == child) { return i; } } return -1; }
private void update() { if (!automaticallyUpdateRowViews) { return; } super.removeAllViews(); addViews(); }
@Implementation @Override public void clearFocus() { if (hasFocus()) { super.clearFocus(); for (View child : children) { child.clearFocus(); } } }
public void __constructor__(Context context, AttributeSet attributeSet, int defStyle) { setLayoutParams(new ViewGroup.MarginLayoutParams(0, 0)); super.__constructor__(context, attributeSet, defStyle); } }