Android Open Source - bbcplayer Entry Array Adapter






From Project

Back to project page bbcplayer.

License

The source code is released under:

GNU General Public License

If you think the Android project bbcplayer 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

/*
 * Class used to fill in the listview UI element
 * Each row is filled with the title and id strings
 *//* ww  w  .j  a  va2  s .com*/

package com.rmgoncalo.bbcplayer;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class EntryArrayAdapter extends ArrayAdapter<Entry> {

  // private static final String logtag = "ArrayAdapter";
  private final Context context;
  private final List<Entry> values;

  private ImageLoader imgLoader;

  public EntryArrayAdapter(Context context, List<Entry> values) {
    super(context, R.layout.entry, values);
    this.context = context;
    this.values = values;
    imgLoader = new ImageLoader(context);
  }

  // Use the entry layout to each row
  // Use title and id strings of each Entry object
  public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View rowView = inflater.inflate(R.layout.entry, parent, false);

    TextView titleView = (TextView) rowView.findViewById(R.id.title);
    TextView idView = (TextView) rowView.findViewById(R.id.id);

    ImageView imageView = (ImageView) rowView.findViewById(R.id.thumb);
    imgLoader.DisplayImage(values.get(position).getThumb(),
        R.drawable.ic_launcher, imageView);

    titleView.setText(values.get(position).getTitle());
    idView.setText(values.get(position).getId());

    return rowView;
  }
}




Java Source Code List

com.rmgoncalo.bbcplayer.EntryArrayAdapter.java
com.rmgoncalo.bbcplayer.Entry.java
com.rmgoncalo.bbcplayer.FileCache.java
com.rmgoncalo.bbcplayer.ImageLoader.java
com.rmgoncalo.bbcplayer.JsonParser.java
com.rmgoncalo.bbcplayer.MainActivity.java
com.rmgoncalo.bbcplayer.MemoryCache.java
com.rmgoncalo.bbcplayer.Util.java
com.rmgoncalo.bbcplayer.XmlParser.java