Simplified feeditemlist_item layout

This commit is contained in:
Michael Kaiser 2012-10-22 15:28:46 +02:00
parent 75dc42c438
commit 56a06f98eb
2 changed files with 80 additions and 90 deletions

View File

@ -2,10 +2,78 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp" >
android:paddingLeft="8dp" >
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@+id/butAction"
android:textSize="16dp" />
<TextView
android:id="@+id/txtvFeedname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvItemname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:visibility="gone" />
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:textColor="@color/gray" />
<ImageView
android:id="@+id/imgvType"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvInPlaylist" />
<ImageView
android:id="@id/imgvInPlaylist"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloaded"
android:src="@drawable/stat_playlist"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloaded"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloading"
android:src="@drawable/av_download"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloading"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@id/butAction"
android:src="@drawable/navigation_refresh"
android:visibility="visible" />
<TextView
android:id="@+id/txtvLenSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/txtvPublished"
android:maxLines="2" />
<ImageButton
android:id="@+id/butAction"
android:id="@id/butAction"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
@ -18,85 +86,4 @@
android:scaleType="fitXY"
android:src="@drawable/navigation_expand" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_toLeftOf="@id/butAction"
android:orientation="vertical" >
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:textSize="16dp" />
<TextView
android:id="@+id/txtvFeedname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:visibility="gone" />
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:textColor="@color/gray" />
<RelativeLayout
android:id="@+id/enc_info"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/enc_icons"
android:layout_width="wrap_content"
android:layout_height="@dimen/enc_icons_size"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imgvType"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/imgvInPlaylist"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="match_parent"
android:src="@drawable/stat_playlist"
android:visibility="gone" />
<ImageView
android:id="@+id/imgvDownloaded"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="match_parent"
android:src="@drawable/av_download"
android:visibility="gone" />
<ImageView
android:id="@+id/imgvDownloading"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="match_parent"
android:src="@drawable/navigation_refresh"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/txtvLenSize"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/enc_icons"
android:maxLines="2" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>

View File

@ -14,7 +14,6 @@ import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R;
@ -68,8 +67,6 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
holder.type = (ImageView) convertView.findViewById(R.id.imgvType);
holder.downloading = (ImageView) convertView
.findViewById(R.id.imgvDownloading);
holder.encInfo = (RelativeLayout) convertView
.findViewById(R.id.enc_info);
if (showFeedtitle) {
holder.feedtitle = (TextView) convertView
.findViewById(R.id.txtvFeedname);
@ -106,9 +103,13 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
DateFormat.SHORT));
if (item.getMedia() == null) {
holder.encInfo.setVisibility(View.GONE);
holder.downloaded.setVisibility(View.GONE);
holder.downloading.setVisibility(View.GONE);
holder.inPlaylist.setVisibility(View.GONE);
holder.type.setVisibility(View.GONE);
holder.lenSize.setVisibility(View.GONE);
} else {
holder.encInfo.setVisibility(View.VISIBLE);
holder.lenSize.setVisibility(View.VISIBLE);
if (FeedManager.getInstance().isInQueue(item)) {
holder.inPlaylist.setVisibility(View.VISIBLE);
} else {
@ -139,10 +140,13 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
MediaType mediaType = item.getMedia().getMediaType();
if (mediaType == MediaType.AUDIO) {
holder.type.setImageResource(R.drawable.type_audio);
holder.type.setVisibility(View.VISIBLE);
} else if (mediaType == MediaType.VIDEO) {
holder.type.setImageResource(R.drawable.type_video);
holder.type.setVisibility(View.VISIBLE);
} else {
holder.type.setImageBitmap(null);
holder.type.setVisibility(View.GONE);
}
}
@ -165,7 +169,6 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
ImageView type;
ImageView downloading;
ImageButton butAction;
RelativeLayout encInfo;
}
public int getSelectedItemIndex() {