/*
  * By default ViewGroup call setPressed on each child view, this take into account duplicateparentstate parameter
  */
 @Override
 protected void dispatchSetPressed(boolean pressed) {
   for (int i = 0; i < getChildCount(); i++) {
     View child = getChildAt(i);
     if (child.isDuplicateParentStateEnabled()) {
       getChildAt(i).setPressed(pressed);
     }
   }
 }
Example #2
0
  /**
   * Add to our checkable list all the children of the view that implement the interface Checkable
   */
  protected void findCheckableChildren(View v) {
    if (v instanceof Checkable && v.isDuplicateParentStateEnabled()) {
      this.checkableViews.add((Checkable) v);
    }

    if (v instanceof ViewGroup) {
      final ViewGroup vg = (ViewGroup) v;
      final int childCount = vg.getChildCount();
      if (vg.isDuplicateParentStateEnabled()) {
        for (int i = 0; i < childCount; ++i) {
          findCheckableChildren(vg.getChildAt(i));
        }
      }
    }
  }