/* * This file is part of BBCT for Android. * * Copyright 2012-14 codeguru <codeguru@users.sourceforge.net> * * BBCT for Android is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * BBCT for Android is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package bbct.android.common.view; import android.content.Context; import android.util.AttributeSet; import android.widget.Checkable; import android.widget.LinearLayout; public class CheckableLinearLayout extends LinearLayout implements Checkable { Checkable mCheckable; public CheckableLinearLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } /** * Change the checked state of the view * * @param checked The new checked state */ @Override public void setChecked(boolean checked) { mCheckable.setChecked(checked); } /** * @return The current checked state of the view */ @Override public boolean isChecked() { return mCheckable.isChecked(); } /** * Change the checked state of the view to the inverse of its current state */ @Override public void toggle() { mCheckable.toggle(); } }