diff --git a/core/res/values/strings.xml b/core/res/values/strings.xml index b03014c9..16349f53 100644 --- a/core/res/values/strings.xml +++ b/core/res/values/strings.xml @@ -275,6 +275,8 @@ Show torrent counter in ADW Launcher System + Treat dormant torrents as inactive + Torrents at 0KB/s (no data transfer) will be filtered as being inactive Check for updates Check transdroid.org for latest app version Use dark UI theme diff --git a/core/res/xml/pref_system.xml b/core/res/xml/pref_system.xml index 7060eb10..ef65d994 100644 --- a/core/res/xml/pref_system.xml +++ b/core/res/xml/pref_system.xml @@ -17,6 +17,12 @@ --> + + torrents) { + public void update(List torrents, boolean dormantAsInactive) { if (torrents == null) { downcountText.setText(null); @@ -71,10 +70,10 @@ public class ServerStatusView extends RelativeLayout implements OnRatesPickedLis for (Torrent torrent : torrents) { // Downloading torrents count towards downloads and uploads, seeding torrents towards uploads - if (torrent.getStatusCode() == TorrentStatus.Downloading) { + if (torrent.isDownloading(dormantAsInactive)) { downcount++; upcount++; - } else if (torrent.getStatusCode() == TorrentStatus.Seeding) { + } else if (torrent.isSeeding(dormantAsInactive)) { upcount++; } downspeed += torrent.getRateDownload(); diff --git a/core/src/org/transdroid/core/gui/TorrentsActivity.java b/core/src/org/transdroid/core/gui/TorrentsActivity.java index 69c17cf3..f49cdde5 100644 --- a/core/src/org/transdroid/core/gui/TorrentsActivity.java +++ b/core/src/org/transdroid/core/gui/TorrentsActivity.java @@ -160,6 +160,8 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi // Settings @Bean protected ApplicationSettings applicationSettings; + @Bean + protected SystemSettings systemSettings; @InstanceState boolean firstStart = true; int skipNextOnNavigationItemSelectedCalls = 2; @@ -1072,7 +1074,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi fragmentDetails.updateLabels(lastNavigationLabels); // Update the server status (counts and speeds) in the action bar - serverStatusView.update(torrents); + serverStatusView.update(torrents, systemSettings.treatDormantAsInactive()); } diff --git a/core/src/org/transdroid/core/gui/TorrentsFragment.java b/core/src/org/transdroid/core/gui/TorrentsFragment.java index 02bff444..4d929556 100644 --- a/core/src/org/transdroid/core/gui/TorrentsFragment.java +++ b/core/src/org/transdroid/core/gui/TorrentsFragment.java @@ -30,6 +30,7 @@ import org.androidannotations.annotations.ItemClick; import org.androidannotations.annotations.ViewById; import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; +import org.transdroid.core.app.settings.SystemSettings; import org.transdroid.core.gui.lists.TorrentsAdapter; import org.transdroid.core.gui.lists.TorrentsAdapter_; import org.transdroid.core.gui.navigation.Label; @@ -66,6 +67,8 @@ public class TorrentsFragment extends SherlockFragment implements OnLabelPickedL // Local data @Bean protected ApplicationSettings applicationSettings; + @Bean + protected SystemSettings systemSettings; @InstanceState protected ArrayList torrents = null; @InstanceState @@ -214,7 +217,7 @@ public class TorrentsFragment extends SherlockFragment implements OnLabelPickedL if (filteredTorrents != null && currentNavigationFilter != null) { // Remove torrents that do not match the selected navigation filter for (Iterator torrentIter = filteredTorrents.iterator(); torrentIter.hasNext();) { - if (!currentNavigationFilter.matches(torrentIter.next())) + if (!currentNavigationFilter.matches(torrentIter.next(), systemSettings.treatDormantAsInactive())) torrentIter.remove(); } } diff --git a/core/src/org/transdroid/core/gui/navigation/Label.java b/core/src/org/transdroid/core/gui/navigation/Label.java index 76ad2495..9d8ae96c 100644 --- a/core/src/org/transdroid/core/gui/navigation/Label.java +++ b/core/src/org/transdroid/core/gui/navigation/Label.java @@ -66,9 +66,11 @@ public class Label implements SimpleListItem, NavigationFilter, Comparable