Updated DownloadLogAdapter to support changes in DownloadStatus

This commit is contained in:
daniel oeh 2012-09-20 19:33:09 +02:00
parent 76e11c76b5
commit 47b27cc07d
3 changed files with 28 additions and 14 deletions

View File

@ -21,5 +21,7 @@
<color name="ics_gray">#858585</color>
<color name="selection_background">#FEBB20</color>
<color name="actionbar_gray">#DDDDDD</color>
<color name="download_success_green">#669900</color>
<color name="download_failed_red">#CC0000</color>
</resources>

View File

@ -78,6 +78,10 @@
<string name="downloads_left">\u0020Downloads left</string>
<string name="download_notification_title">Downloading podcast data</string>
<string name="download_report_content">%1$d downloads succeeded, %2$d failed</string>
<string name="download_log_title_unknown">Unknown title</string>
<string name="download_type_feed">Feed</string>
<string name="download_type_media">Media file</string>
<string name="download_type_image">Image</string>
<!-- Mediaplayer messages -->
<string name="player_error_msg">Error!</string>
@ -90,8 +94,8 @@
<string name="no_media_playing_label">No media playing</string>
<string name="position_default_label">00:00:00</string>
<string name="player_buffering_msg">Buffering</string>
<string name="playbackservice_notification_title">Playing podcast</string>
<string name="playbackservice_notification_content">Tap here for more info</string>
<string name="playbackservice_notification_title">Playing podcast</string>
<string name="playbackservice_notification_content">Tap here for more info</string>
<!-- Navigation -->
<string name="show_download_log">Show Log</string>
<string name="show_player_label">Show player</string>

View File

@ -44,29 +44,37 @@ public class DownloadLogAdapter extends ArrayAdapter<DownloadStatus> {
.findViewById(R.id.txtvStatus);
holder.reason = (TextView) convertView
.findViewById(R.id.txtvReason);
if (feedfile.getClass() == Feed.class) {
holder.title.setText(((Feed) feedfile).getTitle());
holder.type.setText("Feed");
holder.type.setText(R.string.download_type_feed);
} else if (feedfile.getClass() == FeedMedia.class) {
holder.title.setText(((FeedMedia) feedfile).getItem()
.getTitle());
holder.type.setText(((FeedMedia) feedfile).getMime_type());
holder.type.setText(R.string.download_type_media);
} else if (feedfile.getClass() == FeedImage.class) {
holder.title.setText(((FeedImage) feedfile).getTitle());
holder.type.setText("Image");
holder.type.setText(R.string.download_type_image);
}
if (status.getTitle() != null) {
holder.title.setText(status.getTitle());
} else {
holder.title.setText(R.string.download_log_title_unknown);
}
holder.date.setText(DateUtils.formatSameDayTime(status
.getCompletionDate().getTime(), System.currentTimeMillis(),
DateFormat.SHORT, DateFormat.SHORT));
if (status.isSuccessful()) {
holder.successful.setTextColor(Color.parseColor("green"));
holder.successful.setTextColor(convertView.getResources()
.getColor(R.color.download_success_green));
holder.successful.setText(R.string.download_successful);
holder.reason.setVisibility(View.GONE);
} else {
holder.successful.setTextColor(Color.parseColor("red"));
holder.successful.setTextColor(convertView.getResources()
.getColor(R.color.download_failed_red));
holder.successful.setText(R.string.download_failed);
holder.reason.setText(DownloadError.getErrorString(
getContext(), status.getReason()));
String reasonText = DownloadError.getErrorString(
getContext(), status.getReason());
if (status.getReasonDetailed() != null) {
reasonText += ": " + status.getReasonDetailed();
}
holder.reason.setText(reasonText);
}
} else {
holder = (Holder) convertView.getTag();