Browse Source

Fixed notification text to show the affected torrents' names instead of using toString().

pull/82/head
Eric Kok 11 years ago
parent
commit
89cea16054
  1. 20
      core/src/org/transdroid/core/gui/TorrentsActivity.java
  2. 11
      core/src/org/transdroid/core/service/ServerCheckerService.java

20
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.apache.http.impl.cookie.BasicClientCookie;
import org.transdroid.core.R; import org.transdroid.core.R;
import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.ApplicationSettings;
import org.transdroid.core.app.settings.ServerSetting; import org.transdroid.core.app.settings.*;
import org.transdroid.core.app.settings.SystemSettings_;
import org.transdroid.core.app.settings.WebsearchSetting; import org.transdroid.core.app.settings.WebsearchSetting;
import org.transdroid.core.gui.lists.LocalTorrent; import org.transdroid.core.gui.lists.LocalTorrent;
import org.transdroid.core.gui.lists.NoProgressHeaderTransformer; import org.transdroid.core.gui.lists.NoProgressHeaderTransformer;
import org.transdroid.core.gui.lists.SimpleListItem; import org.transdroid.core.gui.lists.SimpleListItem;
import org.transdroid.core.gui.log.Log; import org.transdroid.core.gui.log.*;
import org.transdroid.core.gui.log.Log_; import org.transdroid.core.gui.navigation.*;
import org.transdroid.core.gui.navigation.FilterListAdapter; import org.transdroid.core.gui.rss.*;
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.search.BarcodeHelper; import org.transdroid.core.gui.search.BarcodeHelper;
import org.transdroid.core.gui.search.FilePickerHelper; import org.transdroid.core.gui.search.FilePickerHelper;
import org.transdroid.core.gui.search.UrlEntryDialog; 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.BootReceiver;
import org.transdroid.core.service.ConnectivityHelper; import org.transdroid.core.service.ConnectivityHelper;
import org.transdroid.core.widget.WidgetProvider; import org.transdroid.core.widget.WidgetProvider;

11
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.DaemonTaskResult;
import org.transdroid.daemon.task.RetrieveTask; import org.transdroid.daemon.task.RetrieveTask;
import org.transdroid.daemon.task.RetrieveTaskSuccessResult; import org.transdroid.daemon.task.RetrieveTaskSuccessResult;
import org.transdroid.daemon.util.Collections2;
import android.app.IntentService; import android.app.IntentService;
import android.app.NotificationManager; import android.app.NotificationManager;
@ -140,7 +139,8 @@ public class ServerCheckerService extends IntentService {
ArrayList<Torrent> affectedTorrents = new ArrayList<Torrent>(newTorrents.size() + doneTorrents.size()); ArrayList<Torrent> affectedTorrents = new ArrayList<Torrent>(newTorrents.size() + doneTorrents.size());
affectedTorrents.addAll(newTorrents); affectedTorrents.addAll(newTorrents);
affectedTorrents.addAll(doneTorrents); affectedTorrents.addAll(doneTorrents);
String title, forString = Collections2.joinString(affectedTorrents, ", ");
String title;
if (newTorrents.size() > 0 && doneTorrents.size() > 0) { if (newTorrents.size() > 0 && doneTorrents.size() > 0) {
// Note: use the 'one' plural iif 1 new torrent was added and 1 was newly finished // Note: use the 'one' plural iif 1 new torrent was added and 1 was newly finished
title = getResources().getQuantityString(R.plurals.status_service_finished, title = getResources().getQuantityString(R.plurals.status_service_finished,
@ -156,7 +156,12 @@ public class ServerCheckerService extends IntentService {
// No notification to show // No notification to show
continue; continue;
} }
String forString = "";
for (Torrent affected : affectedTorrents) {
forString += affected.getName() + ", ";
}
forString = forString.substring(0, forString.length() - 2);
// Build the basic notification // Build the basic notification
Builder builder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_stat_notification) Builder builder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_stat_notification)
.setTicker(title).setContentTitle(title).setContentText(forString) .setTicker(title).setContentTitle(title).setContentText(forString)

Loading…
Cancel
Save