Added 'downloaded' imageview to episodes list

This commit is contained in:
daniel oeh 2013-01-28 23:30:24 +01:00
parent e67dab5ab2
commit 481d3ea24a
2 changed files with 20 additions and 3 deletions

View File

@ -56,18 +56,29 @@
<TextView
android:id="@+id/txtvLenSize"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedname"
android:layout_marginTop="4dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@id/butAction"
android:layout_marginTop="4dp"
android:layout_toRightOf="@id/imgvFeedimage"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro" />
<ImageView
android:id="@+id/imgvDownloaded"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvFeedname"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_toLeftOf="@id/butAction"
android:src="?attr/av_download" />
</RelativeLayout>

View File

@ -98,6 +98,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.feedImage = (ImageView) convertView
.findViewById(R.id.imgvFeedimage);
holder.butAction = (ImageButton) convertView
@ -113,14 +115,17 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
if (media != null) {
holder.lenSize.setVisibility(View.VISIBLE);
if (!media.isDownloaded()) {
holder.downloaded.setVisibility(View.GONE);
holder.lenSize.setText(context.getString(R.string.size_prefix)
+ Converter.byteToString(media.getSize()));
} else {
holder.downloaded.setVisibility(View.VISIBLE);
holder.lenSize.setText(context
.getString(R.string.length_prefix)
+ Converter.getDurationStringLong(media.getDuration()));
}
} else {
holder.downloaded.setVisibility(View.GONE);
holder.lenSize.setVisibility(View.INVISIBLE);
}
@ -147,6 +152,7 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
TextView title;
TextView feedTitle;
TextView lenSize;
ImageView downloaded;
ImageView feedImage;
ImageButton butAction;
}