|
|
@ -17,6 +17,8 @@ import org.androidannotations.annotations.ViewById; |
|
|
|
import org.transdroid.core.R; |
|
|
|
import org.transdroid.core.R; |
|
|
|
import org.transdroid.core.app.settings.ApplicationSettings; |
|
|
|
import org.transdroid.core.app.settings.ApplicationSettings; |
|
|
|
import org.transdroid.core.app.settings.ServerSetting; |
|
|
|
import org.transdroid.core.app.settings.ServerSetting; |
|
|
|
|
|
|
|
import org.transdroid.core.gui.DetailsFragment.DetailsTasksExecutor; |
|
|
|
|
|
|
|
import org.transdroid.core.gui.TorrentsFragment.TorrentsTasksExecutor; |
|
|
|
import org.transdroid.core.gui.lists.LocalTorrent; |
|
|
|
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.navigation.FilterListAdapter; |
|
|
|
import org.transdroid.core.gui.navigation.FilterListAdapter; |
|
|
@ -31,6 +33,8 @@ import org.transdroid.daemon.IDaemonAdapter; |
|
|
|
import org.transdroid.daemon.Torrent; |
|
|
|
import org.transdroid.daemon.Torrent; |
|
|
|
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.ResumeTask; |
|
|
|
import org.transdroid.daemon.task.RetrieveTask; |
|
|
|
import org.transdroid.daemon.task.RetrieveTask; |
|
|
|
import org.transdroid.daemon.task.RetrieveTaskSuccessResult; |
|
|
|
import org.transdroid.daemon.task.RetrieveTaskSuccessResult; |
|
|
|
|
|
|
|
|
|
|
@ -52,7 +56,7 @@ import com.actionbarsherlock.widget.SearchView; |
|
|
|
|
|
|
|
|
|
|
|
@EActivity(R.layout.activity_torrents) |
|
|
|
@EActivity(R.layout.activity_torrents) |
|
|
|
@OptionsMenu(R.menu.activity_torrents) |
|
|
|
@OptionsMenu(R.menu.activity_torrents) |
|
|
|
public class TorrentsActivity extends SherlockFragmentActivity implements OnNavigationListener { |
|
|
|
public class TorrentsActivity extends SherlockFragmentActivity implements OnNavigationListener, DetailsTasksExecutor, TorrentsTasksExecutor { |
|
|
|
|
|
|
|
|
|
|
|
// Navigation components
|
|
|
|
// Navigation components
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
@ -298,6 +302,12 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi |
|
|
|
// TODO: Update local list of labels
|
|
|
|
// TODO: Update local list of labels
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@UiThread |
|
|
|
|
|
|
|
protected void onTaskSucceeded(DaemonTaskSuccessResult result, int successMessageId, Torrent target) { |
|
|
|
|
|
|
|
// TODO: Properly report this success
|
|
|
|
|
|
|
|
Toast.makeText(this, getString(successMessageId, target.getName()),Toast.LENGTH_LONG).show(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@UiThread |
|
|
|
@UiThread |
|
|
|
protected void onCommunicationError(DaemonTaskFailureResult result) { |
|
|
|
protected void onCommunicationError(DaemonTaskFailureResult result) { |
|
|
|
// TODO: Properly report this error
|
|
|
|
// TODO: Properly report this error
|
|
|
@ -305,4 +315,76 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi |
|
|
|
Toast.LENGTH_LONG).show(); |
|
|
|
Toast.LENGTH_LONG).show(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Background |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void resumeTorrent(Torrent torrent) { |
|
|
|
|
|
|
|
torrent.mimicResume(); |
|
|
|
|
|
|
|
DaemonTaskResult result = ResumeTask.create(currentConnection, torrent).execute(); |
|
|
|
|
|
|
|
if (result instanceof DaemonTaskResult) { |
|
|
|
|
|
|
|
onTaskSucceeded((DaemonTaskSuccessResult) result, R.string.result_resumed, torrent); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
onCommunicationError((DaemonTaskFailureResult) result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void pauseTorrent(Torrent torrent) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void startTorrent(Torrent torrent) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void stopTorrent(Torrent torrent) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void removeTorrent(Torrent torrent, boolean withData) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void setLabel(Torrent torrent) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void updateTrackers(Torrent torrent) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void resumeTorrents(List<Torrent> torrents) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void pauseTorrents(List<Torrent> torrents) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void removeTorrents(List<Torrent> torrents, boolean withData) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void setLabels(List<Torrent> torrents) { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|