diff options
-rw-r--r-- | res/layout/miro_channellist_item.xml | 33 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/adapter/MiroChannellistAdapter.java | 57 |
2 files changed, 90 insertions, 0 deletions
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 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="8dp" > + + <ImageView + android:id="@+id/imgvChannelimage" + android:layout_width="55dip" + android:layout_height="55dip" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_marginLeft="1dip" + android:layout_marginRight="4dip" + android:cropToPadding="true" /> + + <LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_centerVertical="true" + android:layout_toRightOf="@id/imgvChannelimage" + android:orientation="vertical" > + + <TextView + android:id="@+id/txtvTitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:maxLines="2" + android:textStyle="bold" /> + </LinearLayout> + +</RelativeLayout>
\ 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<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; + } + + + +} |