ItemGroup.java revision 5bf291fde3dfd64f264d525534730514a279c8fc
15bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam/*
25bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam * Copyright (C) 2015 The Android Open Source Project
35bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam *
45bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam * Licensed under the Apache License, Version 2.0 (the "License");
55bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam * you may not use this file except in compliance with the License.
65bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam * You may obtain a copy of the License at
75bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam *
85bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam *      http://www.apache.org/licenses/LICENSE-2.0
95bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam *
105bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam * Unless required by applicable law or agreed to in writing, software
115bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam * distributed under the License is distributed on an "AS IS" BASIS,
125bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam * See the License for the specific language governing permissions and
145bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam * limitations under the License.
155bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam */
165bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam
175bf291fde3dfd64f264d525534730514a279c8fcMaurice Lampackage com.android.setupwizardlib.items;
185bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam
195bf291fde3dfd64f264d525534730514a279c8fcMaurice Lamimport android.content.Context;
205bf291fde3dfd64f264d525534730514a279c8fcMaurice Lamimport android.util.AttributeSet;
215bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam
225bf291fde3dfd64f264d525534730514a279c8fcMaurice Lamimport java.util.ArrayList;
235bf291fde3dfd64f264d525534730514a279c8fcMaurice Lamimport java.util.List;
245bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam
255bf291fde3dfd64f264d525534730514a279c8fcMaurice Lampublic class ItemGroup extends Item {
265bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam
275bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam    private List<Item> mItems = new ArrayList<>();
285bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam
295bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam    public ItemGroup(Context context, AttributeSet attrs) {
305bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam        super(context, attrs);
315bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam    }
325bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam
335bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam    public void addChild(Item child) {
345bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam        mItems.add(child);
355bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam    }
365bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam
375bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam    public Item[] getChildren() {
385bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam        return mItems.toArray(new Item[mItems.size()]);
395bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam    }
405bf291fde3dfd64f264d525534730514a279c8fcMaurice Lam}
41