From 6ec87f06d488b57ad7d881e742ce740a13b397c8 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Wed, 10 Jul 2013 18:06:51 +0200 Subject: [PATCH] Close details screen after torrent delete. --- .../org/transdroid/core/gui/DetailsActivity.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/core/src/org/transdroid/core/gui/DetailsActivity.java b/core/src/org/transdroid/core/gui/DetailsActivity.java index ce514a90..67ddea77 100644 --- a/core/src/org/transdroid/core/gui/DetailsActivity.java +++ b/core/src/org/transdroid/core/gui/DetailsActivity.java @@ -47,6 +47,7 @@ import android.annotation.TargetApi; import android.content.Intent; import android.os.Build; import android.os.Bundle; +import android.widget.Toast; import com.actionbarsherlock.app.SherlockFragmentActivity; @@ -217,14 +218,21 @@ public class DetailsActivity extends SherlockFragmentActivity implements Torrent public void removeTorrent(Torrent torrent, boolean withData) { DaemonTaskResult result = RemoveTask.create(currentConnection, torrent, withData).execute(); if (result instanceof DaemonTaskResult) { - onTaskSucceeded( - (DaemonTaskSuccessResult) result, - getString(withData ? R.string.result_removed_with_data : R.string.result_removed, torrent.getName())); + // Close the details activity (as the torrent is now removed) + closeActivity(getString(withData ? R.string.result_removed_with_data : R.string.result_removed, + torrent.getName())); } else { onCommunicationError((DaemonTaskFailureResult) result); } } + @UiThread + protected void closeActivity(String closeText) { + finish(); + if (closeText != null) + Toast.makeText(this, closeText, Toast.LENGTH_LONG).show(); + } + @Background @Override public void updateLabel(Torrent torrent, String newLabel) {