Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 391dc611 authored by John Ritz's avatar John Ritz Committed by Josh Guilfoyle
Browse files

New simple adapter that displays a list of views.

parent 2342eb36
Loading
Loading
Loading
Loading
+39 −0
Original line number Original line Diff line number Diff line

package com.tmobile.widget;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.ArrayList;

/**
 * A simple adapter to draw a list of views contained in a ArrayList<view>.
 *
 */
public class SimpleViewAdapter extends BaseAdapter {

    ArrayList<View> mArrayList;

    public SimpleViewAdapter(ArrayList<View> arrayList) {
        super();
        mArrayList = arrayList;
    }

    public int getCount() {
        return mArrayList.size();
    }

    public Object getItem(int position) {
        return mArrayList.get(position);
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View view = (View)mArrayList.get(position);
        return view;
    }
}