Android Open Source - iPhoroidUI Adapter Wrapper






From Project

Back to project page iPhoroidUI.

License

The source code is released under:

Apache License

If you think the Android project iPhoroidUI listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (c) 2008-2009 CommonsWare, LLC
 * Portions (c) 2009 Google, Inc./*from  ww  w .j  a  va 2 s. co  m*/
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.klab.iphoroid.widget.listview;

import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;


/**
 * Adapter that delegates to a wrapped LisAdapter, much as CursorWrapper
 * delegates to a wrapped Cursor.
 */
public class AdapterWrapper extends BaseAdapter {

    private ListAdapter wrapped = null;

    /**
     * Constructor wrapping a supplied ListAdapter
     */
    public AdapterWrapper(ListAdapter wrapped) {
        super();

        this.wrapped = wrapped;

        wrapped.registerDataSetObserver(new DataSetObserver() {
            public void onChanged() {
                notifyDataSetChanged();
            }

            public void onInvalidated() {
                notifyDataSetInvalidated();
            }
        });
    }

    /**
     * Get the data item associated with the specified position in the data set.
     * 
     * @param position Position of the item whose data we want
     */
    @Override
    public Object getItem(int position) {
        return wrapped.getItem(position);
    }

    /**
     * How many items are in the data set represented by this Adapter.
     */
    @Override
    public int getCount() {
        return wrapped.getCount();
    }

    /**
     * Returns the number of types of Views that will be created by getView().
     */
    @Override
    public int getViewTypeCount() {
        return wrapped.getViewTypeCount();
    }

    /**
     * Get the type of View that will be created by getView() for the specified
     * item.
     * 
     * @param position Position of the item whose data we want
     */
    @Override
    public int getItemViewType(int position) {
        return wrapped.getItemViewType(position);
    }

    /**
     * Are all items in this ListAdapter enabled? If yes it means all items are
     * selectable and clickable.
     */
    @Override
    public boolean areAllItemsEnabled() {
        return wrapped.areAllItemsEnabled();
    }

    /**
     * Returns true if the item at the specified position is something
     * selectable.
     * 
     * @param position Position of the item whose data we want
     */
    @Override
    public boolean isEnabled(int position) {
        return wrapped.isEnabled(position);
    }

    /**
     * Get a View that displays the data at the specified position in the data
     * set.
     * 
     * @param position Position of the item whose data we want
     * @param convertView View to recycle, if not null
     * @param parent ViewGroup containing the returned View
     */
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        return wrapped.getView(position, convertView, parent);
    }

    /**
     * Get the row id associated with the specified position in the list.
     * 
     * @param position Position of the item whose data we want
     */
    @Override
    public long getItemId(int position) {
        return wrapped.getItemId(position);
    }

    /**
     * Returns the ListAdapter that is wrapped by the endless logic.
     */
    public ListAdapter getWrappedAdapter() {
        return wrapped;
    }
}




Java Source Code List

org.klab.iphoroid.util.ActivityUtil.java
org.klab.iphoroid.util.Cache.java
org.klab.iphoroid.widget.adpterview.OnScrollListener.java
org.klab.iphoroid.widget.coverflow.CoverFlowGallery.java
org.klab.iphoroid.widget.coverflow.CoverFlowImageAdapterBase.java
org.klab.iphoroid.widget.flowview.CircleFlowIndicator.java
org.klab.iphoroid.widget.flowview.FlowIndicator.java
org.klab.iphoroid.widget.flowview.FlowView.java
org.klab.iphoroid.widget.flowview.TitleFlowIndicator.java
org.klab.iphoroid.widget.flowview.TitleProvider.java
org.klab.iphoroid.widget.gallery.ScrollDetectableGallery.java
org.klab.iphoroid.widget.listview.AdapterWrapper.java
org.klab.iphoroid.widget.listview.EndlessAdapter.java
org.klab.iphoroid.widget.listview.PullToRefreshEndlessListView.java
org.klab.iphoroid.widget.listview.PullToRefreshListView.java
org.klab.iphoroid.widget.listview.RefreshableArrayAdapter.java
org.klab.iphoroid.widget.support.DownloadTask.java
org.klab.iphoroid.widget.support.HasImage.java
org.klab.iphoroid.widget.support.ImageCache.java
org.klab.iphoroid.widget.support.ImageDownloadTask.java
org.klab.iphoroid.widget.support.SimpleImageDownloadTask.java