diff options
-rw-r--r-- | res/layout/external_itemlist_item.xml | 5 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java | 22 |
2 files changed, 18 insertions, 9 deletions
diff --git a/res/layout/external_itemlist_item.xml b/res/layout/external_itemlist_item.xml index b5f55d914..9f40fcf87 100644 --- a/res/layout/external_itemlist_item.xml +++ b/res/layout/external_itemlist_item.xml @@ -70,7 +70,7 @@ android:textSize="@dimen/text_size_micro" /> <ImageView - android:id="@+id/imgvDownloaded" + android:id="@+id/imgvDownloadStatus" android:layout_width="@dimen/enc_icons_size" android:layout_height="@dimen/enc_icons_size" android:layout_below="@id/txtvFeedname" @@ -78,7 +78,6 @@ android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:layout_marginTop="4dp" - android:layout_toLeftOf="@id/butAction" - android:src="?attr/av_download" /> + android:layout_toLeftOf="@id/butAction" /> </RelativeLayout>
\ No newline at end of file diff --git a/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java b/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java index d303ae977..75ae96ebe 100644 --- a/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java +++ b/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.adapter; import java.util.List; import android.content.Context; +import android.content.res.TypedArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -16,6 +17,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.asynctask.FeedImageLoader; import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedMedia; +import de.danoeh.antennapod.storage.DownloadRequester; import de.danoeh.antennapod.util.Converter; import de.danoeh.antennapod.util.EpisodeFilter; @@ -98,8 +100,8 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter { .findViewById(R.id.txtvFeedname); holder.lenSize = (TextView) convertView .findViewById(R.id.txtvLenSize); - holder.downloaded = (ImageView) convertView - .findViewById(R.id.imgvDownloaded); + holder.downloadStatus = (ImageView) convertView + .findViewById(R.id.imgvDownloadStatus); holder.feedImage = (ImageView) convertView .findViewById(R.id.imgvFeedimage); holder.butAction = (ImageButton) convertView @@ -113,19 +115,27 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter { holder.feedTitle.setText(item.getFeed().getTitle()); FeedMedia media = item.getMedia(); if (media != null) { + TypedArray drawables = context.obtainStyledAttributes(new int[] { + R.attr.av_download, R.attr.navigation_refresh }); holder.lenSize.setVisibility(View.VISIBLE); if (!media.isDownloaded()) { - holder.downloaded.setVisibility(View.GONE); + if (DownloadRequester.getInstance().isDownloadingFile(media)) { + holder.downloadStatus.setVisibility(View.VISIBLE); + holder.downloadStatus.setImageDrawable(drawables.getDrawable(1)); + } else { + holder.downloadStatus.setVisibility(View.GONE); + } holder.lenSize.setText(context.getString(R.string.size_prefix) + Converter.byteToString(media.getSize())); } else { - holder.downloaded.setVisibility(View.VISIBLE); + holder.downloadStatus.setVisibility(View.VISIBLE); + holder.downloadStatus.setImageDrawable(drawables.getDrawable(0)); holder.lenSize.setText(context .getString(R.string.length_prefix) + Converter.getDurationStringLong(media.getDuration())); } } else { - holder.downloaded.setVisibility(View.GONE); + holder.downloadStatus.setVisibility(View.GONE); holder.lenSize.setVisibility(View.INVISIBLE); } @@ -152,7 +162,7 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter { TextView title; TextView feedTitle; TextView lenSize; - ImageView downloaded; + ImageView downloadStatus; ImageView feedImage; ImageButton butAction; } |