summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/service/download/DownloadService.java
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2014-03-17 17:00:13 +0100
committerdaniel oeh <daniel.oeh@gmail.com>2014-03-17 17:00:13 +0100
commit0c2d78157c94a7c92cea5d7548332f55f5d976b2 (patch)
treec5583f20f3da24645de4d1981e2c6de334b37716 /src/de/danoeh/antennapod/service/download/DownloadService.java
parentd8a9d68bf84ac1ec7f8f176c70886b3ed9dfabc5 (diff)
downloadAntennaPod-0c2d78157c94a7c92cea5d7548332f55f5d976b2.zip
Implemented DownloadAuthenticationActivity
Diffstat (limited to 'src/de/danoeh/antennapod/service/download/DownloadService.java')
-rw-r--r--src/de/danoeh/antennapod/service/download/DownloadService.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/de/danoeh/antennapod/service/download/DownloadService.java b/src/de/danoeh/antennapod/service/download/DownloadService.java
index 962fce747..5e1d29ecc 100644
--- a/src/de/danoeh/antennapod/service/download/DownloadService.java
+++ b/src/de/danoeh/antennapod/service/download/DownloadService.java
@@ -21,6 +21,7 @@ import android.webkit.URLUtil;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.DownloadActivity;
+import de.danoeh.antennapod.activity.DownloadAuthenticationActivity;
import de.danoeh.antennapod.activity.DownloadLogActivity;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.feed.*;
@@ -557,6 +558,11 @@ public class DownloadService extends Service {
final String resourceTitle = (downloadRequest.getTitle() != null)
? downloadRequest.getTitle() : downloadRequest.getSource();
+ final Intent activityIntent = new Intent(getApplicationContext(), DownloadAuthenticationActivity.class);
+ activityIntent.putExtra(DownloadAuthenticationActivity.ARG_DOWNLOAD_REQUEST, downloadRequest);
+ activityIntent.putExtra(DownloadAuthenticationActivity.ARG_SEND_TO_DOWNLOAD_REQUESTER_BOOL, true);
+ final PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, activityIntent, PendingIntent.FLAG_ONE_SHOT);
+
NotificationCompat.Builder builder = new NotificationCompat.Builder(DownloadService.this);
builder.setTicker(getText(R.string.authentication_notification_title))
.setContentTitle(getText(R.string.authentication_notification_title))
@@ -566,7 +572,7 @@ public class DownloadService extends Service {
.setSmallIcon(R.drawable.ic_stat_authentication)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_stat_authentication))
.setAutoCancel(true)
- .setContentIntent(PendingIntent.getActivity(getApplicationContext(), 0, new Intent(getApplicationContext(), MainActivity.class), 0));
+ .setContentIntent(contentIntent);
Notification n = builder.build();
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(downloadRequest.getSource().hashCode(), n);
@@ -628,6 +634,7 @@ public class DownloadService extends Service {
Feed feed = new Feed(request.getSource(), new Date());
feed.setFile_url(request.getDestination());
feed.setDownloaded(true);
+ feed.setPreferences(new FeedPreferences(0, true, request.getUsername(), request.getPassword()));
reason = null;
String reasonDetailed = null;