diff --git a/core/res/drawable-hdpi/ic_action_turtle_enabled.png b/core/res/drawable-hdpi/ic_action_turtle_enabled.png new file mode 100644 index 00000000..1532eb39 Binary files /dev/null and b/core/res/drawable-hdpi/ic_action_turtle_enabled.png differ diff --git a/core/res/drawable-mdpi/ic_action_turtle_disabled.png b/core/res/drawable-mdpi/ic_action_turtle_disabled.png new file mode 100644 index 00000000..70155517 Binary files /dev/null and b/core/res/drawable-mdpi/ic_action_turtle_disabled.png differ diff --git a/core/res/drawable-mdpi/ic_action_turtle_enabled.png b/core/res/drawable-mdpi/ic_action_turtle_enabled.png new file mode 100644 index 00000000..fedbfc9b Binary files /dev/null and b/core/res/drawable-mdpi/ic_action_turtle_enabled.png differ diff --git a/core/res/drawable-xhdpi/ic_action_turtle_disabled.png b/core/res/drawable-xhdpi/ic_action_turtle_disabled.png new file mode 100644 index 00000000..12068f67 Binary files /dev/null and b/core/res/drawable-xhdpi/ic_action_turtle_disabled.png differ diff --git a/core/res/drawable-xhdpi/ic_action_turtle_enabled.png b/core/res/drawable-xhdpi/ic_action_turtle_enabled.png new file mode 100644 index 00000000..8bfedf1e Binary files /dev/null and b/core/res/drawable-xhdpi/ic_action_turtle_enabled.png differ diff --git a/core/res/layout/fragment_details.xml b/core/res/layout/fragment_details.xml index a3dbbaeb..e60c310b 100644 --- a/core/res/layout/fragment_details.xml +++ b/core/res/layout/fragment_details.xml @@ -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" /> diff --git a/core/res/layout/fragment_torrents.xml b/core/res/layout/fragment_torrents.xml index b27f779a..292df0b1 100644 --- a/core/res/layout/fragment_torrents.xml +++ b/core/res/layout/fragment_torrents.xml @@ -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" /> diff --git a/core/src/org/transdroid/core/gui/TorrentsFragment.java b/core/src/org/transdroid/core/gui/TorrentsFragment.java index cebeab27..05db1cd6 100644 --- a/core/src/org/transdroid/core/gui/TorrentsFragment.java +++ b/core/src/org/transdroid/core/gui/TorrentsFragment.java @@ -112,22 +112,15 @@ 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(); } - + /** * Apply a filter on the current list of all torrents, showing the appropriate sublist of torrents only * @param newFilter The new filter to apply to the local list of torrents @@ -136,15 +129,18 @@ public class TorrentsFragment extends SherlockFragment { this.currentNavigationFilter = newFilter; applyAllFilters(); } - + private void applyAllFilters() { - - // No torrents? Directly update views accordingly + + // No torrents? Directly update views accordingly if (torrents == null) { updateViewVisibility(); 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 filteredTorrents = torrents; if (torrents != null && currentNavigationFilter != null) { @@ -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 { @ItemClick(resName = "torrent_list") protected void torrentsListClicked(Torrent torrent) { - ((TorrentsActivity)getActivity()).openDetails(torrent); + ((TorrentsActivity) getActivity()).openDetails(torrent); } /**