From f2e12ee52e8e2d376b0fc2cb255977448da18e3e Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Thu, 2 Aug 2012 16:52:52 +0200 Subject: [PATCH] Added channellist adapter --- res/layout/miro_channellist_item.xml | 33 +++++++++++ .../adapter/MiroChannellistAdapter.java | 57 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 res/layout/miro_channellist_item.xml create mode 100644 src/de/danoeh/antennapod/adapter/MiroChannellistAdapter.java diff --git a/res/layout/miro_channellist_item.xml b/res/layout/miro_channellist_item.xml new file mode 100644 index 000000000..ac89cfe46 --- /dev/null +++ b/res/layout/miro_channellist_item.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + \ No newline at end of file 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 { + + public MiroChannellistAdapter(Context context, int textViewResourceId, + List 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; + } + + + +}