Browse Source

Correct loading of details fragment (and stats and files) into phone and tablet fragments.

pull/11/head
Eric Kok 12 years ago
parent
commit
490ebbe828
  1. 36
      core/src/org/transdroid/core/gui/DetailsActivity.java
  2. 30
      core/src/org/transdroid/core/gui/DetailsFragment.java
  3. 2
      core/src/org/transdroid/core/gui/TorrentTasksExecutor.java
  4. 105
      core/src/org/transdroid/core/gui/TorrentsActivity.java
  5. 2
      core/src/org/transdroid/core/gui/TorrentsFragment.java
  6. 6
      core/src/org/transdroid/core/gui/navigation/FilterListAdapter.java

36
core/src/org/transdroid/core/gui/DetailsActivity.java

@ -88,8 +88,6 @@ public class DetailsActivity extends SherlockFragmentActivity implements Torrent
// Show details and load fine stats and torrent files // Show details and load fine stats and torrent files
fragmentDetails.updateTorrent(torrent); fragmentDetails.updateTorrent(torrent);
refreshTorrentDetails();
refreshTorrentFiles();
} }
@ -103,8 +101,6 @@ public class DetailsActivity extends SherlockFragmentActivity implements Torrent
protected void refreshScreen() { protected void refreshScreen() {
fragmentDetails.updateIsLoading(true); fragmentDetails.updateIsLoading(true);
refreshTorrent(); refreshTorrent();
refreshTorrentDetails();
refreshTorrentFiles();
} }
@Background @Background
@ -119,24 +115,24 @@ public class DetailsActivity extends SherlockFragmentActivity implements Torrent
} }
@Background @Background
protected void refreshTorrentDetails() { public void refreshTorrentDetails(Torrent torrent) {
if (!Daemon.supportsFineDetails(torrent.getDaemon())) if (!Daemon.supportsFineDetails(torrent.getDaemon()))
return; return;
DaemonTaskResult result = GetTorrentDetailsTask.create(currentConnection, torrent).execute(); DaemonTaskResult result = GetTorrentDetailsTask.create(currentConnection, torrent).execute();
if (result instanceof GetTorrentDetailsTaskSuccessResult) { if (result instanceof GetTorrentDetailsTaskSuccessResult) {
onTorrentDetailsRetrieved(((GetTorrentDetailsTaskSuccessResult) result).getTorrentDetails()); onTorrentDetailsRetrieved(torrent, ((GetTorrentDetailsTaskSuccessResult) result).getTorrentDetails());
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result);
} }
} }
@Background @Background
protected void refreshTorrentFiles() { public void refreshTorrentFiles(Torrent torrent) {
if (!Daemon.supportsFileListing(torrent.getDaemon())) if (!Daemon.supportsFileListing(torrent.getDaemon()))
return; return;
DaemonTaskResult result = GetFileListTask.create(currentConnection, torrent).execute(); DaemonTaskResult result = GetFileListTask.create(currentConnection, torrent).execute();
if (result instanceof GetFileListTaskSuccessResult) { if (result instanceof GetFileListTaskSuccessResult) {
onTorrentFilesRetrieved(((GetFileListTaskSuccessResult) result).getFiles()); onTorrentFilesRetrieved(torrent, ((GetFileListTaskSuccessResult) result).getFiles());
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result);
} }
@ -242,6 +238,18 @@ public class DetailsActivity extends SherlockFragmentActivity implements Torrent
navigationHelper.CROUTON_INFO_STYLE); navigationHelper.CROUTON_INFO_STYLE);
} }
@UiThread
protected void onTorrentDetailsRetrieved(Torrent torrent, TorrentDetails torrentDetails) {
// Update the details fragment with the new fine details for the shown torrent
fragmentDetails.updateTorrentDetails(torrent, torrentDetails);
}
@UiThread
protected void onTorrentFilesRetrieved(Torrent torrent, List<TorrentFile> torrentFiles) {
// Update the details fragment with the newly retrieved list of files
fragmentDetails.updateTorrentFiles(torrent, new ArrayList<TorrentFile>(torrentFiles));
}
@UiThread @UiThread
protected void onCommunicationError(DaemonTaskFailureResult result) { protected void onCommunicationError(DaemonTaskFailureResult result) {
Log.i(this, result.getException().toString()); Log.i(this, result.getException().toString());
@ -257,16 +265,4 @@ public class DetailsActivity extends SherlockFragmentActivity implements Torrent
fragmentDetails.perhapsUpdateTorrent(torrents); fragmentDetails.perhapsUpdateTorrent(torrents);
} }
@UiThread
protected void onTorrentDetailsRetrieved(TorrentDetails torrentDetails) {
// Update the details fragment with the new fine details for the shown torrent
fragmentDetails.updateTorrentDetails(torrentDetails);
}
@UiThread
protected void onTorrentFilesRetrieved(List<TorrentFile> torrentFiles) {
// Update the details fragment with the newly retrieved list of files
fragmentDetails.updateTorrentFiles(new ArrayList<TorrentFile>(torrentFiles));
}
} }

