From 89cea160542bc24ed4a3ed2930c199f4804d0c04 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Thu, 31 Oct 2013 10:23:14 +0100 Subject: [PATCH] Fixed notification text to show the affected torrents' names instead of using toString(). --- .../transdroid/core/gui/TorrentsActivity.java | 20 +++++-------------- .../core/service/ServerCheckerService.java | 11 +++++++--- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/core/src/org/transdroid/core/gui/TorrentsActivity.java b/core/src/org/transdroid/core/gui/TorrentsActivity.java index c8ec5792..73521a51 100644 --- a/core/src/org/transdroid/core/gui/TorrentsActivity.java +++ b/core/src/org/transdroid/core/gui/TorrentsActivity.java @@ -45,28 +45,18 @@ import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.cookie.BasicClientCookie; import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; -import org.transdroid.core.app.settings.ServerSetting; -import org.transdroid.core.app.settings.SystemSettings_; +import org.transdroid.core.app.settings.*; import org.transdroid.core.app.settings.WebsearchSetting; import org.transdroid.core.gui.lists.LocalTorrent; import org.transdroid.core.gui.lists.NoProgressHeaderTransformer; import org.transdroid.core.gui.lists.SimpleListItem; -import org.transdroid.core.gui.log.Log; -import org.transdroid.core.gui.log.Log_; -import org.transdroid.core.gui.navigation.FilterListAdapter; -import org.transdroid.core.gui.navigation.FilterListAdapter_; -import org.transdroid.core.gui.navigation.FilterListDropDownAdapter; -import org.transdroid.core.gui.navigation.FilterListDropDownAdapter_; -import org.transdroid.core.gui.navigation.Label; -import org.transdroid.core.gui.navigation.NavigationFilter; -import org.transdroid.core.gui.navigation.NavigationHelper; -import org.transdroid.core.gui.navigation.RefreshableActivity; -import org.transdroid.core.gui.navigation.StatusType; -import org.transdroid.core.gui.rss.RssfeedsActivity_; +import org.transdroid.core.gui.log.*; +import org.transdroid.core.gui.navigation.*; +import org.transdroid.core.gui.rss.*; import org.transdroid.core.gui.search.BarcodeHelper; import org.transdroid.core.gui.search.FilePickerHelper; import org.transdroid.core.gui.search.UrlEntryDialog; -import org.transdroid.core.gui.settings.MainSettingsActivity_; +import org.transdroid.core.gui.settings.*; import org.transdroid.core.service.BootReceiver; import org.transdroid.core.service.ConnectivityHelper; import org.transdroid.core.widget.WidgetProvider; diff --git a/core/src/org/transdroid/core/service/ServerCheckerService.java b/core/src/org/transdroid/core/service/ServerCheckerService.java index 41751a3c..0a35b48e 100644 --- a/core/src/org/transdroid/core/service/ServerCheckerService.java +++ b/core/src/org/transdroid/core/service/ServerCheckerService.java @@ -36,7 +36,6 @@ import org.transdroid.daemon.Torrent; import org.transdroid.daemon.task.DaemonTaskResult; import org.transdroid.daemon.task.RetrieveTask; import org.transdroid.daemon.task.RetrieveTaskSuccessResult; -import org.transdroid.daemon.util.Collections2; import android.app.IntentService; import android.app.NotificationManager; @@ -140,7 +139,8 @@ public class ServerCheckerService extends IntentService { ArrayList affectedTorrents = new ArrayList(newTorrents.size() + doneTorrents.size()); affectedTorrents.addAll(newTorrents); affectedTorrents.addAll(doneTorrents); - String title, forString = Collections2.joinString(affectedTorrents, ", "); + + String title; if (newTorrents.size() > 0 && doneTorrents.size() > 0) { // Note: use the 'one' plural iif 1 new torrent was added and 1 was newly finished title = getResources().getQuantityString(R.plurals.status_service_finished, @@ -156,7 +156,12 @@ public class ServerCheckerService extends IntentService { // No notification to show continue; } - + String forString = ""; + for (Torrent affected : affectedTorrents) { + forString += affected.getName() + ", "; + } + forString = forString.substring(0, forString.length() - 2); + // Build the basic notification Builder builder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_stat_notification) .setTicker(title).setContentTitle(title).setContentText(forString)