Skip to content

Commit

Permalink
Changed behavior of download reports
Browse files Browse the repository at this point in the history
  • Loading branch information
danieloeh committed Oct 4, 2012
1 parent c042145 commit cd7cb59
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/de/danoeh/antennapod/service/download/DownloadService.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.DownloadActivity;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.activity.DownloadLogActivity;
import de.danoeh.antennapod.asynctask.DownloadStatus;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.feed.FeedFile;
Expand Down Expand Up @@ -416,17 +416,13 @@ private void sendDownloadHandledIntent(int type) {
private void updateReport() {
// check if report should be created
boolean createReport = false;
int successfulFeedDownloads = 0;
int successfulDownloads = 0;
int failedDownloads = 0;

// a download report is created if at least one download has failed
// (excluding failed image downloads)
for (DownloadStatus status : completedDownloads) {
if (status.isSuccessful()) {
if (status.getFeedFile().getClass() == Feed.class) {
successfulFeedDownloads++;
} else if (status.getFeedFile().getClass() == FeedMedia.class) {
createReport = true;
}
successfulDownloads++;
} else if (!status.isCancelled()) {
if (status.getFeedFile().getClass() != FeedImage.class) {
Expand All @@ -436,10 +432,6 @@ private void updateReport() {
}
}

if (successfulFeedDownloads > 1) {
createReport = true;
}

if (createReport) {
if (AppConfig.DEBUG)
Log.d(TAG, "Creating report");
Expand All @@ -459,7 +451,7 @@ private void updateReport() {
android.R.drawable.stat_notify_sync))
.setContentIntent(
PendingIntent.getActivity(this, 0, new Intent(this,
MainActivity.class), 0))
DownloadLogActivity.class), 0))
.setAutoCancel(true).getNotification();
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(REPORT_ID, notification);
Expand Down

0 comments on commit cd7cb59

Please sign in to comment.