1/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.internal.view;
18
19import com.android.internal.R;
20
21import android.content.Context;
22import android.util.AttributeSet;
23import android.widget.Checkable;
24import android.widget.CheckBox;
25import android.widget.LinearLayout;
26
27public class CheckableLinearLayout extends LinearLayout implements Checkable {
28    private CheckBox mCheckBox;
29
30    public CheckableLinearLayout(Context context) {
31        super(context);
32        // TODO Auto-generated constructor stub
33    }
34
35    public CheckableLinearLayout(Context context, AttributeSet attrs) {
36        super(context, attrs);
37        // TODO Auto-generated constructor stub
38    }
39
40    public CheckableLinearLayout(Context context, AttributeSet attrs, int defStyle) {
41        super(context, attrs, defStyle);
42        // TODO Auto-generated constructor stub
43    }
44
45    @Override
46    protected void onFinishInflate() {
47        super.onFinishInflate();
48        mCheckBox = (CheckBox) findViewById(R.id.check);
49    }
50
51    @Override
52    public void setChecked(boolean checked) {
53        mCheckBox.setChecked(checked);
54    }
55
56    @Override
57    public boolean isChecked() {
58        return mCheckBox.isChecked();
59    }
60
61    @Override
62    public void toggle() {
63        mCheckBox.toggle();
64    }
65}
66