1/*
2 * Copyright (C) 2014 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.tv.settings.dialog.old;
18
19import android.app.Fragment;
20import android.os.Bundle;
21import android.view.LayoutInflater;
22import android.view.View;
23import android.view.ViewGroup;
24
25import com.android.tv.settings.widget.ScrollAdapter;
26import com.android.tv.settings.widget.ScrollAdapterView;
27
28/**
29 * *************************
30 *   DO NOT ADD LOGIC HERE!
31 * *************************
32 * This is a wrapper for {@link BaseScrollAdapterFragment}. Place your logic
33 * in there and call the function from here
34 */
35public class ScrollAdapterFragment extends Fragment implements LiteFragment {
36
37    private BaseScrollAdapterFragment mBase = new BaseScrollAdapterFragment(this);
38
39    @Override
40    public View onCreateView(LayoutInflater inflater, ViewGroup container,
41            Bundle savedInstanceState) {
42        return mBase.onCreateView(inflater, container, savedInstanceState);
43    }
44
45    @Override
46    public void onViewCreated(View view, Bundle savedInstanceState) {
47        super.onViewCreated(view, savedInstanceState);
48        mBase.onViewCreated(view, savedInstanceState);
49    }
50
51    public ScrollAdapterView getScrollAdapterView() {
52        return mBase.getScrollAdapterView();
53    }
54
55    public ScrollAdapter getAdapter() {
56        return mBase.getAdapter();
57    }
58
59    public void setAdapter(ScrollAdapter adapter) {
60        mBase.setAdapter(adapter);
61    }
62
63    public void setSelection(int position) {
64        mBase.setSelection(position);
65    }
66
67    public void setSelectionSmooth(int position) {
68        mBase.setSelectionSmooth(position);
69    }
70
71    public int getSelectedItemPosition() {
72        return mBase.getSelectedItemPosition();
73    }
74
75    protected void setBaseScrollAdapterFragment(BaseScrollAdapterFragment base) {
76        mBase = base;
77    }
78}
79