30
core/src/org/transdroid/core/gui/DetailsFragment.java

@ -59,14 +59,14 @@ public class DetailsFragment extends SherlockFragment {
if (torrent != null) if (torrent != null)
updateTorrent(torrent); updateTorrent(torrent);
if (torrentDetails != null) if (torrentDetails != null)
updateTorrentDetails(torrentDetails); updateTorrentDetails(torrent, torrentDetails);
if (torrentFiles != null) if (torrentFiles != null)
updateTorrentFiles(torrentFiles); updateTorrentFiles(torrent, torrentFiles);
} }
/** /**
* Updates the details adapter header to show the new torrent data * Updates the details adapter header to show the new torrent data.
* @param newTorrent The new torrent object * @param newTorrent The new torrent object
*/ */
public void updateTorrent(Torrent newTorrent) { public void updateTorrent(Torrent newTorrent) {
@ -79,13 +79,20 @@ public class DetailsFragment extends SherlockFragment {
loadingProgress.setVisibility(View.GONE); loadingProgress.setVisibility(View.GONE);
// Also update the available actions in the action bar // Also update the available actions in the action bar
getActivity().supportInvalidateOptionsMenu(); getActivity().supportInvalidateOptionsMenu();
// Refresh the detailed statistics (errors) and list of files
getTasksExecutor().refreshTorrentDetails(torrent);
getTasksExecutor().refreshTorrentFiles(torrent);
} }
/** /**
* Updates the details adapter to show the list of trackers and tracker errors * Updates the details adapter to show the list of trackers and tracker errors.
* @param checkTorrent The torrent for which the details were retrieved
* @param newTorrentDetails The new fine details object of some torrent * @param newTorrentDetails The new fine details object of some torrent
*/ */
public void updateTorrentDetails(TorrentDetails newTorrentDetails) { public void updateTorrentDetails(Torrent checkTorrent, TorrentDetails newTorrentDetails) {
// Check if these are actually the details of the torrent we are now showing
if (!torrent.getUniqueID().equals(checkTorrent.getUniqueID()))
return;
this.torrentDetails = newTorrentDetails; this.torrentDetails = newTorrentDetails;
((DetailsAdapter) detailsList.getAdapter()).updateTrackers(SimpleListItemAdapter.SimpleStringItem ((DetailsAdapter) detailsList.getAdapter()).updateTrackers(SimpleListItemAdapter.SimpleStringItem
.wrapStringsList(newTorrentDetails.getTrackers())); .wrapStringsList(newTorrentDetails.getTrackers()));
@ -94,20 +101,27 @@ public class DetailsFragment extends SherlockFragment {
} }
/** /**
* Updates the list adapter to show a new list of torrent files, replacing the old files list * Updates the list adapter to show a new list of torrent files, replacing the old files list.
* @param checkTorrent The torrent for which the details were retrieved
* @param newTorrents The new, updated list of torrent file objects * @param newTorrents The new, updated list of torrent file objects
*/ */
public void updateTorrentFiles(ArrayList<TorrentFile> newTorrentFiles) { public void updateTorrentFiles(Torrent checkTorrent, ArrayList<TorrentFile> newTorrentFiles) {
// Check if these are actually the details of the torrent we are now showing
if (!torrent.getUniqueID().equals(checkTorrent.getUniqueID()))
return;
this.torrentFiles = newTorrentFiles; this.torrentFiles = newTorrentFiles;
((DetailsAdapter) detailsList.getAdapter()).updateTorrentFiles(newTorrentFiles); ((DetailsAdapter) detailsList.getAdapter()).updateTorrentFiles(newTorrentFiles);
} }
/** /**
* Can be called if some outside activity returned new torrents, so we can perhaps piggyback on this by update our * Can be called if some outside activity returned new torrents, so we can perhaps piggyback on this by update our
* data as well * data as well.
* @param torrents The last of retrieved torrents * @param torrents The last of retrieved torrents
*/ */
public void perhapsUpdateTorrent(List<Torrent> torrents) { public void perhapsUpdateTorrent(List<Torrent> torrents) {
// Only try to update if we actually were showing a torrent
if (this.torrent == null || torrents == null)
return;
for (Torrent newTorrent : torrents) { for (Torrent newTorrent : torrents) {
if (newTorrent.getUniqueID().equals(this.torrent.getUniqueID())) { if (newTorrent.getUniqueID().equals(this.torrent.getUniqueID())) {
// Found, so we can update our data as well // Found, so we can update our data as well

2
core/src/org/transdroid/core/gui/TorrentTasksExecutor.java

@ -13,4 +13,6 @@ public interface TorrentTasksExecutor {
void updateLabel(Torrent torrent, String newLabel); void updateLabel(Torrent torrent, String newLabel);
void updateTrackers(Torrent torrent, List<String> newTrackers); void updateTrackers(Torrent torrent, List<String> newTrackers);
void updateLocation(Torrent torrent, String newLocation); void updateLocation(Torrent torrent, String newLocation);
void refreshTorrentDetails(Torrent torrent);
void refreshTorrentFiles(Torrent torrent);
} }

105
core/src/org/transdroid/core/gui/TorrentsActivity.java

@ -26,10 +26,6 @@ import org.transdroid.core.gui.lists.LocalTorrent;
import org.transdroid.core.gui.lists.SimpleListItem; import org.transdroid.core.gui.lists.SimpleListItem;
import org.transdroid.core.gui.log.*; import org.transdroid.core.gui.log.*;
import org.transdroid.core.gui.navigation.*; import org.transdroid.core.gui.navigation.*;
import org.transdroid.core.gui.navigation.Label;
import org.transdroid.core.gui.navigation.NavigationFilter;
import org.transdroid.core.gui.navigation.NavigationHelper;
import org.transdroid.core.gui.navigation.StatusType;
import org.transdroid.core.gui.search.BarcodeHelper; import org.transdroid.core.gui.search.BarcodeHelper;
import org.transdroid.core.gui.search.FilePickerHelper; import org.transdroid.core.gui.search.FilePickerHelper;
import org.transdroid.core.gui.search.UrlEntryDialog; import org.transdroid.core.gui.search.UrlEntryDialog;
@ -37,14 +33,20 @@ import org.transdroid.core.gui.settings.*;
import org.transdroid.daemon.Daemon; import org.transdroid.daemon.Daemon;
import org.transdroid.daemon.IDaemonAdapter; import org.transdroid.daemon.IDaemonAdapter;
import org.transdroid.daemon.Torrent; import org.transdroid.daemon.Torrent;
import org.transdroid.daemon.TorrentDetails;
import org.transdroid.daemon.TorrentFile;
import org.transdroid.daemon.task.AddByFileTask; import org.transdroid.daemon.task.AddByFileTask;
import org.transdroid.daemon.task.AddByMagnetUrlTask; import org.transdroid.daemon.task.AddByMagnetUrlTask;
import org.transdroid.daemon.task.AddByUrlTask; import org.transdroid.daemon.task.AddByUrlTask;
import org.transdroid.daemon.task.DaemonTaskFailureResult; import org.transdroid.daemon.task.DaemonTaskFailureResult;
import org.transdroid.daemon.task.DaemonTaskResult; import org.transdroid.daemon.task.DaemonTaskResult;
import org.transdroid.daemon.task.DaemonTaskSuccessResult; import org.transdroid.daemon.task.DaemonTaskSuccessResult;
import org.transdroid.daemon.task.GetFileListTask;
import org.transdroid.daemon.task.GetFileListTaskSuccessResult;
import org.transdroid.daemon.task.GetStatsTask; import org.transdroid.daemon.task.GetStatsTask;
import org.transdroid.daemon.task.GetStatsTaskSuccessResult; import org.transdroid.daemon.task.GetStatsTaskSuccessResult;
import org.transdroid.daemon.task.GetTorrentDetailsTask;
import org.transdroid.daemon.task.GetTorrentDetailsTaskSuccessResult;
import org.transdroid.daemon.task.PauseTask; import org.transdroid.daemon.task.PauseTask;
import org.transdroid.daemon.task.RemoveTask; import org.transdroid.daemon.task.RemoveTask;
import org.transdroid.daemon.task.ResumeTask; import org.transdroid.daemon.task.ResumeTask;
@ -317,8 +319,12 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
private void updateFragmentVisibility(boolean hasServerSettings) { private void updateFragmentVisibility(boolean hasServerSettings) {
if (filtersList != null) if (filtersList != null)
filtersList.setVisibility(hasServerSettings ? View.VISIBLE : View.GONE); filtersList.setVisibility(hasServerSettings ? View.VISIBLE : View.GONE);
if (fragmentDetails != null) if (fragmentDetails != null) {
getSupportFragmentManager().beginTransaction().hide(fragmentDetails).commit(); if (hasServerSettings)
getSupportFragmentManager().beginTransaction().show(fragmentDetails).commit();
else
getSupportFragmentManager().beginTransaction().hide(fragmentDetails).commit();
}
} }
/** /**
@ -447,6 +453,22 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.transdroid.org/download/"))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.transdroid.org/download/")));
} }
/**
* Shows the a details fragment for the given torrent, either in the dedicated details fragment pane, in the same
* pane as the torrent list was displayed or by starting a details activity.
* @param torrent The torrent to show detailed statistics for
*/
public void openDetails(Torrent torrent) {
if (fragmentDetails != null) {
fragmentDetails.updateTorrent(torrent);
} else if (filtersList != null) {
getSupportFragmentManager().beginTransaction().add(R.id.torrent_list, DetailsFragment_.builder().build())
.addToBackStack(null).commit();
} else {
DetailsActivity_.intent(this).torrent(torrent).start();
}
}
@Background @Background
protected void refreshTorrents() { protected void refreshTorrents() {
DaemonTaskResult result = RetrieveTask.create(currentConnection).execute(); DaemonTaskResult result = RetrieveTask.create(currentConnection).execute();
@ -454,7 +476,31 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
onTorrentsRetrieved(((RetrieveTaskSuccessResult) result).getTorrents(), onTorrentsRetrieved(((RetrieveTaskSuccessResult) result).getTorrents(),
((RetrieveTaskSuccessResult) result).getLabels()); ((RetrieveTaskSuccessResult) result).getLabels());
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, true);
}
}
@Background
public void refreshTorrentDetails(Torrent torrent) {
if (!Daemon.supportsFineDetails(currentConnection.getType()))
return;
DaemonTaskResult result = GetTorrentDetailsTask.create(currentConnection, torrent).execute();
if (result instanceof GetTorrentDetailsTaskSuccessResult) {
onTorrentDetailsRetrieved(torrent, ((GetTorrentDetailsTaskSuccessResult) result).getTorrentDetails());
} else {
onCommunicationError((DaemonTaskFailureResult) result, false);
}
}
@Background
public void refreshTorrentFiles(Torrent torrent) {
if (!Daemon.supportsFileListing(currentConnection.getType()))
return;
DaemonTaskResult result = GetFileListTask.create(currentConnection, torrent).execute();
if (result instanceof GetFileListTaskSuccessResult) {
onTorrentFilesRetrieved(torrent, ((GetFileListTaskSuccessResult) result).getFiles());
} else {
onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -464,7 +510,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
if (result instanceof GetStatsTaskSuccessResult) { if (result instanceof GetStatsTaskSuccessResult) {
onTurtleModeRetrieved(((GetStatsTaskSuccessResult) result).isAlternativeModeEnabled()); onTurtleModeRetrieved(((GetStatsTaskSuccessResult) result).isAlternativeModeEnabled());
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -475,7 +521,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
// Success; no need to retrieve it again - just update the visual indicator // Success; no need to retrieve it again - just update the visual indicator
onTurtleModeRetrieved(enable); onTurtleModeRetrieved(enable);
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -486,7 +532,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_added, title); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_added, title);
refreshTorrents(); refreshTorrents();
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -497,7 +543,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_added, "Torrent"); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_added, "Torrent");
refreshTorrents(); refreshTorrents();
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -508,7 +554,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_added, title); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_added, title);
refreshTorrents(); refreshTorrents();
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -557,7 +603,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
if (result instanceof DaemonTaskResult) { if (result instanceof DaemonTaskResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_resumed); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_resumed);
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -569,7 +615,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
if (result instanceof DaemonTaskResult) { if (result instanceof DaemonTaskResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_paused); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_paused);
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -581,7 +627,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
if (result instanceof DaemonTaskResult) { if (result instanceof DaemonTaskResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_started); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_started);
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -593,7 +639,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
if (result instanceof DaemonTaskResult) { if (result instanceof DaemonTaskResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_stopped); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_stopped);
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -605,7 +651,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
onTaskSucceeded((DaemonTaskSuccessResult) result, withData ? R.string.result_removed_with_data onTaskSucceeded((DaemonTaskSuccessResult) result, withData ? R.string.result_removed_with_data
: R.string.result_removed); : R.string.result_removed);
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -617,7 +663,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
if (result instanceof DaemonTaskResult) { if (result instanceof DaemonTaskResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_labelset, newLabel); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_labelset, newLabel);
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -628,7 +674,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
if (result instanceof DaemonTaskResult) { if (result instanceof DaemonTaskResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_trackersupdated); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_trackersupdated);
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -639,7 +685,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
if (result instanceof DaemonTaskResult) { if (result instanceof DaemonTaskResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_locationset, newLocation); onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_locationset, newLocation);
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result, false);
} }
} }
@ -650,12 +696,13 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
} }
@UiThread @UiThread
protected void onCommunicationError(DaemonTaskFailureResult result) { protected void onCommunicationError(DaemonTaskFailureResult result, boolean isCritical) {
Log.i(this, result.getException().toString()); Log.i(this, result.getException().toString());
String error = getString(LocalTorrent.getResourceForDaemonException(result.getException())); String error = getString(LocalTorrent.getResourceForDaemonException(result.getException()));
Crouton.showText(this, error, navigationHelper.CROUTON_ERROR_STYLE); Crouton.showText(this, error, navigationHelper.CROUTON_ERROR_STYLE);
fragmentTorrents.updateIsLoading(false); fragmentTorrents.updateIsLoading(false);
fragmentTorrents.updateError(error); if (isCritical)
fragmentTorrents.updateError(error);
} }
@UiThread @UiThread
@ -679,6 +726,20 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi
} }
} }
@UiThread
protected void onTorrentDetailsRetrieved(Torrent torrent, TorrentDetails torrentDetails) {
// Update the details fragment with the new fine details for the shown torrent
if (fragmentDetails != null)
fragmentDetails.updateTorrentDetails(torrent, torrentDetails);
}
@UiThread
protected void onTorrentFilesRetrieved(Torrent torrent, List<TorrentFile> torrentFiles) {
// Update the details fragment with the newly retrieved list of files
if (fragmentDetails != null)
fragmentDetails.updateTorrentFiles(torrent, new ArrayList<TorrentFile>(torrentFiles));
}
@UiThread @UiThread
protected void onTurtleModeRetrieved(boolean turtleModeEnabled) { protected void onTurtleModeRetrieved(boolean turtleModeEnabled) {
turleModeEnabled = turtleModeEnabled; turleModeEnabled = turtleModeEnabled;

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

@ -169,7 +169,7 @@ public class TorrentsFragment extends SherlockFragment {
@ItemClick(resName = "torrent_list") @ItemClick(resName = "torrent_list")
protected void torrentsListClicked(Torrent torrent) { protected void torrentsListClicked(Torrent torrent) {
DetailsActivity_.intent(getActivity()).torrent(torrent).start(); ((TorrentsActivity)getActivity()).openDetails(torrent);
} }
/** /**

6
core/src/org/transdroid/core/gui/navigation/FilterListAdapter.java

@ -42,7 +42,7 @@ public class FilterListAdapter extends MergeAdapter {
this.serverItems = new FilterListItemAdapter(context, servers); this.serverItems = new FilterListItemAdapter(context, servers);
addAdapter(serverItems); addAdapter(serverItems);
} else if (this.serverItems != null && servers != null) { } else if (this.serverItems != null && servers != null) {
serverSeparator.setVisibility(serverItems.isEmpty()? View.GONE: View.VISIBLE); serverSeparator.setVisibility(servers.isEmpty()? View.GONE: View.VISIBLE);
this.serverItems.update(servers); this.serverItems.update(servers);
} else { } else {
serverSeparator.setVisibility(View.GONE); serverSeparator.setVisibility(View.GONE);
@ -63,7 +63,7 @@ public class FilterListAdapter extends MergeAdapter {
this.statusTypeItems = new FilterListItemAdapter(context, statusTypes); this.statusTypeItems = new FilterListItemAdapter(context, statusTypes);
addAdapter(statusTypeItems); addAdapter(statusTypeItems);
} else if (this.statusTypeItems != null && statusTypes != null) { } else if (this.statusTypeItems != null && statusTypes != null) {
statusTypeSeparator.setVisibility(statusTypeItems.isEmpty()? View.GONE: View.VISIBLE); statusTypeSeparator.setVisibility(statusTypes.isEmpty()? View.GONE: View.VISIBLE);
this.statusTypeItems.update(statusTypes); this.statusTypeItems.update(statusTypes);
} else { } else {
statusTypeSeparator.setVisibility(View.GONE); statusTypeSeparator.setVisibility(View.GONE);
@ -83,7 +83,7 @@ public class FilterListAdapter extends MergeAdapter {
this.labelItems = new FilterListItemAdapter(context, labels); this.labelItems = new FilterListItemAdapter(context, labels);
addAdapter(labelItems); addAdapter(labelItems);
} else if (this.labelItems != null && labels != null) { } else if (this.labelItems != null && labels != null) {
labelSeperator.setVisibility(labelItems.isEmpty()? View.GONE: View.VISIBLE); labelSeperator.setVisibility(labels.isEmpty()? View.GONE: View.VISIBLE);
this.labelItems.update(labels); this.labelItems.update(labels);
} else { } else {
labelSeperator.setVisibility(View.GONE); labelSeperator.setVisibility(View.GONE);

Loading…
Cancel
Save