Browse Source

Added view for only active (both seeding and downloading) torrents (issue 349).

pull/11/head
Eric Kok 13 years ago
parent
commit
6a90fe2ae5
  1. BIN
      android/res/drawable-hdpi/icon_showactive.png
  2. 9
      android/res/layout/part_quickaction.xml
  3. 2
      android/res/values/strings.xml
  4. 3
      android/src/org/transdroid/gui/MainViewType.java
  5. 1
      android/src/org/transdroid/gui/TorrentViewSelectorWindow.java
  6. 9
      android/src/org/transdroid/gui/TorrentsFragment.java

BIN
android/res/drawable-hdpi/icon_showactive.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

9
android/res/layout/part_quickaction.xml

@ -54,6 +54,15 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_weight="1" /> android:layout_weight="1" />
<ImageButton
android:id="@+id/showactive"
android:layout_width="0dip"
android:layout_height="48dip"
android:src="@drawable/icon_showactive"
android:background="@android:drawable/btn_default_small"
android:layout_gravity="center"
android:layout_weight="1" />
<ImageButton <ImageButton
android:id="@+id/showinactive" android:id="@+id/showinactive"
android:layout_width="0dip" android:layout_width="0dip"

2
android/res/values/strings.xml

@ -10,6 +10,7 @@
<string name="no_downloading_torrents">Connected, but no downloading torrents on the server.</string> <string name="no_downloading_torrents">Connected, but no downloading torrents on the server.</string>
<string name="no_uploading_torrents">Connected, but no seeding torrents on the server.</string> <string name="no_uploading_torrents">Connected, but no seeding torrents on the server.</string>
<string name="no_inactive_torrents">Connected, but no inactive torrents on the server.</string> <string name="no_inactive_torrents">Connected, but no inactive torrents on the server.</string>
<string name="no_active_torrents">Connected, but no active torrents on the server.</string>
<string name="no_file_uploads">Your torrent client does not support .torrent file uploads or this is not yet implemented.</string> <string name="no_file_uploads">Your torrent client does not support .torrent file uploads or this is not yet implemented.</string>
<string name="no_magnet_links">Your torrent client does not support .magnet links or this is not yet implemented.</string> <string name="no_magnet_links">Your torrent client does not support .magnet links or this is not yet implemented.</string>
<string name="save">Save</string> <string name="save">Save</string>
@ -27,6 +28,7 @@
<string name="view_showall">All torrents</string> <string name="view_showall">All torrents</string>
<string name="view_showdl">Downloading torrents</string> <string name="view_showdl">Downloading torrents</string>
<string name="view_showul">Seeding torrents</string> <string name="view_showul">Seeding torrents</string>
<string name="view_showactive">Active torrents</string>
<string name="view_showinactive">Inactive torrents</string> <string name="view_showinactive">Inactive torrents</string>
<string name="menu_add">Add</string> <string name="menu_add">Add</string>

3
android/src/org/transdroid/gui/MainViewType.java

@ -25,7 +25,8 @@ public enum MainViewType {
ShowAll (1), ShowAll (1),
OnlyDownloading (2), OnlyDownloading (2),
OnlyUploading (3), OnlyUploading (3),
OnlyInactive (4); OnlyInactive (4),
OnlyActive (5);
private int code; private int code;
private static final Map<Integer,MainViewType> lookup = new HashMap<Integer,MainViewType>(); private static final Map<Integer,MainViewType> lookup = new HashMap<Integer,MainViewType>();

1
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.showall)).setOnClickListener(getOnMainViewTypeClickListener(MainViewType.ShowAll));
((ImageButton)rootView.findViewById(R.id.showdl)).setOnClickListener(getOnMainViewTypeClickListener(MainViewType.OnlyDownloading)); ((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.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)); ((ImageButton)rootView.findViewById(R.id.showinactive)).setOnClickListener(getOnMainViewTypeClickListener(MainViewType.OnlyInactive));
labelsListView = (ListView) rootView.findViewById(R.id.labelsList); labelsListView = (ListView) rootView.findViewById(R.id.labelsList);
labelsListView.setOnItemClickListener(onLabelClickListener); labelsListView.setOnItemClickListener(onLabelClickListener);

9
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); emptyText.setText(R.string.no_uploading_torrents);
} else if (activeMainView == MainViewType.OnlyInactive) { } else if (activeMainView == MainViewType.OnlyInactive) {
emptyText.setText(R.string.no_inactive_torrents); emptyText.setText(R.string.no_inactive_torrents);
} else if (activeMainView == MainViewType.OnlyActive) {
emptyText.setText(R.string.no_active_torrents);
} else { } else {
emptyText.setText(R.string.no_torrents); emptyText.setText(R.string.no_torrents);
} }
@ -1978,10 +1980,12 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou
// Update the torrents view type text // Update the torrents view type text
int mainViewTextID = activeMainView == MainViewType.OnlyDownloading? R.string.view_showdl: int mainViewTextID = activeMainView == MainViewType.OnlyDownloading? R.string.view_showdl:
(activeMainView == MainViewType.OnlyUploading? R.string.view_showul: (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: int mainViewDrawableID = activeMainView == MainViewType.OnlyDownloading? R.drawable.icon_showdl:
(activeMainView == MainViewType.OnlyUploading? R.drawable.icon_showup: (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: "")); viewtype.setText(getText(mainViewTextID).toString() + (Daemon.supportsLabels(getActiveDaemonType())? "\n" + useLabel: ""));
viewtypeselector.setImageResource(mainViewDrawableID); viewtypeselector.setImageResource(mainViewDrawableID);
@ -2001,6 +2005,7 @@ public class TorrentsFragment extends Fragment implements IDaemonCallback, OnTou
return (matchViewType == MainViewType.ShowAll || return (matchViewType == MainViewType.ShowAll ||
(matchViewType == MainViewType.OnlyDownloading && isActivelyDownloading) || (matchViewType == MainViewType.OnlyDownloading && isActivelyDownloading) ||
(matchViewType == MainViewType.OnlyUploading && isActivelySeeding)|| (matchViewType == MainViewType.OnlyUploading && isActivelySeeding)||
(matchViewType == MainViewType.OnlyActive && (isActivelySeeding || isActivelyDownloading))||
(matchViewType == MainViewType.OnlyInactive && !isActivelyDownloading && !isActivelySeeding)); (matchViewType == MainViewType.OnlyInactive && !isActivelyDownloading && !isActivelySeeding));
} }

Loading…
Cancel
Save