diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-08-02 16:52:52 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-08-02 16:52:52 +0200 |
commit | f2e12ee52e8e2d376b0fc2cb255977448da18e3e (patch) | |
tree | 0f6421333a89577715d12ab2137fc6b1d23d63a1 /src | |
parent | 8960d85452dc851d36c80e411ce7a63020ab6efb (diff) | |
download | AntennaPod-f2e12ee52e8e2d376b0fc2cb255977448da18e3e.zip |
Added channellist adapter
Diffstat (limited to 'src')
-rw-r--r-- | src/de/danoeh/antennapod/adapter/MiroChannellistAdapter.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/de/danoeh/antennapod/adapter/MiroChannellistAdapter.java b/src/de/danoeh/antennapod/adapter/MiroChannellistAdapter.java new file mode 100644 index 000000000..b07e2445d --- /dev/null +++ b/src/de/danoeh/antennapod/adapter/MiroChannellistAdapter.java @@ -0,0 +1,57 @@ +package de.danoeh.antennapod.adapter; + +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; +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.miroguide.model.MiroChannel; + +public class MiroChannellistAdapter extends ArrayAdapter<MiroChannel> { + + public MiroChannellistAdapter(Context context, int textViewResourceId, + List<MiroChannel> objects) { + super(context, textViewResourceId, objects); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + Holder holder; + MiroChannel channel = getItem(position); + + // Inflate Layout + if (convertView == null) { + holder = new Holder(); + LayoutInflater inflater = (LayoutInflater) getContext() + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + convertView = inflater.inflate(R.layout.miro_channellist_item, null); + holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); + holder.cover = (ImageView) convertView + .findViewById(R.id.imgvChannelimage); + + + convertView.setTag(holder); + } else { + holder = (Holder) convertView.getTag(); + } + + holder.cover.setVisibility(View.GONE); + holder.title.setText(channel.getName()); + + return convertView; + } + + static class Holder { + ImageView cover; + TextView title; + } + + + +} |