Browse Source

Fixed torrent list sorting.

pull/11/head
Eric Kok 12 years ago
parent
commit
ed718e2cfe
  1. BIN
      core/res/drawable-hdpi/ic_action_turtle_enabled.png
  2. BIN
      core/res/drawable-mdpi/ic_action_turtle_disabled.png
  3. BIN
      core/res/drawable-mdpi/ic_action_turtle_enabled.png
  4. BIN
      core/res/drawable-xhdpi/ic_action_turtle_disabled.png
  5. BIN
      core/res/drawable-xhdpi/ic_action_turtle_enabled.png
  6. 2
      core/res/layout/fragment_details.xml
  7. 2
      core/res/layout/fragment_torrents.xml
  8. 17
      core/src/org/transdroid/core/gui/TorrentsFragment.java

BIN
core/res/drawable-hdpi/ic_action_turtle_enabled.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B

BIN
core/res/drawable-mdpi/ic_action_turtle_disabled.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

BIN
core/res/drawable-mdpi/ic_action_turtle_enabled.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

BIN
core/res/drawable-xhdpi/ic_action_turtle_disabled.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
core/res/drawable-xhdpi/ic_action_turtle_enabled.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

2
core/res/layout/fragment_details.xml

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
android:layout_height="128dp"
android:layout_gravity="center"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/loading_progress_dark"
android:indeterminateDrawable="?attr/loading_progress"
android:indeterminateOnly="true"
android:visibility="gone" />

2
core/res/layout/fragment_torrents.xml

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
android:layout_height="128dp"
android:layout_gravity="center"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/loading_progress_dark"
android:indeterminateDrawable="?attr/loading_progress"
android:indeterminateOnly="true"
android:visibility="visible" />

17
core/src/org/transdroid/core/gui/TorrentsFragment.java

@ -112,18 +112,11 @@ public class TorrentsFragment extends SherlockFragment { @@ -112,18 +112,11 @@ public class TorrentsFragment extends SherlockFragment {
this.currentSortDescending = false;
}
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();
}
public void applyTextFilter(String newTextFilter) {
this.currentTextFilter = newTextFilter;
// TODO: Actually apply text filter
// Show the new filtered list
applyAllFilters();
}
@ -145,6 +138,9 @@ public class TorrentsFragment extends SherlockFragment { @@ -145,6 +138,9 @@ public class TorrentsFragment extends SherlockFragment {
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
ArrayList<Torrent> filteredTorrents = torrents;
if (torrents != null && currentNavigationFilter != null) {
@ -162,6 +158,11 @@ public class TorrentsFragment extends SherlockFragment { @@ -162,6 +158,11 @@ public class TorrentsFragment extends SherlockFragment {
torrentIter.remove();
}
}
// Sort the list of filtered torrents
Collections.sort(this.torrents, new TorrentsComparator(serverType, this.currentSortOrder,
this.currentSortDescending));
((TorrentsAdapter) torrentsList.getAdapter()).update(filteredTorrents);
updateViewVisibility();
}
@ -237,7 +238,7 @@ public class TorrentsFragment extends SherlockFragment { @@ -237,7 +238,7 @@ public class TorrentsFragment extends SherlockFragment {
@ItemClick(resName = "torrent_list")
protected void torrentsListClicked(Torrent torrent) {
((TorrentsActivity)getActivity()).openDetails(torrent);
((TorrentsActivity) getActivity()).openDetails(torrent);
}
/**

Loading…
Cancel
Save