Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/news-android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luhmer <david-dev@live.de>2018-05-15 23:24:11 +0300
committerDavid Luhmer <david-dev@live.de>2018-05-15 23:24:11 +0300
commit44cb71c847a2166a6f921a24672f1546ad67cd98 (patch)
treec353a4fbcc166e40f30f7328f9d855e8b79828be /News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java
parent9c7666c33c6ef2cb5b0d4d7f0980011770c8f8e2 (diff)
Move notification handling into separate class / add/improve support for android 8+ notifications
Diffstat (limited to 'News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java')
-rw-r--r--News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java22
1 files changed, 4 insertions, 18 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java
index 1aa34177..5fe6e583 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/services/PodcastDownloadService.java
@@ -2,9 +2,7 @@ package de.luhmer.owncloudnewsreader.services;
import android.app.DownloadManager;
import android.app.IntentService;
-import android.app.Notification;
import android.app.NotificationManager;
-import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -24,10 +22,9 @@ import java.net.URL;
import java.net.URLConnection;
import java.security.MessageDigest;
-import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
-import de.luhmer.owncloudnewsreader.R;
import de.luhmer.owncloudnewsreader.helper.FileUtils;
import de.luhmer.owncloudnewsreader.model.PodcastItem;
+import de.luhmer.owncloudnewsreader.notification.NextcloudNotificationManager;
/**
* An {@link IntentService} subclass for handling asynchronous task requests in
@@ -133,22 +130,11 @@ public class PodcastDownloadService extends IntentService {
private void downloadPodcast(PodcastItem podcast, Context context) {
- Intent intentNewsReader = new Intent(this, NewsReaderListActivity.class);
- PendingIntent pIntent = PendingIntent.getActivity(this, 0, intentNewsReader, 0);
- NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
- NotificationCompat.Builder mNotificationDownloadPodcast = new NotificationCompat.Builder(this)
- .setContentTitle(getResources().getString(R.string.app_name))
- .setContentText("Downloading podcast")
- .setSmallIcon(R.drawable.ic_notification)
- .setContentIntent(pIntent)
- .setOngoing(true);
- Notification notify = mNotificationDownloadPodcast.build();
- //Hide the notification after its selected
- notify.flags |= Notification.FLAG_AUTO_CANCEL;
- notify.flags |= Notification.FLAG_NO_CLEAR;
+ NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ NotificationCompat.Builder mNotificationDownloadPodcast = NextcloudNotificationManager.BuildDownloadPodcastNotification(context, "Download Podcast");
int NOTIFICATION_ID = 543226;
- notificationManager.notify(NOTIFICATION_ID, notify);
+ notificationManager.notify(NOTIFICATION_ID, mNotificationDownloadPodcast.build());