From 6a90fe2ae5d18764ec497863a7c535012a67b29c Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Wed, 22 Feb 2012 00:44:29 +0100 Subject: [PATCH] Added view for only active (both seeding and downloading) torrents (issue 349). --- android/res/drawable-hdpi/icon_showactive.png | Bin 0 -> 2251 bytes android/res/layout/part_quickaction.xml | 9 +++++++++ android/res/values/strings.xml | 2 ++ android/src/org/transdroid/gui/MainViewType.java | 3 ++- .../gui/TorrentViewSelectorWindow.java | 1 + .../src/org/transdroid/gui/TorrentsFragment.java | 11 ++++++++--- 6 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 android/res/drawable-hdpi/icon_showactive.png diff --git a/android/res/drawable-hdpi/icon_showactive.png b/android/res/drawable-hdpi/icon_showactive.png new file mode 100644 index 0000000000000000000000000000000000000000..f5e6e9a37a2d1a0e50ecadfef68421e7c114d865 GIT binary patch literal 2251 zcmV;+2sHPJP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_000PHNklVvNeNNwS$ReCDzYv?>sOd4wW`>s^2M_RqB`6-uE6UBV~1 zv}t<1d)fAb8?!MR(-=guKOoC8q5MwtmguqMIG=^W?+JpCr+R)=3gA=# zNC0Z(RTTphhE^$C7$Ou65%YOa*#cvHXJ+qUf){{NE&!z*GYG)100aqw2u;^HsHPc? z1ds-R0iZv1>eTlR95`?mfB^spfCfOyvaI^Q0vrR*aPs8IA3b~a><@0Y`;&tQ4_@VY zK2w3z0H9=9Rw?_vUrA;RI8_Xs?%1(orG0&UpBartq^GBY=Xn75de5FcpRQQ3q8oq< zfHyqnl1VDl3K#`Phll0i!-uP!PUjEJW;1efa=&ddb8ff0$YQa;WHNza7|=8g0FWdJcDo&dAnA_-QC^j>FGgMR@N8Q)zz02NGS?3G-H5K8i>GMxNzY+&CSif)@rqS ztJMmF!2pd$Ga+0!LZJ})`ufn_-3^Z8Zk#`V{se##1=2fJNFoWiGzCsqRaLd6t*z~I zy!U}H{&>-%MX#eE{gZ(trT`al zTxn@(#o*xJZj;G`?Cfl?EQ_?Xv?;?yLkfZbyWI}I-~V#w&YhpwY_?ZZaV3%9kR0W> z*RNk2D=I3!5JmC(+1c3<$Enroq~W3=B}u}|moFhn5^uBF_V3!Y>t9Op@g(X>B0)HH z7_POoHT(4G)0h2z|3|sGxya1S99ILWfb@F3=;-Kx)9D;3EG#@+R#x`6n1Ud#Mu^Ec z?%~6SA6&b3?P@3#T41$WBaWjeD&=souI%jWgu~(R=I7`CqO!6wVOJ6fI8FnAtF5j5 zc0)tMmn2D=!x~7$ajA-6Fo>R>9`HOL%F4<*d-m+vD~d+k@mxv7Nhskt$DKKI=Hr%@ zmP;CqMjzIIMx&Xu22ugZ^E`Tcd%Ua#pfa5r%r>9@uzI}W3L~V|QMgREm<3hXL{#!|s%&~WJrh;J@ zFbosQ%F6n@xVZTDF^l3*!lECqRBLT*&1-IM{>trkFAxL)!C-JkzzBi}Yr|`?SdJDI z6*VMPs>Lg|dwYAc8yg#cCyHXBD2nj={nHAkQmMdk99Whe%FD|uU9)D*-(yx3Q!BRP zEti~5r}566JLg<3SCJ@+@Or(|2B*{Mz_M&#K|#U3Wy_ZRCu&WY{Bmic1#ewl-HGAh z;T^#l^+t>FMc% zQJuBvZ92ti8|ofBcwlR9Z?BOgiJ6K<2!en{qXEZpFdB_l6~_rP-ZqTa_-$%x`mn97 z?Xo0Erpai8Ac(NQLuRx2SDQC){xXrp>`b@rwE);BPo6AnX=%A4Nzw;`ARrJ3OqeNI zmIcRgUW>)@^G%yJ{pr1E-N*U!g|pl3-+1)s(PdE-mkNRapU)Rp102VVzP`T7 z>2&^JWMm`)8P}zKK}tafh+YlZrmtyI2?yvE*AoUKp5_y8#Zj% zpPQRIWyie}z%g9O0N`%kyt(tun>UptNvbJ|x?56G^3#lrj5o + + Connected, but no downloading torrents on the server. Connected, but no seeding torrents on the server. Connected, but no inactive torrents on the server. +Connected, but no active torrents on the server. Your torrent client does not support .torrent file uploads or this is not yet implemented. Your torrent client does not support .magnet links or this is not yet implemented. Save @@ -27,6 +28,7 @@ All torrents Downloading torrents Seeding torrents +Active torrents Inactive torrents Add diff --git a/android/src/org/transdroid/gui/MainViewType.java b/android/src/org/transdroid/gui/MainViewType.java index 7c3c342d..7de3d1fe 100644 --- a/android/src/org/transdroid/gui/MainViewType.java +++ b/android/src/org/transdroid/gui/MainViewType.java @@ -25,7 +25,8 @@ public enum MainViewType { ShowAll (1), OnlyDownloading (2), OnlyUploading (3), - OnlyInactive (4); + OnlyInactive (4), + OnlyActive (5); private int code; private static final Map lookup = new HashMap(); diff --git a/android/src/org/transdroid/gui/TorrentViewSelectorWindow.java b/android/src/org/transdroid/gui/TorrentViewSelectorWindow.java index aac72db2..1b9f6416 100644 --- a/android/src/org/transdroid/gui/TorrentViewSelectorWindow.java +++ b/android/src/org/transdroid/gui/TorrentViewSelectorWindow.java @@ -45,6 +45,7 @@ public class TorrentViewSelectorWindow extends BetterPopupWindow { ((ImageButton)rootView.findViewById(R.id.showall)).setOnClickListener(getOnMainViewTypeClickListener(MainViewType.ShowAll)); ((ImageButton)rootView.findViewById(R.id.showdl)).setOnClickListener(getOnMainViewTypeClickListener(MainViewType.OnlyDownloading)); ((ImageButton)rootView.findViewById(R.id.showup)).setOnClickListener(getOnMainViewTypeClickListener(MainViewType.OnlyUploading)); + ((ImageButton)rootView.findViewById(R.id.showactive)).setOnClickListener(getOnMainViewTypeClickListener(MainViewType.OnlyActive)); ((ImageButton)rootView.findViewById(R.id.showinactive)).setOnClickListener(getOnMainViewTypeClickListener(MainViewType.OnlyInactive)); labelsListView = (ListView) rootView.findViewById(R.id.labelsList); labelsListView.setOnItemClickListener(onLabelClickListener); diff --git a/android/src/org/transdroid/gui/TorrentsFragment.java b/android/src/org/transdroid/gui/TorrentsFragment.java index d8d42887..e423b27a 100644 --- a/android/src/org/transdroid/gui/TorrentsFragment.java +++ b/android/src/org/transdroid/gui/TorrentsFragment.java @@ -1778,6 +1778,8 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou emptyText.setText(R.string.no_uploading_torrents); } else if (activeMainView == MainViewType.OnlyInactive) { emptyText.setText(R.string.no_inactive_torrents); + } else if (activeMainView == MainViewType.OnlyActive) { + emptyText.setText(R.string.no_active_torrents); } else { emptyText.setText(R.string.no_torrents); } @@ -1978,10 +1980,12 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou // Update the torrents view type text int mainViewTextID = activeMainView == MainViewType.OnlyDownloading? R.string.view_showdl: (activeMainView == MainViewType.OnlyUploading? R.string.view_showul: - (activeMainView == MainViewType.OnlyInactive? R.string.view_showinactive: R.string.view_showall)); + (activeMainView == MainViewType.OnlyInactive? R.string.view_showinactive: + (activeMainView == MainViewType.OnlyActive? R.string.view_showactive: R.string.view_showall))); int mainViewDrawableID = activeMainView == MainViewType.OnlyDownloading? R.drawable.icon_showdl: (activeMainView == MainViewType.OnlyUploading? R.drawable.icon_showup: - (activeMainView == MainViewType.OnlyInactive? R.drawable.icon_showinactive: R.drawable.icon_showall)); + (activeMainView == MainViewType.OnlyInactive? R.drawable.icon_showinactive: + (activeMainView == MainViewType.OnlyActive? R.drawable.icon_showactive: R.drawable.icon_showall))); viewtype.setText(getText(mainViewTextID).toString() + (Daemon.supportsLabels(getActiveDaemonType())? "\n" + useLabel: "")); viewtypeselector.setImageResource(mainViewDrawableID); @@ -2000,7 +2004,8 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou boolean isActivelySeeding = torrent.getStatusCode() == TorrentStatus.Seeding && (!onlyShowTransferring || torrent.getRateUpload() > 0); return (matchViewType == MainViewType.ShowAll || (matchViewType == MainViewType.OnlyDownloading && isActivelyDownloading) || - (matchViewType == MainViewType.OnlyUploading && isActivelySeeding)|| + (matchViewType == MainViewType.OnlyUploading && isActivelySeeding)|| + (matchViewType == MainViewType.OnlyActive && (isActivelySeeding || isActivelyDownloading))|| (matchViewType == MainViewType.OnlyInactive && !isActivelyDownloading && !isActivelySeeding)); }