// PUBLIC METHODS public void register(CheckableView child) { mChildren.add(child); if (getChildCount() == 1) { protectedCheck(child.getId()); } child.setOnCheckedChangeListener(mChildOnCheckedChangeListener); }
public void onCheckedChanged(CheckableView buttonView, boolean isChecked) { // prevents from infinite recursion if (mProtectFromCheckedChange) { return; } mProtectFromCheckedChange = true; if (mCheckedId != NO_CHECKED_ID) { setCheckedStateForView(mCheckedId, false); } mProtectFromCheckedChange = false; int id = buttonView.getId(); setCheckedId(id); }
public CheckableView findViewById(int id) { for (CheckableView v : mChildren) { if (v.getId() == id) return v; } return null; }
public void deregister(CheckableView child) { mChildren.remove(child); child.setOnCheckedChangeListener(null); if (child.getId() == mCheckedId) mCheckedId = NO_CHECKED_ID; }