165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane/*
265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Copyright (C) 2014 The Android Open Source Project
365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *
465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Licensed under the Apache License, Version 2.0 (the "License");
565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * you may not use this file except in compliance with the License.
665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * You may obtain a copy of the License at
765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *
865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *      http://www.apache.org/licenses/LICENSE-2.0
965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane *
1065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Unless required by applicable law or agreed to in writing, software
1165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * distributed under the License is distributed on an "AS IS" BASIS,
1265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * See the License for the specific language governing permissions and
1465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * limitations under the License.
1565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane */
1665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
1765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lanepackage com.android.tv.settings.widget;
1865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
1965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.view.View;
2065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.view.ViewGroup;
2165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.widget.Adapter;
2265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.widget.ListAdapter;
2365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
2465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane/**
2565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * The adapter for ScrollAdapterView added more features controlling life cycle.
2665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane */
2765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lanepublic interface ScrollAdapterBase extends ListAdapter {
2865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
2965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    /**
3065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     * optional method to be implemented by {@link Adapter}. {@link #viewRemoved(View)} is called
3165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     * when a view is removed from ScrollAdapterView, this gives Adapter a chance to do some clean
3265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     * up work: for example release resources, cancel image downloading task. The implementation
3365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     * should not destroy the view hierarchy because the view might be recycled and passed as
3465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     * parameter in next {@link Adapter#getView(int, View, ViewGroup)}.
3565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     */
3665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public abstract void viewRemoved(View view);
3765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
3865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    /**
3965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     * Creates a scrap view to measure and decide the size of ScrollAdapterView , the difference
4065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     * from {@link #getView(int, View, ViewGroup)} is that it shouldn't load any runtime data for
4165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     * efficiency.
4265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane     */
4365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane    public abstract View getScrapView(ViewGroup parent);
4465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane
4565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane}
46