From cb6be9d32af273219ce0230672d480a4ac87cb38 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Thu, 20 Sep 2012 19:42:39 +0200 Subject: Fixed scrolling issues in Downloadlog --- .../antennapod/adapter/DownloadLogAdapter.java | 65 +++++++++++----------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java b/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java index eae163231..3a5fa4282 100644 --- a/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java +++ b/src/de/danoeh/antennapod/adapter/DownloadLogAdapter.java @@ -44,41 +44,42 @@ public class DownloadLogAdapter extends ArrayAdapter { .findViewById(R.id.txtvStatus); holder.reason = (TextView) convertView .findViewById(R.id.txtvReason); - - if (feedfile.getClass() == Feed.class) { - holder.type.setText(R.string.download_type_feed); - } else if (feedfile.getClass() == FeedMedia.class) { - holder.type.setText(R.string.download_type_media); - } else if (feedfile.getClass() == FeedImage.class) { - 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(convertView.getResources() - .getColor(R.color.download_success_green)); - holder.successful.setText(R.string.download_successful); - holder.reason.setVisibility(View.GONE); - } else { - holder.successful.setTextColor(convertView.getResources() - .getColor(R.color.download_failed_red)); - holder.successful.setText(R.string.download_failed); - String reasonText = DownloadError.getErrorString( - getContext(), status.getReason()); - if (status.getReasonDetailed() != null) { - reasonText += ": " + status.getReasonDetailed(); - } - holder.reason.setText(reasonText); - } + convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); } + if (feedfile.getClass() == Feed.class) { + holder.type.setText(R.string.download_type_feed); + } else if (feedfile.getClass() == FeedMedia.class) { + holder.type.setText(R.string.download_type_media); + } else if (feedfile.getClass() == FeedImage.class) { + 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(convertView.getResources().getColor( + R.color.download_success_green)); + holder.successful.setText(R.string.download_successful); + holder.reason.setVisibility(View.GONE); + } else { + holder.successful.setTextColor(convertView.getResources().getColor( + R.color.download_failed_red)); + holder.successful.setText(R.string.download_failed); + String reasonText = DownloadError.getErrorString(getContext(), + status.getReason()); + if (status.getReasonDetailed() != null) { + reasonText += ": " + status.getReasonDetailed(); + } + holder.reason.setText(reasonText); + holder.reason.setVisibility(View.VISIBLE); + } return convertView; } -- cgit v1.2.3