From ed718e2cfe94b5cfdd66d74ecb44272da50ae12c Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Thu, 13 Jun 2013 17:16:39 +0200 Subject: [PATCH] Fixed torrent list sorting. --- .../ic_action_turtle_enabled.png | Bin 0 -> 853 bytes .../ic_action_turtle_disabled.png | Bin 0 -> 690 bytes .../ic_action_turtle_enabled.png | Bin 0 -> 571 bytes .../ic_action_turtle_disabled.png | Bin 0 -> 1660 bytes .../ic_action_turtle_enabled.png | Bin 0 -> 1225 bytes core/res/layout/fragment_details.xml | 2 +- core/res/layout/fragment_torrents.xml | 2 +- .../transdroid/core/gui/TorrentsFragment.java | 29 +++++++++--------- 8 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 core/res/drawable-hdpi/ic_action_turtle_enabled.png create mode 100644 core/res/drawable-mdpi/ic_action_turtle_disabled.png create mode 100644 core/res/drawable-mdpi/ic_action_turtle_enabled.png create mode 100644 core/res/drawable-xhdpi/ic_action_turtle_disabled.png create mode 100644 core/res/drawable-xhdpi/ic_action_turtle_enabled.png 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 0000000000000000000000000000000000000000..1532eb398d80a84ae002522cecc8dd7796c77a05 GIT binary patch literal 853 zcmV-b1FHOqP)k5p!op-SxvyTYAMPC^s8*|e zUa$9iKA*3f#oHFpB7X_;ei;dq`3B=tl}hDFsZ^@9$B4EJ27@EursfJh|L@Avy}+C3`m^u_8}$o?SLORhY} z?2=U+Qvt)n!Orq7vlNyphgjGMQf;NO)<R f>k7E-unhk3Z1-`HM6@cv)g67Hm z0hzy1L*5owmi)X+D1GJn)SFc`eZhR+1Q7&P;(c-r+S-=|xx*1dc_|4|9&Zvqx5B!RJ7 zsZ^GV#p1dQK<{uk1iRgCqM&}T*6D6PsSdFHYPnp#St^x&_DiB?7x?}DY0k~SF+7z( zyk74?qtSSrxp5q-G1ZoYVy(dcTd7kh);jfbh>D-W!QZOAmyn(UXsZbbk5RR^1A)LS zWMcp)xe$4Yi0(nZ{PV(#F` z49?x?XTP+rbP?&X^BMxOfIU+K#`*6<^f?54WzV9TJ$YYl7`g+$ Y0KYLCFvXt*D*ylh07*qoM6N<$f)-Xvz5oCK literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..fedbfc9b5d15f33851c56212a2cc218fae6805a9 GIT binary patch literal 571 zcmV-B0>u4^P)M|P29h~B5d^)}>-CF7A`wBX-l`By0Y0B^ z1WDIHGOLyxLhj1t@^L1Ud6MItPUkrGMpLQOJ$~OCb2!T#V^OfhcF z#55J)a5yF~!~35q2??X3bG3@xZnqV<5Y{koS&Z93M-JfQKJ>#Tx)+lpT(Km>#be<( zZW-Sc(D9ue0SjR_Fq;1b-5_ac41b$YF;#y}s0+{?&>fIF@BvNlt08b+3Zno3002ov JPDHLkV1g=G`+xud literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..12068f67f772b90c703c880e1e841fb45fcd4773 GIT binary patch literal 1660 zcmbW&|34G>0|)T;YBT5C&6oL>uYJy!D9d*~*9!A(Y0Dg$6!WEzh>vFZ7G_Moe{DOY z$>kmpC4Y&*W>jUyo&tsKB`LkN&o;=tgmOl zmv;LaMTIZ^5=))~KmmjGbPr4mdtaO38+Oh>fabUN;LfJc%+^g_l2R`ytaSXb-#Rj) z#MYZ&d-|!ddxz3?`);wE2zBp}EAwuu|4#Tfm+AQ~s~+#ntw~BB%!r+9&!Q$lEmmBO zD)^|rw*$izn3^A!tP zw-WIHsfkweudis55`%MwhK4GamzVd4hl>MgM^7jdLqe{xS3|?X_(%leReW4r-NhKh z=6A69g$4T1@NmidlnhffpB6P4-h{jl8WuE&)PFoI>`#?>FE_wsZ`X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;5=**HBs4b4WjM1S__M;FjeKa(*JrnveuixSls@8UOe!J0ggv)ie4lw zR)}`1gwf#8!8_(em5bJ&jeeSq{6A(IdaoS*tNH8ja{b=hUtR@Zz3`rG9;DoV02tg6 AO#lD@ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..8bfedf1e65b67477c82614237997bf0b126a1ffb GIT binary patch literal 1225 zcmV;)1UCDLP)KptVs(rG&I!J*ViBP zcsyMMyt71r1;a4@%jI%^E-o$(jg5`HtOOCt3FzqP*hU~n3B1i}KoF6Dh|9xVR&`X# zDJ7t}xp_}bP0dN1+hx~5NSLQB2D900?|N2)Dgr#Mt*xKZ>pcYSw;TL&d5Cziw6t_{ zW@hHj#Kc5K0?Um~&Z?dY0u0Lj3k-fq*$d+;E-@d5Gnvd4sv%(p*wobIWuUer7e;R@ zm6T-uTpt)1cxI+sE&-nQ_VyzfImqobGiLWa!Mudj-efX4I5{~vUrZnSL4N-n*{05o%l z2g-?NopfJCqtWk`5g>xEt*!kU<{Q^309i9)h(5&6-yk5agn-7z#(>}NKVfHsBkO%R zdSZ9UeHTA(QT}N&EK4&W7!3LXfxroXBW8dVc%Q|uNoGTw=aad)xd-Fp$jWdJjNAA&LADoV@Js_D_`Mi71^5;j18bmDU;y9e0M$D( zGV&07u{ua!rUbCd`_XKFZ$ZH(+fni9~~)^-NQcVXCL7kmxmpEK3Z zf}2-`ZAyUnsF6ygHZx>=Y<@n#@ILNHsoj?<$BN<5_ZR8)n<{OX5>U(-C%>aq#UYE1 zq;Nb5VXwI7`8&^(hfxQ{CjQD=c=l)Wc7)+0- zni#|C9w)kK{x5n&1#1h(-#rZ4kC6#;7d=!#KpMPru~=-%Zjh_VOA)|a=)|GZCCc;> z@BT_85>cCj${h}egB)YUa{JLrY%p^W@G}I6vw*Toih$0}&JfOgyW9)0E{omQ?Cfk` zJRV<=^)M2NY+hJcI9B4Uag`zXyDWCmgvo%Bsoi8s95P%&|6O)2k)1ze@K)-)J9B&k zp?g=n8-##gRoHlsAyonN?M488z`-3Nc%IjB>?*%4sd6q93T9i}hcW00000NkvXXu0mjf4o^t_ literal 0 HcmV?d00001 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); } /**