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