Browse Source

Close details screen after torrent delete.

pull/11/head
Eric Kok 11 years ago
parent
commit
6ec87f06d4
  1. 14
      core/src/org/transdroid/core/gui/DetailsActivity.java

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

@ -47,6 +47,7 @@ import android.annotation.TargetApi;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.widget.Toast;
import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.app.SherlockFragmentActivity;
@ -217,14 +218,21 @@ public class DetailsActivity extends SherlockFragmentActivity implements Torrent
public void removeTorrent(Torrent torrent, boolean withData) { public void removeTorrent(Torrent torrent, boolean withData) {
DaemonTaskResult result = RemoveTask.create(currentConnection, torrent, withData).execute(); DaemonTaskResult result = RemoveTask.create(currentConnection, torrent, withData).execute();
if (result instanceof DaemonTaskResult) { if (result instanceof DaemonTaskResult) {
onTaskSucceeded( // Close the details activity (as the torrent is now removed)
(DaemonTaskSuccessResult) result, closeActivity(getString(withData ? R.string.result_removed_with_data : R.string.result_removed,
getString(withData ? R.string.result_removed_with_data : R.string.result_removed, torrent.getName())); torrent.getName()));
} else { } else {
onCommunicationError((DaemonTaskFailureResult) result); onCommunicationError((DaemonTaskFailureResult) result);
} }
} }
@UiThread
protected void closeActivity(String closeText) {
finish();
if (closeText != null)
Toast.makeText(this, closeText, Toast.LENGTH_LONG).show();
}
@Background @Background
@Override @Override
public void updateLabel(Torrent torrent, String newLabel) { public void updateLabel(Torrent torrent, String newLabel) {

Loading…
Cancel
Save