|
|
@ -112,18 +112,11 @@ public class TorrentsFragment extends SherlockFragment { |
|
|
|
this.currentSortDescending = false; |
|
|
|
this.currentSortDescending = false; |
|
|
|
} |
|
|
|
} |
|
|
|
applicationSettings.setLastUsedSortOrder(this.currentSortOrder, this.currentSortDescending); |
|
|
|
applicationSettings.setLastUsedSortOrder(this.currentSortOrder, this.currentSortDescending); |
|
|
|
// Get the server daemon type directly form the local list of torrents, if it's not empty
|
|
|
|
|
|
|
|
Daemon serverType = (this.torrents != null && this.torrents.size() > 0 ? this.torrents.get(0).getDaemon() |
|
|
|
|
|
|
|
: Daemon.Transmission); |
|
|
|
|
|
|
|
Collections.sort(this.torrents, new TorrentsComparator(serverType, this.currentSortOrder, |
|
|
|
|
|
|
|
this.currentSortDescending)); |
|
|
|
|
|
|
|
// Show the new resorted list
|
|
|
|
|
|
|
|
applyAllFilters(); |
|
|
|
applyAllFilters(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void applyTextFilter(String newTextFilter) { |
|
|
|
public void applyTextFilter(String newTextFilter) { |
|
|
|
this.currentTextFilter = newTextFilter; |
|
|
|
this.currentTextFilter = newTextFilter; |
|
|
|
// TODO: Actually apply text filter
|
|
|
|
|
|
|
|
// Show the new filtered list
|
|
|
|
// Show the new filtered list
|
|
|
|
applyAllFilters(); |
|
|
|
applyAllFilters(); |
|
|
|
} |
|
|
|
} |
|
|
@ -145,6 +138,9 @@ public class TorrentsFragment extends SherlockFragment { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get the server daemon type directly form the local list of torrents, if it's not empty
|
|
|
|
|
|
|
|
Daemon serverType = (this.torrents.size() > 0 ? this.torrents.get(0).getDaemon() : Daemon.Transmission); |
|
|
|
|
|
|
|
|
|
|
|
// Filter the list of torrents to show according to navigation and text filters
|
|
|
|
// Filter the list of torrents to show according to navigation and text filters
|
|
|
|
ArrayList<Torrent> filteredTorrents = torrents; |
|
|
|
ArrayList<Torrent> filteredTorrents = torrents; |
|
|
|
if (torrents != null && currentNavigationFilter != null) { |
|
|
|
if (torrents != null && currentNavigationFilter != null) { |
|
|
@ -162,6 +158,11 @@ public class TorrentsFragment extends SherlockFragment { |
|
|
|
torrentIter.remove(); |
|
|
|
torrentIter.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Sort the list of filtered torrents
|
|
|
|
|
|
|
|
Collections.sort(this.torrents, new TorrentsComparator(serverType, this.currentSortOrder, |
|
|
|
|
|
|
|
this.currentSortDescending)); |
|
|
|
|
|
|
|
|
|
|
|
((TorrentsAdapter) torrentsList.getAdapter()).update(filteredTorrents); |
|
|
|
((TorrentsAdapter) torrentsList.getAdapter()).update(filteredTorrents); |
|
|
|
updateViewVisibility(); |
|
|
|
updateViewVisibility(); |
|
|
|
} |
|
|
|
} |
|
|
|